def test_get_squared_tiles(small_bbox): box_walker = BoxWalker(small_bbox) box_walker.load_tiles() walker = Walker(tile=box_walker.tile) centre_node = box_walker.tile.get_centre_node() tile = walker._get_squared_tiles([centre_node]) assert len(tile) is 1
def test_get_squared_tiles(small_bbox, default_config): box_walker = BoxWalker(small_bbox, configuration=default_config) box_walker.load_tiles() walker = Walker(tile=box_walker.tile) centre_node = box_walker.tile.get_centre_node() tile = walker._get_squared_tiles([centre_node]) assert len(tile) is 1
def test_walk_no_compare(zurich_bellevue, configuration_no_compare): walker = BoxWalker(zurich_bellevue, configuration=configuration_no_compare) walker.load_convnet() walker.load_tiles() walker.load_streets() crosswalk_nodes = walker.walk() assert crosswalk_nodes is not None assert len(crosswalk_nodes) > 0
def test_walk(zurich_bellevue): walker = BoxWalker(zurich_bellevue) walker.load_convnet() walker.load_tiles() walker.load_streets() crosswalk_nodes = walker.walk() assert crosswalk_nodes is not None assert len(crosswalk_nodes) == 0
def test_walk(zurich_bellevue, default_config): walker = BoxWalker(zurich_bellevue, configuration=default_config) walker.load_convnet() walker.load_tiles() walker.load_streets() crosswalk_nodes = walker.walk() assert crosswalk_nodes is not None assert len(crosswalk_nodes) == 0
def detect(bbox, redis, search): walker = BoxWalker(bbox=bbox, search=search) walker.load_streets() crosswalk_nodes = [] if len(walker.streets) > 0: walker.load_convnet() walker.load_tiles() crosswalk_nodes = walker.walk() redis_connection = Redis(redis[0], redis[1], password=redis[2]) enqueue_results(crosswalk_nodes, redis_connection)
def get_nodes(bbox, configuration): walker = BoxWalker(bbox=bbox, configuration=configuration) if configuration.follow_streets: walker.load_streets() crosswalk_nodes = [] if len(walker.streets) > 0 or not configuration.follow_streets: walker.load_convnet() walker.load_tiles() crosswalk_nodes = walker.walk() return crosswalk_nodes
def detect(bbox, redis, search): walker = BoxWalker(bbox=bbox, search=search) walker.load_streets() crosswalk_nodes = [] if len(walker.streets) > 0: walker.load_convnet() walker.load_tiles() crosswalk_nodes = walker.walk() redis_connection = Redis(redis[0], redis[1], password=redis[2]) q = Queue('results', connection=redis_connection) q.enqueue_call(func=store, args=(crosswalk_nodes, ), timeout=5400)
def get_nodes(bbox, configuration): walker = BoxWalker(bbox=bbox, configuration=configuration) follow_streets = configuration.to_bool( configuration.DETECTION.followstreets) if follow_streets: walker.load_streets() crosswalk_nodes = [] if len(walker.streets) > 0 or not follow_streets: walker.load_convnet() walker.load_tiles() crosswalk_nodes = walker.walk() return crosswalk_nodes
def get_tile_streets(bbox): box_walker = BoxWalker(bbox) box_walker.load_tiles() box_walker.load_streets() return box_walker.tile, box_walker.streets
def test_get_tiles(small_bbox, default_config): box_walker = BoxWalker(small_bbox, configuration=default_config) box_walker.load_tiles() tile_walker = TileWalker(tile=box_walker.tile) tiles = tile_walker.get_tiles() assert len(tiles) > 1
def draw_small_boxes(tiles, big_tile): for tile in tiles: node_left_down = tile.bbox.node_left_down() node_right_up = tile.bbox.node_right_up() start = big_tile.get_pixel(node_left_down) end = big_tile.get_pixel(node_right_up) drawer.rectangle(big_tile.image, start, end, "red") def draw_nodes(nodes, tile): for node in nodes: position = tile.get_pixel(node) drawer.point(tile.image, position, '#66ff33') walker = BoxWalker(bbox=small_bbox()) walker.configuration.compare = False walker.configuration.follow_streets = True walker.load_streets() walker.load_tiles() walker.load_convnet() # sample_streets = walker.streets sample_tile = walker.tile detected_nodes = walker.walk() # sample_small_tiles = walker._get_tiles_of_box_with_streets(sample_streets, sample_tile) sample_small_tiles = walker._get_tiles_of_box(sample_tile) # sample_tile.image.show()
def test_load_streets(small_bbox): walker = BoxWalker(small_bbox) walker.load_streets() assert walker.streets is not None
def test_load_tile(small_bbox): walker = BoxWalker(small_bbox) walker.load_tiles() assert walker.tile is not None
def test_load_tile(small_bbox, default_config): walker = BoxWalker(small_bbox, configuration=default_config) walker.load_tiles() assert walker.tile is not None
def test_load_streets(small_bbox, default_config): walker = BoxWalker(small_bbox, configuration=default_config) walker.load_streets() assert walker.streets is not None
def test_get_tiles(small_bbox): box_walker = BoxWalker(small_bbox) box_walker.load_tiles() tile_walker = TileWalker(tile=box_walker.tile) tiles = tile_walker.get_tiles() assert len(tiles) > 1
def get_tile_streets(bbox, config): box_walker = BoxWalker(bbox, configuration=config) box_walker.load_tiles() box_walker.load_streets() return box_walker.tile, box_walker.streets