GithubHelp home page GithubHelp logo

ada-collection's Introduction

ada-collection

Tools for Automated Mapping and Damage Assessment.

This repo wraps two packages:

  • abd_model - forked from automated-building-detection
  • ada_tools - tools for pre- and post-processing of remote sensing images and vector data

The damage assessment framework & model is at caladrius:ada-0.1 automatically installed via Docker (caladrius.Dockerfile).

Important

This readme is intended for the general public.

For 510-specific instructions during emergencies, see the ADA SOP.

Getting started

Get pre-trained models and images

  1. Download pre-trained building detection model: neat-fullxview-epoch75.pth:
  • architecture: AlbuNet (U-Net-like encoder-decoder with a ResNet, ResNext or WideResNet encoder)
  • training: xBD dataset, 75 epochs
  • performance: IoU 0.79, MCC 0.75
  1. Download pre-trained building damage classification model: caladrius_att_effnet4_v1.pkl
  1. [OPTIONAL] pre- and post-disaster satellite images

Your workspace should then look like

    <workspace>
    ├── ...
    ├── neat-fullxview-epoch75.pth    # pre-trained building detection model
    ├── caladrius_att_effnet4_v1.pkl  # pre-trained building damage classification model
    ├── images                        # satellite images
    │   ├── pre-event                 # before the disaster
    │   └── post-event                # after the disaster
    └── ...

Using Docker

  1. Install Docker.
  2. Download the latest Docker Image
docker pull jmargutti/ada-collection
  1. Create a docker container and connect it to a local directory (<path-to-your-workspace>)
docker run --name ada-collection -dit -v <path-to-your-workspace>:/workdir --ipc=host --gpus all -p 5000:5000 rodekruis/ada-collection
  1. Access the container
docker exec -it ada-collection 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 ada_tools and install
cd ada_tools
pip install .

Note: Make sure libboost/boost is installed.

  1. Move to abd_model and install
cd ../abd_model
pip install .
  1. Get caladrius:ada-0.1 (damage assessment framework) and install
git clone --branch ada-0.1 https://github.com/rodekruis/caladrius.git
cd caladrius
./caladrius_install.sh

End-to-end example

  1. Get satellite images of typhoon Mangkhut from Maxar Open Data
load-images --disaster typhoon-mangkhut --dest <workspace>/images
  • Alternatively, load images from Azure blob storage
load-images-azure --disaster typhoon-mangkhut --dest <workspace>/images
  • Set the CONNECTION_STRING and CONTAINER_NAME environmental variables corresponding to your Azure account
  1. Prepare images for building detection
abd cover --raster <workspace>/images/pre-event/*.tif --zoom 17 --out <workspace>/abd/cover.csv
abd tile --raster <workspace>/images/pre-event/*.tif --zoom 17 --cover <workspace>/abd/cover.csv --out <workspace>/abd/images --format tif --no_web_ui --config ada-tools/config.toml
  1. Detect buildings
abd predict --dataset <workspace>/abd --cover <workspace>/abd/cover.csv --checkpoint <workspace>/neat-fullxview-epoch75.pth --out <workspace>/abd/predictions --metatiles --keep_borders --config ada-tools/config.toml
  1. Generate vector file with buildings and filter noise
abd vectorize --masks <workspace>/abd/predictions --type Building --out <workspace>/abd/buildings.geojson --config ada-tools/config.toml
filter-buildings --data <workspace>/abd/buildings.geojson --dest <workspace>/abd/buildings-clean.geojson
  1. Prepare images for building damage classification
prepare-data --data <workspace>/images --buildings <workspace>/abd/buildings-clean.geojson --dest <workspace>/caladrius
  1. Classify building damage
CUDA_VISIBLE_DEVICES="0" python caladrius/caladrius/run.py --run-name run --data-path <workspace>/caladrius --model-type attentive --model-path <workspace>/caladrius_att_effnet4_v1.pkl --checkpoint-path <workspace>/caladrius/runs --batch-size 2 --classification-loss-type f1 --output-type classification --inference
  1. Generate vector file with buildings and damage labels
final-layer --builds <workspace>/abd/buildings-clean.geojson --damage <workspace>/caladrius/runs/run-input_size_32-learning_rate_0.001-batch_size_32/predictions/run-split_inference-epoch_001-model_inception-predictions.txt --out <workspace>/buildings-predictions.geojson --thresh 1
  1. Take your favorite GIS application and visualize <workspace>/buildings-predictions.geojson in a nice map

ada-collection's People

Contributors

dependabot[bot] avatar jmargutt avatar lemanuel avatar lukeruud avatar maarten990 avatar menymetekia avatar ondrejzacha avatar tnmygrwl avatar wessel93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ada-collection's Issues

[BUG] docker image not available

Who notified us about the bug?

Julian

Describe the bug

The docker image is not available (nor is any other docker image by rodekruis on docker for that matter)

To Reproduce

Steps to reproduce the behavior:

  1. Go to docker
  2. See error

Expected behavior

docker image

Screenshots

image

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.