All Projects → sagiebenaim → Distancegan

sagiebenaim / Distancegan

Licence: other
Pytorch implementation of "One-Sided Unsupervised Domain Mapping" NIPS 2017

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Distancegan

Oneshottranslation
Pytorch implementation of "One-Shot Unsupervised Cross Domain Translation" NIPS 2018
Stars: ✭ 135 (-25%)
Mutual labels:  gan, unsupervised-learning, image-generation, image-manipulation
automatic-manga-colorization
Use keras.js and cyclegan-keras to colorize manga automatically. All computation in browser. Demo is online:
Stars: ✭ 20 (-88.89%)
Mutual labels:  gan, image-manipulation, image-generation
Pytorch Cyclegan And Pix2pix
Image-to-Image Translation in PyTorch
Stars: ✭ 16,477 (+9053.89%)
Mutual labels:  gan, image-generation, image-manipulation
Pix2pix
Image-to-image translation with conditional adversarial nets
Stars: ✭ 8,765 (+4769.44%)
Mutual labels:  gan, image-generation, image-manipulation
Exprgan
Facial Expression Editing with Controllable Expression Intensity
Stars: ✭ 98 (-45.56%)
Mutual labels:  gan, image-generation, image-manipulation
Lggan
[CVPR 2020] Local Class-Specific and Global Image-Level Generative Adversarial Networks for Semantic-Guided Scene Generation
Stars: ✭ 97 (-46.11%)
Mutual labels:  gan, image-generation, image-manipulation
Awesome-ICCV2021-Low-Level-Vision
A Collection of Papers and Codes for ICCV2021 Low Level Vision and Image Generation
Stars: ✭ 163 (-9.44%)
Mutual labels:  gan, image-manipulation, image-generation
Tsit
[ECCV 2020 Spotlight] A Simple and Versatile Framework for Image-to-Image Translation
Stars: ✭ 141 (-21.67%)
Mutual labels:  gan, image-generation, image-manipulation
Focal Frequency Loss
Focal Frequency Loss for Generative Models
Stars: ✭ 141 (-21.67%)
Mutual labels:  gan, image-generation, image-manipulation
UEGAN
[TIP2020] Pytorch implementation of "Towards Unsupervised Deep Image Enhancement with Generative Adversarial Network"
Stars: ✭ 68 (-62.22%)
Mutual labels:  gan, image-manipulation, unsupervised-learning
Hidt
Official repository for the paper "High-Resolution Daytime Translation Without Domain Labels" (CVPR2020, Oral)
Stars: ✭ 513 (+185%)
Mutual labels:  gan, unsupervised-learning, image-generation
Anycost Gan
[CVPR 2021] Anycost GANs for Interactive Image Synthesis and Editing
Stars: ✭ 367 (+103.89%)
Mutual labels:  gan, image-generation, image-manipulation
Cyclegan
Software that can generate photos from paintings, turn horses into zebras, perform style transfer, and more.
Stars: ✭ 10,933 (+5973.89%)
Mutual labels:  gan, image-generation, image-manipulation
Semantic Object Accuracy For Generative Text To Image Synthesis
Code for "Semantic Object Accuracy for Generative Text-to-Image Synthesis" (TPAMI 2020)
Stars: ✭ 78 (-56.67%)
Mutual labels:  gan, image-generation
Ganspace
Discovering Interpretable GAN Controls [NeurIPS 2020]
Stars: ✭ 1,224 (+580%)
Mutual labels:  gan, image-generation
Dcgan Tensorflow
A Tensorflow implementation of Deep Convolutional Generative Adversarial Networks trained on Fashion-MNIST, CIFAR-10, etc.
Stars: ✭ 70 (-61.11%)
Mutual labels:  gan, image-generation
Neural Doodle
Turn your two-bit doodles into fine artworks with deep neural networks, generate seamless textures from photos, transfer style from one image to another, perform example-based upscaling, but wait... there's more! (An implementation of Semantic Style Transfer.)
Stars: ✭ 9,680 (+5277.78%)
Mutual labels:  image-generation, image-manipulation
Mlds2018spring
Machine Learning and having it Deep and Structured (MLDS) in 2018 spring
Stars: ✭ 124 (-31.11%)
Mutual labels:  gan, image-generation
Hypergan
Composable GAN framework with api and user interface
Stars: ✭ 1,104 (+513.33%)
Mutual labels:  gan, unsupervised-learning
Gandissect
Pytorch-based tools for visualizing and understanding the neurons of a GAN. https://gandissect.csail.mit.edu/
Stars: ✭ 1,700 (+844.44%)
Mutual labels:  gan, image-manipulation

