0
0
TensorFlowml~20 mins

Feature map visualization in TensorFlow - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Feature Map Visualization Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output shape of feature maps after Conv2D layer
Given the following TensorFlow code snippet, what is the shape of the feature map output 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 = conv_layer(input_tensor)
output_shape = output.shape
print(output_shape)
A(1, 32, 32, 16)
B(1, 31, 31, 16)
C(1, 62, 62, 16)
D(1, 64, 64, 16)
Attempts:
2 left
💡 Hint
Remember that 'same' padding keeps the spatial dimensions divided by stride.
🧠 Conceptual
intermediate
1:30remaining
Purpose of feature map visualization in CNNs
What is the main purpose of visualizing feature maps in convolutional neural networks (CNNs)?
ATo increase the number of parameters in the model for better accuracy.
BTo reduce the size of the dataset before training the model.
CTo understand which parts of the input image activate certain filters and how the network processes features.
DTo convert the CNN into a fully connected network.
Attempts:
2 left
💡 Hint
Think about what feature maps represent in CNN layers.
Metrics
advanced
1:30remaining
Interpreting activation values in feature maps
In feature map visualization, what does a higher activation value in a specific spatial location generally indicate?
AThe model is overfitting to the training data.
BThe filter strongly detects a feature at that location in the input.
CThe input image has low contrast in that region.
DThe filter is not learning any useful features.
Attempts:
2 left
💡 Hint
Activation values represent how much a filter responds to input features.
🔧 Debug
advanced
2:00remaining
Identifying error in feature map extraction code
What error will occur when running this TensorFlow code to extract feature maps from a model?
TensorFlow
import tensorflow as tf
model = tf.keras.applications.VGG16(weights=None, include_top=False)
input_image = tf.random.uniform([1, 224, 224, 3])
layer_outputs = [layer.output for layer in model.layers if 'conv' in layer.name]
feature_map_model = tf.keras.Model(inputs=model.input, outputs=layer_outputs)
feature_maps = feature_map_model(input_image)
print(len(feature_maps))
ATypeError because layer.output is not a tensor.
BRuntimeError because the model was created without weights.
CValueError because model.layers contains layers without 'name' attribute.
DNo error; prints the number of convolutional layers.
Attempts:
2 left
💡 Hint
Check if all layers have a 'name' attribute and output tensor.
Model Choice
expert
2:30remaining
Best model type for detailed feature map visualization
Which model architecture is best suited for detailed feature map visualization to understand hierarchical feature extraction?
AA deep convolutional neural network with multiple convolutional and pooling layers.
BA recurrent neural network designed for sequence data.
CA simple logistic regression model with no hidden layers.
DA decision tree classifier with no convolutional layers.
Attempts:
2 left
💡 Hint
Consider which model type uses convolutional layers producing feature maps.