- Notifications
You must be signed in to change notification settings - Fork254
Toward Multimodal Image-to-Image Translation
License
junyanz/BicycleGAN
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Pytorch implementation for multimodal image-to-image translation. For example, given the same night image, our model is able to synthesize possible day images with different types of lighting, sky and clouds. The training requires paired data.
Note: The current software works well with PyTorch 0.41+. Check out the olderbranch that supports PyTorch 0.1-0.3.
Toward Multimodal Image-to-Image Translation.
Jun-Yan Zhu,Richard Zhang,Deepak Pathak,Trevor Darrell,Alexei A. Efros,Oliver Wang,Eli Shechtman.
UC Berkeley and Adobe Research
In Neural Information Processing Systems, 2017.
- [Tensorflow] by Youngwoon Lee (USC CLVR Lab).
- [Tensorflow] by Kv Manohar.
- Linux or macOS
- Python 3
- CPU or NVIDIA GPU + CUDA CuDNN
- Clone this repo:
git clone -b master --single-branch https://github.com/junyanz/BicycleGAN.gitcd BicycleGAN
- Install PyTorch and dependencies fromhttp://pytorch.org
- Install python librariesvisdom,dominate, andmoviepy.
For pip users:
bash ./scripts/install_pip.sh
For conda users:
bash ./scripts/install_conda.sh
- Download some test photos (e.g., edges2shoes):
bash ./datasets/download_testset.sh edges2shoes
- Download a pre-trained model (e.g., edges2shoes):
bash ./pretrained_models/download_model.sh edges2shoes
- Generate results with the model
bash ./scripts/test_edges2shoes.sh
The test results will be saved to a html file here:./results/edges2shoes/val/index.html
.
- Generate results with synchronized latent vectors
bash ./scripts/test_edges2shoes.sh --sync
Results can be found at./results/edges2shoes/val_sync/index.html
.
bash ./scripts/video_edges2shoes.sh
Results can be found at./videos/edges2shoes/
.
- To train a model, download the training images (e.g., edges2shoes).
bash ./datasets/download_dataset.sh edges2shoes
- Train a model:
bash ./scripts/train_edges2shoes.sh
- To view training results and loss plots, run
python -m visdom.server
and click the URLhttp://localhost:8097. To see more intermediate results, check out./checkpoints/edges2shoes_bicycle_gan/web/index.html
- See more training details for other datasets in
./scripts/train.sh
.
Download the datasets using the following script. Many of the datasets are collected by other researchers. Please cite their papers if you use the data.
- Download the testset.
bash ./datasets/download_testset.sh dataset_name
- Download the training and testset.
bash ./datasets/download_dataset.sh dataset_name
facades
: 400 images fromCMP Facades dataset. [Citation]maps
: 1096 training images scraped from Google Mapsedges2shoes
: 50k training images fromUT Zappos50K dataset. Edges are computed byHED edge detector + post-processing. [Citation]edges2handbags
: 137K Amazon Handbag images fromiGAN project. Edges are computed byHED edge detector + post-processing. [Citation]night2day
: around 20K natural scene images fromTransient Attributes dataset [Citation]
Download the pre-trained models with the following script.
bash ./pretrained_models/download_model.sh model_name
edges2shoes
(edge -> photo) trained on UT Zappos50K dataset.edges2handbags
(edge -> photo) trained on Amazon handbags images..
bash ./pretrained_models/download_model.sh edges2handbagsbash ./datasets/download_testset.sh edges2handbagsbash ./scripts/test_edges2handbags.sh
night2day
(nighttime scene -> daytime scene) trained on around 100webcams.
bash ./pretrained_models/download_model.sh night2daybash ./datasets/download_testset.sh night2daybash ./scripts/test_night2day.sh
facades
(facade label -> facade photo) trained on the CMP Facades dataset.
bash ./pretrained_models/download_model.sh facadesbash ./datasets/download_testset.sh facadesbash ./scripts/test_facades.sh
maps
(map photo -> aerial photo) trained on 1096 training images scraped from Google Maps.
bash ./pretrained_models/download_model.sh mapsbash ./datasets/download_testset.sh mapsbash ./scripts/test_maps.sh
Figure 6 shows realism vs diversity of our method.
Realism We use the Amazon Mechanical Turk (AMT) Real vs Fake test fromthis repository, first introduced inthis work.
Diversity For each input image, we produce 20 translations by randomly sampling 20
z
vectors. We compute LPIPS distance between consecutive pairs to get 19 paired distances. You can compute this by putting the 20 images into a directory and usingthis script (note that we used version 0.0 rather than default 0.1, so use flag-v 0.0
). This is done for 100 input images. This results in 1900 total distances (100 images X 19 paired distances each), which are averaged together. A larger number means higher diversity.
If you find this useful for your research, please use the following.
@inproceedings{zhu2017toward, title={Toward multimodal image-to-image translation}, author={Zhu, Jun-Yan and Zhang, Richard and Pathak, Deepak and Darrell, Trevor and Efros, Alexei A and Wang, Oliver and Shechtman, Eli}, booktitle={Advances in Neural Information Processing Systems}, year={2017}}
If you use modules from CycleGAN or pix2pix paper, please use the following:
@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}}@inproceedings{isola2017image, title={Image-to-Image Translation with Conditional Adversarial Networks}, author={Isola, Phillip and Zhu, Jun-Yan and Zhou, Tinghui and Efros, Alexei A}, booktitle={Computer Vision and Pattern Recognition (CVPR), 2017 IEEE Conference on}, year={2017}}
This code borrows heavily from thepytorch-CycleGAN-and-pix2pix repository.