Open Sustainable Technology

A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

Browse accepted projects | Review proposed projects | Propose new project | Open Issues


This project maps tree extent at the ten-meter scale using open source artificial intelligence and satellite imagery.

Last synced: about 9 hours ago
JSON representation

Repository metadata

Image segmentations of trees outside forest



Mapping tree cover and extent with Sentinel-1 and 2

# Description

This is the GitHub repository for the Sentinel-1 and Sentinel-2 dataset Tropical Tree Cover, which is viewable on Google Earth Engine [here]( The asset is public as of May 2023 on Google Earth Engine [here]( The dataset is published in [Remote Sensing of Environment](

The trained model and training data are in preparation for release in early 2024.

This project maps tree extent at the ten-meter scale using open source artificial intelligence and satellite imagery. The data enables accurate reporting of tree cover in urban areas, tree cover on agricultural lands, and tree cover in open canopy and dry forest ecosystems.

This repository contains the source code for the project. A full description of the methodology can be found in the [publication]( The data product specifications can be accessed on the wiki page.
* [Background](
* [Data Extent](
* [Methodology](
* [Validation and Analysis]( | [Jupyter Notebook](
* [Definitions](
* [Limitations](

# Citation

Brandt, J., Ertel, J., Spore, J., & Stolle, F. (2023). Wall-to-wall mapping of tree extent in the tropics with Sentinel-1 and Sentinel-2. Remote Sensing of Environment, 292, 113574. doi:10.1016/j.rse.2023.113574

Brandt, J. & Stolle, F. (2021) A global method to identify trees outside of closed-canopy forests with medium-resolution satellite imagery. International Journal of Remote Sensing, 42:5, 1713-1737, DOI: 10.1080/01431161.2020.1841324


# Getting started

An overview Jupyter notebook walking through the creation of the data can be found [here](

A Google Earth Engine script to export Geotiffs of the extent data by country can be found [here](

# Installation

Utilizing this repository to generate your own data requires:
* Sentinel-Hub API key, see [Sentinel-hub](
* Amazon Web Services API key (optional) with s3 read/write privileges

The API keys should be stored as `config.yaml` in the base directory with the structure:

awskey: "YOUR-AWS-API-KEY"
awssecret: "YOUR-AWS-API-SECRET"

The code can be utilized without AWS by setting `--ul_flag False` in ``. By default, the pipeline will output satellite imagery and predictions in 6 x 6 km tiles to the `--s3_bucket` bucket. NOTE: The specific layer configurations for Sentinel-Hub have not yet been released but are available on request.

## With Docker

git clone
cd sentinel-tree-cover/
touch config.yaml
vim config.yaml # insert your API keys here
docker build -t sentinel_tree_cover .
docker run -it --entrypoint /bin/bash sentinel_tree_cover:latest
cd src
python3 --country "country" --year year

## Without docker
* Clone repository
* Install dependencies `pip3 install -r requirements.txt`
* Install GDAL (different process for different operating systems, see
* Download model `python3 src/models/`
* Start Jupyter notebook and navigate to `notebooks/` folder

# Usage
The `notebooks/` folder contains ordered notebooks for downloading training and testing data and training the model, as follows:
* 1a-download-sentinel-2: downloads monthly mosaic 10 and 20 meter bands for training / testing plots
* 1b-download-sentinel-1: downloads monthly VV-VH db sigma Sentinel-1 imagery for training / testing plots
* 2-data-preprocessing: Combines satellite imagery for training / testing plots with labelled data from [Collect Earth Online](
* 3-feature-selection: Feature selection for remote sensing indices utilizing random forests
* 4-model: Trains and deploys tree cover model

The `src/` folder contains the source code for the project, as well as the primary entrypoint for the Docker container, ``

`` can be used as follows, with additional optional arguments listed in the file: `python3 --country $COUNTRY --year $YEAR`

# Methodology

## Model
This model uses a U-Net architecture with the following modifications:
* [Convolutional GRU]( encoder with group normalization to develop temporal features of monthly cloud-free mosaics
* Concurrent spatial and channel squeeze excitation in both the encoder and decoder (
* DropBlock and Zoneout for generalization in both the encoder and decoder
* Group normalization and Swish activation in both the encoder and decoder
* [AdaBound]( optimizer with Stochastic Weight Averaging and Sharpness Aware Minimization
* Binary cross entropy and boundary loss
* Smoothed image predictions across moving windows with Gaussian filters
* A much larger input (28x28) than output (14x14) at training time, with 182x182 and 168x168 input and output size in production, respectively


## Data
This project uses Sentinel 1 and Sentinel 2 imagery. Monthly composites of Sentinel 1 VV-VH imagery are fused with the nearest Sentinel 2 10- and 20-meter bands. These images are preprocessed by:
* Super-resolving 20m bands to 10m with DSen2
* Calculating cloud cover and cloud shadow masks
* Removing steps with >30% cloud cover, and linearly interpolating to remove clouds and shadows from <30% cloud cover images
* Applying Whittaker smoothing (lambda = 100) to each time series for each pixel for each band to reduce noise
* Calculating vegetation indices, including EVI, BI, and MSAVI2

The cloud / shadow removal and temporal mosaicing algorithm is summarized below:
* Select all images with <30% cloud cover
* Select up to two images per month with <30% cloud cover, closest to beginning and middle of month
* Select least cloudy image if max CC > 15%, otherwise select the image closest to the middle of the month
* Linearly interpolate clouds and cloud shadows with a rolling median
* Smooth time series data with a rolling median
* Linearly interpolate image stack to a 15 day timestep
* Smooth time stack with Whittaker smoother

# License

The code is released under the GNU General Public License v3.0.

# Project Organization

├── Makefile <- Makefile with commands like `make data` or `make train`
├── <- The top-level README for developers using this project.
├── docs <- A default Sphinx project; see for details

├── models <- Trained and serialized models, model predictions, or model summaries

├── notebooks <- Jupyter notebooks
│   └── baseline
│   └── replicate-paper
│   └── visualization

├── references <- Data dictionaries, manuals, and all other explanatory materials.

├── requirements.txt <- The requirements file for reproducing the analysis environment, e.g.
│ generated with `pip freeze > requirements.txt`

├── <- makes project pip installable (pip install -e .) so src can be imported
├── src <- Source code for use in this project.
│   ├── <- Makes src a Python module
│ │
│   ├── data <- Scripts to download or generate data
│   │   └──
│ │
│   ├── features <- Scripts to turn raw data into features for modeling
│   │   └──
│ │
│   ├── models <- Scripts to train models and then use trained models to make
│ │ │ predictions
│   │   ├──
│   │   └──
│ │
│   └── visualization <- Scripts to create exploratory and results oriented visualizations
│   └──

└── tox.ini <- tox file with settings for running tox; see


Owner metadata

GitHub Events

Last Year

Committers metadata

Last synced: 27 days ago

Total Commits: 223
Total Committers: 3
Avg Commits per committer: 74.333
Development Distribution Score (DDS): 0.439

Commits in past year: 17
Committers in past year: 1
Avg Commits per committer in past year: 17.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
John Brandt =**** 125
John Brandt 3****t 91
Jessica Ertel 3****0 7

Committer domains:

Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 21
Total pull requests: 28
Average time to close issues: 7 months
Average time to close pull requests: about 1 month
Total issue authors: 6
Total pull request authors: 3
Average comments per issue: 1.33
Average comments per pull request: 0.43
Merged pull request: 16
Bot issues: 0
Bot pull requests: 8

Past year issues: 3
Past year pull requests: 2
Past year average time to close issues: N/A
Past year average time to close pull requests: less than a minute
Past year issue authors: 3
Past year pull request authors: 2
Past year average comments per issue: 2.0
Past year average comments per pull request: 0.0
Past year merged pull request: 1
Past year bot issues: 0
Past year bot pull requests: 1

More stats:

Top Issue Authors

  • JohnMBrandt (15)
  • sandersson-sylvera (2)
  • amiralipour (1)
  • blossomzx (1)
  • ib-albo (1)
  • theoway (1)

Top Pull Request Authors

  • JohnMBrandt (11)
  • jessicarose00 (9)
  • dependabot[bot] (8)

Top Issue Labels

  • enhancement (12)
  • bug (1)

Top Pull Request Labels

  • dependencies (8)


Dockerfile docker
  • tensorflow/tensorflow 1.15.5-gpu-py3 build

Score: 6.075346031088684