Complete the code to add random flipping to the image augmentation pipeline.
data_augmentation = tf.keras.Sequential([
tf.keras.layers.RandomFlip([1])
])The RandomFlip layer flips images horizontally when set to 'horizontal'.
Complete the code to add random rotation to the augmentation pipeline.
data_augmentation = tf.keras.Sequential([
tf.keras.layers.RandomRotation([1])
])The RandomRotation layer takes a float representing the fraction of 2π radians for max rotation. 0.2 means up to 20% of 360° rotation.
Fix the error in the code to correctly normalize images in the pipeline.
normalization_layer = tf.keras.layers.Rescaling([1])The Rescaling layer expects a scale factor to multiply the input. Dividing by 255 normalizes pixel values to [0,1].
Fill both blanks to create a pipeline that randomly flips and normalizes images.
data_augmentation = tf.keras.Sequential([
tf.keras.layers.RandomFlip([1]),
tf.keras.layers.Rescaling([2])
])RandomFlip with 'horizontal' flips images left-right. Rescaling with 1/255 normalizes pixel values.
Fill all three blanks to build a pipeline that flips, rotates, and rescales images.
data_augmentation = tf.keras.Sequential([
tf.keras.layers.RandomFlip([1]),
tf.keras.layers.RandomRotation([2]),
tf.keras.layers.Rescaling([3])
])This pipeline flips images horizontally, rotates them up to 10% of 360°, and normalizes pixel values.