GithubHelp home page GithubHelp logo

alkiskk / crop-type-mapping Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marccoru/crop-type-mapping

0.0 0.0 0.0 35.1 MB

Source code to Rußwurm & Körner 2019. Self-Attention for Raw Optical Satellite Time Series Classification

License: MIT License

Dockerfile 0.01% Shell 0.08% Jupyter Notebook 98.54% Python 1.37%

crop-type-mapping's Introduction

Self-Attention for Raw Optical Satellite Time Series Classification

Feature extraction through self-attention on Raw Sentinel 2 Time Series First-Layer Attention Heads

Source Code of Rußwurm & Körner (2019), Self-Attention for Raw Optical Satellite Time Series Classification

@article{russwurm2020,
title = "Self-attention for raw optical Satellite Time Series Classification",
journal = "ISPRS Journal of Photogrammetry and Remote Sensing",
volume = "169",
pages = "421 - 435",
year = "2020",
issn = "0924-2716",
doi = "https://doi.org/10.1016/j.isprsjprs.2020.06.006",
url = "http://www.sciencedirect.com/science/article/pii/S0924271620301647",
author = "Marc Rußwurm and Marco Körner",
}

Architectures

Models

Four deep learning models for time series classification are implemented

  • Recurrent Neural Net (LSTM) src/models/rnn.py
  • Transformer src/models/transformerEncoder.py
  • TempCNN (Pelleter et al., 2019) src/models/tempcnn.py
  • Multi-scale ResNet src/models/msresnet.py

Getting started

Python Dependencies

Anaconda environment

conda create -n crop-type-mapping python=3.7.3 pip
conda activate crop-type-mapping
pip install -r requirements.txt

Download Dataset, Tuning Results and Models

download raw Sentinel 2 crop type label dataset to data/BavarianCrops via

bash download.sh dataset

and the pretrained models for hyperparameter tuning and evaluation via

bash download.sh models

or both with bash download.sh all

Experiments are composed of a set of parameters that define model and datasets. Experiments are defined in the if-else cases in src/experiments.py and generally follow the naming convention isprs_<model>_<dataset>_<meta>.

Training

start visdom server by running visdom in conda environment and open http://localhost:8097/ in the browser.

train from scratch (23 classes) with hyperparameters defined in ../models/tune/23classes/transformer_tum.csv. Working directory is src

python train.py --experiment isprs_tum_transformer \
    --store /tmp/ \
    --classmapping ../data/BavarianCrops/classmapping23.csv \
    --hyperparameterfolder ../models/tune/23classes

to continue training with 23 classes point --store to an existing model

python train.py --experiment isprs_tum_transformer \
    --store ../models/train/23classes/0 \
    --classmapping ../data/BavarianCrops/classmapping23.csv \
    --hyperparameterfolder ../models/tune/23classes

experiments on raw dataset: isprs_tum_transformer, isprs_tum_msresnet, isprs_tum_tempcnn, isprs_tum_rnn

classmappings: mapping tables to select 12 or 23 classes to classify

hyperparameter folder: folder with results of ray-tune results implemented in tune.py. hyperparameters summarized in csv files for model and dataset, as defined in src/hyperparameters.py

Hyperparameter Tuning

Ray-Tune allows hyperparameter tuning of multiple models in parallel. Execute in src

python tune.py --experiment transformer_tum \
    -g 0.5 -c 2 -b 64 --local_dir ../models/tune --seed 0 \
    --classmapping $PWD/../data/BavarianCrops/classmapping23.csv \
    --dataroot $PWD/../data

to train two models per GPU and store results in ../models/tune. Valid experiments are [transformer|rnn|msresnet|tempcnn]_[tum|gaf] which are defined in src/hyperparameter.py

External Code

https://github.com/jadore801120/attention-is-all-you-need-pytorch

  • Multi-scale ResNet implementation by Fei Wang

https://github.com/geekfeiw/Multi-Scale-1D-ResNet

https://github.com/charlotte-pel/igarss2019-dl4sits

crop-type-mapping's People

Contributors

marccoru avatar rtavenar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.