GithubHelp home page GithubHelp logo

apls's Introduction

APLS Metric

CosmiQ Works


This package evaluates the Average Path Length Similarity (APLS) metric to measure the difference between ground truth and proposal graphs. The metric sums the differences in optimal path lengths between all nodes in the ground truth graph G and the proposal graph Gโ€™. This metric was used to score the SpaceNet 3 challenge. For further details, see Blog1 and Blog2.


Installation Instructions

pip

pip install apls

Dependencies

All dependencies can be found in environment.yml


License

See LICENSE.


Usage

apls.py compares ground truth and proposal graphs. The actual metric takes up a relatively small portion of this code (functions: single_path_metric, path_sim_metric_, and compute_metric). Much of the code (e.g. cut_linestring, get_closest_edge, insert_point_into_G, insert_control_points, create_graph_midpoints) is concerned with injecting nodes into graphs. We inject nodes (i.e. control points) into the graph at a predetermined distance along edges, and at the location nearest proposal nodes. Injecting nodes is essential to properly compare graphs, though it unfortunately requires quite a bit of code. graphTools.py parses geojson labels into networkx graphs for analysis. Examples for running apls.py are shown below with the attached sample data

# for further details: python apls.py --help

# 1. Compare a ground truth SpaceNet geojson with a submission csv
python apls.py --test_method=gt_json_prop_wkt --output_name=gt_json_prop_wkt \
	--truth_dir=data/gt_json_prop_wkt/ground_truth_randomized \
	--wkt_file=data/gt_json_prop_wkt/proposal/sn3_sample_submission_albu.csv \
	--im_dir=data/images

# 2. Compare a ground truth geojson with a proposal json
python apls.py --test_method=gt_json_prop_json --output_name=gt_json_prop_json \
	--truth_dir=data/gt_json_prop_json/AOI_2_Vegas_Train/spacenetroads \
	--prop_dir=data/gt_json_prop_json/AOI_2_Vegas_Train/osm 
		
# 3. Compare a ground truth geojson with a pickled proposal graph 
python apls.py --test_method=gt_json_prop_pkl --output_name=gt_json_prop_pkl \
	--truth_dir=data/gt_json_prop_pkl/ground_truth_randomized \
	--prop_dir=data/gt_json_prop_pkl/proposal \
	--im_dir=data/images

# 4. Compare a pickled ground truth graph with a pickled proposal graph 
python apls.py --test_method=gt_pkl_prop_pkl --output_name=gt_pkl_prop_pkl \
	--truth_dir=data/gt_pkl_prop_pkl/ground_truth_randomized \
	--prop_dir=data/gt_pkl_prop_pkl/proposal \
	--im_dir=data/images	

Outputs

Running apls.py yields a number of plots in the outputs directory, along with the APLS score

Alt text

Alt text


SpaceNet Training Masks

Run the create_spacenet_masks.py script to create training masks with spacenet geojsons

apls's People

Contributors

avanetten avatar shgold avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.