Skip to content

Repository files navigation

Harnessing Massive Satellite Imagery with Efficient Masked Image Modeling

Fengxiang Wang1 Hongzhen Wang2,‡ Di Wang3 Zonghao Guo2
Zhenyu Zhong4 Long Lan1,‡ Wenjing Yang1,‡ Jing Zhang3,‡
1 National University of Defense Technology 2Tsinghua University
3Wuhan University 4Nankai University

ICCV 2025

📃 Paper | 🤗 OpticalRS-4M | 🤗 OpticalRS-13M | 🤗 Models

🎯Intruduction

  • Dataset: OpticalRS-13M is a large-scale remote sensing dataset. This dataset, comprising 13 million optical images, is designed to fully leverage the representation learning capabilities of MIM methods in RS applications, distinguished by its diverse scene details. We also offer a light version, named OpticalRS-4M.
  • SelectiveMAE: A novel and efficient MIM method tailored for remote sensing images. This method incorporates a new PSTS module, which significantly accelerates convergence and enhances representation learning compared to the original MIM approach.

✅ To do List

  • Initial release of checkpoint of SelectiveMAE.
  • Pretraining codes and configs for SelectiveMAE have be released.
  • OpticalRS-4M dataset has be released.
  • OpticalRS-13M dataset will be released.
  • Codes and configs for downstream tasks of Scene Classification.
  • Codes and configs for downstream tasks of Object Detection and Semantic Segmentation.

🔥 News

  • 2025.08 : The object detection and semantic segmentation codes have been released.
  • 2025.07 : The classification codes have been released.
  • 2025.06 : SelectiveMAE has been accepted by ICCV2025.
  • 2025.06 : OpticalRS-13M has been released on 🤗HuggingFace.
  • 2025.06 : Models have been released on 🤗HuggingFace.
  • 2025.06 : OpticalRS-4M has been released on 🤗HuggingFace.
  • 2025.06 : The pretraining codes of the SelectiveMAE have been released.
  • 2024.06 : Paper has been released on arxiv.
  • 2024.06 : The training logs and checkpoints of the SelectiveMAE have been released.

📚 Contents

🚀OpticalRS-4M

Usage

OpticalRS-4M available on 🤗HuggingFace via OpticalRS-4M.

Use the following command to unzip:

# if 7z is available
7z x OpticalRS-4M.zip
# if zip and unzip is available
zip -s 0 OpticalRS-4M.zip --out whole.zip
unzip whole.zip

Experiments on OpticalRS-4M

OpticalRS-4M offers a significantly larger and more diverse image set compared to previous datasets. To evaluate its effectiveness, we pre-train a ViT-Base model using the vanilla MAE method. For comparison, we use the MillionAID dataset, maintaining an equal number of data points during training: 800 epochs for MillionAID's 1 million images and 200 epochs for our OpticalRS-4M dataset.

DatasetPretrained modelImages NumberEpochSence ClassificationSence ClassificationObject DetectionObject DetectionSemantic SegmentationSemantic Segmentation
AIDRESISC-45DIORDIOR-RLoveDASpaceNetv1
OA (TR=20%/50%)OA (TR=20%/50%)mAP50mAP50mIoUmF1
MillionAIDWeights1 million80094.92/97.3889.20/93.6071.8062.3351.2479.24
OpticalRS-4MWeights2 million40096.64/98.1091.80/94.3173.9065.9552.8679.37
OpticalRS-4MWeights3 million26796.67/98.1892.24/94.4175.4067.0752.3979.37
OpticalRS-4MWeights4 million20096.10/98.0392.38/94.3074.7066.2652.7579.23
OpticalRS-4MWeights4 million80096.88/98.2292.44/94.4375.4067.3552.8079.41

🚀OpticalRS-13M

OpticalRS-13M available on 🤗HuggingFace via OpticalRS-13M. Follow OpticalRS-4M to unzip.

🚀SelectiveMAE

⚙️ Installation for Pretraining

Please install the pretraining dependencies in SelectiveMAE/requirements.txt:

# Optionally create a conda environment
conda create -n selectivemae python=3.10 -y
conda activate selectivemae
# Install dependencies
pip install -r requirements.txt

🚙 Pretraining for SelectiveMAE

To pre-train ViT-Base, run the following on 8 GPUs:

torchrun --nproc_per_node=8 --nnodes 1 --master_port 16666 main_pretrain.py --batch_size 256 --selectivemae --dataset opticalrs-4m --dataset_path 'your_dataset_path' --model mae_vit_base_patch16 --output_dir output --norm_pix_loss --blr 1.5e-4 --weight_decay 0.05 --num_workers 12 --decoder_depth 12 --mask_ratio 0.85 --kept_mask_ratio 0.25 --epochs 800 --warmup_epochs 30

