Pytorch codes of Combining SAM with Limited Data for Change Detection in Remote Sensing [paper]
How to Use (Following SAM-CD)
-
Installation
- Install FastSAM following the instructions.
- Modify the Ultralytics source files following the instructions at: 'SAM-CD/models/FastSAM/README.md'.
-
Dataset preparation.
- Please split the data into training, validation and test sets and organize them as follows:
YOUR_DATA_DIR
├── ...
├── train
│ ├── A
│ ├── B
│ ├── label
├── val
│ ├── A
│ ├── B
│ ├── label
├── test
│ ├── A
│ ├── B
│ ├── label
- Find change line 13 in datasets/Levir_CD.py (or other data-loading .py files), change
/YOUR_DATA_ROOT/to your local dataset directory.
-
Training
classic CD training:
python train_CD.pytraining CD with the proposed task-agnostic semantic learning:
python train_SAM_CD.pyline 16-45 are the major training args, which can be changed to load different datasets, models and adjust the training settings.
-
Inference and evaluation
inference on test sets: set the chkpt_path and run
python pred_CD.pyevaluation of accuracy: set the prediction dir and GT dir, and run
python eval_CD.py
In the following, we summarize links to some frequently used CD datasets:
Our code is based on SAM-CD.
If you find this work useful or interesting, please consider citing the following BibTeX entry.
@article{gao2025combining,
title={Combining SAM With Limited Data for Change Detection in Remote Sensing},
author={Gao, Junyu and Zhang, Da and Wang, Feiyu and Ning, Lichen and Zhao, Zhiyuan and Li, Xuelong},
journal={IEEE Transactions on Geoscience and Remote Sensing},
year={2025},
publisher={IEEE}
}
