The codebase contains the official code of our paper Domain-Rectifying Adapter for Cross-Domain Few-Shot Segmentation, CVPR 2024.
In our research, we employ the plug-and-play Domain Adapter to investigate the Cross-Domain Few-Shot Segmentation (CDFSS) problem. By integrating the adapter into the initial stages of the baseline model, we aim to align images from various domains to a standardized source domain, thereby mitigating domain discrepancies across different domains.
The Cross-Domain Few-Shot Semantic Segmentation includes data from the Deepglobe [1], ISIC2018 [2-3], Chest X-ray [4-5], and FSS-1000 [6] datasets.You can follow PATNet to prepare the source domain and target domain datasets.
-
PASCAL VOC2012:
Download PASCAL VOC2012 devkit (train/val data):
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar
Download PASCAL VOC2012 SDS extended mask annotations from [Google Drive].
-
Deepglobe:
Home: http://deepglobe.org/
Preprocessed Data: https://drive.google.com/file/d/10qsi1NRyFKFyoIq1gAKDab6xkbE0Vc74/view?usp=sharing
-
ISIC2018:
Home: http://challenge2018.isic-archive.com
Direct (must login): https://challenge.isic-archive.com/data#2018
Class Information: data/isic/class_id.csv
Preprocess: After downloading the ISIC dataset, please utilize the "./data_util/ISIC_Split.py" script to preprocess the raw ISIC data.
-
Chest X-ray:
-
FSS-1000:
Home: https://github.com/HKUSTCV/FSS-1000
-
Pretrained model: ResNet-50
-
Base model trained in original SSP: Ori_SSP_trained_on_VOC.pth(Google drive||Baidu Netdisk)
Please place the "Ori_SSP_trained_on_VOC.pth", trained in SSP, under the directory "./outdir/models/", and put the "resnet50.pth" under "./outdir/models/pretrained/".
DR_Adapter # current (project) directory
├── codes # various codes
├── ./outdir # (dir)pretrained model and output model
│ ├── Ori_SSP_trained_on_VOC.pth
│ ├── pretrained/
│ └── resnet50.pth
└── ./data
├── VOCdevkit/ # PASCAL VOC2012 devkit
│ └── VOC2012/
│ ├── Annotations/
│ ├── ImageSets/
│ ├── ...
│ └── SegmentationClassAug/
├── chest/
│ └── LungSegmentation # lung benchmark
│
├── fss
│ └── FSS-1000/ # fss benchmark
│ ├── abacus/
│ ├── ...
│ └── zucchini/
├── ISIC
│ └── ISIC/ # ISIC benchmark
└── deepglobe
└── Deepglobe/ # deepglobe benchmark
python train.py --train_datapath ./data/VOCdevkit --shot 1 --benchmark pascal --bsz 8 --logpath "your_experiment_name"
python test.py --test_datapath {./data/fss, ./data/chest, ./data/ISIC, ./data/deepglobe} --benchmark {fss,lung,isic,deepglobe} --nshot {1, 5} --checkpoint_path "./outdir/models/pascal/best_model.pth"
This codebase is built based on SSP's baseline code and we borrow PATNet's evaluation protocol for the different dataset. We thank SSP and PATNet and other FSS works for their great contributions.
@article{su2024domain,
title={Domain-Rectifying Adapter for Cross-Domain Few-Shot Segmentation},
author={Su, Jiapeng and Fan, Qi and Lu, Guangming and Chen, Fanglin and Pei, Wenjie},
journal={arXiv preprint arXiv:2404.10322},
year={2024}
}
[1] Demir, I., Koperski, K., Lindenbaum, D., Pang, G., Huang, J., Basu, S., Hughes, F., Tuia, D., Raskar, R.: Deepglobe 2018: A challenge to parse the earth through satellite images. In: The IEEE Conference on Computer Vision and Pattern Recog- nition (CVPR) Workshops (June 2018)Li, X., Wei, T., Chen, Y.P., Tai, Y.W., Tang, C.K.: Fss-1000: A 1000-class dataset for few-shot segmentation. In: Proceedings of the IEEE/CVF Conference on Com- puter Vision and Pattern Recognition. pp. 2869–2878 (2020)
[2] Codella, N., Rotemberg, V., Tschandl, P., Celebi, M.E., Dusza, S., Gutman, D., Helba, B., Kalloo, A., Liopyris, K., Marchetti, M., et al.: Skin lesion analysis toward melanoma detection 2018: A challenge hosted by the international skin imaging collaboration (isic). arXiv preprint arXiv:1902.03368 (2019)
[3] Tschandl, P., Rosendahl, C., Kittler, H.: The ham10000 dataset, a large collection of multi-source dermatoscopic images of common pigmented skin lesions. Scientific data 5, 180161 (2018)
[4] Candemir, S., Jaeger, S., Palaniappan, K., Musco, J.P., Singh, R.K., Xue, Z., Karargyris, A., Antani, S., Thoma, G., McDonald, C.J.: Lung segmentation in chest radiographs using anatomical atlases with nonrigid registration. IEEE trans- actions on medical imaging 33(2), 577–590 (2013)
[5] Jaeger, S., Karargyris, A., Candemir, S., Folio, L., Siegelman, J., Callaghan, F., Xue, Z., Palaniappan, K., Singh, R.K., Antani, S., et al.: Automatic tuberculosis screening using chest radiographs. IEEE transactions on medical imaging 33(2), 233–245 (2013)
[6] Li, X., Wei, T., Chen, Y.P., Tai, Y.W., Tang, C.K.: Fss-1000: A 1000-class dataset for few-shot segmentation. In: Proceedings of the IEEE/CVF Conference on Com- puter Vision and Pattern Recognition. pp. 2869–2878 (2020)