Challenge - 5 Problems
GAN Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateOutput of discriminator prediction on real images
Given a simple GAN discriminator model and a batch of real images, what is the shape of the output predictions?
TensorFlow
import tensorflow as tf from tensorflow.keras import layers def make_discriminator_model(): model = tf.keras.Sequential([ layers.Flatten(input_shape=(28, 28, 1)), layers.Dense(512, activation='relu'), layers.Dense(1, activation='sigmoid') ]) return model # Create discriminator D = make_discriminator_model() # Batch of 16 real images (28x28 grayscale) real_images = tf.random.normal([16, 28, 28, 1]) # Get predictions predictions = D(real_images) print(predictions.shape)
Attempts:
2 left
💡 Hint
The discriminator outputs one probability per input image.
✗ Incorrect
The discriminator outputs a single probability (shape 1) for each image in the batch. Since the batch size is 16, the output shape is (16, 1).
❓ Model Choice
intermediateChoosing the correct generator output shape
Which generator model architecture correctly outputs a 28x28 grayscale image from a 100-dimensional noise vector?
Attempts:
2 left
💡 Hint
The generator uses Conv2DTranspose layers to upscale from a small feature map to 28x28.
✗ Incorrect
Option A correctly starts from a dense layer to a small 7x7 feature map, then uses two Conv2DTranspose layers with stride 2 to upscale to 28x28, outputting 1 channel with tanh activation.
❓ Hyperparameter
advancedBest learning rate for GAN training stability
Which learning rate is most commonly recommended to start training a simple GAN with Adam optimizer for stable convergence?
Attempts:
2 left
💡 Hint
GANs usually require small learning rates to avoid instability.
✗ Incorrect
A learning rate of 0.0002 with Adam optimizer is a common default for GANs to balance learning speed and stability.
❓ Metrics
advancedInterpreting GAN discriminator loss during training
If the discriminator loss is close to 0.0 during GAN training, what does it indicate about the discriminator's performance?
Attempts:
2 left
💡 Hint
Low loss means the model is confident and correct.
✗ Incorrect
A discriminator loss near 0 means it is confidently and correctly classifying real and fake images, indicating strong performance.
🔧 Debug
expertIdentifying cause of mode collapse in GAN training
During GAN training, the generator produces very similar images repeatedly (mode collapse). Which cause is most likely responsible?
Attempts:
2 left
💡 Hint
Mode collapse often happens when the discriminator fails to challenge the generator.
✗ Incorrect
If the discriminator is too weak, it cannot push the generator to explore diverse outputs, causing mode collapse.
