This repository includes the PyTorch implementation for the paper Rethinking Ensemble-Distillation for Semantic Segmentation Based Unsupervised Domain Adaptation.
weights/
├── weights/
| ├── synthia/
| ├── gta5/
| | ├── gta5_ours_drn_57.98.pth
| | ├── ...
Rethinking_EnD_UDA/
├── label_fusion/
├── train_deeplabv2/
├── train_deeplabv3+/
├── ...
Warehouse/
├── SYNTHIA/
│ ├── labels/
│ ├── images/
| | ├── 0000000.png
| | ├── 0000001.png
| | ├── ...
├── GTA5/
│ ├── image/
│ ├── labels/
| | ├── 00000.png
| | ├── 00001.png
| | ├── ...
├── Cityscapes/
│ ├── data/
│ │ ├── gtFine/
│ │ ├── leftImg8bit/
│ │ │ ├── train/
│ | | ├── val/
│ | | ├── test/
│ │ | | ├── aachen
│ │ | | ├── ...
Quick Start:
- Download the pre-generated pseudo labels here.
- Place the pseudo labels in
Cityscapes/data/gtFine
folder and train the model with the following commands:
cd train_deeplabv3+
python train.py --class-balance --often-balance --backbone drn --restore-from ../../weights/weights/gta5/source/model_34.80.pth
The whole training procedure:
- Train the teacher models
-
Generate the pseudo labels and the output tensors. (NOTE: it is recommended that the certainty tensors should be first mapped to 0~100 and stored using byte tensors for memory conservation.)
-
Fuse the pseudo labels
cd label_fusion
python3 label_fusion.py
- Place the pseudo labels in
Cityscapes/data/gtFine
folder and follow the instructions in "Quick Start" to train the model.
================ GTA5 ================
{ Deeplabv3+ }
cd train_deeplabv3+
python test.py --backbone drn --restore-from ../../weights/weights/gta5/gta5_ours_drn_57.98.pth
============== SYNTHIA ===============
{ Deeplabv3+ }
cd train_deeplabv3+
python test.py --num-classes 16 --source-domain synthia --backbone drn --restore-from ../../weights/weights/synthia/synthia_ours_drn_59.95.pth
You can download the pre-trained weights here.
- Python 3.6
- Pytorch 1.5.0
Download the dependencies:
pip install requirement.txt
If you find the code useful for your research, please consider citing
@InProceedings{Chao_2021_CVPR,
author = {Chao, Chen-Hao and Cheng, Bo-Wun and Lee, Chun-Yi},
title = {Rethinking Ensemble-Distillation for Semantic Segmentation Based Unsupervised Domain Adaption},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
month = {June},
year = {2021},
pages = {2610-2620}
}
The code is partially borrowed from the following works: