Unsupervised Image to Image Translation with Generative Adversarial Networks

Overview

Unsupervised Image to Image Translation with Generative Adversarial Networks

Paper: Unsupervised Image to Image Translation with Generative Adversarial Networks

Requirements

  • TensorFlow 1.0.0
  • TensorLayer 1.3.11
  • CUDA 8
  • Ubuntu

Dataset

  • Before training the network, please prepare the data
  • CelebA download
  • Cropped SVHN download
  • MNIST download, and put to data/mnist_png

Usage

Step 1: Learning shared feature

python3 train.py --train_step="ac_gan" --retrain=1

Step 2: Learning image encoder

python3 train.py --train_step="imageEncoder" --retrain=1

Step 3: Translation

python3 translate_image.py
  • Samples of all steps will be saved to data/samples/

Network

Want to use different datasets?

  • in train.py and translate_image.py modify the name of dataset flags.DEFINE_string("dataset", "celebA", "The name of dataset [celebA, obama_hillary]")
  • write your own data_loader in data_loader.py
You might also like...
The pytorch implementation of  DG-Font: Deformable Generative Networks for Unsupervised Font Generation
The pytorch implementation of DG-Font: Deformable Generative Networks for Unsupervised Font Generation

DG-Font: Deformable Generative Networks for Unsupervised Font Generation The source code for 'DG-Font: Deformable Generative Networks for Unsupervised

Minimal PyTorch implementation of Generative Latent Optimization from the paper
Minimal PyTorch implementation of Generative Latent Optimization from the paper "Optimizing the Latent Space of Generative Networks"

Minimal PyTorch implementation of Generative Latent Optimization This is a reimplementation of the paper Piotr Bojanowski, Armand Joulin, David Lopez-

Regularizing Generative Adversarial Networks under Limited Data (CVPR 2021)
Regularizing Generative Adversarial Networks under Limited Data (CVPR 2021)

Regularizing Generative Adversarial Networks under Limited Data [Project Page][Paper] Implementation for our GAN regularization method. The proposed r

NR-GAN: Noise Robust Generative Adversarial Networks
NR-GAN: Noise Robust Generative Adversarial Networks

NR-GAN: Noise Robust Generative Adversarial Networks (CVPR 2020) This repository provides PyTorch implementation for noise robust GAN (NR-GAN). NR-GAN

HiFi-GAN: Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis
HiFi-GAN: Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis

HiFi-GAN: Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis Jungil Kong, Jaehyeon Kim, Jaekyoung Bae In our paper, we p

Generating Anime Images by Implementing Deep Convolutional Generative Adversarial Networks paper
Generating Anime Images by Implementing Deep Convolutional Generative Adversarial Networks paper

AnimeGAN - Deep Convolutional Generative Adverserial Network PyTorch implementation of DCGAN introduced in the paper: Unsupervised Representation Lear

