Home

Awesome

Cross-Image Relational Knowledge Distillation for Semantic Segmentation

This repository contains the source code of CIRKD (Cross-Image Relational Knowledge Distillation for Semantic Segmentation) and implementations of semantic segmentation tasks on some datasets.

Requirement

Ubuntu 18.04 LTS

Python 3.8 (Anaconda is recommended)

CUDA 11.1

PyTorch 1.8.0

NCCL for CUDA 11.1

Install python packages:

pip install timm==0.3.2
pip install mmcv-full==1.2.7
pip install opencv-python==4.5.1.48

Backbones pretrained on ImageNet:

CNNTransformer
resnet101-imagenet.pthmit_b0.pth
resnet18-imagenet.pthmit_b1.pth
mobilenetv2-imagenet.pthmit_b4.pth

Support datasets:

DatasetTrain SizeVal SizeTest SizeClass
Cityscapes2975500152519
Pascal VOC Aug105821449--21
CamVid36710123311
ADE20K202102000--150
COCO-Stuff-164K1182875000--182

Performance on Cityscapes

All models are trained over 8 * NVIDIA GeForce RTX 3090

RoleNetworkMethodVal mIoUtest mIoUPretrainedtrain script
TeacherDeepLabV3-ResNet101-78.0777.46Google Drivesh
StudentDeepLabV3-ResNet18Baseline74.2173.45-sh
StudentDeepLabV3-ResNet18CIRKD76.3875.05Google Drivesh
StudentDeepLabV3-MobileNetV2Baseline73.1272.36-sh
StudentDeepLabV3-MobileNetV2CIRKD75.4274.03Google Drivesh
StudentPSPNet-ResNet18Baseline72.5572.29-sh
StudentPSPNet-ResNet18CIRKD74.7374.05Google Drivesh

Performance of Segmentation KD methods on Cityscapes

MethodVal mIoUVal mIoUVal mIoUtrain script
TeacherDeepLabV3-ResNet101DeepLabV3-ResNet101SegFormer-MiT-B4
Baseline78.0778.0781.23 [pretrained]sh
StudentDeepLabV3-ResNet18DeepLabV3-MobileNetV2SegFormer-MiT-B0
Baseline74.2173.1275.58 [pretrained]sh
SKD [3]75.4273.8276.43 [pretrained]sh
IFVD [4]75.5973.5076.30 [pretrained]sh
CWD [5]75.5574.6674.80 [pretrained]sh
DSD [6]74.8174.1176.62 [pretrained]sh
CIRKD [7]76.3875.4276.92 [pretrained]sh

The references are shown in references.md

Evaluate pre-trained models on Cityscapes test sets

You can run test_cityscapes.sh. You can zip the resulting images and submit it to the Cityscapes test server.

Note: The current codes have been reorganized and we have not tested them thoroughly. If you have any questions, please contact us without hesitation.

Performance of Segmentation KD methods on Pascal VOC

The Pascal VOC dataset for segmentation is available at Baidu Drive

RoleNetworkMethodVal mIoUtrain scriptPretrained
TeacherDeepLabV3-ResNet101-77.67shGoogle Drive
StudentDeepLabV3-ResNet18Baseline73.21sh
StudentDeepLabV3-ResNet18CIRKD74.50sh
StudentPSPNet-ResNet18Baseline73.33sh
StudentPSPNet-ResNet18CIRKD74.78sh

Performance of Segmentation KD methods on CamVid

The CamVid dataset for segmentation is available at Baidu Drive

RoleNetworkMethodVal mIoUtrain scriptPretrained
TeacherDeepLabV3-ResNet101-69.84shGoogle Drive
StudentDeepLabV3-ResNet18Baseline66.92sh
StudentDeepLabV3-ResNet18CIRKD68.21sh
StudentPSPNet-ResNet18Baseline66.73sh
StudentPSPNet-ResNet18CIRKD68.65sh

Performance of Segmentation KD methods on ADE20K

The ADE20K dataset for segmentation is available at Google Drive

RoleNetworkMethodVal mIoUtrain scriptPretrained
TeacherDeepLabV3-ResNet101-42.70shGoogle Drive
StudentDeepLabV3-ResNet18Baseline33.91sh
StudentDeepLabV3-ResNet18CIRKD35.41sh

Performance of Segmentation KD methods on COCO-Stuff-164K

RoleNetworkMethodVal mIoUtrain scriptPretrained
TeacherDeepLabV3-ResNet101-38.71shGoogle Drive
StudentDeepLabV3-ResNet18Baseline32.60sh
StudentDeepLabV3-ResNet18CIRKD33.11sh

Visualization of segmentation mask using pretrained models

DatasetColor PalleteBlendScripts
Pascal VOCtop1top1sh
Cityscapestop1top1sh
ADE20Ktop1top1sh
COCO-Stuff-164Ktop1top1sh

Citation

We would appreciate it if you could give this repo a star or cite our paper!

@inproceedings{yang2022cross,
  title={Cross-image relational knowledge distillation for semantic segmentation},
  author={Yang, Chuanguang and Zhou, Helong and An, Zhulin and Jiang, Xue and Xu, Yongjun and Zhang, Qian},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={12319--12328},
  year={2022}
}