Challenge - 5 Problems
Python CV Ecosystem Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this OpenCV image shape code?
Given an image loaded with OpenCV, what will be the output of the shape attribute?
Computer Vision
import cv2 img = cv2.imread('sample.jpg') print(img.shape)
Attempts:
2 left
💡 Hint
OpenCV loads images as NumPy arrays with shape (rows, columns, channels).
✗ Incorrect
OpenCV loads images as NumPy arrays with shape (height, width, channels). The shape attribute returns a tuple in this order.
❓ Model Choice
intermediate2:00remaining
Which torchvision model is best for image classification on ImageNet?
You want to use a pretrained model from torchvision for classifying images into 1000 classes. Which model is designed specifically for this?
Attempts:
2 left
💡 Hint
Image classification models output class probabilities for fixed classes.
✗ Incorrect
ResNet50 is a standard image classification model pretrained on ImageNet with 1000 classes. The others are for segmentation, detection, or video tasks.
❓ Metrics
advanced2:00remaining
How to correctly compute accuracy for a torchvision classification model?
You have model outputs as logits and true labels as integers. Which code snippet correctly computes accuracy?
Attempts:
2 left
💡 Hint
Accuracy is the fraction of correct predictions over total samples.
✗ Incorrect
Option C correctly finds predicted classes by argmax over dimension 1, compares with labels, converts to float, averages, and extracts scalar.
🔧 Debug
advanced2:00remaining
Why does this PIL image conversion code raise an error?
Code snippet:
from PIL import Image
img = Image.open('photo.png')
img = img.convert('HSV')
Computer Vision
from PIL import Image img = Image.open('photo.png') img = img.convert('HSV')
Attempts:
2 left
💡 Hint
PIL supports specific modes like 'RGB', 'L', 'RGBA'.
✗ Incorrect
The convert method accepts 'HSV' as a valid mode in PIL, so no error is raised.
🧠 Conceptual
expert2:00remaining
What is the main difference between OpenCV and PIL in image processing?
Choose the statement that best describes a key difference between OpenCV and PIL libraries.
Attempts:
2 left
💡 Hint
Think about default color channel order in each library.
✗ Incorrect
OpenCV loads images in BGR order by default, while PIL uses RGB order. This often causes color confusion if not handled.