0
0
Computer Visionml~10 mins

Autoencoder for images 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
Bmatplotlib
Cnumpy
Dpandas
Attempts:
3 left
💡 Hint
Common Mistakes
Importing unrelated libraries like pandas or matplotlib.
Forgetting to import keras from tensorflow.
2fill in blank
medium

Complete the code to define the input shape for the autoencoder model.

Computer Vision
input_img = keras.Input(shape=[1])
Drag options to blanks, or click blank then click option'
A(28, 28, 1)
B(100,)
C(3, 224, 224)
D(None,)
Attempts:
3 left
💡 Hint
Common Mistakes
Using a flat vector shape like (100,) instead of image dimensions.
Using color image shape (3, 224, 224) which is incorrect here.
3fill in blank
hard

Fix the error in the code to compile the autoencoder model with the correct loss function.

Computer Vision
autoencoder.compile(optimizer='adam', loss='[1]')
Drag options to blanks, or click blank then click option'
Aprecision
Bmse
Ccategorical_crossentropy
Daccuracy
Attempts:
3 left
💡 Hint
Common Mistakes
Using classification losses like categorical_crossentropy.
Using metrics like accuracy or precision as loss.
4fill in blank
hard

Fill both blanks to create the encoder part of the autoencoder using convolution and pooling layers.

Computer Vision
x = keras.layers.Conv2D(32, (3, 3), activation='relu', padding='same')(input_img)
x = keras.layers.[1]((2, 2), padding='same')(x)
Drag options to blanks, or click blank then click option'
AFlatten
BDense
CDropout
DMaxPooling2D
Attempts:
3 left
💡 Hint
Common Mistakes
Using Dense or Flatten layers directly after Conv2D in encoder.
Using Dropout which is for regularization, not pooling.
5fill in blank
hard

Fill all three blanks to build the decoder part with upsampling and convolution layers to reconstruct the image.

Computer Vision
x = keras.layers.[1]((2, 2))(encoded)
x = keras.layers.Conv2D(32, (3, 3), activation='relu', padding='[2]')(x)
decoded = keras.layers.Conv2D(1, (3, 3), activation='[3]', padding='same')(x)
Drag options to blanks, or click blank then click option'
AMaxPooling2D
Bsame
Csigmoid
DUpSampling2D
Attempts:
3 left
💡 Hint
Common Mistakes
Using MaxPooling2D in decoder which reduces size instead of increasing.
Using relu activation in output layer instead of sigmoid.