vehicleDetectorFasterRCNN

Detect vehicles using Faster R-CNN

Syntax

detector = vehicleDetectorFasterRCNN
detector = vehicleDetectorFasterRCNN(modelName)

Description

detector = vehicleDetectorFasterRCNN 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 detection.

The function trains the detector 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 CIFAR-10 network architecture.

Use of this function requires Deep Learning Toolbox™.

Note

The detector is trained using uint8 images. Before using this detector, rescale the input images to the range [0, 255] by using im2uint8 or rescale.

example

detector = vehicleDetectorFasterRCNN(modelName) returns a pretrained vehicle detector based on the model name specified in modelName. The default 'full-view' model uses training images that are unoccluded views from the front, rear, left, and right sides of vehicles. A 'front-rear-view' model uses images of only the front and rear sides of the vehicles.

Examples

collapse all

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('full-view');

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')

Input Arguments

collapse all

Type of vehicle detector model, specified as either 'full-view' or 'front-rear-view'. A 'full-view' model uses training images that are unoccluded views from the front, rear, left, and right sides of vehicles. A 'front-rear-view' model uses images of only the front and rear sides of the vehicles.

Data Types: char | string

Output Arguments

collapse all

Trained Faster R-CNN-based object detector, returned as an fasterRCNNObjectDetector object.

Introduced in R2017a