Choose an Object Detector
The Computer Vision Toolbox™ provides object detectors to use for finding and classifying objects in an image or video. Train a detector using an object detector function, then use it with machine learning and deep learning to quickly and accurately predict the location of an object in an image.
When choosing a detector, consider whether you need these features::
Application and Performance
Single vs Multiple classes — Multiple classes require a variation of different classifiers used at multiple locations and scales on the image or video.
Runtime performance — Detectors vary in performance depending on the time it takes to detect objects in an image. A detector trained for a single class, or a detector trained to detect objects that are similar in pose and shape, will have a faster runtime performance than a deep learning detector trained on multiple objects. More importantly, deep learning is slower because it requires more computations than machine learning or feature-based detection approaches.
Machine learning — Machine learning uses two types of techniques: supervised learning, which trains a model on known input and output data so that it can predict future outputs, and unsupervised learning, which finds hidden patterns or intrinsic structures in input data. For more details, see Machine Learning in MATLAB (Statistics and Machine Learning Toolbox)
Deep learning — Implements deep neural networks with algorithms, pretrained models, and apps. You can use convolutional neural networks to perform classification and regression on images. For more details, see Getting Started with Object Detection Using Deep Learning.
C/C++ code generation — SSD, YOLO, ACF, and system object-based detectors support MATLAB® Coder™ C and C++ code generation for a variety of hardware platforms, from desktop systems to embedded hardware. For more details, see MATLAB Coder. The R-CNN-based detectors do not support code generation.
GPU code generation — Deep learning-based detectors support GPU code generation with optimized CUDA® by GPU Coder™ for embedded vision, and autonomous systems. For more details, see GPU Coder.
Use the table to view and compare the object detector functions.
|Detector||Multiple Classes Support||Deep Learning Support||Code Generation Support||GPU Support||Example||Description|
|Yes||Yes||No||Yes||Object Detection Using Faster R-CNN Deep Learning|
Faster R-CNN is a two-stage network. The second stage refines detection proposals produced by the first stage, which helps improve localization at the cost of runtime performance.
|Yes||Yes||No||Yes||Train Fast R-CNN Stop Sign Detector|
|Yes||Yes||No||Yes||Train Object Detector Using R-CNN Deep Learning|
This algorithm combines rectangular region proposals with convolutional neural network features. It is a two-stage detection algorithm. The first stage identifies a subset of regions in an image that might contain an object. The second stage classifies the object in each region.
|Yes||Yes||Yes||Yes||Object Detection Using YOLO v2 Deep Learning|
YOLO v2 uses a single stage network to perform object detection.
|Yes||Yes||Yes||Yes||Object Detection Using SSD Deep Learning|
Single shot detector (SSD) uses a single stage detection network to detects objects using multi-scale features.
|No||No||Yes||No||Train ACF-based Stop Sign Detector|
ACF works well for a single class that can be easily classified regardless of pose. For example, it would work well to detect a person, who can be recognized in multiple poses, such as sitting, standing, or riding a horse.
ACF would not work well for detecting vehicles from various viewpoints, such as front, side, and rear.
|Pretrained||No||Yes||No||Tracking Pedestrians from a Moving Car|
Use this pretrained detector to detect upright positioned people.
|Pretrained||No||Yes||No||Depth Estimation From Stereo Video||Use this pretrained cascade object detector to detect upright positioned people.|
|No||No||Yes||No||Detect Faces in an Image Using the Frontal Face Classification Model|
|Mask R-CNN||Yes||Yes||No||Yes||Getting Started with Mask R-CNN for Instance Segmentation|
Use this detector when you need to segment individual objects.
|YOLO v3||Yes||Yes||Yes||Yes||Object Detection Using YOLO v3 Deep Learning|
YOLO v3 is a single stage network that uses multi-scale features to better handle detection of objects of various sizes.
|Pretrained||No||Yes||No||Track Multiple Vehicles Using a Camera (Automated Driving Toolbox)||Pretrained ACF detector|
|Pretrained||Yes||No||Yes||Train a Deep Learning Vehicle Detector (Automated Driving Toolbox)||Pretrained Faster R-CNN detector|
|Pretrained||Yes||Yes||Yes||Detect Vehicles Using Monocular Camera and YOLO v2 (Automated Driving Toolbox)||Pretrained YOLO v2 detector|
vehicleDetectorYOLOv2(Automated Driving Toolbox)
vehicleDetectorACF(Automated Driving Toolbox) |
vehicleDetectorFasterRCNN(Automated Driving Toolbox) |
acfObjectDetectorMonoCamera(Automated Driving Toolbox)