Giter Club home page Giter Club logo

Comments (4)

eriklindernoren avatar eriklindernoren commented on July 27, 2024 4

Yeah, the implementations will in some cases not exactly mirror the ones described in the papers. Here is how I interpret the architecture described in the text you posted:

def build_generator(self):

  # Noise layer
  noise = Input(shape=(self.latent_dim,))
  noise_emb = Dense(200, activation='relu')(noise)      # out_shape: (batch_size, 200)

  # Label layer
  label = Input(shape=(self.num_classes+1,))
  label_emb = Dense(1000, activation='relu')(label)     # out_shape: (batch_size, 1000)

  # Joint layers
  merged = Concatenate()([noise_emb, label_emb])        # out_shape: (batch_size, 1200)
  combined_out = Dense(1200, activation='relu')(merged) # out_shape: (batch_size, 1200)
  img_flat = Dense(np.prod(self.img_shape), activation='sigmoid') \
                                (combined_out)          # out_shape: (batch_size, 784)
  img = Reshape(self.img_shape)(img_flat)               # out_shape: (batch_size, 28, 28, 1)


  return Model([noise, label], img)

The labels will have to be one-hot encoded before fed as input to the generator. self.num_classes will have to be set to 10 in the MNIST case.

from keras-gan.

andrearama avatar andrearama commented on July 27, 2024 2

Might I ask what exactly the main change is supposed to do, and the motivation of such choice?
I mean the line:
Flatten()(Embedding(self.num_classes, self.latent_dim)(label))

Thanks

from keras-gan.

miranthajayatilake avatar miranthajayatilake commented on July 27, 2024

Thanks a lot for this Erik! Exactly what I wanted to figure out! Keep up the great work.

from keras-gan.

OUARED-A avatar OUARED-A commented on July 27, 2024

Thanks a lot for this Erik!

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.