Skip to content

Draft: (early draft) Sentinel2 upsampling with deep learning

Hugo Trentesaux requested to merge issue#214-upsampling into develop

This branch takes the prototyping done in issue#214/s2_deep_upsampling and applies the refactoring of issue#474-refac-preprocess-date and the integration work done in issue#214-upsampling-new. It has a ~clean commit history. To use deep learning upsampling, add a section in your config file:

Sentinel_2:
{
    deep_learning_upsampling: {
        remove_models: False
        hyperparameters: {
            use_mask: True
            sample_count: 3000
            patch_size: [32, 32]
            patch_shape_10: 90
            patch_shape_20: 45
            batch_size: 64
            scratch_epochs: 50
            fine_tuning_epochs: 25
        }
    }
}

There is tensorflow-gpu and pydantic as an additional dependency.

The output tree located at s2_output_path will look like

S2_upsampled/
└── T31TCJ
    ├── SENTINEL2A_20180511-105804-037_L2A_T31TCJ_D_V1-7
    │   ├── dlupsample
    │   │   └── checkpoints
    │   │       ├── ckpt_001.h5
    │   │       ├── ckpt_002.h5
    │   │       ├── ...
    │   │       ├── ckpt_049.h5
    │   │       └── ckpt_050.h5
    │   ├── MASKS
    │   │   ├── SENTINEL2A_20180511-105804-037_L2A_T31TCJ_D_V1-7_BINARY_MASK.tif
    │   │   └── SENTINEL2A_20180511-105804-037_L2A_T31TCJ_D_V1-7_EDG_R1.tif
    │   ├── SENTINEL2A_20180511-105804-037_L2A_T31TCJ_D_V1-7_FRE_STACK_params.json
    │   ├── SENTINEL2A_20180511-105804-037_L2A_T31TCJ_D_V1-7_FRE_STACK.tif
    │   └── stats
    │       ├── S2_10m_stats.xml
    │       └── S2_20m_stats.xml
    └── SENTINEL2A_20180521-105702-711_L2A_T31TCJ_D_V1-7
        ├── dlupsample
        │   └── checkpoints
        │       ├── ckpt_051.h5
        │       ├── ...
        │       └── ckpt_075.h5
        ├── MASKS
        │   ├── SENTINEL2A_20180521-105702-711_L2A_T31TCJ_D_V1-7_BINARY_MASK.tif
        │   └── SENTINEL2A_20180521-105702-711_L2A_T31TCJ_D_V1-7_EDG_R1.tif
        ├── SENTINEL2A_20180521-105702-711_L2A_T31TCJ_D_V1-7_FRE_STACK_params.json
        ├── SENTINEL2A_20180521-105702-711_L2A_T31TCJ_D_V1-7_FRE_STACK.tif
        └── stats
            ├── S2_10m_stats.xml
            └── S2_20m_stats.xml

The .json files allow to keep track of the hyperparameters used to produce the stacks.

closes #474
closes #214

Edited by Hugo Trentesaux

Merge request reports