Home

Awesome

Self-Support Few-Shot Semantic Segmentation

Qi Fan, Wenjie Pei, Yu-Wing Tai, Chi-Keung Tang

The codebase contains the official code of our paper Self-Support Few-Shot Semantic Segmentation, ECCV 2022.

中文解读: ECCV 2022 | SSP: 自支持匹配的小样本任务新思想

PWC
PWC
PWC
PWC
PWC
PWC

Data preparation

Download

Pretrained model: ResNet-50 | ResNet-101

Dataset: Pascal images and ids | Semantic segmentation annotations

File Organization

You can follow HSNet to prepare the MS COCO and FSS-1000 datasets.

    ../                         # parent directory
    ├── ./SSP                   # current (project) directory
    |   ├── codes               # various codes
    |   └── ./pretrained        # pretrained model directory
    |            ├── resnet50.pth
    |            └── resnet101.pth
    └── Datasets_SSP/
        ├── VOC2012/            # PASCAL VOC2012 devkit
        │   ├── Annotations/
        │   ├── ImageSets/
        │   ├── ...
        │   └── SegmentationClassAug/
        ├── COCO2014/           
        │   ├── annotations/
        │   │   ├── train2014/  # (dir.) training masks (from Google Drive) 
        │   │   ├── val2014/    # (dir.) validation masks (from Google Drive)
        │   │   └── ..some json files..
        │   ├── train2014/
        │   └── val2014/
        └── FSS-1000/           # (dir.) contains 1000 object classes
            ├── abacus/   
            ├── ...
            └── zucchini/

Run the code

You can adapt the scripts of all.sh, test.sh and hsnet_test.sh (for the HSNet evaluation protocol) to train and evaluate your models.

CUDA_VISIBLE_DEVICES=0,1 python -W ignore main.py \
  --dataset pascal --data-root [Your Pascal Path] \
  --backbone resnet50 --fold 0 --shot 1

You may change the backbone from resnet50 to resnet101, change the fold from 0 to 1/2/3, or change the shot from 1 to 5 for other settings.

You can add/remove --refine to enable/disable the self-support refinement.

Performance and Trained Models

Pascal VOC

MethodSettingBackboneSSP RefineFold 0Fold 1Fold 2Fold 3Mean
Baseline1-shotResNet-50No54.966.561.748.357.9
Baseline1-shotResNet-101No57.268.561.353.360.1
Baseline5-shotResNet-50No61.670.370.556.464.7
Baseline5-shotResNet-101No64.274.071.561.367.8
SSP (Ours)1-shotResNet-50Yes61.467.866.550.961.7
SSP (Ours)1-shotResNet-101Yes63.270.468.556.364.6
SSP (Ours)5-shotResNet-50Yes67.572.375.262.169.3
SSP (Ours)5-shotResNet-101Yes70.977.178.966.173.3

MS COCO

MethodSettingBackboneEval ProtocolFold 0Fold 1Fold 2Fold 3Mean
SSP (Ours)1-shotResNet-50Ours46.435.227.325.433.6
SSP (Ours)1-shotResNet-101Ours50.439.930.630.037.7
SSP (Ours)5-shotResNet-50Ours53.942.036.033.741.4
SSP (Ours)5-shotResNet-101Ours57.847.040.239.946.2
SSP (Ours)1-shotResNet-50HSNet35.539.637.936.737.4
SSP (Ours)1-shotResNet-101HSNet39.145.142.741.242.0
SSP (Ours)5-shotResNet-50HSNet40.647.045.143.944.1
SSP (Ours)5-shotResNet-101HSNet47.454.550.449.650.2

Acknowledgement

This codebase is built based on MLC's baseline code and we borrow HSNet's evaluation protocol for the MS COCO dataset. We thank MLC and other FSS works for their great contributions.

Other related repos

Few-shot image/video object detection: FewX

Other related papers

@inproceedings{fan2021fsvod,
  title={Few-Shot Video Object Detection},
  author={Fan, Qi and Tang, Chi-Keung and Tai, Yu-Wing},
  booktitle={ECCV},
  year={2022}
}
@inproceedings{fan2020cpmask,
  title={Commonality-Parsing Network across Shape and Appearance for Partially Supervised Instance Segmentation},
  author={Fan, Qi and Ke, Lei and Pei, Wenjie and Tang, Chi-Keung and Tai, Yu-Wing},
  booktitle={ECCV},
  year={2020}
}
@inproceedings{fan2020fsod,
  title={Few-Shot Object Detection with Attention-RPN and Multi-Relation Detector},
  author={Fan, Qi and Zhuo, Wei and Tang, Chi-Keung and Tai, Yu-Wing},
  booktitle={CVPR},
  year={2020}
}

Citation

@inproceedings{fan2022ssp,
  title={Self-Support Few-Shot Semantic Segmentation},
  author={Fan, Qi and Pei, Wenjie and Tai, Yu-Wing and Tang, Chi-Keung},
  journal={ECCV},
  year={2022}
}