All Projects → Ha0Tang → Attentiongan

Ha0Tang / Attentiongan

Licence: other
AttentionGAN for Unpaired Image-to-Image Translation & Multi-Domain Image-to-Image Translation

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Attentiongan

Pytorch Cyclegan And Pix2pix
Image-to-Image Translation in PyTorch
Stars: ✭ 16,477 (+4731.96%)
Mutual labels:  gans, image-generation, cyclegan
Contrastive Unpaired Translation
Contrastive unpaired image-to-image translation, faster and lighter training than cyclegan (ECCV 2020, in PyTorch)
Stars: ✭ 822 (+141.06%)
Mutual labels:  gans, image-generation, cyclegan
Selectiongan
[CVPR 2019 Oral] Multi-Channel Attention Selection GAN with Cascaded Semantic Guidance for Cross-View Image Translation
Stars: ✭ 366 (+7.33%)
Mutual labels:  gans, image-generation, image-translation
Matlab Gan
MATLAB implementations of Generative Adversarial Networks -- from GAN to Pixel2Pixel, CycleGAN
Stars: ✭ 63 (-81.52%)
Mutual labels:  gans, image-generation, cyclegan
Gesturegan
[ACM MM 2018 Oral] GestureGAN for Hand Gesture-to-Gesture Translation in the Wild
Stars: ✭ 136 (-60.12%)
Mutual labels:  gans, image-generation, image-translation
Cyclegan
Software that can generate photos from paintings, turn horses into zebras, perform style transfer, and more.
Stars: ✭ 10,933 (+3106.16%)
Mutual labels:  gans, image-generation, cyclegan
Img2imggan
Implementation of the paper : "Toward Multimodal Image-to-Image Translation"
Stars: ✭ 49 (-85.63%)
Mutual labels:  gans, image-generation, image-translation
Fq Gan
Official implementation of FQ-GAN
Stars: ✭ 137 (-59.82%)
Mutual labels:  gans, image-generation, image-translation
CoCosNet-v2
CoCosNet v2: Full-Resolution Correspondence Learning for Image Translation
Stars: ✭ 312 (-8.5%)
Mutual labels:  image-generation, gans, image-translation
Anime2Sketch
A sketch extractor for anime/illustration.
Stars: ✭ 1,623 (+375.95%)
Mutual labels:  image-generation, gans
day2night
Image2Image Translation Research
Stars: ✭ 46 (-86.51%)
Mutual labels:  image-translation, cyclegan
Cyclegan Tensorflow 2
CycleGAN Tensorflow 2
Stars: ✭ 330 (-3.23%)
Mutual labels:  cyclegan, image-translation
Text To Image Synthesis
Pytorch implementation of Generative Adversarial Text-to-Image Synthesis paper
Stars: ✭ 288 (-15.54%)
Mutual labels:  gans, image-generation
pytorch-gans
PyTorch implementation of GANs (Generative Adversarial Networks). DCGAN, Pix2Pix, CycleGAN, SRGAN
Stars: ✭ 21 (-93.84%)
Mutual labels:  gans, cyclegan
multitask-CycleGAN
Pytorch implementation of multitask CycleGAN with auxiliary classification loss
Stars: ✭ 88 (-74.19%)
Mutual labels:  image-translation, cyclegan
CycleGAN-Models
Models generated by CycleGAN
Stars: ✭ 42 (-87.68%)
Mutual labels:  image-generation, cyclegan
ganslate
Simple and extensible GAN image-to-image translation framework. Supports natural and medical images.
Stars: ✭ 17 (-95.01%)
Mutual labels:  image-translation, cyclegan
AODA
Official implementation of "Adversarial Open Domain Adaptation for Sketch-to-Photo Synthesis"(WACV 2022/CVPRW 2021)
Stars: ✭ 44 (-87.1%)
Mutual labels:  image-generation, gans
cycleGAN-PyTorch
A clean and lucid implementation of cycleGAN using PyTorch
Stars: ✭ 107 (-68.62%)
Mutual labels:  image-translation, cyclegan
pytorch-CycleGAN
Pytorch implementation of CycleGAN.
Stars: ✭ 39 (-88.56%)
Mutual labels:  image-translation, cyclegan

License CC BY-NC-SA 4.0 Python 3.6 Packagist Last Commit Maintenance Contributing Ask Me Anything !

AttentionGAN-v2 for Unpaired Image-to-Image Translation

AttentionGAN-v2 Framework

The proposed generator learns both foreground and background attentions. It uses the foreground attention to select from the generated output for the foreground regions, while uses the background attention to maintain the background information from the input image. Please refer to our papers for more details.

Framework

Comparsion with State-of-the-Art Methods

Selfie To Anime Translation

Result

Horse to Zebra Translation

Result
Result

Zebra to Horse Translation

Result

Apple to Orange Translation

Result

Orange to Apple Translation

Result

Map to Aerial Photo Translation

Result

Aerial Photo to Map Translation

Result

Style Transfer

Result

Visualization of Learned Attention Masks

Selfie to Anime Translation

Result

Horse to Zebra Translation

Attention

Zebra to Horse Translation

Attention

Apple to Orange Translation

Attention

Orange to Apple Translation

Attention

Map to Aerial Photo Translation

Attention

Aerial Photo to Map Translation

Attention

Extended Paper | Conference Paper

