Taking A Closer Look at Domain Shift: Category-level Adversaries for Semantics Consistent Domain Adaptation (CVPR2019)
This is a pytorch implementation of CLAN.
- Python 3.6
- GPU Memory >= 11G
- Pytorch 1.0.0
-
Download The GTA5 Dataset
-
Download The SYNTHIA Dataset
-
Download The Cityscapes Dataset
-
Download The imagenet pretraind model
The data folder is structured as follows:
├── data/
│ ├── Cityscapes/
| | ├── gtFine/
| | ├── leftImg8bit/
│ ├── GTA5/
| | ├── images/
| | ├── labels/
│ ├── SYNTHIA/
| | ├── RAND_CITYSCAPES/
│ └──
└── model/
│ ├── DeepLab_resnet_pretrained.pth
...
CUDA_VISIBLE_DEVICES=0 python CLAN_train.py --snapshot-dir ./snapshots/GTA2Cityscapes
CUDA_VISIBLE_DEVICES=0 python CLAN_evaluate.py --restore-from ./snapshots/GTA2Cityscapes/GTA5_100000.pth --save ./result/GTA2Cityscapes_100000
Our pretrained model is available via Google Drive
python CLAN_iou.py ./data/Cityscapes/gtFine/val result/GTA2Cityscapes_100000
Tip: The best-performance model might not be the final one in the last epoch. If you want to evaluate every saved models in bulk, please use CLAN_evaluate_bulk.py and CLAN_iou_bulk.py, the result will be saved in an Excel sheet.
CUDA_VISIBLE_DEVICES=0 python python CLAN_evaluate_bulk.py
python CLAN_iou_bulk.py
This code is heavily borrowed from the baseline AdaptSegNet
If you use this code in your research please consider citing
@inproceedings{Yawei2019Taking,
title={Taking A Closer Look at Domain Shift: Category-level Adversaries for Semantics Consistent Domain Adaptation},
author={Luo, Yawei and Zheng, Liang and Guan, Tao and Yu, Junqing and Yang, Yi},
booktitle={The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year={2019}
}