Complete the code to import the TensorFlow library.
import [1] as tf
TensorFlow is imported as tf to build and train CNN models.
Complete the code to add a convolutional layer with 32 filters and kernel size 3.
model = tf.keras.Sequential([
tf.keras.layers.Conv2D([1], kernel_size=3, activation='relu', input_shape=(28, 28, 1))
])The convolutional layer uses 32 filters to detect visual patterns.
Fix the error in the code to compile the CNN model with Adam optimizer.
model.compile(optimizer='[1]', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
Adam optimizer is commonly used for training CNNs efficiently.
Fill both blanks to create a dictionary comprehension that maps each image to its label if the label is 0.
filtered_data = {img: label for img, label in dataset.items() if label [1] [2]The comprehension keeps images where the label equals 0, filtering for a specific class.
Fill all three blanks to create a dictionary of image sizes for images with width greater than 28.
image_sizes = {img: (width, height) for img, (width, height) in images.items() if width [1] [2] and height [3] 28}This filters images with width greater than 28 and height less than 28.