AttentionGAN: Unpaired Image-to-Image Translation using Attention-Guided Generative Adversarial Networks.
Hao Tang1, Hong Liu2, Dan Xu3, Philip H.S. Torr3 and Nicu Sebe1.
1University of Trento, Italy, 2Peking University, China, 3University of Oxford, UK.
The repository offers the official implementation of our paper in PyTorch.

Are you looking for AttentionGAN-v1 for Unpaired Image-to-Image Translation?

Paper | Code

Are you looking for AttentionGAN-v1 for Multi-Domain Image-to-Image Translation?

Paper | Code

Facial Expression-to-Expression Translation

Result Order: The Learned Attention Masks, The Learned Content Masks, Final Results

Facial Attribute Transfer

Attention Order: The Learned Attention Masks, The Learned Content Masks, Final Results

Result Order: The Learned Attention Masks, AttentionGAN, StarGAN

License

Creative Commons License
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].

Installation

Clone this repo.

git clone https://github.com/Ha0Tang/AttentionGAN
cd AttentionGAN/

This code requires PyTorch 0.4.1+ and python 3.6.9+. Please install dependencies by

pip install -r requirements.txt (for pip users)

or

./scripts/conda_deps.sh (for Conda users)

To reproduce the results reported in the paper, you would need an NVIDIA Tesla V100 with 16G memory.

Dataset Preparation

Download the datasets using the following script. Please cite their paper if you use the data. Try twice if it fails the first time!

sh ./datasets/download_cyclegan_dataset.sh dataset_name

The selfie2anime dataset can be download here.

AttentionGAN Training/Testing

  • Download a dataset using the previous script (e.g., horse2zebra).
  • To view training results and loss plots, run python -m visdom.server and click the URL http://localhost:8097.
  • Train a model:
sh ./scripts/train_attentiongan.sh
  • To see more intermediate results, check out ./checkpoints/horse2zebra_attentiongan/web/index.html.
  • How to continue train? Append --continue_train --epoch_count xxx on the command line.
  • Test the model:
sh ./scripts/test_attentiongan.sh
  • The test results will be saved to a html file here: ./results/horse2zebra_attentiongan/latest_test/index.html.

Generating Images Using Pretrained Model

  • You need download a pretrained model (e.g., horse2zebra) with the following script:
sh ./scripts/download_attentiongan_model.sh horse2zebra
  • The pretrained model is saved at ./checkpoints/{name}_pretrained/latest_net_G.pth.
  • Then generate the result using
python test.py --dataroot ./datasets/horse2zebra --name horse2zebra_pretrained --model attention_gan --dataset_mode unaligned --norm instance --phase test --no_dropout --load_size 256 --crop_size 256 --batch_size 1 --gpu_ids 0 --num_test 5000 --epoch latest --saveDisk

The results will be saved at ./results/. Use --results_dir {directory_path_to_save_result} to specify the results directory. Note that if you want to save the intermediate results and have enough disk space, remove --saveDisk on the command line.

  • For your own experiments, you might want to specify --netG, --norm, --no_dropout to match the generator architecture of the trained model.

Image Translation with Geometric Changes Between Source and Target Domains

For instance, if you want to run experiments of Selfie to Anime Translation. Usage: replace attention_gan_model.py and networks with the ones in the AttentionGAN-geo folder.

Test the Pretrained Model

Download data and pretrained model according above instructions.

python test.py --dataroot ./datasets/selfie2anime/ --name selfie2anime_pretrained --model attention_gan --dataset_mode unaligned --norm instance --phase test --no_dropout --load_size 256 --crop_size 256 --batch_size 1 --gpu_ids 0 --num_test 5000 --epoch latest

Train a New Model

python train.py --dataroot ./datasets/selfie2anime/ --name selfie2anime_attentiongan --model attention_gan --dataset_mode unaligned --pool_size 50 --no_dropout --norm instance --lambda_A 10 --lambda_B 10 --lambda_identity 0.5 --load_size 286 --crop_size 256 --batch_size 4 --niter 100 --niter_decay 100 --gpu_ids 0 --display_id 0 --display_freq 100 --print_freq 100

Test the Trained Model

python test.py --dataroot ./datasets/selfie2anime/ --name selfie2anime_attentiongan --model attention_gan --dataset_mode unaligned --norm instance --phase test --no_dropout --load_size 256 --crop_size 256 --batch_size 1 --gpu_ids 0 --num_test 5000 --epoch latest

Evaluation Code

  • FID: Official Implementation
  • KID or Here: Suggested by UGATIT. Install Steps: conda create -n python36 pyhton=3.6 anaconda and pip install --ignore-installed --upgrade tensorflow==1.13.1. If you encounter the issue AttributeError: module 'scipy.misc' has no attribute 'imread', please do pip install scipy==1.1.0.

Citation

If you use this code for your research, please cite our papers.

@article{tang2019attentiongan,
  title={AttentionGAN: Unpaired Image-to-Image Translation using Attention-Guided Generative Adversarial Networks},
  author={Tang, Hao and Liu, Hong and Xu, Dan and Torr, Philip HS and Sebe, Nicu},
  journal={arXiv preprint arXiv:1911.11897},
  year={2019}
}

@inproceedings{tang2019attention,
  title={Attention-Guided Generative Adversarial Networks for Unsupervised Image-to-Image Translation},
  author={Tang, Hao and Xu, Dan and Sebe, Nicu and Yan, Yan},
  booktitle={International Joint Conference on Neural Networks (IJCNN)},
  year={2019}
}

Acknowledgments

This source code is inspired by CycleGAN, GestureGAN, and SelectionGAN.

Contributions

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]).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].