First, download the corresponding dataset, then set opticalrs-4m or opticalrs-13m, and update the dataset path accordingly. To train ViT-Small or ViT-Large, set --model mae_vit_small_patch16 or --model mae_vit_large_patch16. You can use --accum_iter to perform gradient accumulation if your hardware could not fit the batch size. FlashAttention 2 should be installed with pip install flash-attn --no-build-isolation.

🚀 Results on downstream tasks

ModelPublicationBackboneSence ClassificationSence ClassificationObject DetectionObject DetectionSemantic SegmentationSemantic Segmentation
AIDRESISC-45DIORDIOR-RLoveDASpaceNetv1
OA (TR=20%/50%)OA (TR=20%/50%)mAP50mAP50mIoUmF1
SeCoICCV'21ResNet-5093.47/95.9989.64/92.91--43.6377.09
GASSLICCV'21ResNet-5093.55/95.9290.86/93.0667.4065.6548.7678.51
TOVJSTARS'23ResNet-5095.16/97.0990.97/93.7970.1666.3349.70-
CACoCVPR'23ResNet-5090.88/95.0588.28/91.9466.9164.1048.8977.94
SatMAENIPS'22ViT-L95.02/96.9491.72/94.1070.8965.66-78.07
ScaleMAEICCV'23ViT-L96.44/97.5892.63/95.0473.8166.47--
SSL4EOGRSM'23ViT-S91.06/94.7487.60/91.2764.8261.23--
RingMoTGRS'22Swin-B96.90/98.3494.25/95.6775.90---
SatLasICCV'23Swin-B94.96/97.3892.16/94.7074.1067.59--
GFMICCV'23Swin-B95.47/97.0992.73/94.6472.8467.67--
RVSATGRS'23ViT-B+RVSA97.03/98.5093.93/95.6975.8068.0651.95-
SelectiveMAE(OpticalRS-4M)Baidu & HuggingFaceViT-B96.90/98.1293.35/94.5875.7067.7853.0579.50
SelectiveMAE(OpticalRS-4M)Baidu & HuggingFaceViT-L97.25/98.4894.57/95.7777.8070.3154.3179.46
SelectiveMAE(OpticalRS-13M)Baidu & HuggingFaceViT-B97.10/98.2893.70/95.4875.8067.6952.6879.44
SelectiveMAE(OpticalRS-13M)Baidu & HuggingFaceViT-L97.49/98.5294.73/96.3678.7071.7553.9279.48

🚀Classification

We evaluate the pretrained weights of SelectiveMAE on the AID and NWPU datasets using different training ratios. We have released configuration files for different datasets under the Classification folder. Please use the files in the Classification/AID and Classification/NWPU-RESISC45 subfolders to run the experiments with different training ratio (TR) settings for the respective datasets.

The classification experiments can be completed on a single GPU, run the following:

torchrun --nproc_per_node=1 --nnodes 1 --master_port 1888 \
--dataset 'aid' --model 'vit_base_patch16' --postfix 'sota' \
--batch_size 1024 --epochs 100 --warmup_epochs 5 \
--blr 1e-3 --weight_decay 0.05 --split 19 --tag 0 --exp_num 1 \
--data_path 'your_dataset_path' \
--finetune 'your_checkpoint.pth'

The --split can be changed to your setting, like 19/28/55.

🎁Object Detection & Semantic Segmentation

Horizontal Object Detection (using MMDetection)

Training on DIOR using Faster-RCNN with a backbone network of SelectiveMAE pretrained ViT-L:

srun -J mmdet -p gpu --gres=dcu:4 --ntasks=4 --ntasks-per-node=4 --cpus-per-task=8 --kill-on-bad-exit=1 \
python -u tools/train.py configs/wfx/vit-l-frcn-800-proposed-dior.py \
--work-dir=/diwang/work_dir/wfx_iccv/finetune/dior/vit-l-frcn-800-proposed-dior \
--launcher="slurm"

Then testing and generating dection results:

srun -J mmdet -p gpu --gres=dcu:4 --ntasks=4 --ntasks-per-node=4 --cpus-per-task=8 --kill-on-bad-exit=1 \
python -u tools/test.py configs/wfx/vit-l-frcn-800-proposed-dior.py \
/diwang/work_dir/wfx_iccv/finetune/dior/vit-l-frcn-800-proposed-dior/epoch_12.pth \
--work-dir=/diwang/work_dir/wfx_iccv/finetune/dior/vit-l-frcn-800-proposed-dior/predict \
--show-dir=/diwang/work_dir/wfx_iccv/finetune/dior/vit-l-frcn-800-proposed-dior/predict/show \
--launcher="slurm" --cfg-options val_cfg=None val_dataloader=None val_evaluator=None

Rotated Object Detection (using MMRotate)

