Learn from Segment Anything Model: Local Region Homogenizing for Cross-domain Remote Sensing Image Segmentation
This is the official implementation for RegDA. There are some differences comparing with the published paper.
- The denoising approach in this repository is re-weighting, while in the paper is voting;
- A class-frequency threshold is utilized to guide the pseudo-label homogenizing. For each local region, if the class with a larger frequency than this threshold, it will be employed for homogenizing;
- The LRH is also utilized in the aligning stage.
Fig. 1 An overview of the proposed RegDA.
- conda create -n regda python=3.8
- source activate regda
- pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
- conda install pytorch-scatter -c pyg
- pip install -r requirement.txt
- pip install -e .
- Download the raw datasets here.
- Run the preprocess script in ./convert_datasets/ to crop train, val, test sets:
python convert_datasets/convert_potsdam.py
python convert_datasets/convert_vaihingen.py
- Generate local regions by running
python tools/seg_everything.py
- Download the processed datasets here.
- reorganize the directory tree.
"
./data
---- IsprsDA
---- Potsdam
---- ann_dir
---- img_dir
---- reg_dir
---- Vaihingen
---- ann_dir
---- img_dir
---- reg_dir
"
Download the pre-trained weights and logs.
Run evaluating: python tools/eval.py --config-path st.regda.2potsdam --ckpt-path log/regda/2potsdam/ssl/Potsdam_best.pth --test 1
Run evaluating: python tools/eval.py --config-path st.regda.2vaihingen --ckpt-path log/regda/2vaihingen/ssl/Vaihingen_best.pth --test 1
bash runs/regda/run_2potsdam.sh
bash runs/regda/run_2vaihingen.sh
python tools/infer_single.py st.regda.2potsdam log/regda/ssl/Potsdam_best.pth [image-path] --save-dir [save-dir-path]
If you are interested in this work, please cite it as follows:
@INPROCEEDINGS{RegDA,
author={Liu, Wang and Duan, Puhong and Xie, Zhuojun and Kang, Xudong and Li, Shutao},
booktitle={IGARSS 2024 - 2024 IEEE International Geoscience and Remote Sensing Symposium},
title={Learn from Segment Anything Model: Local Region Homogenizing for Cross-domain Remote Sensing Image Segmentation},
year={2024}
}