Automatic field delineation
Generate automatic contours for agricultural parcels, given Sentinel-2 images.
https://github.com/sentinel-hub/field-delineation
Keywords from Contributors
sentinel-hub ogc-services eo-data eo-research
Last synced: over 1 year ago
JSON representation
Acceptance Criteria
- Revelant topics? false
- External users? true
- Open source license? true
- Active? false
- Fork? false
Repository metadata
Field delineation with Sentinel-2 data from Sentinel-Hub and a ResUnet-a architecture.
- Host: GitHub
- URL: https://github.com/sentinel-hub/field-delineation
- Owner: sentinel-hub
- License: mit
- Archived: true
- Created: 2020-10-20T08:19:28.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-08-10T08:47:27.000Z (over 1 year ago)
- Last Synced: 2024-01-20T00:04:08.808Z (over 1 year ago)
- Language: Jupyter Notebook
- Size: 20.9 MB
- Stars: 140
- Watchers: 14
- Forks: 48
- Open Issues: 0
- Releases: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
⚠️ THIS REPOSITORY IS ARCHIVED. ⚠️
As the repository is not maintained, we are archiving it. The code works with the fixed versions of the packages in the requirements.txt
file. You can also make use of the paid Field Delineation service on EuroDataCube or contact us directly for large orders at eoresearch [at] sinergise.com
.
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;
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
GPKG
format (or similar)); - 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 intoEOPatches
(seeeo-learn
),
and computes cloud masks from cloud probabilities;Vector to raster
: adds reference vector data from a database toEOPatches
and creates reference masks used
for training of the model;Patchlets sampling
: sampleEOPatches
into smaller256x256
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. TheResUnet-a
architecture
implemented withineo-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.
Owner metadata
- Name: Sentinel Hub
- Login: sentinel-hub
- Email: [email protected]
- Kind: organization
- Description: Sentinel Hub services by Sinergise
- Website: https://www.sentinel-hub.com
- Location:
- Twitter: sentinel_hub
- Company:
- Icon url: https://avatars.githubusercontent.com/u/31830596?v=4
- Repositories: 26
- Last ynced at: 2023-02-26T04:28:17.065Z
- Profile URL: https://github.com/sentinel-hub
GitHub Events
Total
- Issues event: 26
- Watch event: 112
- Delete event: 1
- Issue comment event: 62
- Push event: 16
- Pull request review event: 5
- Pull request review comment event: 5
- Pull request event: 9
- Fork event: 41
- Create event: 4
Last Year
- Fork event: 9
- Issue comment event: 11
- Issues event: 13
- Pull request event: 3
- Push event: 6
- Watch event: 34
Committers metadata
Last synced: over 1 year ago
Total Commits: 28
Total Committers: 7
Avg Commits per committer: 4.0
Development Distribution Score (DDS): 0.679
Commits in past year: 7
Committers in past year: 4
Avg Commits per committer in past year: 1.75
Development Distribution Score (DDS) in past year: 0.571
Name | Commits | |
---|---|---|
Matej BatiÄŤ | m****c@s****m | 9 |
Devis Peressutti | d****i@s****m | 6 |
Ubuntu | u****u@i****l | 5 |
Nejc Vesel | n****l@s****m | 3 |
samshal | s****3@g****m | 2 |
Nejc Vesel | n****l@g****m | 2 |
gmilcinski | g****i@s****m | 1 |
Committer domains:
Issue and Pull Request metadata
Last synced: over 1 year ago
Total issues: 18
Total pull requests: 6
Average time to close issues: 6 months
Average time to close pull requests: 5 months
Total issue authors: 13
Total pull request authors: 3
Average comments per issue: 4.67
Average comments per pull request: 1.17
Merged pull request: 5
Bot issues: 0
Bot pull requests: 0
Past year issues: 4
Past year pull requests: 1
Past year average time to close issues: about 2 months
Past year average time to close pull requests: 8 days
Past year issue authors: 3
Past year pull request authors: 1
Past year average comments per issue: 1.25
Past year average comments per pull request: 2.0
Past year merged pull request: 1
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- SFrav (5)
- pganot2 (2)
- aidos2 (1)
- bumie-e (1)
- chase-dwelle (1)
- hukelin (1)
- LucaScalam (1)
- mustafateke (1)
- sen-pai (1)
- spaceie07 (1)
- spaceie08 (1)
- Spiruel (1)
- tiago-lam (1)
Top Pull Request Authors
- devisperessutti (3)
- veseln (2)
- Samshal (1)
Top Issue Labels
- bug (1)
Top Pull Request Labels
Dependencies
- boto3 *
- dataclasses *
- eo-learn ==0.10.2
- fs *
- geopandas >=0.8.1
- ipywidgets *
- lxml *
- matplotlib *
- numpy *
- pandarallel *
- pandas *
- psycopg2 *
- pyproj *
- python-dateutil *
- rasterio *
- s2cloudless *
- scikit-image *
- scikit-learn *
- scipy *
- sentinelhub *
- setuptools *
- shapely *
- tensorflow *
- tqdm *
- wandb *
Score: 6.887552571664617