0
0
Computer Visionml~20 mins

Image augmentation transforms in Computer Vision - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Image Augmentation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:30remaining
Output of horizontal flip augmentation
What will be the shape and pixel value of the center pixel after applying a horizontal flip to this 3x3 grayscale image?
Computer Vision
import numpy as np
image = np.array([[10, 20, 30],
                  [40, 50, 60],
                  [70, 80, 90]])
flipped = np.fliplr(image)
center_pixel = flipped[1,1]
print(flipped.shape, center_pixel)
A(3, 3) 40
B(3, 3) 80
C(3, 3) 60
D(3, 3) 50
Attempts:
2 left
💡 Hint
Horizontal flip reverses columns but keeps rows the same.
Model Choice
intermediate
1:30remaining
Best augmentation for rotation invariance
Which image augmentation transform helps a model learn rotation invariance best?
ARandom rotation by angles between -30 and 30 degrees
BRandom brightness adjustment
CRandom horizontal flip
DRandom cropping
Attempts:
2 left
💡 Hint
Rotation invariance means the model should recognize objects even if rotated.
Hyperparameter
advanced
2:00remaining
Choosing brightness adjustment range
You want to augment images by adjusting brightness. Which brightness factor range is most reasonable to avoid unnatural images?
A[0.0, 3.0]
B[0.1, 2.0]
C[0.5, 1.5]
D[1.0, 5.0]
Attempts:
2 left
💡 Hint
Brightness factor 1 means no change; too low or too high values can distort images.
Metrics
advanced
2:00remaining
Effect of augmentation on validation accuracy
After adding random cropping augmentation during training, which effect on validation accuracy is most likely?
AValidation accuracy increases due to better generalization
BValidation accuracy fluctuates randomly without pattern
CValidation accuracy stays the same
DValidation accuracy decreases due to overfitting
Attempts:
2 left
💡 Hint
Augmentation usually helps models generalize better to unseen data.
🔧 Debug
expert
2:30remaining
Bug in augmentation pipeline code
What error will this code raise when applying a vertical flip using torchvision transforms on a PIL image?
Computer Vision
from torchvision import transforms
from PIL import Image

image = Image.new('RGB', (100, 100), color='red')
transform = transforms.RandomVerticalFlip(p=1.0)
augmented = transform(image)
print(type(augmented))
AAttributeError: 'RandomVerticalFlip' object has no attribute 'forward'
BNo error, prints <class 'PIL.Image.Image'>
CTypeError: 'RandomVerticalFlip' object is not callable
DRuntimeError: transform requires tensor input
Attempts:
2 left
💡 Hint
Check if RandomVerticalFlip works directly on PIL images.