All Projects → Prinsphield → Dna Gan

Prinsphield / Dna Gan

Licence: mit
DNA-GAN: Learning Disentangled Representations from Multi-Attribute Images

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Dna Gan

Pytorch Cyclegan And Pix2pix
Image-to-Image Translation in PyTorch
Stars: ✭ 16,477 (+25249.23%)
Mutual labels:  generative-adversarial-network, image-manipulation
Faceswap Gan
A denoising autoencoder + adversarial losses and attention mechanisms for face swapping.
Stars: ✭ 3,099 (+4667.69%)
Mutual labels:  generative-adversarial-network, image-manipulation
Finegan
FineGAN: Unsupervised Hierarchical Disentanglement for Fine-grained Object Generation and Discovery
Stars: ✭ 240 (+269.23%)
Mutual labels:  generative-adversarial-network, image-manipulation
Tsit
[ECCV 2020 Spotlight] A Simple and Versatile Framework for Image-to-Image Translation
Stars: ✭ 141 (+116.92%)
Mutual labels:  generative-adversarial-network, image-manipulation
Igan
Interactive Image Generation via Generative Adversarial Networks
Stars: ✭ 3,845 (+5815.38%)
Mutual labels:  generative-adversarial-network, image-manipulation
Genegan
GeneGAN: Learning Object Transfiguration and Attribute Subspace from Unpaired Data
Stars: ✭ 142 (+118.46%)
Mutual labels:  generative-adversarial-network, image-manipulation
UEGAN
[TIP2020] Pytorch implementation of "Towards Unsupervised Deep Image Enhancement with Generative Adversarial Network"
Stars: ✭ 68 (+4.62%)
Mutual labels:  generative-adversarial-network, image-manipulation
Cyclegan
Software that can generate photos from paintings, turn horses into zebras, perform style transfer, and more.
Stars: ✭ 10,933 (+16720%)
Mutual labels:  generative-adversarial-network, image-manipulation
Anycost Gan
[CVPR 2021] Anycost GANs for Interactive Image Synthesis and Editing
Stars: ✭ 367 (+464.62%)
Mutual labels:  generative-adversarial-network, image-manipulation
Selectiongan
[CVPR 2019 Oral] Multi-Channel Attention Selection GAN with Cascaded Semantic Guidance for Cross-View Image Translation
Stars: ✭ 366 (+463.08%)
Mutual labels:  generative-adversarial-network, image-manipulation
Focal Frequency Loss
Focal Frequency Loss for Generative Models
Stars: ✭ 141 (+116.92%)
Mutual labels:  generative-adversarial-network, image-manipulation
Image To Image Papers
🦓<->🦒 🌃<->🌆 A collection of image to image papers with code (constantly updating)
Stars: ✭ 949 (+1360%)
Mutual labels:  generative-adversarial-network, image-manipulation
Gesturegan
[ACM MM 2018 Oral] GestureGAN for Hand Gesture-to-Gesture Translation in the Wild
Stars: ✭ 136 (+109.23%)
Mutual labels:  generative-adversarial-network, image-manipulation
Cocosnet
Cross-domain Correspondence Learning for Exemplar-based Image Translation. (CVPR 2020 Oral)
Stars: ✭ 211 (+224.62%)
Mutual labels:  generative-adversarial-network, image-manipulation
Gandissect
Pytorch-based tools for visualizing and understanding the neurons of a GAN. https://gandissect.csail.mit.edu/
Stars: ✭ 1,700 (+2515.38%)
Mutual labels:  generative-adversarial-network, image-manipulation
gan tensorflow
Automatic feature engineering using Generative Adversarial Networks using TensorFlow.
Stars: ✭ 48 (-26.15%)
Mutual labels:  generative-adversarial-network, representation-learning
Lggan
[CVPR 2020] Local Class-Specific and Global Image-Level Generative Adversarial Networks for Semantic-Guided Scene Generation
Stars: ✭ 97 (+49.23%)
Mutual labels:  generative-adversarial-network, image-manipulation
Mgan
Masking GAN - Image attribute mask generation
Stars: ✭ 120 (+84.62%)
Mutual labels:  generative-adversarial-network, image-manipulation
Deep Generative Prior
Code for deep generative prior (ECCV2020 oral)
Stars: ✭ 308 (+373.85%)
Mutual labels:  generative-adversarial-network, image-manipulation
Contrastive Unpaired Translation
Contrastive unpaired image-to-image translation, faster and lighter training than cyclegan (ECCV 2020, in PyTorch)
Stars: ✭ 822 (+1164.62%)
Mutual labels:  generative-adversarial-network, image-manipulation

