Skip to main content

Smart Land Use Reconstruction Pipeline

Project description

Overview

SLURP : Smart Land Use Reconstruction Pipeline

SLURP is your companion to compute a simple land-use/land-cover mask from Very High Resolution (VHR) optical images. It proposes different few or unsupervised learning algorithms that produce one-versus-all masks (water, vegetation, shadow, urban). Then a final algorithm stacks them all together and regularize them to obtain into a single multiclass mask.

SLURP uses some global data, such as Global Surface Water (Pekel) for water detection or World Settlement Footprint (WSF) for building detection.

Data preparation can be achieved with Orfeo ToolBox or other tools, in order to bring all necessary data in the same projection. You can either build your mask step by step, or use a batch script to launch and build the final mask automatically.

Initial VHR image Water mask Low/High vegetation and bare ground mask Shadow mask Urban probability Final mask
Bring your own VHR 4 bands (R/G/B/NIR) image (Pleiades, WorldView, PNEO, CO3D,...) Learn water occurrence (from 'Pekel') and predict water mask Use an unsupervised clustering algorithm to detect low/high vegetation and bare ground Detect large shadows (but avoid water confusion) Learn 'WSF" urban mask and compute building probability Stack and regularize building and vegetated areas contours

First steps

Installation

SLURP can be installed with pip :

pip install slurp-masks

Once your environment is ready, you can prepare data with slurp_prepare and then compute SLURP masks with slurp_watermask, slurp_urbanmask, etc.

Documentation is available on Read the docs

A tutorial is available : Tutorial.md.

Compute a land cover map

SLURP computes several single-class masks (one versus all) and then stacks (and regularize) them into a multi-class map.

SLURP needs to superimpose some external data so it fits your target VHR image. It can be done through OTB Superimpose application

mkdir out
# Superimpose Pekel, Hand and WSF with OTB
# 
# /!\ Adapt path depending on where your global Pekel database (resp. HAND, WSF) is located
otbcli_Superimpose -inr <your VHR image.tif> -inm <path to Global Surface Water Pekel occurrence file> -out "out/pekel.tif?&gdal:co:TILED=YES&gdal:co:COMPRESS=DEFLATE" uint8 -interpolator nn
otbcli_Superimpose -inr <your VHR image.tif> -inm <path to Heigh Above Nearest Drainage map>  -out "out/hand.tif?&gdal:co:TILED=YES&gdal:co:COMPRESS=DEFLATE" 
otbcli_Superimpose -inr <your VHR image.tif> -inm <path to World Settlement Footprint map> -out "out/wsf.tif?&gdal:co:TILED=YES&gdal:co:COMPRESS=DEFLATE" uint8 -interpolator nn

# Prepare : computes primitives (NDVI / NDWI / textures)
slurp_prepare <your_slurp_conf.json> -file_vhr <your VHR image.tif>

# Watermask : learn from Pekel database and predict water occurrence
slurp_watermask out/effective_used_config.json

# Vegetationmask : segment image and apply clustering method to detect low/high vegetation
slurp_vegetationmask out/effective_used_config.json

# Shadowmask : threshold RGB and NIR to detect shadows
slurp_shadowmask out/effective_used_config.json

# Urbanmask : learn from WSF and compute urban probability
slurp_urbanmask out/effective_used_config.json 

# Stack : regularize all the previous masks together
slurp_stackmasks out/effective_used_config.json 

Algorithm description

SLURP is designed to compute a simple land cover map (water, low/high vegetation, bare groud, buildings) from a VHR (Very High Resolution) image with 4 bands (Red, Green, Blue, Near-Infrared). SLURP is based on few or unsupervised algorithms (random forest, clustering, segmentation) that need some auxiliary data for training step.

It had been validated with Pleiades and tested with WordView, CO3D, Pleiades NEO images. It shall also work with images with lower resolution (ex : SPOT 6/7).

Auxiliary input data

Data Step / usage Comments
Pekel (Global Surface Water) Water mask prediction : Water occurrence [0-100] during the last 30 years, used to learn a water prediction model (MANDATORY) The global map is mandatory but you can also use some data by month
Hand MERIT Water mask prediction : Map of height above nearest drainage used to optimize choice of "non water" samples in the training step (OPTIONAL) Free after registration (other kind of HAND maps exist)
WSF 2019 (World Settlement Footprint) Urban mask prediction : global buildings map used to learn a building prediction model (MANDATORY) Could be replaced by a better resolution map if available (ex : OSM buildings)
ESA WorldCover Vegetation mask configuration Global land cover map (10m resolution) used to customize vegetation clustering (OPTIONAL) Very helpful to parameterize balance between non-vegetation / low and high vegetation clusters (see vegetation mask algorithm)
Copernicus WBM Stack mask : Water Body Mask from Copernicus, used to classify each water body from the watermasl (OPTIONAL) If used, the final map will contain river, lake, sea classes

