DCGAN LSGAN WGAN-GP DRAGAN PyTorch

Overview

Recommendation

  • Our GAN based work for facial attribute editing - AttGAN.

News

  • 8 April 2019: We re-implement these GANs by Tensorflow 2! The old version is here: v1 or in the "v1" directory.
  • PyTorch Version


GANs - Tensorflow 2

Tensorflow 2 implementations of DCGAN, LSGAN, WGAN-GP and DRAGAN.

Exemplar results

Fashion-MNIST

DCGAN LSGAN WGAN-GP DRAGAN

CelebA

DCGAN LSGAN
WGAN-GP DRAGAN

Anime

WGAN-GP DRAGAN

Usage

  • Environment

    • Python 3.6

    • TensorFlow 2.2, TensorFlow Addons 0.10.0

    • OpenCV, scikit-image, tqdm, oyaml

    • we recommend Anaconda or Miniconda, then you can create the TensorFlow 2.2 environment with commands below

      conda create -n tensorflow-2.2 python=3.6
      
      source activate tensorflow-2.2
      
      conda install scikit-image tqdm tensorflow-gpu=2.2
      
      conda install -c conda-forge oyaml
      
      pip install tensorflow-addons==0.10.0
    • NOTICE: if you create a new conda environment, remember to activate it before any other command

      source activate tensorflow-2.2
  • Datasets

  • Examples of training

    • Fashion-MNIST DCGAN

      CUDA_VISIBLE_DEVICES=0 python train.py --dataset=fashion_mnist --epoch=25 --adversarial_loss_mode=gan
    • CelebA DRAGAN

      CUDA_VISIBLE_DEVICES=0 python train.py --dataset=celeba --epoch=25 --adversarial_loss_mode=gan --gradient_penalty_mode=dragan
    • Anime WGAN-GP

      CUDA_VISIBLE_DEVICES=0 python train.py --dataset=anime --epoch=200 --adversarial_loss_mode=wgan --gradient_penalty_mode=wgan-gp --n_d=5
    • see more training exampls in commands.sh

    • tensorboard for loss visualization

      tensorboard --logdir ./output/fashion_mnist_gan/summaries --port 6006
