|
|
||
|---|---|---|
| .. | ||
| lab | ||
| ObjectDetection.ipynb | ||
| README.md | ||
README.md
Object Detection
Di image classification models we don deal wit before na to take one image and produce one categorical result, like di class 'number' for MNIST problem. But, for many cases, we no just wan sabi say di picture get objects - we wan fit know di exact place wey dem dey. Na wetin object detection dey do be dat.
Pre-lecture quiz
Image from YOLO v2 web site
One Simple Way to Do Object Detection
If we wan find cat for one picture, one simple way to do object detection go be like dis:
- Cut di picture into plenty small tiles.
- Run image classification for each tile.
- Any tile wey get high activation fit mean say di object dey inside.
Image from Exercise Notebook
But dis method no too make sense because e no dey fit locate di object bounding box well. To get di exact location, we go need to run regression to predict di bounding box coordinates - and for dat, we go need special datasets.
Regression for Object Detection
Dis blog post explain di basics of detecting shapes well well.
Datasets for Object Detection
You fit see dis datasets for dis kind task:
- PASCAL VOC - 20 classes
- COCO - Common Objects in Context. 80 classes, bounding boxes and segmentation masks
Object Detection Metrics
Intersection over Union
For image classification, e dey easy to measure how di algorithm dey perform. But for object detection, we need to measure di class correctness and di bounding box location precision. For di bounding box, we dey use Intersection over Union (IoU), wey dey measure how two boxes (or areas) dey overlap.
Figure 2 from dis blog post on IoU
Di idea simple - we go divide di area wey two figures dey overlap by di area of their union. If di two areas dey exactly di same, IoU go be 1. If dem no touch at all, IoU go be 0. Any other case go dey between 0 and 1. We dey usually consider bounding boxes wey get IoU above one certain value.
Average Precision
If we wan measure how well one class of objects C dey recognized, we go use Average Precision metrics. Di steps be:
- Look di Precision-Recall curve wey show accuracy based on detection threshold (0 to 1).
- Di threshold go affect how many objects we detect and di precision/recall values.
- Di curve go look like dis:
Image from NeuroWorkshop
Di Average Precision for one class C na di area under di curve. More specifically, Recall axis dey divided into 10 parts, and Precision dey averaged for all di points:
AP = {1\over11}\sum_{i=0}^{10}\mbox{Precision}(\mbox{Recall}={i\over10})
AP and IoU
We go only consider detections wey get IoU above one certain value. For example, for PASCAL VOC dataset, \mbox{IoU Threshold} = 0.5, but for COCO, AP dey measured for different \mbox{IoU Threshold} values.
Image from NeuroWorkshop
Mean Average Precision - mAP
Di main metric for Object Detection na Mean Average Precision or mAP. E dey calculate di Average Precision across all object classes, and sometimes across \mbox{IoU Threshold}. You fit read more about how to calculate mAP for dis blog post) and dis one with code samples.
Different Object Detection Approaches
We get two main types of object detection algorithms:
- Region Proposal Networks (R-CNN, Fast R-CNN, Faster R-CNN). Di idea na to generate Regions of Interests (ROI) and run CNN for dem to find maximum activation. E dey similar to di simple method, but di ROIs dey generated in a smarter way. Di problem be say e dey slow because we dey run CNN classifier many times for di image.
- One-pass (YOLO, SSD, RetinaNet) methods. For dis ones, di network dey predict both classes and ROIs in one pass.
R-CNN: Region-Based CNN
R-CNN dey use Selective Search to generate ROI regions, wey CNN go process to extract features. SVM-classifiers go determine di object class, and linear regression go predict di bounding box coordinates. Official Paper
Image from van de Sande et al. ICCV’11
*Images from dis blog
F-RCNN - Fast R-CNN
Dis method dey similar to R-CNN, but e dey define regions after convolution layers don run.
Image from di Official Paper, arXiv, 2015
Faster R-CNN
Dis method dey use neural network to predict ROIs - di Region Proposal Network. Paper, 2016
Image from di official paper
R-FCN: Region-Based Fully Convolutional Network
Dis algorithm dey faster pass Faster R-CNN. Di main idea be:
- Extract features wit ResNet-101.
- Process di features wit Position-Sensitive Score Map. Each object from
Cclasses dey divide intok\times kregions, and we dey train to predict di object parts. - For each part, di network go vote for di object class, and di class wit di highest vote go dey selected.
Image from official paper
YOLO - You Only Look Once
YOLO na realtime one-pass algorithm. Di main idea be:
- Divide di image into
S\times Sregions. - For each region, CNN go predict
npossible objects, bounding box coordinates, and confidence=probability * IoU.
Image from official paper
Other Algorithms
- RetinaNet: official paper
- SSD (Single Shot Detector): official paper
✍️ Exercises: Object Detection
Continue your learning for dis notebook:
Conclusion
For dis lesson, you don see di different ways wey object detection fit work!
🚀 Challenge
Read dis articles and notebooks about YOLO and try dem:
- Good blog post wey explain YOLO
- Official site
- Yolo: Keras implementation, step-by-step notebook
- Yolo v2: Keras implementation, step-by-step notebook
Post-lecture quiz
Review & Self Study
- Object Detection by Nikhil Sardana
- Comparison of object detection algorithms
- Review of Deep Learning Algorithms for Object Detection
- Step-by-Step Intro to Object Detection Algorithms
- Faster R-CNN Implementation in Python
Assignment: Object Detection
Disclaimer:
Dis docu don use AI translation service Co-op Translator take translate am. Even though we dey try make e accurate, abeg sabi say automated translations fit get mistake or no dey 100% correct. Di original docu for di language wey dem write am first na di main correct one. For important information, e good make una use professional human translation. We no go fit take blame for any misunderstanding or wrong interpretation wey fit happen because of dis translation.









