Classify roads and features in satellite imagery, by training neural networks with OpenStreetMap (OSM) data.
- Download a chunk of satellite imagery
- Download OSM data that shows roads/features for that area
- Generate training and evaluation data
- Display predictions of mis-registered roads in OSM data, or display raw predictions of ON/OFF
Running the code is as easy as install Docker, make dev, and run a script.
Contributions are welcome. Open an issue if you want to discuss something to do, or email me.
By default, DeepOSM will analyze about 200 sq. km of area in Delaware. DeepOSM will
- predict if the center 9px of a 64px tile contains road.
- use the infrared (IR) band and RGB bands.
- be 75-80% accurate overall, training only for a minute or so.
- use a single fully-connected relu layer in TensorFlow.
- render, as JPEGs, "false positive" predictions in the OSM data - i.e. where OSM lists a road, but DeepOSM thinks there isn't one.
Background on Data - NAIPs and OSM PBF
For training data, DeepOSM cuts tiles out of NAIP images, which provide 1-meter-per-pixel resolution, with RGB+infrared data bands.
For training labels, DeepOSM uses PBF extracts of OSM data, which contain features/ways in binary format that can be munged with Python.
The NAIPs come from a requester pays bucket on S3 set up by Mapbox, and the OSM extracts come from geofabrik.
DeepOSM has been run successfully on both Mac (10.x) and Linux (14.04 and 16.04). You need at least 4GB of memory.
You need AWS credentials to download NAIPs from an S3 requester-pays bucket. This only costs a few cents for a bunch of images, but you need a credit card on file.
export them as environment variables (and maybe add to your bash or zprofile)
export AWS_ACCESS_KEY_ID='FOO' export AWS_SECRET_ACCESS_KEY='BAR'
First, install a Docker Binary.
I also needed to set my VirtualBox default memory to 4GB, when running on a Mac. This is easy:
- start Docker, per the install instructions
- stop Docker
- open VirtualBox, and increase the memory of the VM Docker made
Start Docker, then run:
Download NAIP, PBF, and Analyze
Inside Docker, the following Python scripts will work. This will download all source data, tile it into training/test data and labels, train the neural net, and generate image and text output.
The default data is six NAIPs, which get tiled into 64x64x4 bands of data (RGB-IR bands). The training labels derive from PBF files that overlap the NAIPs.
python bin/create_training_data.py python bin/train_neural_net.py
For output, DeepOSM will produce some console logs, and then JPEGs of the ways, labels, and predictions overlaid on the tiff.
Alternately, development/research can be done via jupyter notebooks:
To access the notebook via a browser on your host machine, find the IP VirtualBox is giving your default docker container by running:
docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default * virtualbox Running tcp://192.168.99.100:2376 v1.10.3
The notebook server is accessible via port 8888, so in this case you'd go to: http://192.168.99.100:8888
- Learning to Detect Roads in High-Resolution Aerial Images (Hinton)
- Machine Learning for Aerial Image Labeling- Minh's 2013 thesis, student of Hinton's best/recent paper on doing this, great success with these methods
Similar Efforts with OSM Data
- OSM-Crosswalk-Detection - uses Keras to detect crosswalks, a class project (Fall 2015)
- OSM-HOT-ConvNet - attempted use for disaster response, author thinks it's only 69% accurate at pixel level (fall 2016)
- Terrapattern - (spring 2016) - detect similar images, such as pools, boat wakes, or other patterns journalists/researchers might be interested in - Carnegie Mellon researchers, open source
- Skynet Data - (spring 2016) - data pipeline for machine learning with OpenStreetMap
- Full implementation of Mnih's CNN with Massachusetts data
- Background on Neural Networks and Deep Learning
Papers - Relevant Maybe
Papers - Not All that Relevant
Papers to Review
FIND - have you seen a paper from a few years ago about estimating OSM completeness by comparing size of compressed satellite images vs number of osm nodes
READ - this presentation on using GPS traces to suggest OSM edits (Strava/Telenav): http://webcache.googleusercontent.com/search?q=cache:VoiCwRHOyLUJ:stateofthemap.us/map-tracing-for-millennials/+&cd=3&hl=en&ct=clnk&gl=us
Citing Mnih and Hinton
I am reviewing these papers from Google Scholar that both cite the key papers and seem relevant to the topic.
This was the general idea to start, and working with TMS tiles sort of worked (see first 50 or so commits), so DeepOSM got switched to better data: