Challenge - 5 Problems
CNN Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output shape after Conv2D layer
Given the following TensorFlow code snippet for a CNN layer, what is the output shape of the tensor after the Conv2D layer?
TensorFlow
import tensorflow as tf input_tensor = tf.random.uniform([1, 64, 64, 3]) conv_layer = tf.keras.layers.Conv2D(filters=16, kernel_size=3, strides=2, padding='same') output_tensor = conv_layer(input_tensor) print(output_tensor.shape)
Attempts:
2 left
💡 Hint
Remember that padding='same' keeps the spatial size divided by stride.
✗ Incorrect
With padding='same' and stride=2, the output height and width are input size divided by stride, rounded up. So 64/2=32. The number of filters is 16, so output shape is (1, 32, 32, 16).
❓ Model Choice
intermediate1:30remaining
Choosing activation function for CNN output layer
You are building a CNN to classify images into 10 categories. Which activation function should you use in the output layer to get probabilities for each class?
Attempts:
2 left
💡 Hint
The output should represent probabilities that sum to 1.
✗ Incorrect
Softmax converts raw scores into probabilities that sum to 1, which is ideal for multi-class classification.
❓ Hyperparameter
advanced2:00remaining
Effect of increasing kernel size in Conv2D
In a CNN, what is the most likely effect of increasing the kernel size from 3x3 to 7x7 in the first Conv2D layer?
Attempts:
2 left
💡 Hint
Think about how kernel size affects receptive field and parameter count.
✗ Incorrect
Larger kernels cover more area, capturing bigger features but also increasing the number of parameters and computation cost.
❓ Metrics
advanced2:00remaining
Interpreting CNN training accuracy and loss
During CNN training for image classification, you observe training accuracy steadily increasing but validation accuracy plateaus and then decreases. What does this indicate?
Attempts:
2 left
💡 Hint
Think about what it means when training improves but validation worsens.
✗ Incorrect
When training accuracy improves but validation accuracy drops, the model memorizes training data and fails to generalize, which is overfitting.
🔧 Debug
expert2:30remaining
Identifying error in CNN model definition
What error will this TensorFlow CNN model code raise when run?
TensorFlow
import tensorflow as tf model = tf.keras.Sequential([ tf.keras.layers.Conv2D(32, kernel_size=3, activation='relu', input_shape=(28, 28, 1)), tf.keras.layers.MaxPooling2D(pool_size=2), tf.keras.layers.Flatten(), tf.keras.layers.Dense(10, activation='softmax') ]) model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
Attempts:
2 left
💡 Hint
Check the input_shape parameter for Conv2D layer.
✗ Incorrect
Conv2D expects input shape with 3 dimensions: height, width, and channels. Here channels dimension is missing.