This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Detect objects using aggregate channel features


Create a trained aggregate channel features (ACF) object detector. The ACF object detector recognizes specific objects in images, based on the training images and the object ground truth locations that are input to trainACFObjectDetector.


Use the trainACFObjectDetector function with training data to create an ACF object detector.


detector = trainACFObjectDetector(trainingData)
detector = trainACFObjectDetector(trainingData,Name,Value)



detector = trainACFObjectDetector(trainingData) returns a trained aggregate channel features (ACF) object detector.


detector = trainACFObjectDetector(trainingData,Name,Value) returns an ACF object detector with additional options specified by one or more Name,Value pair arguments.


expand all

Name of the classification model, specified as a character vector. By default, the name is set to the heading of the second column of the groundTruth table specified in trainACFObjectDetector.

Example: 'stopSign'

This property is read-only.

Size of training images, specified as a [height width] vector.

Example: [100,100]

This property is read-only.

Number of weak learners used in the detector, specified as a scalar integer. This property is set based on the 'MaxWeakLearners' name-value pair in the trainACFObjectDetector function.

Object Functions

detectDetect objects using ACF object detector


expand all

Load the training data.


Select the ground truth for stop signs.

stopSigns = stopSignsAndCars(:, 1:2);

Add the fullpath to image files.

stopSigns.imageFilename = fullfile(toolboxdir('vision'),'visiondata', ...

Train the ACF detector.

acfDetector = trainACFObjectDetector(stopSigns,'NegativeSamplesFactor',2,'Verbose',false);

Test the ACF detector on a test image.

img = imread('stopSignTest.jpg');

[bboxes, scores] = detect(acfDetector, img);

Display the detection result.

for i = 1:length(scores)
   annotation = sprintf('Confidence = %.1f', scores(i));
   img = insertObjectAnnotation(img, 'rectangle', bboxes(i,:), annotation);



[1] Dollar, P., R. Appel, S. Belongie, and P. Perona. "Fast Feature Pyramids for Object Detection." Pattern Analysis and Machine Intelligence, IEEE Transactions. Vol. 36, Issue 8, 2014, pp. 1532–1545.

Introduced in R2017a