0
0
Computer Visionml~20 mins

Cropping images in Computer Vision - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cropping Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:30remaining
What is the shape of the cropped image?
Given a 100x100 RGB image represented as a NumPy array, what will be the shape of the cropped image after executing the following code?

cropped_img = img[20:70, 30:80]
Computer Vision
import numpy as np
img = np.zeros((100, 100, 3))
cropped_img = img[20:70, 30:80]
A(51, 51, 3)
B(50, 50, 3)
C(49, 49, 3)
D(50, 50)
Attempts:
2 left
💡 Hint
Remember that slicing in Python includes the start index but excludes the end index.
Model Choice
intermediate
1:30remaining
Choosing the best cropping method for data augmentation
You want to augment your image dataset by cropping random patches of size 64x64 from 256x256 images during training. Which method is best to implement this in a deep learning pipeline?
ARandomly select top-left coordinates and crop 64x64 patches on the fly during training.
BUse a fixed crop of the center 64x64 pixels for all images.
CResize images to 64x64 instead of cropping.
DCrop the bottom-right 64x64 pixels for all images.
Attempts:
2 left
💡 Hint
Data augmentation should introduce variety to help the model generalize.
Metrics
advanced
2:00remaining
Effect of cropping on model accuracy
You train two image classifiers on the same dataset. Model A uses full 128x128 images. Model B uses center-cropped 64x64 images. After training, Model A achieves 92% accuracy, Model B achieves 85%. What is the most likely reason for the accuracy drop in Model B?
AModel B used a different optimizer causing lower accuracy.
BCenter cropping introduced noise that confused the model.
CModel B was trained with fewer epochs than Model A.
DCropping reduced the amount of useful information available to the model.
Attempts:
2 left
💡 Hint
Think about what information might be lost when cropping images smaller.
🔧 Debug
advanced
1:30remaining
Why does this cropping code raise an error?
Consider this code snippet:

cropped = img[50:30, 20:70]

Why does this raise an error or produce an unexpected result?
Computer Vision
import numpy as np
img = np.zeros((100, 100, 3))
cropped = img[50:30, 20:70]
AThe start index is greater than the end index in the first slice, resulting in an empty array.
BThe slice syntax is invalid and causes a SyntaxError.
CThe image array does not have enough dimensions for this slicing.
DThe indices are out of bounds causing an IndexError.
Attempts:
2 left
💡 Hint
Check how Python slicing behaves when start > end.
🧠 Conceptual
expert
2:30remaining
Impact of cropping on convolutional neural network feature maps
When you crop input images before feeding them into a convolutional neural network (CNN), how does this affect the spatial dimensions of the feature maps in the early convolutional layers compared to using full images?
AFeature maps will be larger because cropping increases feature resolution.
BFeature maps will have the same spatial dimensions regardless of input size due to padding.
CFeature maps will have smaller spatial dimensions proportional to the cropped input size.
DFeature maps will be one-dimensional vectors after cropping.
Attempts:
2 left
💡 Hint
Consider how input size affects convolution output size.