Comments
  • GPU is full

    GPU is full

    Hello, when the code runs, the memory is full. What happened? My python version is 3.6, tensorflow version is 1.11, my GPU is 1080ti, thanks! the error is as follow: An error ocurred while starting the kernel 2019󈚥󈚦 08:40:45.229298: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2019󈚥󈚦 08:40:45.601632: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1411] Found device 0 with properties: name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.582 pciBusID: 0000:65:00.0 totalMemory: 11.00GiB freeMemory: 9.10GiB 2019󈚥󈚦 08:40:45.603929: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1490] Adding visible gpu devices: 0 2019󈚥󈚦 08:40:46.556261: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] Device interconnect StreamExecutor with strength 1 edge matrix: 2019󈚥󈚦 08:40:46.558110: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] 0 2019󈚥󈚦 08:40:46.558407: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0: N 2019󈚥󈚦 08:40:46.558836: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1103] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 8789 MB memory) ‑> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:65:00.0, compute capability: 6.1)

    opened by lixingbao 9
  • About problem with generating image size

    About problem with generating image size

    Hello,can your code only generate 64×64 images? Can I generate an image of the specified size? For example: 256 × 256, if you can, what parameters need to be modified?thank you!

    opened by lixingbao 6
  • WGAN-GP does not work!!!

    WGAN-GP does not work!!!

    I have updated the code from TensorFlow 2.0-alpha to TensorFlow 2.0, everything works well except for WGAN-GP (it works in tf2.0-alpha). In tf2.0, The gradient penalty seems very unstable, but I cannot find out the problem. Does anybody help? I will be grateful.

    help wanted 
    opened by LynnHo 3
  • how about 3D data?

    how about 3D data?

    Hi!

    cartoon faces original size is [96, 96, 3],the number 3 means 3 channel RGB data. But if I have grayscale data with 3 slices, i.e the size is [121,145,3], Can I simply use this code? If not, what should I change based on this code?

    Thanks for your work! Look forward to your response.

    opened by KakaVlasic 3
  • c_iter isn't used

    c_iter isn't used

    c_iter is defined but not used in all of the WGAN files. What is the correct behaviour? i.e should the critic be optimised heavily initially or not?

    Also, can you confirm that you use a learning rate parameter of 0.0002, regardless of whether RMSProp or Adam is used as the optimiser?

    opened by davidADSP 3
  • About n_critic = 5

    About n_critic = 5

    i use the code whitch be used to train cartoon pictures with WGAN-GP. i don't know what the mean of n_critic = 5 , and why do you to set it. thanks.

    opened by tuoniaoren 3
  • Error while using celeba dataset

    Error while using celeba dataset

    I am getting this error while running train.py TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string. Please help with this. Thanks in advance

    opened by yksolanki9 2
  • Where do you freeze the gradient descent?

    Where do you freeze the gradient descent?

    Hello, I am confused about how do you freeze the gradient descent to the other model. When training d_step, I suppose the generator should be freezed, as f_logit is based on generator and used in d_loss; similarly, when training g_step, I suppose the discriminator should be freezed, as f_logit depens on discriminator.

    However, I do not see where you stop those gradients flowing to the unwanted part, either generator or discriminator. Would you please provide some hints for me? Thank you.

    opened by ybsave 2
  • do you try to use Resnet in wgan-gp?

    do you try to use Resnet in wgan-gp?

    Have you compared the difference between the network structure of DCGAN and the structure of Resnet in WGAN-GP?Is the effect of Resnet will be better than the structure of DCGAN.

    opened by tuoniaoren 2
  • running question

    running question

    do you meet the program stop without mistakes when the code running for some time ,and the GPU stops work.I changed the value of num_threads。(from 16 to 10)。i run it again.i don't know Is it because the value is too high。

    opened by tuoniaoren 2
  • License

    License

    Hi Zhenliang He, I wonder whether you would be willing to please license this code under an open source license? If so please add a license, or if not please just close this request. Thanks, Connelly

    opened by connellybarnes 2
  • A problem for your DCGAN architecture

    A problem for your DCGAN architecture

    Hi, - Your work is really interesting. But I have found there is a problem for your DCGAN that I didn't understand. You generate noise twice when train discriminator and generator for each iteration, like the blue lines in the following picture. In soumith code (includes some official DCGAN code), he only generate noise once: https://github.com/soumith/dcgan.torch. Could you please tell me the reason?

    image

    opened by RayGuo-C 1
  • NameError: name 'shape' is not defined

    NameError: name 'shape' is not defined

    Traceback (most recent call last): File "D:/github/DCGAN-LSGAN-WGAN-GP-DRAGAN-Tensorflow-2-master/DCGAN-LSGAN-WGAN-GP-DRAGAN-Tensorflow-2-master/train.py", line 91, in G = module.ConvGenerator(input_shape=(1, 1, args.z_dim), output_channels=shape[-1], n_upsamplings=n_G_upsamplings, name='G_%s' % args.dataset) NameError: name 'shape' is not defined please tell me why

    opened by Tonyztj 0
Releases(v1)
Owner
Zhenliang He
Zhenliang He
Official repository for the paper "Can You Learn an Algorithm? Generalizing from Easy to Hard Problems with Recurrent Networks"

Easy-To-Hard The official repository for the paper "Can You Learn an Algorithm? Generalizing from Easy to Hard Problems with Recurrent Networks". Gett

Avi Schwarzschild 52 Sep 08, 2022
Qlib is an AI-oriented quantitative investment platform

Qlib is an AI-oriented quantitative investment platform, which aims to realize the potential, empower the research, and create the value of AI technologies in quantitative investment.

Microsoft 10.1k Dec 30, 2022
Self-Supervised Monocular 3D Face Reconstruction by Occlusion-Aware Multi-view Geometry Consistency[ECCV 2020]

Self-Supervised Monocular 3D Face Reconstruction by Occlusion-Aware Multi-view Geometry Consistency(ECCV 2020) This is an official python implementati

304 Jan 03, 2023
Code for our ALiBi method for transformer language models.

Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation This repository contains the code and models for our paper Tra

Ofir Press 211 Dec 31, 2022
This code provides various models combining dilated convolutions with residual networks

Overview This code provides various models combining dilated convolutions with residual networks. Our models can achieve better performance with less

Fisher Yu 1.1k Dec 30, 2022
UFPR-ADMR-v2 Dataset

