What is Object Detection?
Object detection is the task of finding and classifying multiple objects in an image simultaneously, reporting both what they are and where they are.
What is Object Detection?
Object detection identifies and locates multiple objects in an image in a single pass.
For each detected object, it returns:
- A bounding box: the rectangle that contains the object
- A class label: what the object is (e.g., 'car', 'person', 'dog')
- A confidence score: how certain the model is (0.0 to 1.0)
Object detection answers three questions simultaneously:
1. Are there any objects in this image?
2. What class is each object?
3. Where exactly is each object?
Object detection is used in:
- Self-driving cars (detect pedestrians, vehicles, signs, cyclists)
- Security cameras (detect people, vehicles, packages)
- Retail (product counting, customer tracking)
- Medical imaging (detecting tumours, fractures, abnormalities)
- Manufacturing quality control (defect detection)
- Augmented reality (detecting surfaces and objects to overlay graphics)
Machine Learning follows a structured pipeline from data to deployment
Detection Output Structure
# Object detection output structure
# Each detection is a dictionary with:
detection_example = {
"class_id": 2, # Integer class index
"class_name": "car", # Human-readable label
"confidence": 0.93, # How sure the model is (0.0 to 1.0)
"bbox": {
"x": 150, # Left edge of bounding box (pixels)
"y": 80, # Top edge of bounding box (pixels)
"width": 220, # Width of bounding box (pixels)
"height": 140, # Height of bounding box (pixels)
}
}
# Multiple detections in one image:
detections = [
{"class_name": "car", "confidence": 0.93, "bbox": (150, 80, 220, 140)},
{"class_name": "person", "confidence": 0.87, "bbox": (50, 30, 45, 180)},
{"class_name": "bicycle","confidence": 0.72, "bbox": (300, 100, 80, 120)},
]
print(f"Found {len(detections)} objects:")
for d in detections:
x, y, w, h = d["bbox"]
print(f" {d['class_name']}: {d['confidence']*100:.1f}% confident at ({x},{y})")