Module 8: Object Detection
1. Learning Objectives
- Understand the basics of object detection
- Learn the differences between detection and classification
- Explore region-based and single-shot detection methods
2. Object Detection vs. Classification
Classification: Predicts a single label for the entire image.
Detection: Identifies and locates multiple objects with bounding boxes and labels.
3. Key Metrics
- IoU (Intersection over Union): Measures overlap between predicted and ground truth boxes.
- mAP (mean Average Precision): Standard metric for evaluation across classes.
4. Object Detection Models
- R-CNN: Region proposals + CNN classifier (slow but accurate)
- Fast R-CNN: Faster version using shared features
- Faster R-CNN: Uses Region Proposal Network (RPN)
- YOLO (You Only Look Once): Real-time detection using a single network
- SSD (Single Shot MultiBox Detector): Faster with multi-scale feature maps
5. Anchor Boxes and NMS
- Anchor Boxes: Predefined bounding boxes of different aspect ratios
- Non-Maximum Suppression (NMS): Removes redundant overlapping boxes
6. Example: YOLOv5 Inference
# Example using YOLOv5
!git clone https://github.com/ultralytics/yolov5
%cd yolov5
!pip install -r requirements.txt
# Run inference
!python detect.py --source ../your_image.jpg --weights yolov5s.pt --conf 0.5
7. Assignment
Objective: Understand and experiment with object detection.
- 1. Run YOLOv5 on your own image and analyze the results
- 2. Compare YOLO with a Faster R-CNN model (optional)
- 3. Report bounding box results and detection confidence
- 4. Write a 1–2 page report about performance, speed, and accuracy
Due: End of Week 8