This repo provides the implementation of CAPL in FS-Seg.
- Python 3.7.9
- Torch 1.5.1
- cv2 4.4.0
- numpy 1.21.0
- CUDA 10.1
Please prepare the datasets (COCO-20i and PASCAL-5i) by following the instructions of PFENet.
- Execute
mkdir initmodel
at the root directory. - Download the ImageNet pretrained backbones and put them into the
initmodel
directory. - Please download the pretrained models.
- We provide 16 pre-trained models: 8 for 1/5 shot results on PASCAL-5i and 8 for COCO.
- Update the config files by speficifying the target split, weights and val_shot for loading different checkpoints.
-
For training, please set the option only_evaluate to False in the configuration file. Then execute this command at the root directory:
sh train.sh {dataset} {model_config}
-
For evaluation only, please set the option only_evaluate to True in the corresponding configuration file.
Example: Train / Evaluate CAPL with 1-shot on the split 0 of PASCAL-5i:
sh train.sh pascal split0_1shot
We gratefully thank the authors of PANet and PPNet that inspire our implementation.
If you find this project useful, please consider citing:
@InProceedings{tian2022gfsseg,
title={Generalized Few-shot Semantic Segmentation},
author={Zhuotao Tian and Xin Lai and Li Jiang and Shu Liu and Michelle Shu and Hengshuang Zhao and Jiaya Jia},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
year={2022}
}