Complete the code to apply random horizontal flip to images for data augmentation.
data_augmentation = tf.keras.Sequential([
tf.keras.layers.RandomFlip([1])
])The RandomFlip layer with 'horizontal' flips images left to right, which is a common augmentation.
Complete the code to add random rotation of 20% to the data augmentation pipeline.
data_augmentation = tf.keras.Sequential([
tf.keras.layers.RandomRotation([1])
])The RandomRotation layer expects a float between 0 and 1 representing fraction of 2π radians. 0.2 means 20% rotation.
Fix the error in the code to correctly apply random zoom augmentation.
data_augmentation = tf.keras.Sequential([
tf.keras.layers.RandomZoom(height_factor=[1])
])The height_factor must be a float between 0 and 1 representing zoom range. 0.1 means zoom in/out by 10%.
Fill both blanks to create a data augmentation pipeline with random flip and rotation.
data_augmentation = tf.keras.Sequential([
tf.keras.layers.RandomFlip([1]),
tf.keras.layers.RandomRotation([2])
])Use 'horizontal' for flipping and 0.2 for 20% rotation.
Fill all three blanks to build a data augmentation pipeline with flip, rotation, and zoom.
data_augmentation = tf.keras.Sequential([
tf.keras.layers.RandomFlip([1]),
tf.keras.layers.RandomRotation([2]),
tf.keras.layers.RandomZoom(height_factor=[3])
])The pipeline flips images horizontally, rotates by 20%, and zooms by 10%.