In object detection, the key metric is Intersection over Union (IoU). It measures how well the predicted box matches the true object box. A higher IoU means the model localizes the object more accurately. Along with IoU, mean Average Precision (mAP) is used to evaluate both detection and localization quality together. These metrics matter because detection is not just about saying "there is an object" but also showing exactly where it is in the image.
Why detection localizes objects in images in Computer Vision - Why Metrics Matter
True Positive (TP): Correctly detected and localized objects (IoU > threshold)
False Positive (FP): Detected boxes with no matching true object or low IoU
False Negative (FN): True objects missed by the detector
Example confusion matrix for detection:
| Detected Object | No Detection |
-----------|-----------------|--------------|
Object | TP | FN |
No Object | FP | TN |
Note: TN (True Negative) is less meaningful in detection because the background is large.
Precision means when the model says "object here," it is usually right. High precision means few false alarms.
Recall means the model finds most of the objects present. High recall means few missed objects.
For example, in self-driving cars, missing a pedestrian (low recall) is dangerous, so recall is critical. But too many false alarms (low precision) can also confuse the system.
Balancing precision and recall depends on the use case. IoU thresholds affect this balance: a higher IoU threshold demands more accurate localization, which can lower recall but improve precision.
Good detection model:
- IoU > 0.5 for most detected objects
- High mAP (e.g., > 0.7) showing good detection and localization
- Precision and recall both above 0.8, meaning few false alarms and few misses
Bad detection model:
- Low IoU (e.g., < 0.3) meaning boxes do not match objects well
- Low mAP (e.g., < 0.4) indicating poor detection or localization
- High false positives (low precision) or many missed objects (low recall)
- Accuracy paradox: In images with few objects, a model that predicts no objects can have high accuracy but is useless.
- Ignoring IoU: Counting detections without checking localization quality can mislead about model performance.
- Data leakage: Testing on images very similar to training can inflate metrics falsely.
- Overfitting: Very high training mAP but low test mAP means the model memorizes training images, not generalizing.
Your object detection model has 98% accuracy but only 12% recall on detecting pedestrians. Is it good for production? Why or why not?
Answer: No, it is not good. The high accuracy is misleading because most of the image is background (no pedestrians). The very low recall means the model misses almost all pedestrians, which is dangerous especially in safety-critical applications like self-driving cars.
Practice
Solution
Step 1: Understand the purpose of detection
Detection aims to identify objects and their positions in an image, not just what they are.Step 2: Differentiate detection from classification
Classification only tells what object is present, but detection also tells where it is by drawing boxes.Final Answer:
To find both what the object is and where it is located -> Option AQuick Check:
Detection = What + Where [OK]
- Confusing detection with classification
- Thinking detection changes image colors
- Believing detection removes objects
Solution
Step 1: Identify detection output components
Detection outputs include the object label and a bounding box showing where the object is.Step 2: Eliminate incorrect outputs
Labels alone or pixel colors do not localize objects; blurring is unrelated.Final Answer:
A label and a bounding box with coordinates -> Option BQuick Check:
Detection output = label + box [OK]
- Thinking detection outputs only labels
- Confusing detection output with image filters
- Ignoring bounding box coordinates
{'label': 'cat', 'box': [50, 30, 150, 130], 'confidence': 0.9}, what does the box represent?Solution
Step 1: Understand the box format
The box is a list of four numbers representing coordinates (x1, y1, x2, y2) of the bounding box around the object.Step 2: Interpret the meaning of the box
This box shows where the cat is located in the image, not color or image size.Final Answer:
Coordinates of the cat's bounding box in the image -> Option DQuick Check:
Box = object location coordinates [OK]
- Confusing box with color or size
- Thinking box counts objects
- Ignoring coordinate meaning
Solution
Step 1: Identify training data impact
Detection models need many labeled bounding boxes to learn accurate localization.Step 2: Rule out unrelated factors
High resolution or grayscale images do not directly cause poor box accuracy; classification-only models do not output boxes at all.Final Answer:
The model was not trained with enough labeled bounding boxes -> Option AQuick Check:
Training data quality affects box accuracy [OK]
- Blaming image resolution instead of training data
- Confusing classification with detection
- Ignoring training data quality
Solution
Step 1: Understand safety system needs
Safety systems need to know where objects are to monitor movement and prevent accidents.Step 2: Compare classification vs localization
Classification only tells what objects are present, but localization tells where they are, which is critical for tracking.Final Answer:
Because knowing object locations helps track movements and avoid hazards -> Option CQuick Check:
Safety needs location info, not just labels [OK]
- Thinking classification changes colors
- Believing localization removes objects
- Confusing speed differences
Ready to prove it?
Pass the test and this pattern moves unknown
