Detect vehicles using Faster R-CNN
returns a trained Faster R-CNN (regions with convolution neural networks) object
detector for detecting vehicles. Faster R-CNN is a deep learning object
detection framework that uses a convolutional neural network (CNN) for
detector = vehicleDetectorFasterRCNN
The detector is trained using unoccluded images of the front, rear, left, and right sides of vehicles. The CNN used with the vehicle detector uses a modified version of the MobileNet-v2 network architecture.
Use of this function requires Deep Learning Toolbox™.
The detector is trained using
uint8 images. Before
using this detector, rescale the input images to the range [0, 255] by
Detect Vehicles on Highway
Detect cars in a single image and annotate the image with the detection scores. To detect cars, use a Faster R-CNN object detector that was trained using images of vehicles.
Load the pretrained detector.
fasterRCNN = vehicleDetectorFasterRCNN;
Use the detector on a loaded image. Store the locations of the bounding boxes and their detection scores.
I = imread('highway.png'); [bboxes,scores] = detect(fasterRCNN,I);
Annotate the image with the detections and their scores.
I = insertObjectAnnotation(I,'rectangle',bboxes,scores); figure imshow(I) title('Detected Vehicles and Detection Scores')
detector — Trained Faster R-CNN-based object detector
Trained Faster R-CNN-based object detector, returned as an
Version HistoryIntroduced in R2017a
modelName input argument is not recommended
modelName input argument is not recommended. To update your
code, remove all instances of
|Discouraged Usage||Recommended Replacement|
modelName = 'front-rear-view' detector = vehicleDetectorFasterRCNN(modelName);
detector = vehicleDetectorFasterRCNN;