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
Learning Dense Representations of Phrases at Scale (Lee et al., 2020)

DensePhrases DensePhrases provides answers to your natural language questions from the entire Wikipedia in real-time. While it efficiently searches th

Princeton Natural Language Processing 540 Dec 30, 2022
ActNN: Reducing Training Memory Footprint via 2-Bit Activation Compressed Training

ActNN : Activation Compressed Training This is the official project repository for ActNN: Reducing Training Memory Footprint via 2-Bit Activation Comp

UC Berkeley RISE 178 Jan 05, 2023
The code for SAG-DTA: Prediction of Drug–Target Affinity Using Self-Attention Graph Network.

SAG-DTA The code is the implementation for the paper 'SAG-DTA: Prediction of Drug–Target Affinity Using Self-Attention Graph Network'. Requirements py

Shugang Zhang 7 Aug 02, 2022
Cluttered MNIST Dataset

Cluttered MNIST Dataset A setup script will download MNIST and produce mnist/*.t7 files: luajit download_mnist.lua Example usage: local mnist_clutter

DeepMind 50 Jul 12, 2022
Code for "On Memorization in Probabilistic Deep Generative Models"

On Memorization in Probabilistic Deep Generative Models This repository contains the code necessary to reproduce the experiments in On Memorization in

The Alan Turing Institute 3 Jun 09, 2022
A curated list of neural network pruning resources.

A curated list of neural network pruning and related resources. Inspired by awesome-deep-vision, awesome-adversarial-machine-learning, awesome-deep-learning-papers and Awesome-NAS.

Yang He 1.7k Jan 09, 2023
Subnet Replacement Attack: Towards Practical Deployment-Stage Backdoor Attack on Deep Neural Networks

Subnet Replacement Attack: Towards Practical Deployment-Stage Backdoor Attack on Deep Neural Networks Official implementation of paper Towards Practic

Xiangyu Qi 8 Dec 30, 2022
9th place solution in "Santa 2020 - The Candy Cane Contest"

Santa 2020 - The Candy Cane Contest My solution in this Kaggle competition "Santa 2020 - The Candy Cane Contest", 9th place. Basic Strategy In this co

toshi_k 22 Nov 26, 2021
PyTorch implementation of "LayoutTransformer: Layout Generation and Completion with Self-attention"

PyTorch implementation of "LayoutTransformer: Layout Generation and Completion with Self-attention" to appear in ICCV 2021

Kamal Gupta 75 Dec 23, 2022
[CVPR 2021] "Multimodal Motion Prediction with Stacked Transformers": official code implementation and project page.

mmTransformer Introduction This repo is official implementation for mmTransformer in pytorch. Currently, the core code of mmTransformer is implemented

DeciForce: Crossroads of Machine Perception and Autonomy 232 Dec 31, 2022
Official implementation of UTNet: A Hybrid Transformer Architecture for Medical Image Segmentation

UTNet (Accepted at MICCAI 2021) Official implementation of UTNet: A Hybrid Transformer Architecture for Medical Image Segmentation Introduction Transf

110 Jan 01, 2023
Project Tugas Besar pertama Pengenalan Komputasi Institut Teknologi Bandung

Vending_Machine_(Mesin_Penjual_Minuman) Project Tugas Besar pertama Pengenalan Komputasi Institut Teknologi Bandung Raw Sketch untuk Essay Ringkasan P

QueenLy 1 Nov 08, 2021
ThunderGBM: Fast GBDTs and Random Forests on GPUs

Documentations | Installation | Parameters | Python (scikit-learn) interface What's new? ThunderGBM won 2019 Best Paper Award from IEEE Transactions o

Xtra Computing Group 647 Jan 04, 2023
Lorien: A Unified Infrastructure for Efficient Deep Learning Workloads Delivery

Lorien: A Unified Infrastructure for Efficient Deep Learning Workloads Delivery Lorien is an infrastructure to massively explore/benchmark the best sc

Amazon Web Services - Labs 45 Dec 12, 2022
Bayesian optimization in PyTorch

BoTorch is a library for Bayesian Optimization built on PyTorch. BoTorch is currently in beta and under active development! Why BoTorch ? BoTorch Prov

2.5k Dec 31, 2022
Event sourced bank - A wide-and-shallow example using the Python event sourcing library

Event Sourced Bank A "wide but shallow" example of using the Python event sourci

3 Mar 09, 2022
Toolbox of models, callbacks, and datasets for AI/ML researchers.

Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch Website • Installation • Main

Pytorch Lightning 1.4k Dec 30, 2022
A Python package to create, run, and post-process MODFLOW-based models.

Version 3.3.5 — release candidate Introduction FloPy includes support for MODFLOW 6, MODFLOW-2005, MODFLOW-NWT, MODFLOW-USG, and MODFLOW-2000. Other s

388 Nov 29, 2022
🔮 A refreshing functional take on deep learning, compatible with your favorite libraries

Thinc: A refreshing functional take on deep learning, compatible with your favorite libraries From the makers of spaCy, Prodigy and FastAPI Thinc is a

Explosion 2.6k Dec 30, 2022
A public available dataset for road boundary detection in aerial images

Topo-boundary This is the official github repo of paper Topo-boundary: A Benchmark Dataset on Topological Road-boundary Detection Using Aerial Images

Zhenhua Xu 79 Jan 04, 2023