• This repository has been archived on 10/Aug/2023
  • Stars
    star
    149
  • Rank 248,619 (Top 5 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created about 4 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

Field delineation with Sentinel-2 data from Sentinel-Hub and a ResUnet-a architecture.

NIVA - Automatic field delineation

This repo contains code to generate automatic contours for agricultural parcels, given Sentinel-2 images. This code has been used ot generate contours for Lithuania and the province of Castilla y Leon.

You can find more information about this project in the blog post Parcel Boundary Detection for CAP. The webinar walks through the software and how to use it.

Introduction

This sub-project is part of the "New IACS Vision in Actionโ€ --- NIVA project that delivers a suite of digital solutions, e-tools and good practices for e-governance and initiates an innovation ecosystem to support further development of IACS that will facilitate data and information flows.

This project has received funding from the European Unionโ€™s Horizon 2020 research and innovation programme under grant agreement No 842009.

Please visit the website for further information. A complete list of the sub-projects made available under the NIVA project can be found on gitlab

Requirements

The field delineation pipeline uses SentinelHub service to download Sentinel-2 imagery, in particular using the large-scale batch processing API. The batch processing allows to download images over large Areas of Interest in a very fast and efficient manner. The data is automatically stored in S3 buckets, which need to be adequately configured.

Installation

The fd Python 3.5+ package allows to execute the end-to-end field delineation workflow.

To install the fd package, clone locally the repository, and from within the repository, run the following commands:

pip install -r requirements.txt
python setup.py install --user

In addition, the field delineation workflow uses the following:

  • Docker containers;
  • psql PostgreSQL database;
  • gdal geospatial processing library, version >2.4.0.

The numbered notebooks showcase how to execute the end-to-end workflow.

AWS set-up

To run the notebooks, the bucket-name bucket permission need to be set-up, as described below.

bucket_name = "bucket-name"
aws_access_key_id = ""
aws_secret_access_key = ""
region = "eu-central-1"

Sentinel-Hub credentials

Sentinel-Hub credentials need to be added to the download notebook.

Input data

In order to execute the entire workflow, including training of the deep learning model, the following files are required:

  • file with geometry of the AOI (e.g. in GeoJSON format);
  • file with reference GSAA parcel boundaries (e.g. in ESRI Shapefile format);
  • the time-interval over which we want to estimate parcel boundaries. Predictions can be made for sub-intervals of this given time period (e.g. aggregation can be done over an arbitrary time interval as a post-processing step)

Content

This repository has the following content:

  • fd: modules implementing each part of the workflow;
  • input-data: folder storing the file defining the AOI and the consequent grid definition file;
  • notebooks: folder storing the example notebook to execute the end-to-end workflow.

End2End Execution

The field delineation workflow has been designed to scale to large AOIs, by downloading data quickly and efficiently, and by parallelizing execution of pipelines over the tiled data.

The End2End notebook showcases the entire procedure to reproduce the entire end-to-end workflow. The following steps are executed:

  • Data download: downloading the Sentinel-2 images (B-G-R-NIR) using Sentinel-Hub Batch API;
  • Conversion of tiffs to patches: converts the downloaded tiff files into EOPatches (see eo-learn), and computes cloud masks from cloud probabilities;
  • Vector to raster: adds reference vector data from a database to EOPatches and creates reference masks used for training of the model;
  • Patchlets sampling: sample EOPatches into smaller 256x256 patchlets for each cloud-free time-stamp. The sampling can be done for positive and negative examples separately;
  • Patchlets to npz files: the sampled patchlets are chunked and stored into multiple .npz files, allowing to efficiently access the data during training;
  • Create normalization stats: compute normalisation factors for the S2 bands (e.g. B-G-R-NIR) per month. These factors will be used to normalise the data before training and evaluation;
  • Patchlets split into k-folds: split patchlets into K-folds, allowing to perform a robust cross-validation of the models;
  • Train model from cached npz: train k-models, one for each left out fold. The ResUnet-a architecture implemented within eo-flow is used as model. A single model can be derived by averaging the weights of the k-fold models;
  • Predict eopatches: use the trained models to predict parcel boundary probabilities for the entire dataset;
  • Post process predictions: merge the predictions temporally and combine the predicted extent and boundary probabilities. A time interval can be specified over which the predictions are temporally aggregated;
  • Create vectors: vectorise the combined field delineation probabilities;
  • Utm zone merging: combine spatially vectors from multiple UTM zone if applicable.

More Repositories

1

eo-learn

Earth observation processing framework for machine learning in Python
Python
1,111
star
2

sentinelhub-py

Download and process satellite imagery in Python using Sentinel Hub services.
Python
804
star
3

custom-scripts

A repository of custom scripts to be used with Sentinel Hub
JavaScript
651
star
4

sentinel2-cloud-detector

Sentinel Hub Cloud Detector for Sentinel-2 images in Python
Python
422
star
5

eo-flow

Collection of TensorFlow 2.0 code for Earth Observation applications
Python
91
star
6

water-observatory-backend

Monitoring water levels of lakes and reservoirs using satellite imagery
Jupyter Notebook
79
star
7

EOBrowser

The Earth Observation Browser is a search tool for Sentinel-1, -2, -3, Landsat 5, 7, 8, Modis and Envisat satellite imagery
JavaScript
78
star
8

SentinelPlayground

Simple application for using Sentinel-2 WMS service
JavaScript
73
star
9

multi-temporal-super-resolution

Multi-temporal Super-Resolution on Sentinel-2 Imagery using Deimos
Jupyter Notebook
57
star
10

time-lapse

Python scripts for creating time lapse videos and gifs from Sentinel-2 images
Jupyter Notebook
55
star
11

sentinelhub-js

Download and process satellite imagery in JavaScript or TypeScript using Sentinel Hub services.
TypeScript
52
star
12

eo-learn-workshop

Bridging Earth Observation data and Machine Learning in Python
Jupyter Notebook
42
star
13

sentinelhub-qgis-plugin

QGIS Plugin for Sentinel Hub
Python
37
star
14

eo-grow

Earth observation framework for scaled-up processing in Python
Python
37
star
15

eo-learn-examples

Examples of Earth observation workflows that extract valuable information from satellite imagery, giving you hints and ideas how to use the EO data.
Jupyter Notebook
36
star
16

natural-color

Natural color representation of Sentinel-2 data
JavaScript
29
star
17

water-observatory-frontend

Frontend React app for https://water.blue-dot-observatory.com/
JavaScript
27
star
18

collections

Repository with information about openly available collections
JavaScript
26
star
19

example-notebooks

Miscellaneous notebooks to use with Sentinel Hub
Jupyter Notebook
18
star
20

education

Worked out examples for common eo topics, meant to facilitate learning and encourage curiosity.
Jupyter Notebook
16
star
21

hiector

A Python package for hierarchical building detection developed under Query Planet CCN3
Python
13
star
22

code-snippets

Jupyter Notebook
12
star
23

byoc-tool

Tool that prepares your data for use in Sentinel Hub
Java
7
star
24

cv4a-iclr-2020-starter-notebooks

Starter notebooks using eo-learn for the CV4A workshop at ICLR 2020
Jupyter Notebook
6
star
25

pin-library

HTML
5
star
26

classification-app-frontend

JavaScript
5
star
27

global-timelapse

Interact with our planet and observe global-level data in the form of different layers
JavaScript
4
star
28

odc-sh

Sentinel plugin for Open data cube https://www.opendatacube.org/
Jupyter Notebook
3
star
29

classification-app-backend

Code to reproduce the back-end service for ClassificationApp
Python
3
star
30

requests-builder

JavaScript
2
star
31

digital-twin-of-news

Jupyter Notebook
2
star
32

eo-grow-examples

Earth Observation framework for scaled-up processing `eo-grow` in action.
Jupyter Notebook
2
star
33

bids-cdse-jupyter

Workshop content for using Jupyter Notebooks on the Copernicus Data Space Ecosystem. Workshop held at the Big Data from Space 2023 conference.
Jupyter Notebook
2
star
34

sentinel-hub-code-editor

JavaScript
1
star
35

stac-ml-example

A repository demonstrating an example ML workflow with the usage of STAC
Jupyter Notebook
1
star