This repository contains the PyTorch implementation of:
Intra-class Feature Variation Distillation for Semantic Segmentation, ECCV 2020 [Paper]
All the codes are tested in the following environment:
- Linux (tested on Ubuntu 16.04 / CentOS 7.6)
- Python 3.6.2
- PyTorch 0.4.1
- Single TITAN Xp GPU
- Install PyTorch:
conda install pytorch=0.4.1 cuda90 torchvision -c pytorch
- Install other dependences:
pip install opencv-python scipy
- Install InPlace-ABN:
cd libs
sh build.sh
python build.py
The build.sh
script assumes that the nvcc
compiler is available in the current system search path.
The CUDA kernels are compiled for sm_50
, sm_52
and sm_61
by default.
To change this (e.g. if you are using a Kepler GPU), please edit the CUDA_GENCODE
variable in build.sh
.
-
Dataset: [Cityscapes]
-
Teacher: PSPNet (ResNet-101) trained on Cityscapes [Google Drive]
-
Student: ResNet-18 pretrained on ImageNet [Google Drive]
-
After distillation: PSPNet (ResNet-18) [Google Drive]
Please create a new folder ckpt
and move all downloaded models to it.
python train.py --data-dir /path/to/cityscapes --save-name /path/to/save --gpu /device/id
python val.py --data-dir /path/to/cityscapes --restore-from /path/to/pth --gpu /device/id
python test.py --data-dir /path/to/cityscapes --restore-from /path/to/pth --gpu /device/id
Please consider citing this work if it helps your research:
@inproceedings{wang2020ifvd,
title={Intra-class Feature Variation Distillation for Semantic Segmentation},
author={Wang, Yukang and Zhou, Wei and Jiang, Tao and Bai, Xiang and Xu, Yongchao},
booktitle={Proceedings of the European Conference on Computer Vision},
year={2020}
}
This codebase is heavily borrowed from pytorch-segmentation-toolbox and structure_knowledge_distillation. Thanks for their excellent works.