UFPR-ADMR-v2 Dataset The UFPR-ADMRv2 dataset contains 5,000 dial meter images obtained on-site by employees of the Energy Company of Paraná (Copel), w

Gabriel Salomon 8 Sep 29, 2022
Variational Attention: Propagating Domain-Specific Knowledge for Multi-Domain Learning in Crowd Counting (ICCV, 2021)

DKPNet ICCV 2021 Variational Attention: Propagating Domain-Specific Knowledge for Multi-Domain Learning in Crowd Counting Baseline of DKPNet is availa

19 Oct 14, 2022
This repository is based on Ultralytics/yolov5, with adjustments to enable rotate prediction boxes.

Rotate-Yolov5 This repository is based on Ultralytics/yolov5, with adjustments to enable rotate prediction boxes. Section I. Description The codes are

xinzelee 90 Dec 13, 2022
An original implementation of "MetaICL Learning to Learn In Context" by Sewon Min, Mike Lewis, Luke Zettlemoyer and Hannaneh Hajishirzi

MetaICL: Learning to Learn In Context This includes an original implementation of "MetaICL: Learning to Learn In Context" by Sewon Min, Mike Lewis, Lu

Meta Research 141 Jan 07, 2023
Official repository of the AAAI'2022 paper "Contrast and Generation Make BART a Good Dialogue Emotion Recognizer"

CoG-BART Contrast and Generation Make BART a Good Dialogue Emotion Recognizer Quick Start: To run the model on test sets of four datasets, Download th

39 Dec 24, 2022
RNG-KBQA: Generation Augmented Iterative Ranking for Knowledge Base Question Answering

RNG-KBQA: Generation Augmented Iterative Ranking for Knowledge Base Question Answering Authors: Xi Ye, Semih Yavuz, Kazuma Hashimoto, Yingbo Zhou and

Salesforce 72 Dec 05, 2022
data/code repository of "C2F-FWN: Coarse-to-Fine Flow Warping Network for Spatial-Temporal Consistent Motion Transfer"

C2F-FWN data/code repository of "C2F-FWN: Coarse-to-Fine Flow Warping Network for Spatial-Temporal Consistent Motion Transfer" (https://arxiv.org/abs/

EKILI 46 Dec 14, 2022
Download from Onlyfans.com.

OnlySave: Onlyfans downloader Getting Started: Download the setup executable from the latest release. Install and run. Only works on Windows currently

4 May 30, 2022
Reimplement of SimSwap training code

SimSwap-train Reimplement of SimSwap training code Instructions 1.Environment Preparation (1)Refer to the README document of SIMSWAP to configure the

seeprettyface.com 111 Dec 31, 2022
PyTorch implementation of DeepUME: Learning the Universal Manifold Embedding for Robust Point Cloud Registration (BMVC 2021)

DeepUME: Learning the Universal Manifold Embedding for Robust Point Cloud Registration [video] [paper] [supplementary] [data] [thesis] Introduction De

Natalie Lang 10 Dec 14, 2022
Record radiologists' eye gaze when they are labeling images.

Record radiologists' eye gaze when they are labeling images. Read for installation, usage, and deep learning examples. Why use MicEye Versatile As a l

24 Nov 03, 2022
A very simple tool for situations where optimization with onnx-simplifier would exceed the Protocol Buffers upper file size limit of 2GB, or simply to separate onnx files to any size you want.

sne4onnx A very simple tool for situations where optimization with onnx-simplifier would exceed the Protocol Buffers upper file size limit of 2GB, or

Katsuya Hyodo 10 Aug 30, 2022
Codes for TS-CAM: Token Semantic Coupled Attention Map for Weakly Supervised Object Localization.

TS-CAM: Token Semantic Coupled Attention Map for Weakly SupervisedObject Localization This is the official implementaion of paper TS-CAM: Token Semant

vasgaowei 112 Jan 02, 2023
Source code for GNN-LSPE (Graph Neural Networks with Learnable Structural and Positional Representations)

Graph Neural Networks with Learnable Structural and Positional Representations Source code for the paper "Graph Neural Networks with Learnable Structu

Vijay Prakash Dwivedi 180 Dec 22, 2022
My personal Home Assistant configuration.

About This is my personal Home Assistant configuration. My guiding princile is to have full local control of all my devices. I intend everything to ru

Chris Turra 13 Jun 07, 2022