0
0
TensorFlowml~10 mins

Data augmentation in pipeline in TensorFlow - Interactive Code Practice

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

Complete the code to add random flipping to the image augmentation pipeline.

TensorFlow
data_augmentation = tf.keras.Sequential([
    tf.keras.layers.RandomFlip([1])
])
Drag options to blanks, or click blank then click option'
A'none'
B'horizontal'
C'vertical'
D'horizontal_and_vertical'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'none' disables flipping, so no augmentation happens.
Choosing 'vertical' flips images upside down, which is less common.
2fill in blank
medium

Complete the code to add random rotation to the augmentation pipeline.

TensorFlow
data_augmentation = tf.keras.Sequential([
    tf.keras.layers.RandomRotation([1])
])
Drag options to blanks, or click blank then click option'
A0.2
B1.0
C2.0
D0.5
Attempts:
3 left
💡 Hint
Common Mistakes
Using values greater than 1 causes errors.
Using 0.5 rotates images too much, which may distort data.
3fill in blank
hard

Fix the error in the code to correctly normalize images in the pipeline.

TensorFlow
normalization_layer = tf.keras.layers.Rescaling([1])
Drag options to blanks, or click blank then click option'
A1/255
B255
C0.255
D255.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 255 multiplies pixel values, making them larger.
Using 0.255 is not the correct scale factor.
4fill in blank
hard

Fill both blanks to create a pipeline that randomly flips and normalizes images.

TensorFlow
data_augmentation = tf.keras.Sequential([
    tf.keras.layers.RandomFlip([1]),
    tf.keras.layers.Rescaling([2])
])
Drag options to blanks, or click blank then click option'
A'horizontal'
B'vertical'
C1/255
D255
Attempts:
3 left
💡 Hint
Common Mistakes
Using 255 for rescaling causes pixel values to increase.
Using 'vertical' flips images upside down, which is less common.
5fill in blank
hard

Fill all three blanks to build a pipeline that flips, rotates, and rescales images.

TensorFlow
data_augmentation = tf.keras.Sequential([
    tf.keras.layers.RandomFlip([1]),
    tf.keras.layers.RandomRotation([2]),
    tf.keras.layers.Rescaling([3])
])
Drag options to blanks, or click blank then click option'
A'horizontal'
B0.1
C1/255
D'vertical'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'vertical' flip instead of 'horizontal'.
Using rotation values greater than 1 causes errors.
Using 255 instead of 1/255 for rescaling.