Unofficial implementation of Alias-Free Generative Adversarial Networks. (https://arxiv.org/abs/2106.12423) in PyTorch
Unofficial implementation of Alias-Free Generative Adversarial Networks. (https://arxiv.org/abs/2106.12423) in PyTorch

alias-free-gan-pytorch Unofficial implementation of Alias-Free Generative Adversarial Networks. (https://arxiv.org/abs/2106.12423) This implementation

PyTorch implementations of Generative Adversarial Networks.
PyTorch implementations of Generative Adversarial Networks.

This repository has gone stale as I unfortunately do not have the time to maintain it anymore. If you would like to continue the development of it as

Code for the paper "TadGAN: Time Series Anomaly Detection Using Generative Adversarial Networks"

TadGAN: Time Series Anomaly Detection Using Generative Adversarial Networks This is a Python3 / Pytorch implementation of TadGAN paper. The associated

Comments
  • Where can I get “obama_hillary” dataset

    Where can I get “obama_hillary” dataset

    I’m adaping your code

    Now I’m tring to replacement faces

    Is “obama_hillary” is custom dataset? Or public dataset

    Let me know where can I get “obama_hillary”

    Thanks.

    opened by dreamegg 0
  • What is the version of tensorflow?

    What is the version of tensorflow?

    Hi,donghao, I am running this project but I find there are so many errors at the beginning of my training, e.g. Traceback (most recent call last): File "train.py", line 362, in tf.app.run() File "/home/zzw/Program/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "train.py", line 355, in main train_ac_gan() File "train.py", line 98, in train_ac_gan g_loss_fake = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(d_logits_fake, tf.ones_like(d_logits_fake))) File "/home/zzw/Program/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/nn_impl.py", line 149, in sigmoid_cross_entropy_with_logits labels, logits) File "/home/zzw/Program/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/nn_ops.py", line 1512, in _ensure_xent_args "named arguments (labels=..., logits=..., ...)" % name) ValueError: Only call sigmoid_cross_entropy_with_logits with named arguments (labels=..., logits=..., ...)

    I guess these errors are due to differences between mine and yours,so could you please tell me what is your version of tensorflow?

    opened by zzw1123 3
  • Is the output image size of 256 x 256 an option – or is just 64 x 64 px possible?

    Is the output image size of 256 x 256 an option – or is just 64 x 64 px possible?

    Hey it's me again, browsing through your other repos i found this gem – seems fun! A few months ago i've tested another gender swap network written in TF, but the output resolution was hardcoded and i couldn't figure out how to change it (with my limited knowledge of TF). Your version again seems a lot easier to read – due to the usage of the Tensorlayer library?

    I'm using the celebA dataset and have left all thetf.flags by default. So the default image size is 64 x 64px but i've seen that you've also written quite a few lines in train.py and model.py for a 256 x 256px option.

    if FLAGS.image_size == 64:
        generator = model.generator
        discriminator = model.discriminator
        imageEncoder = model.imageEncoder
    # elif FLAGS.image_size == 256:
    #     generator = model.generator_256
    #     discriminator = model.discriminator_256
    #     imageEncoder = model.imageEncoder_256
    else:
        raise Exception("image_size should be 64 or 256")
    
    ################## 256x256x3
    def generator_256(inputs, is_train=True, reuse=False):
    (...)
    def discriminator_256(inputs, is_train=True, reuse=False):
    (...)
    

    Since the second if-statement (elif FLAGS.image_size == 256:) is commented out and never changes the default 64x64px model generator and encoder, setting flags.DEFINE_integer("image_size", ...) in train.py to 256 doesn't really change the size - is this correct?

    I've tried to uncomment the code and enable the elif line but then ran into this error: ValueError: Shapes (64, 64, 64, 256) and (64, 32, 32, 256) are not compatible

    You've added generator_256, discriminator_256 and imageEncoder_256 to model.py so i'm wondering if you just have just experimented with this image size and then discarded the option (and just left the 64x64 image_size option) or if i'm missing something here...

    There is also a commented out flag for output_size – but this variable doesn't show up anywhere else so i guess it's from a previous version of your code: # flags.DEFINE_integer("output_size", 64, "The size of the output images to produce [64]")

    And this one is also non-functional: # flags.DEFINE_integer("train_size", np.inf, "The size of train images [np.inf]")


    I just wondered if it's possible to crank up the training and output resolution to 256x256px (and maybe finish the training process this year – when i get my 1080 Ti 😎).

    Will try to finish the 64x64px first and save the model-.npz files for later, but it would be interesting to know if the mentioned portions of your code are still functional.

    Thanks!

    opened by subzerofun 1
Releases(0.3)
Owner
Hao
Assistant Professor @ Peking University
Hao
StudioGAN is a Pytorch library providing implementations of representative Generative Adversarial Networks (GANs) for conditional/unconditional image generation.

StudioGAN is a Pytorch library providing implementations of representative Generative Adversarial Networks (GANs) for conditional/unconditional image generation.

null 3k Jan 8, 2023
[ICLR 2021, Spotlight] Large Scale Image Completion via Co-Modulated Generative Adversarial Networks

Large Scale Image Completion via Co-Modulated Generative Adversarial Networks, ICLR 2021 (Spotlight) Demo | Paper [NEW!] Time to play with our interac

Shengyu Zhao 373 Jan 2, 2023
π-GAN: Periodic Implicit Generative Adversarial Networks for 3D-Aware Image Synthesis

π-GAN: Periodic Implicit Generative Adversarial Networks for 3D-Aware Image Synthesis Project Page | Paper | Data Eric Ryan Chan*, Marco Monteiro*, Pe

null 375 Dec 31, 2022
Image Deblurring using Generative Adversarial Networks

DeblurGAN arXiv Paper Version Pytorch implementation of the paper DeblurGAN: Blind Motion Deblurring Using Conditional Adversarial Networks. Our netwo

Orest Kupyn 2.2k Jan 1, 2023
Pytorch implementation for reproducing StackGAN_v2 results in the paper StackGAN++: Realistic Image Synthesis with Stacked Generative Adversarial Networks

StackGAN-v2 StackGAN-v1: Tensorflow implementation StackGAN-v1: Pytorch implementation Inception score evaluation Pytorch implementation for reproduci

Han Zhang 809 Dec 16, 2022
Flickr-Faces-HQ (FFHQ) is a high-quality image dataset of human faces, originally created as a benchmark for generative adversarial networks (GAN)

Flickr-Faces-HQ Dataset (FFHQ) Flickr-Faces-HQ (FFHQ) is a high-quality image dataset of human faces, originally created as a benchmark for generative

NVIDIA Research Projects 2.9k Dec 28, 2022
Semi-supervised Representation Learning for Remote Sensing Image Classification Based on Generative Adversarial Networks

SSRL-for-image-classification Semi-supervised Representation Learning for Remote Sensing Image Classification Based on Generative Adversarial Networks

Feng 2 Nov 19, 2021
Multi-View Consistent Generative Adversarial Networks for 3D-aware Image Synthesis (CVPR2022)

Multi-View Consistent Generative Adversarial Networks for 3D-aware Image Synthesis Multi-View Consistent Generative Adversarial Networks for 3D-aware

Xuanmeng Zhang 78 Dec 10, 2022
Code for Dual Contrastive Learning for Unsupervised Image-to-Image Translation, NTIRE, CVPRW 2021.

arXiv Dual Contrastive Learning Adversarial Generative Networks (DCLGAN) We provide our PyTorch implementation of DCLGAN, which is a simple yet powerf

null 119 Dec 4, 2022
Unsupervised Image-to-Image Translation

UNIT: UNsupervised Image-to-image Translation Networks Imaginaire Repository We have a reimplementation of the UNIT method that is more performant. It

Ming-Yu Liu 劉洺堉 1.9k Dec 26, 2022