Data preparation

Some masks need auxiliary files and some primitives computed from your VHR image.

These data must be on the same projection, resolution and bounding box as the VHR input image to enable mask computation.

You can generate this data yourself or use the prepare command (slurp_prepare) available in SLURP.

The prepare script enables :

  • Computation of stack validity (with or without a cloud mask)
  • Computation of NDVI and NDWI
  • Extraction of largest Pekel file (in sensor mode only)
  • Extraction of largest HAND file (in sensor mode only)
  • Extraction of WSF file (in sensor mode only)
  • Extraction of Water Body Mask (if needed, in sensor mode only)
  • Computation of texture file (convolution on NIR band)

Water mask

Water model is learned from Pekel (Global Surface Water) reference data and is based on NDVI/NDWI2 indices.

First the algorithm will pick-up water (and non-water) samples from your image, by using Pekel as a prior.

Then, a random forest learns how to predict water and predicts a raw mask on the whole image. The predicted mask is cleaned with Pekel, possibly with HAND (Height Above Nearest Drainage) maps and post-processed to clean artefacts.

It is possible to adapt a lot of parameters (see slurp_watermask -h) to adapt learning parameters, add other features (-layers <features in an other raster>), etc.

Vegetation mask

Vegetation mask are computed with an unsupervised clustering algorithm. First some primitives are computed from VHR image (NDVI, NDWI2, textures). Then a segmentation is processed (SLIC) and segments are dispatched in several clusters depending on their features. A final labellisation affects a class to each segment (ie : high NDVI and low texture denotes for low vegetation).

Urban (building) mask

An urban model (building) is learned from WSF reference map. The algorithm can take into account water and vegetation masks in order to improve samples selection (non building pixels will be chosen outside WSF and outside water/vegetation masks). The output is a "building probability" layer ([0..100]) that is used by the stack algorithm.

Shadow mask

Shadow mask detects dark areas (supposed shadows), based on two thresholds (RGB, NIR). A post-processing step removes small shadows, holes, etc. The resulting mask is a three-classes mask (no shadow, small shadow, big shadows). The big shadows are used in the stack algorithm in the regularization step.

Stack and regularize buildings

The stack algorithm takes into account all previous masks to produce a 6 classes mask (water, low vegetation, high vegetation, building, bare soil, other) and an auxiliary height layer (low / high / unknown).

The algorithm regularizes urban mask with a watershed algorithm based on building probability and context of surrounding areas.

This algorithm first computes a gradient on the image and fills a marker layer with known classes. Then a watershed step helps to adjust contours along gradient image, thus regularizing buildings shapes.

The stack algorithm can also categorize water bodies (lake, river, sea) if you provide a general water body mask as an input.

You can override the JSON with CLI arguments. For example : slurp_stackmasks <JSON file> -file_vhr <VHR input image> -remove_small_objects 500 -binary_closing 3

References

SLURP vegetation algorithm had been described in the following paper : Smart Land Use Masks : A Simple and Robust Approach to Produce Low/High Vegetation Masks from a Single High Resolution Satellite Image

This package was created with PLUTO-cookiecutter project template.

Inspired by main cookiecutter template and CARS cookiecutter template

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

