0
0
Computer Visionml~10 mins

Training an image classifier in Computer Vision - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the necessary library for building a neural network model.

Computer Vision
from tensorflow import [1]
Drag options to blanks, or click blank then click option'
Akeras
Bpandas
Cnumpy
Dmatplotlib
Attempts:
3 left
💡 Hint
Common Mistakes
Importing unrelated libraries like pandas or matplotlib.
Trying to import tensorflow.keras as a separate package.
2fill in blank
medium

Complete the code to load the CIFAR-10 dataset for training and testing.

Computer Vision
(train_images, train_labels), (test_images, test_labels) = keras.datasets.cifar10.[1]()
Drag options to blanks, or click blank then click option'
Aget_dataset
Bfetch_data
Cload_data
Ddownload
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent functions like fetch_data or get_dataset.
Trying to call download() which is not a valid method here.
3fill in blank
hard

Fix the error in the model compilation step by completing the optimizer argument.

Computer Vision
model.compile(optimizer='[1]', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
Drag options to blanks, or click blank then click option'
Aadam
Brmsprop
Csgd
Drandom
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'random' which is not a valid optimizer.
Choosing 'sgd' without adjusting learning rate may slow training.
4fill in blank
hard

Fill both blanks to normalize the image pixel values between 0 and 1.

Computer Vision
train_images = train_images [1] 255.0
 test_images = test_images [2] 255.0
Drag options to blanks, or click blank then click option'
A/
B*
C-
D+
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication or subtraction instead of division.
Normalizing only train or only test images.
5fill in blank
hard

Fill all three blanks to define a simple CNN model with Conv2D, MaxPooling2D, and Dense layers.

Computer Vision
model = keras.Sequential([
    keras.layers.Conv2D(32, (3, 3), activation='relu', input_shape=[1]),
    keras.layers.MaxPooling2D([2]),
    keras.layers.Flatten(),
    keras.layers.Dense([3], activation='softmax')
])
Drag options to blanks, or click blank then click option'
A(32, 32, 3)
B(2, 2)
C10
D(3, 3)
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong input shape like (28, 28, 1).
Using incorrect pool size or missing it.
Setting output units to a wrong number.