Challenge - 5 Problems
Cropping Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1: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]
Attempts:
2 left
💡 Hint
Remember that slicing in Python includes the start index but excludes the end index.
✗ Incorrect
The slice 20:70 includes indices from 20 up to 69, which is 50 pixels. Similarly, 30:80 includes 50 pixels. The third dimension (color channels) remains 3.
❓ Model Choice
intermediate1: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?
Attempts:
2 left
💡 Hint
Data augmentation should introduce variety to help the model generalize.
✗ Incorrect
Random cropping during training creates diverse inputs, improving model robustness. Fixed crops or resizing reduce variability.
❓ Metrics
advanced2: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?
Attempts:
2 left
💡 Hint
Think about what information might be lost when cropping images smaller.
✗ Incorrect
Cropping to smaller patches removes parts of the image that might contain important features, reducing model performance.
🔧 Debug
advanced1:30remaining
Why does this cropping code raise an error?
Consider this code snippet:
Why does this raise an error or produce an unexpected result?
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]
Attempts:
2 left
💡 Hint
Check how Python slicing behaves when start > end.
✗ Incorrect
Python slicing returns an empty array if the start index is greater than the end index; it does not raise an error.
🧠 Conceptual
expert2: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?
Attempts:
2 left
💡 Hint
Consider how input size affects convolution output size.
✗ Incorrect
Convolutional layers produce feature maps whose spatial size depends on input size, kernel size, stride, and padding. Smaller inputs produce smaller feature maps.