- Linux or macOS
- Python 3
- CPU or NVIDIA GPU + CUDA CuDNN
- Clone this repo:
git clone https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix
cd pytorch-CycleGAN-and-pix2pix
- Install PyTorch and 0.4+ and other dependencies (e.g., torchvision, visdom and dominate).
- For pip users, please type the command
pip install -r requirements.txt
. - For Conda users, you can create a new Conda environment using
conda env create -f environment.yml
.
- For pip users, please type the command
- To view training results and loss plots, run
python -m visdom.server
and click the URL http://localhost:8097. - To log training progress and test images to W&B dashboard, set the
--use_wandb
flag with train and test script - Train a model:
#!./scripts/train_cyclegan.sh
python train.py --gpu_ids x --dataroot datasets/dataset_example/ --n_epochs xxx --model cycle_gan --gan_mode LSSSIMGRAD --input_nc 1 --output_nc 1 --name modelname --wcrit1 0.2 --wcrit2 0.2 --wcrit3 0.6
To see more intermediate results, check out ./checkpoints/maps_cyclegan/web/index.html
.
- Test the model:
#!./scripts/test_cyclegan.sh
python test.py --gpu_ids x --dataroot datasets/dataset_example/ --model cycle_gan --input_nc 1 --output_nc 1 --name modelname
- The test results will be saved to a html file here:
./results/maps_cyclegan/latest_test/index.html
.
A pretrained model is available, to use it for prediction use the model name salienceNet :
#!./scripts/test_cyclegan.sh
python test.py --gpu_ids x --dataroot datasets/dataset_example/ --model cycle_gan --input_nc 1 --output_nc 1 --name salienceNet
Our code is inspired by pytorch-cycleGAN.