Skip to content

giserh/DeepOSM

 
 

Repository files navigation

DeepOSM

Detect roads and features in satellite imagery, by training neural networks with OpenStreetMap (OSM) data. The gist:

  • Download a chunk of satellite imagery
  • Download OSM data that shows roads/features for that area
  • Generate training and evaluation data

Read below to run the code. I am blogging my work journal too.

Contributions are welcome. Open an issue if you want to discuss something to do, or email me.

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, which 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.

Install Requirements

AWS Credentials

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.

Install Docker

First, install a Docker Binary.

I also needed to set my VirtualBox default memory to 12GB. libosmium needed 4GB, and the neural net needed even more. This is easy:

  • start Docker, per the install instructions
  • stop Docker
  • open VirtualBox, and increase the memory of the VM Docker made

Run Scripts

Start Docker, then run:

make dev

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 eight NAIPs, which gets tiled into NxNx4 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/run_analysis.py

For output, it will produce some console logs, and then JPEGs of the ways, labels, and predictions overlaid on the tiff.

NAIP with Ways and Predictions

Jupyter Notebook

Alternately, development/research can be done via jupyter notebooks:

make notebook

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

Readings

Papers that Cite Hinton/Mnih, to Review

I am reviewing these papers from Google Scholar that both cite the key papers and seem relevant to the topic.

Papers - Relevant Maybe

Papers - Not All that Relevant

Original Idea

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:

Deep OSM Project

About

Train a deep learning net with OpenStreetMap features and satellite imagery.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.9%
  • Shell 3.0%
  • Makefile 2.1%