Giter Club home page Giter Club logo

aggan's Introduction

celeba result Comparison with different baselines on CelebA dataset.

bu3dfe result Comparison with different baselines on Bu3dfe dataset.

Attention-Guided GANs (AGGAN) for Unsupervised Image-to-Image Translation

Visualization of Attention Mask and Content Mask

Visualization

AGGAN Framework

AGGAN Framework

Attention-Guided Generative Adversarial Networks for Unsupervised Image-to-Image Translation. arXiv Paper
Hao Tang1, Dan Xu2, Nicu Sebe1, Yan Yan3.
1University of Trento, Italy, 2University of Oxford, UK, 3Texas State University, USA
In IJCNN 2019 (Oral)
The repository offers the implementation of our paper in PyTorch.

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

Prerequisites

Code is intended to work with Python 3.6.x, it hasn't been tested with previous versions.

Follow the instructions in pytorch.org for your current setup.

Note: Make sure that your PyTorch's version is 0.3.1. Later I will update it to 0.4 if I have time.

To plot loss graphs and draw images in a nice web browser view

pip3 install visdom

Training & Testing

1. Setup the dataset

First, you will need to build your datasets by setting up the following directory structure:

.
├── datasets                   
|   ├── <dataset_name>         # i.e., bu3dfe_neutral2happiness
|   |   ├── train              # Training
|   |   |   ├── A              # Contains domain A images (i.e., neutral)
|   |   |   └── B              # Contains domain B images (i.e., happiness)
|   |   └── test               # Testing
|   |   |   ├── A              # Contains domain A images (i.e., neutral)
|   |   |   └── B              # Contains domain B images (i.e., happiness)

Examples of the dataset is shown in this folder

2. Training

export CUDA_VISIBLE_DEVICES=X; 
python train.py --dataroot datasets/<dataset_name>/ --save_name <save_name> --cuda

This command will start a training session using the images under the dataroot/train directory with the default hyperparameters. You are free to change those hyperparameters, see ./train --help for a description of those.

Both generators and discriminators weights will be saved under the output directory.

If you don't own a GPU remove the --cuda option, although I advise you to get one!

You can also view the training progress as well as live output images by running python3 -m visdom in another terminal and opening http://localhost:8097/ in your favourite web browser.

3. Testing

python test.py --dataroot datasets/<dataset_name>/ --save_name <save_name> --cuda

This command will take the images under the dataroot/test directory, run them through the generators and save the output under the output/A and output/B directories. As with train, some parameters like the weights to load, can be tweaked, see ./test --help for more information.

Code Structure

  • train.py, test.py: the entry point for training and testing.
  • models.py: defines the architecture of all models for AGGAN
  • datasets.py: defines the class for loading images.
  • utils.py: consists of several helper functions.

Citation

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

@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 borrows heavily from CycleGAN. We acknowledge the National Institute of Standards and Technology Grant 60NANB17D191 for funding this research. We also acknowledge the gift donation from Cisco, Inc for this research.

Related Projects (Image-to-Image Translation)

1. Supervised image-to-image translation methods.

Pix2pix
SelectionGAN
Pix2pixHD
SPADE
BiCycleGAN
Encoder-Decoder

2. Unsupervised image-to-image translation methods.

CycleGAN
DiscoGAN
DualGAN
DistancGAN
ComboGAN
StarGAN

3. Label-, mask- or attention-guided image translation methods.

IcGAN
GANimation
Unsupervised-Attention-guided-Image-to-Image-Translation
InstaGAN

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.