DNA-GAN: Learning Disentangled Representations from Multi-Attribute Images

By Taihong Xiao, Jiapeng Hong and Jinwen Ma

If you find it useful, please cite our paper.

@article{xiao2018dna,
  title={DNA-GAN: Learning Disentangled Representations from Multi-Attribute Images},
  author={Xiao, Taihong and Hong, Jiapeng and Ma, Jinwen},
  journal={International Conference on Learning Representations, Workshop},
  year={2018}
}

Note the code in this repo is not optimized for speed. A more efficient Pytorch version for higher resolution images will be released soon. Please stay tuned!  I have developed a new method ELEGANT for better performance and efficiency, please visit here.

Introduction

This repo is the official TensorFlow implementation for our paper DNA-GAN: Learning Disentangled Representations from Multi-Attribute Images (OpenReview, ArXiv). DNA-GAN is a supervised method for disentangling multiple factors of variation simultaneously by using multi-attribute images. It can manipulate several attributes in the latent representations of images, which is a generalization of GeneGAN. However, DNA-GAN replaces the explicit nulling loss with the annihilating operation and employes a single discriminator for guiding images generation on multiple attributes.

DNA-GAN Framework

A and B are two images with different label at i-th position. Through an encoder, we can obtain two DNA pieces (latent representations). By the annihilating the recessive pattern and swapping two pieces, we could obtain another two DNA pieces. Therefore, we could obtain four images through an decoder. The reconstruction loss is used to ensure the consistency between A1 and A, B1 and B. The adversarial discriminator loss helps generate novel images A2 and B2. Through iterative training, DNA-GAN is able to disentangle all factors of variations.

Requirement

  • Python 2.7 or 3.5
  • TensorFlow 1.3 or higher
  • OpenCV 3.2

Training DNA-GAN on CelebA Dataset

  1. Download celebA dataset and unzip it into datasets directory. There are various source providers for CelebA datasets. To ensure that the size of downloaded images is correct, please run identify datasets/celebA/data/000001.jpg. The size should be 409 x 687 if you are using the same dataset. Besides, please ensure that you have the following directory tree structure in your repo.
├── datasets
│   └── celebA
│       ├── data
│       ├── list_attr_celeba.txt
│       └── list_landmarks_celeba.txt
  1. Run python preprocess.py. It will take only few minutes to preprocess all images. A new directory datasets/celebA/align_5p will be created.

  2. Run python create_tfrecords.py to obtain tfrecords files.

  3. Run python train.py -a Bangs Eyeglasses -g 0 to train DNA-GAN with respect to two attributes Bangs and Eyeglasses simultaneuously. You can play with other attributes as well. Please refer to list_attr_celeba.txt for all available attributes.

  4. Run tensorboard --logdir=./train_log/logs --port=6006 to watch your training process.

Manipulating Multiple Attributes

We provided three kinds of mode for your manipulating. Run python test.py -h for detailed help.

1. Interpolation on One Attribute

You can also interpolating the process of adding eyeglasses to one person by running

python test.py -m interpolation -a Bangs Eyeglasses --swap_list 1 -i input_img.jpg -t target_img.jpg -n 5

--swap_list gives the indices of attributes to do interpolation. -n 5 gives the interpolation length.

interpolation interpolation
Interpolation on Eyeglasses

2. Matrix Interpolation on One Attributes

What if I want to change my hairstyle everyday? No problem. Take your selfie as input, and several hair models as targets images.

python test.py -m matrix -a Bangs Eyeglasses --swap_list 0 -i input_img.jpg --targets target_img0.jpg -target_img1.jpg target_img2.jpg target_img3.jpg -s 5 5

Which hairstyle suits you best?

four_matrix
Interpolation on different Bangs

3. Interpolation on Two Attributes

The most amazing thing is that we can interpolating two attributes in the same time.

python test.py -m interpolation2 -a Bangs Eyeglasses --swap_list 0 1 -i input_img.jpg --targets target_img0.jpg target_img1.jpg -s 5 5
interpolation2
Interpolation on Bangs and Eyeglasses

For more interpolation results, please refer to our paper.

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