Skip to content
/ RegDA Public

The official implementation for "Learn from Segment Anything Model: Local Region Homogenizing for Cross-domain Remote Sensing Image Segmentation".

Notifications You must be signed in to change notification settings

StuLiu/RegDA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Getting Started

Environment:

  • 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 .

Prepare datasets

1. Generate from raw:

  • 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

2. Alternatively, you can also download the processed data

  • Download the processed datasets here.
  • reorganize the directory tree.

3. The prepared data is formatted as follows:

"
./data
---- IsprsDA
     ---- Potsdam
          ---- ann_dir
          ---- img_dir
          ---- reg_dir
     ---- Vaihingen
          ---- ann_dir
          ---- img_dir
          ---- reg_dir
"

Evaluate the trained RegDA models.\

Download the pre-trained weights and logs.

1. on Vaihingen (IRRG) -> Potsdam (IRRG) task

Run evaluating: python tools/eval.py --config-path st.regda.2potsdam --ckpt-path log/regda/2potsdam/ssl/Potsdam_best.pth --test 1

2. on Potsdam (IRRG) -> Vaihingen (IRRG) task

Run evaluating: python tools/eval.py --config-path st.regda.2vaihingen --ckpt-path log/regda/2vaihingen/ssl/Vaihingen_best.pth --test 1

Train the RegDA

bash runs/regda/run_2potsdam.sh
bash runs/regda/run_2vaihingen.sh

Inference single file

python tools/infer_single.py st.regda.2potsdam log/regda/ssl/Potsdam_best.pth [image-path] --save-dir [save-dir-path]

Cite

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}
}

About

The official implementation for "Learn from Segment Anything Model: Local Region Homogenizing for Cross-domain Remote Sensing Image Segmentation".

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages