Skip to main content

Semantic Segmentation ecosystem for GeoSpatial Imagery

Project description

RoboSat.pink

Semantic Segmentation ecosystem for GeoSpatial imagery

RoboSat.pink buildings segmentation from Imagery

Purposes:

  • DataSet Quality Analysis
  • Change Detection highlighter
  • Features extraction and completion

Main Features:

  • Provides several command line tools, you can combine together to build your own workflow
  • Follows geospatial standards to ease interoperability and data preparation
  • Build-in cutting edge Computer Vision model and loss implementations (and allows to replace by your owns)
  • Support either RGB or multibands imagery (as multispectral or hyperspectral)
  • Allows Data Fusion (from imagery or rasterized vectors)
  • Web-UI tools to easily display, hilight or select results
  • High performances

Documentation:

Tutorials:

Config file:

Tools:

  • rsp cover Generate a tiles covering, in csv format: X,Y,Z
  • rsp download Downloads tiles from a remote server (XYZ, WMS, or TMS)
  • rsp extract Extracts GeoJSON features from OpenStreetMap .pbf
  • rsp rasterize Rasterize vector features (GeoJSON or PostGIS), to raster tiles
  • rsp subset Filter images in a slippy map dir using a csv tiles cover
  • rsp tile Tile raster coverage
  • rsp train Trains a model on a dataset
  • rsp export Export a model to ONNX or Torch JIT
  • rsp predict Predict masks, from given inputs and an already trained model
  • rsp compare Compute composite images and/or metrics to compare several XYZ dirs
  • rsp vectorize Extract simplified GeoJSON features from segmentation masks

Presentations slides:

Installs:

With PIP:

pip3 install RoboSat.pink                                     # For latest stable version

or

pip3 install git+https://github.com/datapink/robosat.pink     # For current dev version

With Conda, using a virtual env:

conda create -n robosat_pink python=3.6 && conda activate robosat_pink
pip install robosat.pink                                      # For latest stable version        

With Ubuntu 18.04, from scratch:

sudo sh -c "apt update && apt install -y build-essential python3-pip"
pip3 install RoboSat.pink && export PATH=$PATH:~/.local/bin
pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.1.post2-cp36-cp36m-linux_x86_64.whl
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/418.43/NVIDIA-Linux-x86_64-418.43.run 
sudo sh NVIDIA-Linux-x86_64-418.43.run -a -q --ui=none

With CentOS 7, from scratch:

sudo sh -c "yum -y update && yum install -y python36 wget && python3.6 -m ensurepip"
pip3 install --user RoboSat.pink
pip3 install --user https://download.pytorch.org/whl/cu100/torch-1.0.1.post2-cp36-cp36m-linux_x86_64.whl
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/418.43/NVIDIA-Linux-x86_64-418.43.run 
sudo sh NVIDIA-Linux-x86_64-418.43.run -a -q --ui=none

NOTAS:

  • Requires: Python 3.6 or later
  • GPU is not strictly mandatory, but rsp train would be -that- slower without.
  • To test RoboSat.pink install, launch in a terminal: rsp -h
  • Upon your pip PATH setting, you may have to update it: export PATH=$PATH:.local/bin
  • PyTorch release published on PyPI is binded with CUDA 9. For CUDA 10, grab a wheel from PyTorch web site, e.g pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.1.post2-cp36-cp36m-linux_x86_64.whl

WorkFlows:

A Minimal example

Minimal Example
  1. Configuration:
echo '

[[channels]]
  name   = "images"
  bands = [1, 2, 3]

[[classes]]
  title = "Building"
  color = "deeppink"

[model]
  nn = "Albunet"
  da = "Strong"
  loss = "Lovasz"
  loader = "SemSegTiles"
  metrics = ["iou"]

' > ~/.rsp_config
  1. Data Preparation:
rsp cover --bbox 4.8,45.7,4.83,45.73 --zoom 18 ds/cover
rsp download --type WMS 'https://download.data.grandlyon.com/wms/grandlyon?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&LAYERS=Ortho2015_vue_ensemble_16cm_CC46&WIDTH=512&HEIGHT=512&CRS=EPSG:3857&BBOX={xmin},{ymin},{xmax},{ymax}&FORMAT=image/jpeg' ds/cover ds/images

wget -nc -O ds/lyon_roofprint.json 'https://download.data.grandlyon.com/wfs/grandlyon?SERVICE=WFS&REQUEST=GetFeature&TYPENAME=ms:fpc_fond_plan_communaut.fpctoit&VERSION=1.1.0&srsName=EPSG:4326&BBOX=4.79,45.69,4.84,45.74&outputFormat=application/json; subtype=geojson'
rsp rasterize --type Building --geojson ds/lyon_roofprint.json --cover ds/cover ds/labels

rsp cover --dir ds/images --splits 70/20/10 ds/training/cover ds/validation/cover ds/prediction/cover
rsp subset --dir ds/images --cover ds/training/cover ds/training/images
rsp subset --dir ds/labels --cover ds/training/cover ds/training/labels
rsp subset --dir ds/images --cover ds/validation/cover ds/validation/images
rsp subset --dir ds/labels --cover ds/validation/cover ds/validation/labels
  1. Model Training and Prediction:
rsp train  --epochs 5 --lr 0.000025 --bs 4 ds ds/models
rsp subset --dir ds/images --cover ds/prediction/cover ds/prediction/images
rsp predict --checkpoint ds/models/checkpoint-00005.pth ds/prediction ds/prediction/masks
rsp compare --images ds/prediction/images ds/prediction/masks --mode side ds/prediction/compare

DataSet:

  • Training and validation datasets have to be tiled, using XYZ tiles format.
  • A Dataset directory, so containing XYZ tiles, can be split as:
dataset
├── training
│   ├── images
│   └── labels
└── validation
    ├── images
    └── labels
  • Tiles images formats could be any able to be read by GDAL.
  • Tiles labels are expected to be PNG with single band.
  • Tools producing XYZ tiles directory, generate also a web map client, for visual inspection.

Data Preparation

Several ways to create your own training dataset, upon input data type:

Data Preparation

NOTA: several inputs connected to a single arrow point means a logical OR (e.g. WMS or XYZ or TMS).

Architecture:

Stacks RoboSat.pink use cherry-picked Open Source libs among Deep Learning, Computer Vision and GIS stacks.

Related resources:

Bibliography:

Contributions and Services:

  • Pull Requests are welcome ! Feel free to send code... Don't hesitate either to initiate a prior discussion via gitter or ticket on any implementation question. And give also a look at Makefile rules.

  • If you want to collaborate through code production and maintenance on a long term basis, please get in touch, co-edition with an ad hoc governance can be considered.

  • If you want a new feature, but don't want to implement it, DataPink provide core-dev services.

  • Expertise and training on RoboSat.pink are also provided by DataPink.

  • And if you want to support the whole project, because it means for your own business, funding is also welcome.

Authors:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
RoboSat.pink-0.4.2.tar.gz (32.4 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page