0
0
Computer Visionml~20 mins

Geometric transforms (rotate, flip, crop) in Computer Vision - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Geometric Transform Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of rotating an image by 90 degrees clockwise
Given a 3x3 grayscale image represented as a 2D list, what is the output after rotating it 90 degrees clockwise?
Computer Vision
import numpy as np
image = np.array([[1,2,3],[4,5,6],[7,8,9]])
rotated = np.rot90(image, k=-1)
print(rotated.tolist())
A[[7,4,1],[8,5,2],[9,6,3]]
B[[9,8,7],[6,5,4],[3,2,1]]
C[[3,6,9],[2,5,8],[1,4,7]]
D[[1,2,3],[4,5,6],[7,8,9]]
Attempts:
2 left
💡 Hint
Rotating 90 degrees clockwise means columns become rows from bottom to top.
Model Choice
intermediate
1:30remaining
Choosing the correct transform for horizontal flip
Which numpy operation correctly flips a 2D image array horizontally?
Anp.transpose(image)
Bnp.flipud(image)
Cnp.rot90(image, k=2)
Dnp.fliplr(image)
Attempts:
2 left
💡 Hint
Horizontal flip means flipping left to right.
🔧 Debug
advanced
2:00remaining
Identify the error in cropping code
What error will this code raise when cropping a 2D image array?
Computer Vision
import numpy as np
image = np.arange(16).reshape(4,4)
cropped = image[1:3, 3:1]
print(cropped)
ATypeError: slice indices must be integers or None or have an __index__ method
BIndexError: slice indices must be increasing
CReturns an empty array with shape (2,0)
DSyntaxError due to invalid slice
Attempts:
2 left
💡 Hint
Check how slicing with start index greater than stop index behaves in numpy.
Hyperparameter
advanced
1:30remaining
Effect of interpolation parameter in rotation
When rotating an image using OpenCV's cv2.warpAffine, which interpolation method preserves the most image quality for small rotations?
Acv2.INTER_CUBIC
Bcv2.INTER_LINEAR
Ccv2.INTER_AREA
Dcv2.INTER_NEAREST
Attempts:
2 left
💡 Hint
Higher order interpolation methods produce smoother results.
Metrics
expert
2:30remaining
Evaluating effect of geometric transforms on classification accuracy
You apply random rotations and flips as data augmentation during training a CNN classifier. After training, which metric change best indicates the augmentation improved model generalization?
ATraining accuracy increases but validation accuracy decreases
BTraining accuracy decreases but validation accuracy increases
CBoth training and validation accuracy decrease
DBoth training and validation accuracy increase
Attempts:
2 left
💡 Hint
Good augmentation reduces overfitting, so training accuracy may drop but validation improves.