Home

Awesome

RSSC-transfer

Repository with the source code and pre-trained models for the paper Do we still need ImageNet pre-training in remote sensing scene classification?.

Datasets

Dataset splits can be downloaded at https://drive.google.com/drive/folders/1utNOUsQP3bWd-36jwVz9gQ-QZRQKhfvq?usp=sharing. The filenames contain the dataset name and proportion of training images. For example, MLRSNet80-split.pkl is the MLRSNet split with 80% training and 20% test images.

Models

The pre-trained models can be downloaded at: https://drive.google.com/drive/folders/1kMpZEPKs7S8XlNMKK-A7fe8_O_SzlMi3?usp=sharing

Models in scratch are trained from scratch on HRRS datasets, models in imagenet are pre-trained on ImageNet-1k and fine-tuned on HRRS datasets, and in ssl are the original SwAV model as well as the models fine-tuned on HRRS datasets.

Installation

Download the data splits from https://drive.google.com/drive/folders/1utNOUsQP3bWd-36jwVz9gQ-QZRQKhfvq?usp=sharing and put them into data_splits directory.

Download the pre-trained models from https://drive.google.com/drive/folders/1kMpZEPKs7S8XlNMKK-A7fe8_O_SzlMi3?usp=sharing and put them into models directory.

Training/Fine-tuning

To train/fine-tune a ResNet50 model on a single-label dataset use:

python train.py --path /path/to/dataset/ \
                --data-split DATASET_SPLIT \
                 --name MODEL_NAME 
                 --lr MAXIMAL_LR 
                 [--model imagenet|/path/to/model]
                 [--batch-size BATCH_SIZE]

To train/fine-tune a ResNet50 model on a multi-label dataset use:

python train_multilabel.py --path /path/to/dataset/ \
                           --data-split DATASET_SPLIT \
                           --name MODEL_NAME \
                           --lr MAXIMAL_LR \
                           [--model imagenet|/path/to/model]
                           [--batch-size BATCH_SIZE]

Flags:

Feature extraction

To run feature extraction on a single-label dataset use:

python extract_features.py --path /path/to/dataset/ \
                           --data-split DATASET_SPLIT \
                           --features /path/to/features/ \
                           --model imagenet|/path/to/model

To run feature extraction on a multi-label dataset use:

python extract_features_multilabel.py --path /path/to/dataset/ \
                                      --data-split DATASET_SPLIT \
                                      --features /path/to/features/ \ 
                                      --model imagenet|/path/to/model

Flags:

Linear classifier

To train a linear classifier on extracted features use:

python classify.py /path/to/features/

for single-label tasks, or

python classify_multilabel.py /path/to/features/

for multi-label tasks.

Citation

If you find this repository useful in your research, please cite:

@Article{isprs-archives-XLIII-B3-2022-1399-2022,
AUTHOR = {Risojevi\'c, V. and Stojni\'c, V.},
TITLE = {DO WE STILL NEED IMAGENET PRE-TRAINING IN REMOTE SENSING SCENE CLASSIFICATION?},
JOURNAL = {The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences},
VOLUME = {XLIII-B3-2022},
YEAR = {2022},
PAGES = {1399--1406},
URL = {https://www.int-arch-photogramm-remote-sens-spatial-inf-sci.net/XLIII-B3-2022/1399/2022/},
DOI = {10.5194/isprs-archives-XLIII-B3-2022-1399-2022}
}