
Analyzing Sentinel-2 satellite data in Python with TensorFlow.Keras
Overview about state-of-the-art land-use classification from satellite data
with CNNs based on an open dataset
Outline
Scripts you will find here
01_split_data_to_train_and_validation.py: split complete dataset into train
and validation
02_train_rgb_finetuning.py: train VGG16 or DenseNet201 using RGB data with
pre-trained weights on ImageNet
03_train_rgb_from_scratch.py: train VGG16 or DenseNet201 from scratch using
RGB data
04_train_ms_finetuning.py: train VGG16 or DenseNet201 using multispectral
data with pre-trained weights on ImageNet
04_train_ms_finetuning_alternative.py: an alternative way to train VGG16 or
DenseNet201 using multispectral data with pre-trained weights on ImageNet
05_train_ms_from_scratch.py: train VGG16 or DenseNet201 from scratch using
multispectral data
06_classify_image.py: a simple implementation to classify images with
trained models
image_functions.py: functions for image normalization and a simple
generator for training data augmentation
statistics.py: a simple implementation to calculate normalization
parameters (i.e. mean and std of training data)
Additionally you will find the following notebooks:
Image_functions.ipynb: notebook of image_functions.py
Train_from_Scratch.ipynb: notebook of 05_train_ms_from_scratch.py
Transfer_learning.ipynb: notebook of 02_train_rgb_finetuning.py
Requirements (what we used)
We have defined the requirements in requirements.txt.
We used:
- python 3.6.x
- tensorflow 2.2
- scikit-image (0.14.1)
- gdal (2.2.4) for
06_classify_image.py
Frequently asked questions (FAQs)
- How can I interpret the classification results? - Please have a look at our answers
#3,
#4, and
#6.
- Is there a paper I can cite for this repository? - Please have a look at Citation
Setup environment
Append conda-forge to your Anaconda channels:
conda config --append channels conda-forge
Create new environment:
conda create -n pycon scikit-image gdal tqdm
conda activate pycon
pip install tensorflow-gpu
pip install keras
(or use tensorflow version of keras, i.e. from tensorflow import keras)
See also:
Our talks about this topic
Podcast episode @ TechTiefen
- Title: "Fernerkundung mit multispektralen Satellitenbildern"
- Episode: Episode 18
- Podcast: TechTiefen by Nico Kreiling
- Language: German (Deutsch)
- Date: July 2019
M3 Minds mastering machines 2019 @ Mannheim
- Title: "Satellite Computer Vision mit Keras und Tensorflow - Best practices und beispiele aus der Forschung"
- Slides: Slides
- Language: German (Deutsch)
- Date: 15 - 16 May 2019
- DOI:

- URL: m3-konferenz.de
PyCon.DE 2018 @ Karlsruhe
Resources
This talk:
- EuroSAT Data (Sentinel-2, Link)
Platforms for datasets:
- HyperLabelMe: a Web Platform for Benchmarking Remote Sensing Image Classifiers (Link)
- GRSS Data and Algorithm Standard Evaluation (DASE) website (Link)
Datasets:
- ISPRS 2D labeling challenge (Link)
- UC Merced Land Use Dataset (Link)
- AID: A Benchmark Dataset for Performance Evaluation of Aerial Scene Classification (Link)
- NWPU-RESISC45 (RGB, Link)
- Zurich Summer Dataset (RGB, Link)
- Note: Many German state authorities offer free geodata (high resolution images, land use/cover vector data, ...) over their geoportals. You can find an overview of all geoportals here (geoportals)
Image Segmentation Resources:
- More than 100 combinations for image segmentation routines with Keras and pretrained weights for endcoding phase (Segmentation Models)
- Another source for image segmentation with Keras including pretrained weights (Keras-FCN)
- Great link collection of image segmantation networks and datasets (Link)
- Free land use vector data of NRW (BasisDLM or openNRW)
Other:
How to get Sentinel-2 data
- Register at Copernicus Open Access Hub or EarthExplorer
- Find your region
- Choose tile(s) (→ area) and date
- Less tiles makes things easier
- Less clouds in the image are better
- Consider multiple dates for classes like “annual crop”
- Download L1C data
- Decide of you want to apply L2A atmospheric corrections
- Your CNN might be able to do this by itself
- If you want to correct, use Sen2Cor
- Have fun with the data
Citation
Jens Leitloff and Felix M. Riese, "Examples for CNN training and classification on Sentinel-2 data", Zenodo, 10.5281/zenodo.3268451, 2018.
@misc{leitloff2018examples,
author = {Leitloff, Jens and Riese, Felix~M.},
title = {{Examples for CNN training and classification on Sentinel-2 data}},
year = {2018},
DOI = {10.5281/zenodo.3268451},
publisher = {Zenodo},
howpublished = {\href{http://doi.org/10.5281/zenodo.3268451}{http://doi.org/10.5281/zenodo.3268451}}
}