Challenge - 5 Problems
NMS Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of PyTorch NMS with overlapping boxes
Given the following bounding boxes and scores, what indices does PyTorch's non_max_suppression (NMS) return?
PyTorch
import torch from torchvision.ops import nms boxes = torch.tensor([[10, 10, 20, 20], [11, 11, 21, 21], [30, 30, 40, 40]], dtype=torch.float32) scores = torch.tensor([0.9, 0.8, 0.7]) iou_threshold = 0.5 keep_indices = nms(boxes, scores, iou_threshold) print(keep_indices.tolist())
Attempts:
2 left
💡 Hint
NMS keeps the highest scoring box and removes boxes with IoU above threshold.
✗ Incorrect
The first two boxes overlap with IoU > 0.5, so only the highest score box (index 0) is kept. The third box is far and kept as well.
🧠 Conceptual
intermediate1:30remaining
Purpose of Non-Maximum Suppression in Object Detection
What is the main purpose of applying Non-Maximum Suppression (NMS) in object detection pipelines?
Attempts:
2 left
💡 Hint
Think about why multiple boxes might appear around the same object.
✗ Incorrect
NMS removes overlapping boxes that likely represent the same object, keeping only the one with the highest confidence score.
❓ Hyperparameter
advanced1:30remaining
Effect of IoU Threshold on NMS Output
If you increase the IoU threshold parameter in NMS from 0.3 to 0.7, what is the expected effect on the number of bounding boxes kept?
Attempts:
2 left
💡 Hint
Higher IoU threshold means boxes need to overlap more to be suppressed.
✗ Incorrect
Increasing the IoU threshold means boxes must overlap more to be suppressed, so fewer boxes are removed and more are kept.
🔧 Debug
advanced2:00remaining
Identify the error in this NMS usage code
What error will this PyTorch code raise when running NMS?
PyTorch
import torch from torchvision.ops import nms boxes = torch.tensor([[10, 10, 20, 20], [15, 15, 25, 25]]) scores = [0.9, 0.8] iou_threshold = 0.5 keep = nms(boxes, scores, iou_threshold) print(keep)
Attempts:
2 left
💡 Hint
Check the data types required by torchvision.ops.nms.
✗ Incorrect
The scores argument must be a torch tensor, but here it is a Python list, causing a TypeError.
❓ Model Choice
expert2:30remaining
Choosing NMS variant for crowded scenes
In a crowded scene with many overlapping objects, which NMS variant is best to reduce missed detections while controlling duplicates?
Attempts:
2 left
💡 Hint
Consider methods that soften suppression to keep more true positives.
✗ Incorrect
Soft-NMS reduces scores of overlapping boxes instead of removing them, which helps keep true positives in crowded scenes.