Skip to content

Nitokou/BCHNet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bidirectional consistent hypercorrelation network for cross-domain few-shot segmentation

This is the official implementation code of our paper "Bidirectional consistent hypercorrelation network for cross-domain few-shot segmentation", published in Knowledge-Based Systems, 2025.

Introduction

The goal of the Cross-Domain Few-shot Semantic Segmentation (CD-FSS) task is to train a generalizable model on the source domain dataset for the segmentation of multiple target domain datasets. We propose a Bidirectional Consistent Hypercorrelation Network (BCHNet) framework to implement CD-FSS.

Datasets preparation

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

Download

Source domain (train & val dataset) :

  • PASCAL VOC2012:

    Download PASCAL VOC2012 devkit :

    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 (test datasets) :

File organization: datasets and project files are under parallel paths.

BCHNet/                                         # codes
├── common/                                     # log & vis codes
├── data/                                       # Dataloader
├── model/                                      # BCHNet's framework and main modules
├── README.md                                   
├── finetuning.py                                                             
└── train.py     


datasets/                                       # datasets
├── VOC2012/                                    # source dataset: pascal voc 2012
|   ├── JPEGImages/
|   └── SegmentationClassAug/
├── Deeoglobe                                   # target dataset: deepglobe
|   ├── 1/
|   ├── 2/
|   ├── 3/
|   ├── 4/
|   ├── 5/
|   └── 6/
├── ISIC/                                       # target dataset: isic
|   ├── ISIC2018_Task1-2_Training_Input/
|   └── ISIC2018_Task1_Training_GroundTruth/
├── LungSegmentation/                           # target dataset: chest x-ray
|   ├── CXR_png/
|   └── masks/
├── FSS-1000                                    # target dataset: fss-1000
|   ├── ab_wheel/
|   └── ...
└── Verse2D                                     # target dataset: spine verse2D
    ├── 1/
    └── 2/                               

Environment

  • python 3.8
  • pytorch 1.12
  • torchaudio 0.12
  • torchvision 0.13
  • cuda 11.3
  • tensorboard 2.2

Training

PASCAL VOC

python train.py
--benchmark pascal
--lr 1e-3
--bsz 12

We trained BCHNet with a single NVIDIA RTX A5000 (24GB) GPU. It took approximately 10 hours to complete the training process.

You can also download our trained model (if you just want to test):

Testing with SFT

1. Deepglobe ( lr = 1e-7 )

python finetuning.py 

2. FSS-1000 ( lr = 1e-2 )

python finetuning.py 

3. ISIC ( lr = 1e-1 )

python finetuning.py 

4. Chest X-ray ( lr = 1e-1 )

python finetuning.py 

5. Verse2D_axial ( lr = 1e-1 )

python finetuning.py 

Domain-specific models

If you are interested in domain-specific models, you can download our domain-specific item.

Citation

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

@inproceedings{KBS2025Tang,
  title   = {Bidirectional consistent hypercorrelation network for cross-domain few-shot segmentation},
  author  = {Tang Chenghua, Yi Jianbing, and et al.},
  journal = {Knowledge-Based Systems, {KBS 2025}},
  year    = {2025}
}

Acknowledgement

The implementation is based on HSNet and DMTNet.
We appreciate the work of HSNet [1], PATNet [2], DMTNet [3] and other FSS & CD-FSS works for their great contributions.

References

[1] J. Min, D. Kang, and M. Cho, Hypercorrelation Squeeze for Few-Shot Segmentation. IEEE International Conference on Computer Vision (ICCV), 2021.

[2] S. Lei, X. Zhang, J. He, F. Chen, B. Du, and C. Lu, Cross-Domain Few-Shot Semantic Segmentation. European Conference on Computer Vision (ECCV), 2022.

[3] J. Chen, R. Quan, and J. Qin, Cross-Domain Few-Shot Semantic Segmentation via Doubly Matching Transformation. International Joint Conference on Artificial Intelligence (IJCAI), 2024.

About

The official implementation code of our paper "Bidirectional consistent hypercorrelation network for cross-domain few-shot segmentation", published in Knowledge-Based Systems, 2025.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%