Gans-in-action - Companion repository to GANs in Action: Deep learning with Generative Adversarial Networks
Overview
Comments
-
Chapter 4 output
I'm not sure if there's something misconfigured in my computer or what, but in every single run I'm getting this kind of outputs (very different from the proposed ones) and the resulting images are still noise.
1000 [D loss: 0.000010, acc.: 100.00%] [G loss: 0.025414] 2000 [D loss: 0.000516, acc.: 100.00%] [G loss: 0.012415] 3000 [D loss: 0.000217, acc.: 100.00%] [G loss: 0.012707] 4000 [D loss: 0.000276, acc.: 100.00%] [G loss: 0.015317] 5000 [D loss: 0.000011, acc.: 100.00%] [G loss: 0.004400] 6000 [D loss: 0.000001, acc.: 100.00%] [G loss: 0.000662] 7000 [D loss: 0.000000, acc.: 100.00%] [G loss: 0.000308] ...
Is there something to fix in the source code?
-
Release Ch9 CycleGAN in advance?
Hi, @vbok @jakubLangr ,
I had gone through ch9-nb, and would like to study the contents in details, could you release the contents of Ch9 CycleGAN on manning website in advance?
THX
-
need clarification for P.51
Hi, authors,
In page 51, it is mentioned as:
6. Use transposed convolution, transforming the 28x28x64 tensor into the output image size, 28x28x1.
However, according to Fig.4.2, it should be the following:
6. Use transposed convolution, transforming the 14x14x64 tensor into the output image size, 28x28x1.
Please clarify for this. THX!
-
Is it an error when train the generator in Chapter7 SGAN ?
The original code is:
# Train Generator g_loss = gan.train_on_batch(z, np.ones((batch_size, 1)))
But the generator generates fake images, so I think the input of gan.train_on_batch is fake=np.zeros((batch_size, 1))
# Train Generator g_loss = gan.train_on_batch(z, np.zeros((batch_size, 1)))
-
chapter4 DCGAN used tf.keras but could not produce same results
Hi, I am reading the chapter 4 of this book and there seem to be some problem. The code written in this book is from Keras but when I do the code I prefer to use tf.keras which should not be different. I implemented the code written in chapter 4 using tf.keras and I got strange result like the loss of discriminator and generator approached 0 and the acc. to 1. Also the result in image-grid is just noise. But when I removed the BathcNormalization layer out of both generator and discriminator, I got fine fake digit images. Any Idea why????
this is the colab containing the code https://colab.research.google.com/drive/1TF-nkPPkj0HAzKceb3UL_AzSdb-0DjKD?usp=sharing
-
Conditional GAN not working
I tried the cGAN code from Chapter 8 previously on April 9th on my computer, and it worked. But this is not working recently (a corresponding google colab link of the python notebook). Can you give any idea why it is not working? Or, can you share your current version of packages with which this code is working? !pip freeze from google colab is attached. Thank you.
-
chapter 4 noise diagrams
I use the colab environment to run it. keras or tensorflow.keras: 2.4.3 or 2.4.0. tensorflow: 2.4.1
The code is the same, but only noise diagrams appear after running. I tried replacing the optimiser with RMSprop and it also only produces noise diagrams
-
Chapter2 code
the below errors occurred when i ran the Chapter_2_Autoencoder.ipynb my env is the colab
Epoch 1/50
TypeError Traceback (most recent call last)
in () 2 shuffle=True, 3 epochs=epochs, ----> 4 batch_size=batch_size) 9 frames /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/func_graph.py in wrapper(*args, **kwargs) 975 except Exception as e: # pylint:disable=broad-except 976 if hasattr(e, "ag_error_metadata"): --> 977 raise e.ag_error_metadata.to_exception(e) 978 else: 979 raise
TypeError: in user code:
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py:805 train_function * return step_function(self, iterator) /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py:795 step_function ** outputs = model.distribute_strategy.run(run_step, args=(data,)) /usr/local/lib/python3.6/dist-packages/tensorflow/python/distribute/distribute_lib.py:1259 run return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs) /usr/local/lib/python3.6/dist-packages/tensorflow/python/distribute/distribute_lib.py:2730 call_for_each_replica return self._call_for_each_replica(fn, args, kwargs) /usr/local/lib/python3.6/dist-packages/tensorflow/python/distribute/distribute_lib.py:3417 _call_for_each_replica return fn(*args, **kwargs) /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py:788 run_step ** outputs = model.train_step(data) /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py:756 train_step y, y_pred, sample_weight, regularization_losses=self.losses) /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/compile_utils.py:238 __call__ total_loss_metric_value, sample_weight=batch_dim) /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/utils/metrics_utils.py:90 decorated update_op = update_state_fn(*args, **kwargs) /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/metrics.py:177 update_state_fn return ag_update_state(*args, **kwargs) /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/metrics.py:364 update_state ** sample_weight, values) /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/weights_broadcast_ops.py:155 broadcast_weights values = ops.convert_to_tensor(values, name="values") /usr/local/lib/python3.6/dist-packages/tensorflow/python/profiler/trace.py:163 wrapped return func(*args, **kwargs) /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py:1540 convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/constant_op.py:339 _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/constant_op.py:265 constant allow_broadcast=True) /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/constant_op.py:283 _constant_impl allow_broadcast=allow_broadcast)) /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/tensor_util.py:435 make_tensor_proto values = np.asarray(values) /usr/local/lib/python3.6/dist-packages/numpy/core/_asarray.py:83 asarray return array(a, dtype, copy=False, order=order) /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/keras_tensor.py:274 __array__ 'Cannot convert a symbolic Keras input/output to a numpy array. ' TypeError: Cannot convert a symbolic Keras input/output to a numpy array. This error may indicate that you're trying to pass a symbolic value to a NumPy call, which is not supported. Or, you may be trying to pass Keras symbolic inputs/outputs to a TF API that does not register dispatching, preventing Keras from automatically converting the API call to a lambda layer in the Functional Model.
-
Poor DCGAN (chapter 5) performance when upgrading from keras to tf.keras
I'm trying to run the DCGAN from chapter 5; the code performs well and the generated images are good.
But when I change the source code so that it becomes compatible with tf.keras rather than keras, the model produces useless images that are obviously just noise
The following is the only bit of the code I've changed. From:
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from keras.datasets import mnist from keras.layers import Activation, BatchNormalization, Dense, Dropout, Flatten, Reshape from keras.layers import LeakyReLU from keras.layers import Conv2D, Conv2DTranspose from keras.models import Sequential from keras.optimizers import Adam
to:
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from tensorflow.keras.datasets import mnist from tensorflow.keras.layers import Activation, BatchNormalization, Dense, Dropout, Flatten, Reshape from tensorflow.keras.layers import LeakyReLU from tensorflow.keras.layers import Conv2D, Conv2DTranspose from tensorflow.keras.models import Sequential from tensorflow.keras.optimizers import Adam
I've even tried to enforce tf_1 compatability with
tf.compat.v1.disable_v2_behavior()
but performance remains poor. Any ideas?
Owner
GANs in Action
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
PyTorch implementation of Advantage Actor Critic (A2C), Proximal Policy Optimization (PPO), Scalable trust-region method for deep reinforcement learning using Kronecker-factored approximation (ACKTR) and Generative Adversarial Imitation Learning (GAIL).
pytorch-a2c-ppo-acktr Update (April 12th, 2021) PPO is great, but Soft Actor Critic can be better for many continuous control tasks. Please check out
PyTorch implementation of Advantage Actor Critic (A2C), Proximal Policy Optimization (PPO), Scalable trust-region method for deep reinforcement learning using Kronecker-factored approximation (ACKTR) and Generative Adversarial Imitation Learning (GAIL).
PyTorch implementation of Advantage Actor Critic (A2C), Proximal Policy Optimization (PPO), Scalable trust-region method for deep reinforcement learning using Kronecker-factored approximation (ACKTR) and Generative Adversarial Imitation Learning (GAIL).
PyTorch implementation of "Learning to Discover Cross-Domain Relations with Generative Adversarial Networks"
DiscoGAN in PyTorch PyTorch implementation of Learning to Discover Cross-Domain Relations with Generative Adversarial Networks. * All samples in READM
Official implementation of "Learning to Discover Cross-Domain Relations with Generative Adversarial Networks"
DiscoGAN Official PyTorch implementation of Learning to Discover Cross-Domain Relations with Generative Adversarial Networks. Prerequisites Python 2.7
Semi-supervised Representation Learning for Remote Sensing Image Classification Based on Generative Adversarial Networks
SSRL-for-image-classification Semi-supervised Representation Learning for Remote Sensing Image Classification Based on Generative Adversarial Networks
Commonality in Natural Images Rescues GANs: Pretraining GANs with Generic and Privacy-free Synthetic Data - Official PyTorch Implementation (CVPR 2022)
Commonality in Natural Images Rescues GANs: Pretraining GANs with Generic and Privacy-free Synthetic Data (CVPR 2022) Potentials of primitive shapes f
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-
[ICLR 2021, Spotlight] Large Scale Image Completion via Co-Modulated Generative Adversarial Networks
Large Scale Image Completion via Co-Modulated Generative Adversarial Networks, ICLR 2021 (Spotlight) Demo | Paper [NEW!] Time to play with our interac
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 (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 Jungil Kong, Jaehyeon Kim, Jaekyoung Bae In our paper, we p
π-GAN: Periodic Implicit Generative Adversarial Networks for 3D-Aware Image Synthesis
π-GAN: Periodic Implicit Generative Adversarial Networks for 3D-Aware Image Synthesis Project Page | Paper | Data Eric Ryan Chan*, Marco Monteiro*, Pe
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.
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
Image Deblurring using Generative Adversarial Networks
DeblurGAN arXiv Paper Version Pytorch implementation of the paper DeblurGAN: Blind Motion Deblurring Using Conditional Adversarial Networks. Our netwo
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
Partial implementation of ODE-GAN technique from the paper Training Generative Adversarial Networks by Solving Ordinary Differential Equations
ODE GAN (Prototype) in PyTorch Partial implementation of ODE-GAN technique from the paper Training Generative Adversarial Networks by Solving Ordinary
Pytorch implementation for reproducing StackGAN_v2 results in the paper StackGAN++: Realistic Image Synthesis with Stacked Generative Adversarial Networks
StackGAN-v2 StackGAN-v1: Tensorflow implementation StackGAN-v1: Pytorch implementation Inception score evaluation Pytorch implementation for reproduci