YouYueHuang / CycleGAN_Unsupervised_Domain_Adaptation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Combination of CycleGan and Mcd in Pytorch

This is my PyTorch implementation for semi-supervised un-paired co-training. Although it is not yet been completed, it is nolonger under development.

This package includes CycleGAN, MCD_DA

The code was written by You Yue Huang.

Note: The current software works well with PyTorch 0.4.

Prerequisites

  • Linux
  • NVIDIA GPU + CUDA CuDNN (CPU mode and CUDA without CuDNN may work with minimal modification, but untested)

Getting Started

Installation

python -m pip install --upgrade pip
pip install git+https://github.com/pytorch/tnt.git@master
pip install --upgrade git+https://github.com/pytorch/tnt.git@master
  • Install bulitins
pip install future
git clone https://github.com/onedayatatime0923/Cycle_Mcd_Gan
cd Cycle_Mcd_Gan

Dataset

Cityscapes

Cityscapes
└───image
│   └───train
│   │   └───aachen
│   │   │     aachen_000000_000019_leftImg8bit.png
│   │   │     ...
│   │   ...
│   │
│   └───val
│   │   └───frankfurt
│   │   │     frankfurt_000000_000294_leftImg8bit.png
│   │   │     ...
│   │   ...
│   │
│   └───test
│       └───berlin
│       │     berlin_000000_000019_leftImg8bit.png
│       │     ...
│       ...
│   
└───label
    └───train
    │   └───aachen
    │   │     aachen_000000_000019_gtFine_labelIds.png
    │   │     ...
    │   ...
    │
    └───val
    │   └───frankfurt
    │   │     frankfurt_000000_000294_gtFine_labelIds.png
    │   │     ...
    │   ...
    │
    └───test
        └───berlin
        │     berlin_000000_000019_gtFine_labelIds.png
        │     ...
        ...
  • Generate txt file
python3 datamanager/generate_txt.py [directory of Cityscapes Dataset]

GTA

GTA
└───image
│     00001.png
│     ...
│   
└───label
      00001.png
      ...
  • Split data
python3 datamanager/split_gta.py [directory of GTA Dataset] [path of split.mat]

Note: the datastructure will become like this

Cityscapes
└───image
│   └───train
│   │     00001.png
│   │     ...
│   │
│   └───val
│   │     00022.png
│   │     ...
│   │
│   └───test
│         00011.png
│         ...
│   
└───label
    └───train
    │     00001.png
    │     ...
    │
    └───val
    │     00022.png
    │     ...
    │
    └───test
          00022.png
          ...
  • Generate txt file
python3 datamanager/generate_txt.py [directory of GTA Dataset]

Train

  • Train a model:
python3 cycle_mcd_trainer.py

Display UI

Optionally, for displaying images during training and test, use the tensorboardX

cd checkpoints/cycle_mcd_da
tensorboard --logdir log

If Ctrl-C couldn't terminate the process properly,

lsof -i:6006
kill -9 <process id>

Citation

@inproceedings{CycleGAN2017,
  title={Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networkss},
  author={Zhu, Jun-Yan and Park, Taesung and Isola, Phillip and Efros, Alexei A},
  booktitle={Computer Vision (ICCV), 2017 IEEE International Conference on},
  year={2017}
}

@article{saito2017maximum,
  title={Maximum Classifier Discrepancy for Unsupervised Domain Adaptation},
  author={Saito, Kuniaki and Watanabe, Kohei and Ushiku, Yoshitaka and Harada, Tatsuya},
  journal={arXiv preprint arXiv:1712.02560},
  year={2017}
}

Acknowledgments

code is done in iis sinica.

Related Projects:

CycleGAN: Project | Paper

MCD_DA: Project | Paper

About


Languages

Language:Python 97.1%Language:HTML 1.8%Language:Shell 0.7%Language:TeX 0.4%