Skip to content

Repository files navigation

FoBa: A Foreground-Background co-Guided Method and New Benchmark for Remote Sensing Semantic Change Detection

Haotian Zhang1, Han Guo1, Keyan Chen1, Hao Chen2, Zhengxia Zou1, Zhenwei Shi1, *

1 Beihang University, 2 Shanghai Artificial Intelligence Laboratory.

* Corresponding author

TGRS paper arXiv paper

Overview | Get Started | Taken Away | Others | 简体中文版

🛎️Updates

  • Notice: FoBa has been accepted by IEEE TGRS! We'd appreciate it if you could give this repo a ⭐️star⭐️ and stay tuned!!

  • November 18th, 2025: FoBa has been accepted by IEEE TGRS!!

🔭Overview

  • FoBa serves as a strong benchmark for semantic change detection tasks.

  • The LevirSCD dataset

accuracy

  • The architecture of FoBa

accuracy

🗝️Let's Get Started!

A. Installation

Note that the code in this repo runs under Linux system. We have not tested whether it works under other OS.

The repo is based on the VMama repo and ChangeMamba repo, thus you need to install it first. The following installation sequence is taken from the VMamba repo.

Step 1: Clone the repository:

Clone this repository and navigate to the project directory:

git clone https://github.com/zmoka-zht/FoBa.git
cd FoBa

Step 2: Environment Setup:

It is recommended to set up a conda environment and installing dependencies via pip. Use the following commands to set up your environment:

Create and activate a new conda environment

conda create -n foba
conda activate foba

Install dependencies

pip install -r requirements.txt
cd kernels/selective_scan && pip install .

Dependencies for "Detection" and "Segmentation" (optional in VMamba)

pip install mmengine==0.10.1 mmcv==2.1.0 opencv-python-headless ftfy regex
pip install mmdet==3.3.0 mmsegmentation==1.2.2 mmpretrain==1.2.0

B. Download Pretrained Weight

Also, please download the pretrained weights of VMamba-Tiny, VMamba-Small, and VMamba-Base and put them under

project_path/FoBa/pretrained_weight/

C. Data Preparation

Semantic change detection

The SECOND dataset is used for semantic change detection experiments. Please download it and make it have the following folder/file structure. Note that the land-cover maps are RGB images in the original SECOND dataset for visualization, you need to transform them into single-channel. Also, the binary change maps should be generated by yourself and put them into folder.

Or you are welcome to directly download and use our preprocessed SECOND, LevirSCD, JL1 dataset from the following links:

📋 Click to expand: LEVIR-SCD Class ID and RGB Visualization Mappings

Class to ID Mapping:

{
    "background": 0,
    "Sparse woodland": 1,
    "Low vegetation": 2,
    "Woodland": 3,
    "Playground": 4,
    "Low building": 5,
    "General building": 6,
    "Unpaved Road": 7,
    "Bare Land": 8,
    "Construction land": 9,
    "Parking Lot": 10,
    "Others": 11,
    "River": 12,
    "Impervious surfaces": 13,
    "Paved Road": 14,
    "High building": 15,
    "Water": 16
}

Note: You can find the implementation of the visualization code here.

${DATASET_ROOT} # Dataset root directory, for example: /home/username/data/SECOND
├── train
│   ├── im1
│   │   ├──00001.png
│   │   ├──00002.png
│   │   ├──00003.png
│   │   ...
│   │
│   ├── im2
│   │   ├──00001.png
│   │   ... 
│   │
│   ├── label   # Binary change map
│   │   ├──00001.png 
│   │   ... 
│   │
│   ├── label1   # Land-cover map of T1
│   │   ├──00001.png 
│   │   ...  
│   │
│   └── label2   # Land-cover map of T2
│       ├──00001.png 
│       ...  
│   
├── test
│   ├── ...
│   ...
├── list 
│   ├──train.txt
└── ├──test.txt

D. Model Training

Before training models, please enter into [changedetection] folder, which contains all the code for network definitions, training and testing.

cd <project_path>/FoBa/changedetection

Semantic change detection

The following commands show how to train and evaluate FoBa on the SECOND dataset:

python script/train_foba.py  --dataset 'SECOND' \
                                 --batch_size 2 \
                                 --crop_size 512 \
                                 --max_iters 480000 \
                                 --model_type FoBa \
                                 --model_param_path '<project_path>/FoBa/changedetection/saved_models' \ 
                                 --train_dataset_path '<dataset_path>/SECOND/train' \
                                 --train_data_list_path '<dataset_path>/SECOND/list/train_list.txt' \
                                 --test_dataset_path '<dataset_path>/SECOND/test' \
                                 --test_data_list_path '<dataset_path>/SECOND/list/test_list.txt'
                                 --cfg '<project_path>/FoBa/changedetection/configs/vssm1/vssm_small_224.yaml' \
                                 --pretrained_weight_path '<project_path>/FoBa/pretrained_weight/vssm_small_0229_ckpt_epoch_222.pth'

