A pytorch implementation of BDL. If you use this code in your research please consider citing
@article{li2019bidirectional, title={Bidirectional Learning for Domain Adaptation of Semantic Segmentation}, author={Li, Yunsheng and Yuan, Lu and Vasconcelos, Nuno}, journal={arXiv preprint arXiv:1904.10620}, year={2019} }
Requirements
conda install pytorch=0.4.0 torchvision cuda91 -y -c pytorch
pip install tensorboard tensorboardX
python BDL.py --snapshot-dir ./snapshots/gta2city \
--init-weights /path/to/inital_weights \
--num-steps-stop 80000 \
--model DeepLab
python SSL.py --data-list-target /path/to/dataset/cityscapes_list/train.txt \
--restore-from /path/to/SSL_step1_or_SSL_step2 \
--model DeepLab \
--save /path/to/cityscapes/cityscapes_ssl \
--set train
With the pseudo labels, the adaptive segmenation model can be trained as:
python BDL.py --data-label-folder-target pseudo_label_folder_name \
--snapshot-dir ./snapshots/gta2city_ssl \
--init-weights /path/to/inital_weights \
--num-steps-stop 120000 \
--model DeepLab
The pre-trained model can be downloaded here GTA5_deeplab. You can use the pre-trained model or your own model to make a test as following:
python evaluation.py --restore-from ./snapshots/gta2city \
--save /path/to/cityscapes/results
The different initial models can be downloaded here:
If you want to use BDL for SYNTHIA dataset or use VGG-FCN model, you can assign '--source synthia' or '--model VGG' The model for SYNTHIA with DeepLab or VGG can be downloaded here to reproduce the results in the paper:
The model for GTA5 with VGG can be downloaded here to reproduce the results in the paper:
The other transferred images can be downloaed here:
This code is heavily borrowed from AdaptSegNet