Skip to content

rodekruis/automated-building-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

version: 0.0.0 style: PEP 8

automated-building-detection

Automated Building Detection using Deep Learning: a NLRC/510 tool

Scope: quickly map a large area to support disaster response operations

Input: very-high-resolution (<= 0.5 m/pixel) RGB satellite images. Currently supported:

  • Bing Maps
  • Any custom image in raster format

Output: buildings in vector format (geojson), to be used in digital map products

Credits

Built on top of robosat and robosat.pink.

Development: Ondrej Zacha, Wessel de Jong, Jacopo Margutti

Contact: Jacopo Margutti.

Structure

  • abd_utils utility functions to download/process satellite images
  • abd_model framework to train and run building detection models on images
  • input input/configuration files needed to run the rest

Requirements:

To download satellite images:

To run the building detection models:

If using Docker

Getting started

Using Docker

  1. Install Docker.
  2. Download the latest Docker Image
docker pull rodekruis/automated-building-detection
  1. Create a docker container and connect it to a local directory (<path-to-your-workspace>)
docker run --name automated-building-detection -dit -v <path-to-your-workspace>:/workdir --ipc=host --gpus all -p 5000:5000 rodekruis/automated-building-detection
  1. Access the container
docker exec -it automated-building-detection bash

Manual Setup

  1. Install Python 3.7 and pip
  2. Install Anaconda
  3. Create and activate a new Anaconda environment
conda create --name abdenv python=3.7 
conda activate abdenv
  1. From root directory, move to abd_utils and install
cd abd_utils
pip install .
  1. Move to abd_model and install
cd ../abd_model
pip install .

N.B. Remember to activate abdenv next time

End-to-end example

How to use these tools? We take as example a small Dutch town; to predict the buildings in another area, simply change the input AOI (you can create your own using e.g. geojson.io).

Detailed explanation on usage and parameters of the different commands is given in the subdirectories abd_utils and abd_model.

  1. Add you Bing Maps Key in abd_utils/src/abd_utils/.env (the Docker container has vim pre-installed)
  2. Download the images of the AOI, divided in tiles
download-images --aoi input/AOI.geojson --output bing-images
  1. Convert the images into the format needed to run the building detection model
images-to-abd --images bing-images/images --output abd-input
  1. Download a pre-trained model (more details below) and add it to the input directory
  2. Run the building detection model
abd predict --config input/config.toml --dataset abd-input --cover abd-input/cover.csv --checkpoint input/neat-fullxview-epoch75.pth --out abd-predictions --metatiles --keep_borders
  1. Vectorize model output (from pixels to polygons)
abd vectorize --config input/config.toml --type Building --masks abd-predictions --out abd-predictions/buildings.geojson
  1. Merge touching polygons, remove small artifacts, simplify geometry
filter-buildings --data abd-predictions/buildings.geojson --dest abd-predictions/buildings-clean.geojson

Model collection

About

Automated Building Detection using Deep Learning

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages