Object Detection
Object detection goes further than classification. It finds where objects are in an image and draws bounding boxes around them, along with identifying what they are.
10 min•By Priygop Team•Updated 2026
Classification vs Detection
Image classification: 'There is a dog in this image' (one label for the whole image)
Object detection: 'There is a dog at location [x=120, y=80, width=200, height=180] and a cat at [x=400, y=150, width=180, height=210]'
Object detection is much more useful for:
- Self-driving cars: detect every car, pedestrian, and traffic light in the scene
- Security cameras: detect specific people or objects
- Retail analytics: count products on shelves
- Sports analysis: track players and ball positions
Diagram
Loading diagram…
Deep Learning ⊂ Machine Learning ⊂ Artificial Intelligence
Bounding Boxes
Bounding Boxes
# Representing object detection results
# A bounding box defines where an object is in an image
# Format: (x, y, width, height, class, confidence)
# x, y = top-left corner of the box
detected_objects = [
{"class": "person", "x": 100, "y": 50, "width": 120, "height": 250, "confidence": 0.97},
{"class": "car", "x": 300, "y": 200, "width": 200, "height": 130, "confidence": 0.92},
{"class": "dog", "x": 500, "y": 300, "width": 150, "height": 100, "confidence": 0.88},
{"class": "bicycle","x": 650, "y": 180, "width": 110, "height": 180, "confidence": 0.75},
]
print("Object Detection Results:")
print(f"{'Class':>10} {'Position (x,y)':>16} {'Size (WxH)':>12} {'Confidence':>12}")
print("-" * 60)
for obj in detected_objects:
print(
f"{obj['class']:>10} "
f"({obj['x']},{obj['y']}){' ':8} "
f"{obj['width']}x{obj['height']}{' ':5} "
f"{obj['confidence']*100:.0f}%"
)
print()
print(f"Total objects detected: {len(detected_objects)}")
high_confidence = [o for o in detected_objects if o["confidence"] >= 0.9]
print(f"High confidence (>=90%): {len(high_confidence)}")Real-World Object Detection
- YOLO (You Only Look Once): the most popular real-time object detection algorithm. Can process 30+ frames per second
- Used in dashcams to detect other vehicles, pedestrians, and road signs
- Used in warehouses to track packages and count inventory automatically
- Used in sports to track player positions and ball movement
- Used in agriculture to detect diseased plants from drone footage
Key Takeaways
- Object detection goes further than classification.
- YOLO (You Only Look Once): the most popular real-time object detection algorithm. Can process 30+ frames per second
- Used in dashcams to detect other vehicles, pedestrians, and road signs
- Used in warehouses to track packages and count inventory automatically