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
Analysis code and Latex source of the manuscript describing the conditional permutation test of confounding bias in predictive modelling.

Git repositoty of the manuscript entitled Statistical quantification of confounding bias in predictive modelling by Tamas Spisak The manuscript descri

PNI - Predictive Neuroimaging Lab, University Hospital Essen, Germany 0 Nov 22, 2021
UnsupervisedR&R: Unsupervised Pointcloud Registration via Differentiable Rendering

UnsupervisedR&R: Unsupervised Pointcloud Registration via Differentiable Rendering This repository holds all the code and data for our recent work on

Mohamed El Banani 118 Dec 06, 2022
Library of various Few-Shot Learning frameworks for text classification

FewShotText This repository contains code for the paper A Neural Few-Shot Text Classification Reality Check Environment setup # Create environment pyt

Thomas Dopierre 47 Jan 03, 2023
Learning Tracking Representations via Dual-Branch Fully Transformer Networks

Learning Tracking Representations via Dual-Branch Fully Transformer Networks DualTFR ⭐ We achieves the runner-ups for both VOT2021ST (short-term) and

phiphi 19 May 04, 2022
A short and easy PyTorch implementation of E(n) Equivariant Graph Neural Networks

Simple implementation of Equivariant GNN A short implementation of E(n) Equivariant Graph Neural Networks for HOMO energy prediction. Just 50 lines of

Arsenii Senya Ashukha 97 Dec 23, 2022
A Joint Video and Image Encoder for End-to-End Retrieval

Frozen️ in Time ❄️ ️️️️ ⏳ A Joint Video and Image Encoder for End-to-End Retrieval project page | arXiv | webvid-data Repository containing the code,

225 Dec 25, 2022
vit for few-shot classification

Few-Shot ViT Requirements PyTorch (= 1.9) TorchVision timm (latest) einops tqdm numpy scikit-learn scipy argparse tensorboardx Pretrained Checkpoints

Martin Dong 26 Nov 30, 2022
Data from "HateCheck: Functional Tests for Hate Speech Detection Models" (Röttger et al., ACL 2021)

In this repo, you can find the data from our ACL 2021 paper "HateCheck: Functional Tests for Hate Speech Detection Models". "test_suite_cases.csv" con

Paul Röttger 43 Nov 11, 2022
Notification Triggers for Python

Notipyer Notification triggers for Python Send async email notifications via Python. Get updates/crashlogs from your scripts with ease. Installation p

Chirag Jain 17 May 16, 2022
A PyTorch implementation of ViTGAN based on paper ViTGAN: Training GANs with Vision Transformers.

ViTGAN: Training GANs with Vision Transformers A PyTorch implementation of ViTGAN based on paper ViTGAN: Training GANs with Vision Transformers. Refer

Hong-Jia Chen 127 Dec 23, 2022
Rewrite ultralytics/yolov5 v6.0 opencv inference code based on numpy, no need to rely on pytorch

Rewrite ultralytics/yolov5 v6.0 opencv inference code based on numpy, no need to rely on pytorch; pre-processing and post-processing using numpy instead of pytroch.

炼丹去了 21 Dec 12, 2022
This is the source code of the 1st place solution for segmentation task (with Dice 90.32%) in 2021 CCF BDCI challenge.

1st place solution in CCF BDCI 2021 ULSEG challenge This is the source code of the 1st place solution for ultrasound image angioma segmentation task (

Chenxu Peng 30 Nov 22, 2022
An open source AutoML toolkit for automate machine learning lifecycle, including feature engineering, neural architecture search, model compression and hyper-parameter tuning.

NNI Doc | 简体中文 NNI (Neural Network Intelligence) is a lightweight but powerful toolkit to help users automate Feature Engineering, Neural Architecture

Microsoft 12.4k Dec 31, 2022
Style transfer between images was performed using the VGG19 model

Style transfer between images was performed using the VGG19 model. The necessary codes, libraries and all other information of this project are available below

Onur yılmaz 2 May 09, 2022
[IJCAI'21] Deep Automatic Natural Image Matting

Deep Automatic Natural Image Matting [IJCAI-21] This is the official repository of the paper Deep Automatic Natural Image Matting. Introduction | Netw

Jizhizi_Li 316 Jan 06, 2023
NVIDIA Deep Learning Examples for Tensor Cores

NVIDIA Deep Learning Examples for Tensor Cores Introduction This repository provides State-of-the-Art Deep Learning examples that are easy to train an

NVIDIA Corporation 10k Dec 31, 2022
Practical Single-Image Super-Resolution Using Look-Up Table

Practical Single-Image Super-Resolution Using Look-Up Table [Paper] Dependency Python 3.6 PyTorch glob numpy pillow tqdm tensorboardx 1. Training deep

Younghyun Jo 116 Dec 23, 2022
Generalized Data Weighting via Class-level Gradient Manipulation

Generalized Data Weighting via Class-level Gradient Manipulation This repository is the official implementation of Generalized Data Weighting via Clas

18 Nov 12, 2022
A scikit-learn compatible neural network library that wraps PyTorch

A scikit-learn compatible neural network library that wraps PyTorch. Resources Documentation Source Code Examples To see more elaborate examples, look

4.9k Jan 03, 2023
Implementation of Pooling by Sliced-Wasserstein Embedding (NeurIPS 2021)

PSWE: Pooling by Sliced-Wasserstein Embedding (NeurIPS 2021) PSWE is a permutation-invariant feature aggregation/pooling method based on sliced-Wasser

Navid Naderializadeh 3 May 06, 2022