Challenge - 5 Problems
Image Augmentation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output shape after applying random flip augmentation
Consider the following TensorFlow code that applies a random horizontal flip to a batch of images. What is the shape of the output tensor?
TensorFlow
import tensorflow as tf images = tf.random.uniform([16, 64, 64, 3]) # batch of 16 images, 64x64 RGB augmented_images = tf.image.random_flip_left_right(images) output_shape = augmented_images.shape print(output_shape)
Attempts:
2 left
💡 Hint
The random flip changes pixel order but not the shape.
✗ Incorrect
The random_flip_left_right function flips images horizontally but does not change their shape or batch size. So the output shape remains (16, 64, 64, 3).
❓ Model Choice
intermediate2:00remaining
Choosing augmentation for small dataset
You have a small image dataset and want to reduce overfitting by augmenting data during training. Which augmentation technique is best suited to increase data variety without changing image content drastically?
Attempts:
2 left
💡 Hint
Think about preserving main image features while increasing variety.
✗ Incorrect
Random cropping with resizing keeps the main content but changes the framing, increasing variety without drastic content changes. Rotations by 90 degrees may be too rigid, color inversion changes semantics, and noise addition may harm learning.
❓ Metrics
advanced2:00remaining
Effect of augmentation on validation accuracy
A model is trained twice: once with data augmentation and once without. The validation accuracy with augmentation is 85%, without augmentation is 78%. What does this difference most likely indicate?
Attempts:
2 left
💡 Hint
Higher validation accuracy usually means better generalization.
✗ Incorrect
Data augmentation increases training data variety, helping the model generalize better and improving validation accuracy. Overfitting would lower validation accuracy, and data leakage would cause suspiciously high accuracy.
🔧 Debug
advanced2:00remaining
Debugging augmentation pipeline error
You run this TensorFlow code but get a runtime error. What is the cause?
```python
import tensorflow as tf
images = tf.random.uniform([8, 32, 32, 3])
augmented = tf.image.random_brightness(images, max_delta=0.5)
augmented = tf.image.random_flip_left_right(augmented)
augmented = tf.image.random_crop(augmented, size=[8, 28, 28, 3])
```
Attempts:
2 left
💡 Hint
Check the shape argument for random_crop carefully.
✗ Incorrect
tf.image.random_crop expects the size argument to exclude the batch dimension. Including batch size causes a runtime error. The batch dimension must be handled separately.
🧠 Conceptual
expert2:00remaining
Why use augmentation only on training data?
Why is data augmentation typically applied only to training images and not to validation or test images?
Attempts:
2 left
💡 Hint
Think about the purpose of validation and test sets.
✗ Incorrect
Augmentation increases training data diversity to improve learning. Validation and test sets must remain unchanged to fairly measure model performance on real, unaltered data.