Coder Social home page Coder Social logo

Comments (5)

obh5pq avatar obh5pq commented on June 10, 2024 2

I encountered the same issue with InfoGAN

On the tensorflow page for BatchNormalization it says that there was a behavioral change between TF 1.x and 2

setting trainable = False on the layer means that the layer will be subsequently run in inference mode [...] This behavior only occurs as of TensorFlow 2.0. In 1.*, setting layer.trainable = False would freeze the layer but would not switch it to inference mode.

Changing the import statement for BatchNormalization to

from tensorflow.compat.v1.keras.layers import BatchNormalization

Seems to fix the issue and produces the output you'd expect (at least, in InfoGAN's case).

Note: To get the InfoGAN example script to run on the current TF build, the import statements needed to be changed to

from tensorflow.keras.datasets import mnist
from tensorflow.keras.layers import Input, Dense, Reshape, Flatten, Dropout
from tensorflow.keras.layers import Activation, Embedding, ZeroPadding2D, Lambda
from tensorflow.compat.v1.keras.layers import BatchNormalization
from tensorflow.keras.layers import LeakyReLU
from tensorflow.keras.layers import UpSampling2D, Conv2D
from tensorflow.keras.models import Sequential, Model
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.utils import to_categorical
import tensorflow.keras.backend as K

from keras-gan.

Ayan-Vishwakarma avatar Ayan-Vishwakarma commented on June 10, 2024

In the book, they did not actually explicitly wrote the learning rate. The typical learning rate for RmsProp is 0.0002 Or 0.00005 as seen in most of the papers. This may be one of the problem as dcgan require learning rate tuning.

from keras-gan.

leeprinxin avatar leeprinxin commented on June 10, 2024

In the book, they did not actually explicitly wrote the learning rate. The typical learning rate for RmsProp is 0.0002 Or 0.00005 as seen in most of the papers. This may be one of the problem as dcgan require learning rate tuning.

I finally solved this problem.
I have tried to downgrade keras to version 2.3.1 and it was working.
But I don't know why keras 2.4.3 is generating noise

from keras-gan.

LiuZhipeng99 avatar LiuZhipeng99 commented on June 10, 2024

I also tried this tutorial and found that it would help to add parameters here
model.add(BatchNormalization(momentum=0.8))

from keras-gan.

thusinh1969 avatar thusinh1969 commented on June 10, 2024

Use Spectral Normalization on top of CONV2D of Discriminator will stabilize the training greatly. Also, pay attention to kernel_initializer (glorot_normal etc...)

from keras-gan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.