- Semantic Image Synthesis with DAGAN
- Installation
- Dataset Preparation
- Generating Images Using Pretrained Model
- Train and Test New Models
- Evaluation
- Acknowledgments
- Related Projects
- Citation
- Contributions
Dual Attention GANs for Semantic Image Synthesis
Hao Tang1, Song Bai2, Nicu Sebe13.
1University of Trento, Italy, 2University of Oxford, UK, 3Huawei Research Ireland, Ireland.
In ACM MM 2020.
The repository offers the official implementation of our paper in PyTorch.
Also see our CVPR 2020 paper Local Class-Specific and Global Image-Level Generative Adversarial Networks for Semantic-Guided Scene Generation.
Copyright (C) 2019 University of Trento, Italy.
All rights reserved. Licensed under the CC BY-NC-SA 4.0 (Attribution-NonCommercial-ShareAlike 4.0 International)
The code is released for academic research use only. For commercial use, please contact [email protected].
Clone this repo.
git clone https://github.com/Ha0Tang/DAGAN
cd DAGAN/
This code requires PyTorch 1.0 and python 3+. Please install dependencies by
pip install -r requirements.txt
This code also requires the Synchronized-BatchNorm-PyTorch rep.
cd DAGAN_v1/
cd models/networks/
git clone https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
cp -rf Synchronized-BatchNorm-PyTorch/sync_batchnorm .
cd ../../
To reproduce the results reported in the paper, you would need an NVIDIA DGX1 machine with 8 V100 GPUs.
Please download the datasets on the respective webpages.
- Facades: here.
- DeepFashion: here.
- CelebAMask-HQ: here.
- Cityscapes: here.
- ADE20K: here.
- COCO-Stuf: here
For Cityscapes, ADE20K, and COCO-Stuf, please refer to GauGAN for more details.
We also provide the prepared datasets for convience.
sh datasets/download_dagan_dataset.sh [dataset]
where [dataset]
can be one of facades
, deepfashion
or celeba
.
- Download the pretrained models using the following script, and save it in
DAGAN_v1/checkpoints/
.
sh scripts/download_dagan_model.sh [dataset]
- Change several parameter and then generate images using
test_[dataset].sh
. If you are running on CPU mode, append--gpu_ids -1
. - The outputs images are stored at
./results/[type]_pretrained/
by default. You can view them using the autogenerated HTML file in the directory.
- Prepare dataset.
- Change several parameters and then run
train_[dataset].sh
for training. There are many options you can specify. To specify the number of GPUs to utilize, use--gpu_ids
. If you want to use the second and third GPUs for example, use--gpu_ids 1,2
. - Testing is similar to testing pretrained models. Use
--results_dir
to specify the output directory.--how_many
will specify the maximum number of images to generate. By default, it loads the latest checkpoint. It can be changed using--which_epoch
.
- FID: mseitzer/pytorch-fid
- FRD: Ha0Tang/GestureGAN
- LPIPS: richzhang/PerceptualSimilarity
- DRN: fyu/drn [model: drn-d-105_ms_cityscapes.pth]
- UperNet: CSAILVision/semantic-segmentation-pytorch [model: baseline-resnet101-upernet]
For more details, please refer to this issue.
This code borrows heavily from GauGAN/SPADE.
EdgeGAN | LGGAN | SelectionGAN | PanoGAN | Guided-I2I-Translation-Papers
If you use this code for your research, please cite our papers.
EdgeGAN
@article{tang2020edge,
title={Edge Guided GANs with Semantic Preserving for Semantic Image Synthesis},
author={Tang, Hao and Qi, Xiaojuan and Xu, Dan and Torr, Philip HS and Sebe, Nicu},
journal={arXiv preprint arXiv:2003.13898},
year={2020}
}
LGGAN
@inproceedings{tang2019local,
title={Local Class-Specific and Global Image-Level Generative Adversarial Networks for Semantic-Guided Scene Generation},
author={Tang, Hao and Xu, Dan and Yan, Yan and Torr, Philip HS and Sebe, Nicu},
booktitle={CVPR},
year={2020}
}
SelectionGAN
@inproceedings{tang2019multi,
title={Multi-channel attention selection gan with cascaded semantic guidance for cross-view image translation},
author={Tang, Hao and Xu, Dan and Sebe, Nicu and Wang, Yanzhi and Corso, Jason J and Yan, Yan},
booktitle={CVPR},
year={2019}
}
@article{tang2020multi,
title={Multi-channel attention selection gans for guided image-to-image translation},
author={Tang, Hao and Xu, Dan and Yan, Yan and Corso, Jason J and Torr, Philip HS and Sebe, Nicu},
journal={arXiv preprint arXiv:2002.01048},
year={2020}
}
If you have any questions/comments/bug reports, feel free to open a github issue or pull a request or e-mail to the author Hao Tang ([email protected]).