• Stars
    star
    160
  • Rank 234,703 (Top 5 %)
  • Language
    Jupyter Notebook
  • License
    GNU General Publi...
  • Created almost 5 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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.

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.

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

img

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:

key: "YOUR-SENTINEL-HUB-API-KEY"
awskey: "YOUR-AWS-API-KEY"
awssecret: "YOUR-AWS-API-SECRET"

The code can be utilized without AWS by setting --ul_flag False in download_and_predict_job.py. 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 https://github.com/wri/sentinel-tree-cover
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 download_and_predict_job.py --country "country" --year year

Without docker

  • Clone repository
  • Install dependencies pip3 install -r requirements.txt
  • Install GDAL (different process for different operating systems, see https://gdal.org)
  • Download model python3 src/models/download_model.py
  • 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, download_and_predict_job_fast.py

download_and_predict_job_fast.py can be used as follows, with additional optional arguments listed in the file: python3 download_and_predict_job_fast.py --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 (https://arxiv.org/abs/1803.02579)
  • 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

img4

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 img
  • Applying Whittaker smoothing (lambda = 100) to each time series for each pixel for each band to reduce noise img
  • 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


β”œβ”€β”€ LICENSE
β”œβ”€β”€ Makefile           <- Makefile with commands like `make data` or `make train`
β”œβ”€β”€ README.md          <- The top-level README for developers using this project.
β”œβ”€β”€ docs               <- A default Sphinx project; see sphinx-doc.org 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`
β”‚
β”œβ”€β”€ setup.py           <- makes project pip installable (pip install -e .) so src can be imported
β”œβ”€β”€ src                <- Source code for use in this project.
β”‚Β Β  β”œβ”€β”€ __init__.py    <- Makes src a Python module
β”‚   β”‚
β”‚Β Β  β”œβ”€β”€ data           <- Scripts to download or generate data
β”‚Β Β  β”‚Β Β  └── make_dataset.py
β”‚   β”‚
β”‚Β Β  β”œβ”€β”€ features       <- Scripts to turn raw data into features for modeling
β”‚Β Β  β”‚Β Β  └── build_features.py
β”‚   β”‚
β”‚Β Β  β”œβ”€β”€ models         <- Scripts to train models and then use trained models to make
β”‚   β”‚   β”‚                 predictions
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ predict_model.py
β”‚Β Β  β”‚Β Β  └── train_model.py
β”‚   β”‚
β”‚Β Β  └── visualization  <- Scripts to create exploratory and results oriented visualizations
β”‚Β Β      └── visualize.py
β”‚
└── tox.ini            <- tox file with settings for running tox; see tox.testrun.org

More Repositories

1

global-power-plant-database

A comprehensive, global, open source database of power plants
HTML
317
star
2

gfw

Global Forest Watch: An online, global, near-real time forest monitoring tool
JavaScript
269
star
3

carbon-budget

Calculate gross GHG emissions, gross carbon removals (sequestration), and net flux from forests globally
Python
76
star
4

gfw-mapbuilder

Template for the GFW Map Builder that is available through ArcGIS Online, as a stand-alone web application, & a library to build custom Forest Atlas web applications
TypeScript
33
star
5

UrbanLandUse

Characterizing urban land use with machine learning
Jupyter Notebook
29
star
6

demographic-identifier

Deep learning approach to identifying demographics and topics of tweets
Jupyter Notebook
25
star
7

aqueduct30_data_download

Make the Aqueduct 3.0 database available for download
Jupyter Notebook
19
star
8

rw-dynamicworld-cd

A repository holding code and example notebooks for change detection methodology for the Dynamic World Land Cover product.
Jupyter Notebook
19
star
9

mmdetection-satellite-dinov2

mmdetection-satellite-dinov2
Jupyter Notebook
15
star
10

gfw-fires-app

The Global Forest Watch Fires app
JavaScript
14
star
11

Aqueduct30Docker

add readme.md
Jupyter Notebook
13
star
12

raster2points

CLI to convert raster data to points (CSV or Pandas Dataframe)
Python
11
star
13

ReservoirWatchHack

11
star
14

UrbanHeatMitigation

Estimating surface reflectivity for multiple urban areas in the United States using machine learning
Jupyter Notebook
11
star
15

charm-global-level

CHARM, a model that estimates the GHG impacts and land-use requirements of forestry
Python
10
star
16

gfw-data-api

GFW Data API
Python
10
star
17

ev-simulator

Python code backing WRI technical note "Simulator to Quantify and Manage Electric Vehicle Load Impacts on Low-voltage Distribution Grids"
Python
10
star
18

gfw_forest_loss_geotrellis

Global Tree Cover Loss Analysis using Geotrellis and SPARK
Scala
10
star
19

cities-urbanshift

Jupyter Notebook
9
star
20

natural-lands-map

Documentation for creating the Natural Lands Map for SBTN Target Setting
JavaScript
9
star
21

Aqueduct40

Aqueduct 4.0 data and methodology
Jupyter Notebook
8
star
22

gfw-raster-analysis-lambda

GFW Raster Analysis in AWS Lambda
Python
8
star
23

retrieveR

A system for automating information retrieval from a corpus of documents
HTML
7
star
24

global-pasture-watch

Python
7
star
25

gee_toolbox

A convenience module and command line tool for GEE.
Python
6
star
26

aqueduct-components

Aqueduct components is a collection of React components shared with all Aqueduct tools.
JavaScript
6
star
27

wri-bounds

Country shapefiles and boundaries for WRI
Makefile
6
star
28

gfw-analysis

GFW Analysis
Python
5
star
29

gfw_pixetl

GFW ETL for raster tiles
Python
5
star
30

gfw-sync2

Tools to manage pushing source data to the GFW Platform
Python
5
star
31

gppd-ai4earth-api

A package for ML models that estimate plant-level annual generation
Python
5
star
32

cities-cities4forests-indicators

Jupyter Notebook
4
star
33

gfw-tile-cache

GFW Tile Cache Service
Python
4
star
34

ndc

Climate Watch Explore NDCs module. Full text of NDCs in HTML coding.
HTML
4
star
35

wri-scl-data-public

Systems Change Lab public data repository
3
star
36

fti_api

OPEN TIMBER PORTAL API
Ruby
3
star
37

gfw-datapump

Nightly batch process to generate summary statistics for user AOIs
Python
3
star
38

ForestAtlasToolbox

Python Toolbox to translate domains, dataset alias, field alias and subtypes and manage metadata
Python
3
star
39

glad-raster-analysis-lambda

POC of using AWS Lambda + Rasterio for raster calculations on S3
Python
3
star
40

cities-cif

Jupyter Notebook
3
star
41

gfw-places-to-watch

Generate new places to watch data when GLAD is updated
Python
3
star
42

gfw-forestlearn

A repository to hold code and examples for binary classification and regression relating to two AI4Earth projects: Mapping Global Carbon Mitigation and Predicting Future Deforestation in the Congo Basin
Jupyter Notebook
3
star
43

MAPSPAM

Process MAPSPAM data and make available in additional formats.
Jupyter Notebook
2
star
44

cities-dataportal-hazards

Jupyter Notebook
2
star
45

wri-list-tools

Python tools for analyzing large data lists.
Python
2
star
46

jurisdictional-risk

Python
2
star
47

glad_tiles_pipeline

Pipeline for GLAD tile processing
Python
2
star
48

wri-terramatch-website

README info goes here :)
TypeScript
2
star
49

zonal-stats-app

Python
2
star
50

gfw-water

JavaScript
2
star
51

otp-observations-tool

TypeScript
2
star
52

dl_jobs

CLI and Helper modules for managing Descartes Labs Tasks
Python
2
star
53

wri-terramatch-api

PHP
2
star
54

comms-dev-documentation

Documentation and notes for dev projects
JavaScript
2
star
55

tree_canopy_fcn

tree canopy predictions
Python
2
star
56

hansen_ee_processing

scripts for post processing hansen data on ee
Python
2
star
57

wri_sites

WRI profile
SCSS
2
star
58

gfw-iac-workshop

Materials needed for exercises associated with a Terraform/Infrastructure as Code workshop for the World Resources Institute (WRI).
HCL
2
star
59

earth-dashboard

JavaScript
2
star
60

gfw-commodities-app

Global Forest Watch Commodities app
JavaScript
2
star
61

template-python

Template repository for python-based projects
Makefile
2
star
62

wri-wpsi

The Water, Peace and Security partnership website
Ruby
2
star
63

cities-indicators-dashboard-urbanshift

R
1
star
64

wri-odp

The WRI Open Data Portal
TypeScript
1
star
65

harvest-fires

harvest fires in the last 24 hours and upload to cartodb
Clojure
1
star
66

gfw-mapbuilder-georspo

JavaScript
1
star
67

biomass_tiles

GFW Climate: Biomass tiles
Python
1
star
68

gfw_forest_loss_geotrellis_arcpy_client

Arcpy client for GFW Forest Loss Analysis
Python
1
star
69

cities-OpenUrban

R
1
star
70

GlobAgri-WRR-Expansion

Python
1
star
71

cities-heat-workspace

Jupyter Notebook
1
star
72

odp_front_end

HTML, CSS, JavaScript code to build a workable UI for the GFW Open Data Portal
CSS
1
star
73

spotutil

CLI tool to create a spot worker on AWS and launch processes
Python
1
star
74

gfw-components

React component library for the Global Forest Watch project
JavaScript
1
star
75

ira-eligibility-enhancements

HTML
1
star
76

agriadapt

Web app for physical climate risk tool.
JavaScript
1
star
77

policy-toolkit

Massively multitask fine tuning of roBERTa for policy priority identification in unstructured text
Jupyter Notebook
1
star
78

glad-data-management

Update GLAD sqlite database, CSV exports and country stats
Python
1
star
79

gfw-country-pages-analysis-2

Enrich GLAD and Fire data with contextual information in Hadoop, upload results to GFW API
Python
1
star
80

gfw-dockerfiles

GFW Dockerfiles
Dockerfile
1
star
81

template-public-documentation

Template for MkDocs-based public documentation, including the deployment pipeline to host on GitHub Pages using GitHub Actions.
Makefile
1
star
82

cities-climatehazards-warmingscenarios

Jupyter Notebook
1
star
83

landmark

JavaScript
1
star
84

cities-socio-economic-vulnerability

R
1
star
85

UrbanTreeCanopy

Jupyter Notebook
1
star
86

gfw-aws-core-infrastructure

Terraform module for GFW Core infrastructure on AWS
HCL
1
star
87

cities-indicators

Jupyter Notebook
1
star
88

basemaps

WRI Basemaps
CartoCSS
1
star
89

ocean-watch

The Ocean Watch open data platform delivers science to policy makers developing sustainable ocean economies and operationalizing integrated ocean management.
JavaScript
1
star
90

urban_extent

urban extents from built-up
Jupyter Notebook
1
star
91

Vetting_Retro_Analysis_Code

Code written in R to track the key factors in scoring that predicted applicant success
1
star
92

cities-thermal-comfort-modeling

Jupyter Notebook
1
star