(Using MMRotate 1.0.0rc1) Training on DIOR-R using Oriented-RCNN with a backbone network of SelectiveMAE pretrained ViT-L:

srun -J mmrot -p gpu --gres=dcu:4 --ntasks=4 --ntasks-per-node=4 --cpus-per-task=8 --kill-on-bad-exit=1 \
python -u tools/train.py configs/wfx/vit-l-orcn-800-proposed-diorr.py \
--work-dir=/diwang/work_dir/wfx_iccv/finetune/diorr/vit-l-orcn-800-proposed-diorr \
--launcher="slurm"

(Using MMRotate 1.0.0rc1) Testing on DIOR-R for evaluation and visualizing detection maps.

srun -J mmrot -p gpu --gres=dcu:4 --ntasks=4 --ntasks-per-node=4 --cpus-per-task=8 --kill-on-bad-exit=1 \
python -u tools/test.py configs/wfx/vit-l-orcn-800-proposed-diorr.py \
/diwang/work_dir/wfx_iccv/finetune/diorr/vit-l-orcn-800-proposed-diorr/epoch_12.pth \
--work-dir=/diwang/work_dir/wfx_iccv/finetune/diorr/vit-l-orcn-800-proposed-diorr/predict \
--show-dir=/diwang/work_dir/wfx_iccv/finetune/diorr/vit-l-orcn-800-proposed-diorr/predict/show \
--launcher="slurm" --cfg-options val_cfg=None val_dataloader=None val_evaluator=None

Semantic Segmentation (using MMSegmentation)

Training on SpaceNetv1 using UperNet with a backbone network of SelectiveMAE pretrained ViT-L:

srun -J mmseg -p gpu --gres=dcu:4 --ntasks=8 --ntasks-per-node=4 --cpus-per-task=8 --kill-on-bad-exit=1 \
python -u tools/train.py configs/wfx/vit-l-upernet-384-proposed-spacenetv1.py \
--work-dir=/diwang/work_dir/wfx_iccv/finetune/spacenetv1/vit-l-upernet-384-proposed-spacenetv1 \
--launcher="slurm" --cfg-options 'find_unused_parameters'=True

Testing on SpaceNetv1 for accuracy evaluation and generating prediction maps:

srun -J mmseg -p gpu --gres=dcu:4 --ntasks=8 --ntasks-per-node=4 --cpus-per-task=8 --kill-on-bad-exit=1 \
python -u tools/test.py configs/wfx/vit-l-upernet-384-proposed-spacenetv1.py \
/diwang/work_dir/wfx_iccv/finetune/spacenetv1/vit-l-upernet-384-proposed-spacenetv1/iter_80000.pth \
--work-dir=/diwang/work_dir/wfx_iccv/finetune/spacenetv1/vit-l-upernet-384-proposed-spacenetv1/predict \
--show-dir=/diwang/work_dir/wfx_iccv/finetune/spacenetv1/vit-l-upernet-384-proposed-spacenetv1/predict/show \
--launcher="slurm" --cfg-options val_cfg=None val_dataloader=None val_evaluator=None

Online Evaluation: Testing on LoveDA for submittting online evaluation results and generating prediction maps:

srun -J mmseg -p gpu --gres=dcu:4 --ntasks=4 --ntasks-per-node=4 --cpus-per-task=8 --kill-on-bad-exit=1 \
python -u tools/test.py configs/wfx/vit-l-upernet-512-proposed-loveda.py \
/diwang/work_dir/wfx_iccv/finetune/loveda/vit-l-upernet-512-proposed-loveda/iter_80000.pth \
--work-dir=/diwang/work_dir/wfx_iccv/finetune/loveda/vit-l-upernet-512-proposed-loveda/predict \
--out=/diwang/work_dir/wfx_iccv/finetune/loveda/vit-l-upernet-512-proposed-loveda/predict/submit \
--show-dir=/diwang/work_dir/wfx_iccv/finetune/loveda/vit-l-upernet-512-proposed-loveda/predict/show \
--launcher="slurm" --cfg-options val_cfg=None val_dataloader=None val_evaluator=None

🔗Citation

If you find SelectiveMAE helpful, please consider citing:

@article{selectivemae,
title={Harnessing Massive Satellite Imagery with Efficient Masked Image Modeling}, author={Fengxiang Wang and Hongzhen Wang and Di Wang and Zonghao Guo and Zhenyu Zhong and Long Lan and Wenjing Yang and Jing Zhang},
year={2025},
journal={arXiv preprint arXiv:2406.11933},
}

🤝License

This work is under the Apache License Version 2.0, while some specific operations in this codebase might be with other licenses. Please refer to LICENSE.md for a more careful check, if you are using our code for commercial matters.

About

Official repo for "[ICCV 2025] Harnessing Massive Satellite Imagery with Efficient Masked Image Modeling"

Resources

Stars

135 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages