Home

Awesome

ServiceNow completed its acquisition of Element AI on January 8, 2021. All references to Element AI in the materials that are part of this project should refer to ServiceNow.

Seasonal Contrast: Unsupervised Pre-Training from Uncurated Remote Sensing Data

diagram

This is the official PyTorch implementation of the SeCo paper:

@article{manas2021seasonal,
  title={Seasonal Contrast: Unsupervised Pre-Training from Uncurated Remote Sensing Data},
  author={Ma{\~n}as, Oscar and Lacoste, Alexandre and Giro-i-Nieto, Xavier and Vazquez, David and Rodriguez, Pau},
  journal={arXiv preprint arXiv:2103.16607},
  year={2021}
}

Preparation

Install Python dependencies by running:

pip install -r requirements.txt

Data Collection

First, obtain Earth Engine authentication credentials by following the installation instructions.

Then, to collect and download a new SeCo dataset from a random set of Earth locations, run:

python datasets/seco_downloader.py \
  --save_path [folder where data will be downloaded] \
  --num_locations 200000

Unsupervised Pre-training

To do unsupervised pre-training of a ResNet-18 model on the SeCo dataset, run:

python main_pretrain.py \
  --data_dir datasets/seco_1m --data_mode seco \
  --base_encoder resnet18

Transferring to Downstream Tasks

With a pre-trained SeCo model, to train a supervised linear classifier on 10% of the BigEarthNet training set in a 4-GPU machine, run:

python main_bigearthnet.py \
  --gpus 4 --accelerator dp --batch_size 1024 \
  --data_dir datasets/bigearthnet --train_frac 0.1 \
  --backbone_type pretrain --ckpt_path checkpoints/seco_resnet18_1m.ckpt \
  --freeze_backbone --learning_rate 1e-3

To train a supervised linear classifier on EuroSAT from a pre-trained SeCo model, run:

python main_eurosat.py \
  --data_dir datasets/eurosat \
  --backbone_type pretrain --ckpt_path checkpoints/seco_resnet18_1m.ckpt

To train a supervised change detection model on OSCD from a pre-trained SeCo model, run:

python main_oscd.py \
  --data_dir datasets/oscd \
  --backbone_type pretrain --ckpt_path checkpoints/seco_resnet18_1m.ckpt

Datasets

Our collected SeCo datasets can be downloaded as following:

#imagesRGB previewsizelinkmd5
100K7.3 GBdownloadebf2d5e03adc6e657f9a69a20ad863e0
~1M36.3 GBdownload187963d852d4d3ce6637743ec3a4bd9e

Pre-trained Models

Our pre-trained SeCo models can be downloaded as following:

datasetarchitecturelinkmd5
SeCo-100KResNet-18downloaddcf336be31f6c6b0e77dcb6cc958fca8
SeCo-1MResNet-18download53d5c41d0f479bdfd31d6746ad4126db
SeCo-100KResNet-50download9672c303f6334ef816494c13b9d05753
SeCo-1MResNet-50download7b09c54aed33c0c988b425c54f4ef948