g = graph.read_graph(EXISTING_GRAPH_FNAME) gc = graph.GraphContainer(g) g = g.clone() graph.densify(g, SEGMENT_LENGTH) tile_data = { 'region': REGION, 'rect': r, 'search_rect': r.add_tol(-WINDOW_SIZE // 2), 'cache': tiles.cache, 'starting_locations': [], } #path = model_utils.Path(gc, tile_data, g=g) path = model_utils.Path(None, tile_data, g=g) for vertex in g.vertices: vertex.edge_pos = None path.prepend_search_vertex(vertex) big_ims = tile_data['cache'].get(tile_data['region'], tile_data['rect']) m6_old = tf_util.apply_conv(session, m, big_ims['input'], scale=4, channels=64) m6_new = tf_util.apply_conv(session, m, big_ims['input1'], scale=4, channels=64) #m6_mask = (m6_old < 0.1).astype('float32') m6_mask = m6_old > 0.4
pos2_point = next_positions[0].point() pos2_pos = next_positions[0] start_loc = [{ 'point': pos1_point, 'edge_pos': pos1_pos, }, { 'point': pos2_point, 'edge_pos': pos2_pos, }] path = model_utils.Path(tile_data['gc'], tile_data, start_loc=start_loc) else: g = graph.read_graph(EXISTING_GRAPH_FNAME) r = g.bounds() tile_data = { 'region': REGION, 'rect': r.add_tol(WINDOW_SIZE/2), 'search_rect': r, 'cache': cache, 'starting_locations': [], } path = model_utils.Path(None, tile_data, g=g) for vertex in g.vertices: path.prepend_search_vertex(vertex) compute_targets = SAVE_EXAMPLES or FOLLOW_TARGETS result = eval([path], m, session, save=SAVE_EXAMPLES, compute_targets=compute_targets, follow_targets=FOLLOW_TARGETS) print result path.graph.save(output_fname)