Skip to content

ChenJiayi68/DMTNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cross-Domain Few-Shot Semantic Segmentation via Doubly Matching Transformation

This is the official implementation of our IJCAI 2024 paper "Cross-Domain Few-Shot Semantic Segmentation via Doubly Matching Transformation".

Datasets

The following datasets are used for evaluation in CD-FSS:

Source domain:

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

Target domains:

Dataset File Organization

    Dataset/                                        # dataset
    ├── VOC2012/                                    # source dataset: pascal voc 2012
    |   ├── JPEGImages/
    |   └── SegmentationClassAug/
    ├── Deeoglobe                                   # target dataset: deepglobe
    |   ├── image/                                  # image
    |   └── filter_mask/                            # mask
    |       ├── 1/                                  # category
    |       ├── ...                                 
    |       ├── 6/
    |       ├── 1.txt                               # image name
    |       ├── ...  
    |       └── 6.txt    
    ├── ISIC/                                       # target dataset: isic
    |   ├── ISIC2018_Task1-2_Training_Input/        # image
    |   |   ├── 1/                                  # category
    |   |   ├── 2/
    |   |   └── 3/
    |   └── ISIC2018_Task1_Training_GroundTruth/    # mask
    |       └── ...
    ├── LungSegmentation/                           # target dataset: chest x-ray
    |   ├── CXR_png/                                # image
    |   └── masks/                                  # mask
    └── FSS-1000                                    # target dataset: fss-1000
        ├── ab_wheel/                               # category
        └── ...

Environment

  • Python 3.7.16
  • PyTorch 1.13.1
  • torchvision 0.14.1
  • cuda 11.4
  • tensorboard 1.14

Training

PASCAL VOC

CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.run --nnodes=1 --nproc_per_node=2 --node_rank=0 trainDDP.py
--backbone {vgg16, resnet50}
--fold 4
--benchmark pascal
--bsz 12
--lr 1e-3
--logpath "your_experiment_name"

We trained DMTNet with 2 NVIDIA RTX A5000. It took approximately 7.5 hours to complete the training process.

Testing with TSF

You can directly download our trained model weights here👉 [GoogleDrive]

1. Deepglobe

CUDA_VISIBLE_DEVICES=0 python -m torch.distributed.run --nnodes=1 --nproc_per_node=1 --node_rank=0  test_finetuning.py 
--backbone {vgg16, resnet50}
--benchmark deepglobe
--nshot {1, 5}
--load "path_to_trained_model/best_model.pt"
--lr 1e-6

2. ISIC

CUDA_VISIBLE_DEVICES=0 python -m torch.distributed.run --nnodes=1 --nproc_per_node=1 --node_rank=0  test_finetuning.py 
--backbone {vgg16, resnet50}
--benchmark isic
--nshot {1, 5}
--load "path_to_trained_model/best_model.pt"
--lr 1e-6

3. Chest X-ray

CUDA_VISIBLE_DEVICES=0 python -m torch.distributed.run --nnodes=1 --nproc_per_node=1 --node_rank=0  test_finetuning.py 
--backbone {vgg16, resnet50}
--benchmark lung
--nshot {1, 5}
--load "path_to_trained_model/best_model.pt"
--lr 1e-1

4. FSS-1000

CUDA_VISIBLE_DEVICES=0 python -m torch.distributed.run --nnodes=1 --nproc_per_node=1 --node_rank=0  test_finetuning.py 
--backbone {vgg16, resnet50}
--benchmark fss
--nshot {1, 5}
--load "path_to_trained_model/best_model.pt"
--lr 1e-6

Citation

If you use this code for your research, please consider citing:

@inproceedings{ijcai2024p71,
  title     = {Cross-Domain Few-Shot Semantic Segmentation via Doubly Matching Transformation},
  author    = {Chen, Jiayi and Quan, Rong and Qin, Jie},
  booktitle = {Proceedings of the Thirty-Third International Joint Conference on
               Artificial Intelligence, {IJCAI-24}},
  publisher = {International Joint Conferences on Artificial Intelligence Organization},
  editor    = {Kate Larson},
  pages     = {641--649},
  year      = {2024},
  month     = {8},
  note      = {Main Track},
  doi       = {10.24963/ijcai.2024/71},
  url       = {https://doi.org/10.24963/ijcai.2024/71},
}

Visualization

Acknowledgement

The implementation is based on PATNet and HSNet.

References

[1] Lei, Shuo, Xuchao Zhang, Jianfeng He, Fanglan Chen, Bowen Du and Chang-Tien Lu. “Cross-Domain Few-Shot Semantic Segmentation.” European Conference on Computer Vision (2022).

[2] Min, Juhong, Dahyun Kang and Minsu Cho. “Hypercorrelation Squeeze for Few-Shot Segmenation.” 2021 IEEE/CVF International Conference on Computer Vision (ICCV) (2021): 6921-6932.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages