- Notifications
You must be signed in to change notification settings - Fork75
License
mitroadmaps/roadtracer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is the code for"RoadTracer: Automatic Extraction of Road Networks from Aerial Images".
There are several components, and each folder has a README with more usage details:
- dataset: code for dataset preparation
- roadtracer: RoadTracer
- roadcnn: our segmentation approach (baseline)
- deeproadmapper: DeepRoadMapper (baseline)
You will need gomapinfer (https://github.com/mitroadmaps/gomapinfer/) as a dependency.
The training/inference code is built on top of TensorFlow.
First, follow instructions in dataset/ to download the dataset.
Then, follow instructions in the other folders to train a model and run inference.
The junction metric matches junctions (any vertex with three or more incident edges) between a ground truth road network graph and an inferred one.
go run junction_metric.go /data/graphs/chicago.graph chicago.out.graph chicago
viz.go
will generate an SVG from a road network graph. It will refer to the/data/testsat/
images; to view the SVG, those images will need to be in the same folder as the generated SVG.
go run viz.go chicago /data/graphs/chicago.graphgo run viz.go chicago chicago.out.graph
You need to make a few modifications to run the code on a region outside of the 40-city RoadTracer dataset.
First, download the imagery. Updatedataset/lib/regions.go
and put a latitude/longitude bounding box around your region in the regionMap. You can comment out the existing regions. Then, follow instructions in dataset/ for running1_sat.go
.
Then, updateroadtracer/tileloader.py
and setTRAINING_REGIONS
andREGIONS
to just a list with your region label from the regionMap. Also updateREGION
,TILE_START
, andTILE_END
ininfer.py
(e.g. if your imagery tiles were saved asxyz_-1_-1_sat.png
throughxyz_1_1_sat.png
, setTILE_START = -1, -1
andTILE_END = 2, 2
.
Finally, manually specify a starting location for RoadTracer in infer.py. SetUSE_TL_LOCATIONS = False
,MANUAL_RELATIVE = 0, 0
, and set the manual points to the pixel positions of two points on the road network inxyz_0_0_sat.png
. These two points should be close to each other (around SEGMENT_LENGTH apart) and best to be in the middle of a road.
Now you should be able to get a road network graph by running infer.py.
To convert this to latitude/longitude, you can usedataset/convertarg.go
:
go run convertarg.go YOUR_REGION_LABEL frompix out.graph out.lonlat.graph