0
$\begingroup$

I'm using Tensorflow to feed a DCGAN 3000 320x320 colored images of cars. The goal is to generate new cars. I've been training on Google Colab for the past 10 hours or so. I guess I can expect results soon but since this is one of my first GAN attempts, I was wondering if there's a way to optimize the layer hyperparameters on both models. Here are both of my model structures:

GENERATOR:

model = tf.keras.Sequential()
model.add(layers.Dense(20*20*128, use_bias=False, input_shape=(100,)))
model.add(layers.BatchNormalization())
model.add(layers.ReLU())

model.add(layers.Reshape((20, 20, 128)))
assert model.output_shape == (None, 20, 20, 128)

model.add(layers.Conv2DTranspose(128, (6, 6), strides=(1, 1), padding='same', use_bias=False))
assert model.output_shape == (None, 20, 20, 128)
model.add(layers.BatchNormalization())
model.add(layers.ReLU())

model.add(layers.Conv2DTranspose(64, (6, 6), strides=(2, 2), padding='same', use_bias=False))
assert model.output_shape == (None, 40, 40, 64)
model.add(layers.BatchNormalization())
model.add(layers.ReLU())

model.add(layers.Conv2DTranspose(32, (6, 6), strides=(2, 2), padding='same', use_bias=False))
assert model.output_shape == (None, 80, 80, 32)
model.add(layers.BatchNormalization())
model.add(layers.ReLU())

model.add(layers.Conv2DTranspose(16, (6, 6), strides=(2, 2), padding='same', use_bias=False))
assert model.output_shape == (None, 160, 160, 16)
model.add(layers.BatchNormalization())
model.add(layers.ReLU())

model.add(layers.Conv2DTranspose(3, (6, 6), strides=(2, 2), padding='same', use_bias=False, activation='tanh'))
assert model.output_shape == (None, 320, 320, 3)

DISCRIMINATOR:

model = tf.keras.Sequential()
model.add(layers.Conv2D(64, (6, 6), strides=(2, 2), padding='same', input_shape=[320, 320, 3]))
model.add(layers.LeakyReLU())
model.add(layers.Dropout(0.3))

model.add(layers.Conv2D(128, (6, 6), strides=(2, 2), padding='same'))
model.add(layers.LeakyReLU())
model.add(layers.Dropout(0.3))

model.add(layers.Conv2D(256, (6, 6), strides=(2, 2), padding='same'))
model.add(layers.LeakyReLU())
model.add(layers.Dropout(0.3))

model.add(layers.Conv2D(512, (6, 6), strides=(2, 2), padding='same'))
model.add(layers.LeakyReLU())
model.add(layers.Dropout(0.3))

model.add(layers.Flatten())
model.add(layers.Dense(1))

Is there a way to make them better by increasing the number of convolutions, convolution size... considering the fact that I have 3000 320x320 colored images of cars?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.