DistanceGAN

Pytorch implementation of "One-Sided Unsupervised Domain Mapping" (arxiv). The implementation is based on the architectures of both DiscoGAN and CycleGAN.

Prerequisites

  • Python 2.7
  • Pytorch 0.1.12
  • Numpy/Scipy/Pandas
  • Progressbar
  • OpenCV
  • visdom
  • dominate

Distance Model based on DiscoGAN architecture

Download dataset

Download dataset [edges2shoes, edges2handbags, facecurb]: python datasets/download.py $DATASET_NAME. Use ./datasets/combine_A_and_B.py to create handbags2shoes dataset.

Download seperately: celebA dataset, car dataset used in Deep Visual Analogy-Making and head/face dataset. Then extract into ./datasets folder.

CelebA training (Male to Female, Blond to Black hair, With Eyeglasses to Without Eyeglasses)

Male to Female: python ./discogan_arch/distance_gan_model.py --task_name='celebA' --style_A='Male'

Blond to Black hair: python ./discogan_arch/distance_gan_model.py --task_name='celebA' --task_name='celebA' --style_A='Blond_Hair' --style_B='Black_Hair' --constraint='Male' --constraint_type=-1

Eyeglasses to Without Eyeglasses: python ./discogan_arch/distance_gan_model.py --task_name='celebA' --style_A='Eyeglasses' --constraint='Male' --constraint_type=1

Edges, Handbags and Shoes (Edges to Shoes, Edges to Handbags, Shoes to Handbags)

Edges to Shoes: python ./discogan_arch/distance_gan_model.py --task_name='edges2shoes' --num_layers=3

Edges to Handbags: python ./discogan_arch/distance_gan_model.py --task_name='edges2handbags' --num_layers=3

Shoes to Handbags: python ./discogan_arch/distance_gan_model.py --task_name='handbags2shoes' --starting_rate=0.5

Car, Head/Face (Car to Car, Car to Head/Face, Head/Face to Head/Face)

Car to Car: python ./discogan_arch/distance_gan_angle_pairing_model.py --task_name='car2car'

Head/Face to Head/Face: python ./discogan_arch/distance_gan_angle_pairing_model.py --task_name='face2face'

Car to Head/Face: python ./discogan_arch/distance_gan_angle_pairing_model.py --task_no ame='car2face'

Options

Add following flags to python command as follows:

To train from A to B only: --model_arch=distance_A_to_B. To train from B to A only: --model_arch=distance_B_to_A.

To add reconstruction/cycle loss to distance loss: --use_reconst_loss.

To use self distance instead of regular distance:--use_self_distance.

To avoid normalizing distances: --unnormalized_distances.

To change number of items used for expectation and std calculation: --max_items=NUM.

Additional options can be found in ./discogan_arch/discogan_arch_options/options.py

Sample Results

Male to Female (First row is input and Second row is output):

Blond to Black Hair:

With to Without Eyeglasses:

Edges to Shoes:

Shoes to Edges:

Handbags to Shoes:

Car to Car:

Car to Head:

Distance Model based on CycleGAN architecture

Horse to Zebra:

Dataset: python datasets/download.py horse2zebra

Train: python train.py --dataroot ./datasets/horse2zebra --name horse2zebra_distancegan --model distance_gan

Test: python test.py --dataroot ./datasets/horse2zebra --name horse2zebra_distancegan --model distance_gan --phase test

Results saved in ./results/horse2zebra_distancegan/latest_test/index.html. Loss results and plots: 'run python -m visdom.server' and navigate to http://localhost:8097 (For other options see pytorch-CycleGAN-and-pix2pix)

Options:

To train from A to B only: --A_to_B.

To train from B to A only: --B_to_A.

To add reconstruction/cycle loss to distance loss: --use_cycle_loss.

To change weights of distance loss: --lambda_distance_A=NUM, --lambda_distance_B=NUM.

--use_self_distance, --unnormalized_distances, --max-items=NUM are as above.

Additional options can be found in ./cyclegan_arch/cyclegan_based_options.

MNIST to SVHN:

python ./cyclegan_arch/mnist_to_svhn/main.py --use_distance_loss=True --use_reconst_loss=False --use_self_distance=False

Change above flags as required.

Sample Results

Horse to Zebra:

SVHN to MNIST:

Reference

If you found this code useful, please cite the following paper:

@inproceedings{Benaim2017OneSidedUD,
  title={One-Sided Unsupervised Domain Mapping},
  author={Sagie Benaim and Lior Wolf},
  booktitle={NIPS},
  year={2017}
}

Acknowledgements

This project has received funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant ERC CoG 725974).

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