slurp_masks-0.0.2-cp314-cp314t-musllinux_1_2_x86_64.whl (761.8 kB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

slurp_masks-0.0.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (770.8 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

slurp_masks-0.0.2-cp314-cp314-musllinux_1_2_x86_64.whl (762.4 kB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

slurp_masks-0.0.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (761.5 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

slurp_masks-0.0.2-cp313-cp313-musllinux_1_2_x86_64.whl (766.8 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

slurp_masks-0.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (768.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

slurp_masks-0.0.2-cp312-cp312-musllinux_1_2_x86_64.whl (768.8 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

slurp_masks-0.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (771.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

slurp_masks-0.0.2-cp311-cp311-musllinux_1_2_x86_64.whl (783.9 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

slurp_masks-0.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (781.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

slurp_masks-0.0.2-cp310-cp310-musllinux_1_2_x86_64.whl (754.8 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

slurp_masks-0.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (752.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

slurp_masks-0.0.2-cp39-cp39-musllinux_1_2_x86_64.whl (753.4 kB view details)

Uploaded CPython 3.9musllinux: musl 1.2+ x86-64

slurp_masks-0.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (751.0 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

slurp_masks-0.0.2-cp38-cp38-musllinux_1_2_x86_64.whl (774.3 kB view details)

Uploaded CPython 3.8musllinux: musl 1.2+ x86-64

slurp_masks-0.0.2-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (773.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file slurp_masks-0.0.2-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9c2736823442850d97c8bad0434755ce32b99cf1b215edf855610985a30b7257
MD5 2b61583b4fbd06cdc0c9e61df7157b77
BLAKE2b-256 85f57bd8f5f70f1e35a172d4e862bf41093db06f81bcabbc247c3b690a825741

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2753b1e2e1cd01fec5a997def6385f186881597d52d4e390ad28dfddbb41cfcb
MD5 34e079d481c117bf8833ded6d27e6aa2
BLAKE2b-256 03527d330702d9f54d3a77fd36619516415245f47642bc4c967c1edabd53039c

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4a22953ef862fb284ed1975d0eaeee096437e77dae55d019fca5e31da452df59
MD5 3815643c2e90b5bc6c880d2c83b22647
BLAKE2b-256 7af0bfb2d0b8e75aa21045c3aac23da3d8f62a1eab5b42c034969502bfb665d5

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 56842fcdbfad82e909da449fd91869cb277b2c811b23103e28ee8eece52fb802
MD5 db5f5f2406abbc7fe016b31fdce2eedf
BLAKE2b-256 8e15b3fb5b34e0e1657ceb7c14784642d1c6bd58b9b78c09e5619ec02ff3e2d9

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e3a53f3f424ba603e5d1ff44cd9cf6cb05fb215fc517fe348201dee6d8ba96a3
MD5 a3f7929dcb2e188882efb777a985e15f
BLAKE2b-256 9a7405e40eb68be4217f4de1a808e106f1591a17fa19c362568bea895719b168

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c8f7a0af3c482cea33c675566db67a6bd3a1f668359f2252cd6374b93242cb2a
MD5 92fc1646edd9f1658c737d9749004fc6
BLAKE2b-256 3e097a85ff02129386ae56c17b8ee142734fa092ac9f88f1858d4bd5770431b7

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 90036ac312a56c3dc8f2003c5d16f7e70769912e8c572ca5e2d6be0bcaa1b48e
MD5 465630a2b315b84effff365839c34122
BLAKE2b-256 6be7de24f6fc3786de299c48f57b41a90ffce88fe04dfc1eaa0fee74d8abc78e

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 174a4a6cc13ecd6d1bcbb177719a5027987c34f77e11afb9a1f0ca4075ca0db5
MD5 00fc370a06e0e24d4dfe058a548f2cc8
BLAKE2b-256 35bebbde78fd47ebe43353af1097f39afe8d9a595369558a23142ea80973e68e

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 cf1f1e177c030cad3b215f17854bac1e9ff9f26c159f8091d842cb402d41e0fd
MD5 346620a31809779a5830f29fd63e387f
BLAKE2b-256 154a485d4261c74aec86d75f0e027178ba354624b735e6962c5c89c606082ad1

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4cf289511066cf4a6bf431afd48ca8c3ebd30698e3af4cceb4e2069235d6ea55
MD5 b70c3cd216fb0b66a746226ed288e157
BLAKE2b-256 3d0ad3cbc73aa588a30bb8a54ee551fbe847f439ade5c28378a07d26deb4e9b2

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1f4ae47fc8951ea97d97fb25a7dc72be0861d42d3764e799b063ed73829dc420
MD5 4efba1a892b7b7197540ade578c251bd
BLAKE2b-256 4762477c22afd8f249044af3af610dccf160fe85b8772a5738956f913899db3a

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0829e38c97e2e246c5a0999d803e9ccacac1120c2cab8a212370b751a56ba9da
MD5 6fad1b6c73f5cdff82862290c053c4c9
BLAKE2b-256 9dd73446b70c82819693822139b30d37cf06ac130221acc7796f0a02198e5a79

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 558285280a4ef023d60a8415873e2e45cfadd141dbce46a2e030881b97de6ad2
MD5 1a76701b0c08736f91f6ddb2fbfea42e
BLAKE2b-256 54e0ea1f7e1cda7be311f222db664daada722db71477d6cb6eb51eab3e707074

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e01d8946e192211c6bf27385c76bdc17b4e081337517f491d5e7767ea5b48d36
MD5 0c1a4701e07e63371d6d2a6d432ac81f
BLAKE2b-256 b28603076607716fde7358923711bc2bc715bf60b8f6938f7bebe531bc0ae6ef

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp38-cp38-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp38-cp38-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 334781486307daf2054e740543808dcf03b360d00e9cc803a389d3b3d1d48852
MD5 5edee77e331f2b020127899139282c22
BLAKE2b-256 2b9103da96a79d2f26e681b7562aa6037be5aacc3977b2d598684aed4b532c56

See more details on using hashes here.

File details

Details for the file slurp_masks-0.0.2-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for slurp_masks-0.0.2-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 597520d1d1457825402a93e8659ea3441d9acaf98ee425635e9b69bc080cf174
MD5 e7275db8068404ccc2fba8cd711b3d0d
BLAKE2b-256 897df1ca55f731f44bf1d57d6b367d9cf2ce50df1ffdf0f39ad1d41c64a804d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page