E. Inference Using Our/Your Weights

Before inference, please enter into [changedetection] folder.

cd <project_path>/FoBa/changedetection

Semantic change detection

The following commands show how to infer semantic change maps using trained FoBa on the SECOND dataset:

python script/infer_foba_second.py  --dataset 'SECOND'  \
                                 --model_type 'FoBaMambaBased' \
                                 --test_dataset_path '<dataset_path>/SECOND/test' \
                                 --test_data_list_path '<dataset_path>/SECOND/list\test_list.txt' \
                                 --cfg '<project_path>/FoBa/changedetection/configs/vssm1/vssm_base_224.yaml' \
                                 --pretrained_weight_path '<project_path>/FoBa/pretrained_weight/vssm_base_0229_ckpt_epoch_237.pth'
                                 --resume '<saved_model_path>/[your_trained_model].pth'

⚗️Results Taken Away

  • We'd appreciate it if you could give this repo a ⭐️star⭐️ and stay tuned.

A. Pretrained Weight of VMamba (Encoder)

Method ImageNet (ckpt)
VMamba-Tiny [GDrive]
VMamba-Small [GDrive]
VMamba-Base [GDrive]

B. Semantic Change Detection

Method Checkpoints
FoBaMambaBased SECOND + LevirSCD + JL1 (Extraction code: foba)
FoBaTransformerBased SECOND + LevirSCD + JL1 (Extraction code: foba)

📜Reference

If this code or dataset contributes to your research, please kindly consider citing our paper and give this repo ⭐️ :)

@ARTICLE{11268372,
  author={Zhang, Haotian and Guo, Han and Chen, Keyan and Chen, Hao and Zou, Zhengxia and Shi, Zhenwei},
  journal={IEEE Transactions on Geoscience and Remote Sensing}, 
  title={FoBa: A Foreground-Background co-Guided Method and New Benchmark for Remote Sensing Semantic Change Detection}, 
  year={2025},
  volume={},
  number={},
  pages={1-1},
  keywords={Semantics;Remote sensing;Transformers;Feature extraction;Annotations;Roads;Multitasking;Spatial resolution;Landsat;Land surface;Semantic change detection (SCD);foreground-background co-guided;bi-temporal interaction;mamba;new benchmark},
  doi={10.1109/TGRS.2025.3636947}}

@ARTICLE{10902569,
  author={Zhang, Haotian and Chen, Keyan and Liu, Chenyang and Chen, Hao and Zou, Zhengxia and Shi, Zhenwei},
  journal={IEEE Transactions on Geoscience and Remote Sensing}, 
  title={CDMamba: Incorporating Local Clues Into Mamba for Remote Sensing Image Binary Change Detection}, 
  year={2025},
  volume={63},
  number={},
  pages={1-16},
  keywords={Feature extraction;Transformers;Remote sensing;Convolutional neural networks;Visualization;Artificial intelligence;Spatiotemporal phenomena;Computational modeling;Attention mechanisms;Computer vision;Bi-temporal interaction;change detection (CD);high-resolution optical remote sensing image;Mamba;state-space model},
  doi={10.1109/TGRS.2025.3545012}}

@ARTICLE{10471555,
  author={Zhang, Haotian and Chen, Hao and Zhou, Chenyao and Chen, Keyan and Liu, Chenyang and Zou, Zhengxia and Shi, Zhenwei},
  journal={IEEE Transactions on Geoscience and Remote Sensing}, 
  title={BiFA: Remote Sensing Image Change Detection With Bitemporal Feature Alignment}, 
  year={2024},
  volume={62},
  number={},
  pages={1-17},
  keywords={Feature extraction;Task analysis;Remote sensing;Transformers;Interference;Decoding;Optical flow;Bitemporal interaction (BI);change detection (CD);feature alignment;flow field;high-resolution optical remote sensing image;implicit neural representation},
  doi={10.1109/TGRS.2024.3376673}}

🤝Acknowledgments

This project is based on VMamba (paper, code), ChangeMamba (paper, code). Thanks for their excellent works!!

🙋Q & A

For any questions, please feel free to contact us.

Star History

Star History Chart

About

No description, website, or topics provided.

Resources

Stars

38 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages