matlab中acf计算,Train ACF object detector

Use the trainACFObjectDetector with training images to create an ACF object detector that can detect stop signs. Test the detector with a separate image.

Load the training data.

load('stopSignsAndCars.mat')

Select the ground truth for stop signs. These ground truth is the set of known locations of stop signs in the images.

stopSigns = stopSignsAndCars(:,1:2);

Add the full path to the image files.

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

'visiondata',stopSigns.imageFilename);

Train the ACF detector. You can turn off the training progress output by specifying 'Verbose',false as a Name,Value pair.

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

ACF Object Detector Training

The training will take 4 stages. The model size is 34x31.

Sample positive examples(~100% Completed)

Compute approximation coefficients...Completed.

Compute aggregated channel features...Completed.

--------------------------------------------

Stage 1:

Sample negative examples(~100% Completed)

Compute aggregated channel features...Completed.

Train classifier with 42 positive examples and 84 negative examples...Completed.

The trained classifier has 19 weak learners.

--------------------------------------------

Stage 2:

Sample negative examples(~100% Completed)

Found 84 new negative examples for training.

Compute aggregated channel features...Completed.

Train classifier with 42 positive examples and 84 negative examples...Completed.

The trained classifier has 20 weak learners.

--------------------------------------------

Stage 3:

Sample negative examples(~100% Completed)

Found 84 new negative examples for training.

Compute aggregated channel features...Completed.

Train classifier with 42 positive examples and 84 negative examples...Completed.

The trained classifier has 54 weak learners.

--------------------------------------------

Stage 4:

Sample negative examples(~100% Completed)

Found 84 new negative examples for training.

Compute aggregated channel features...Completed.

Train classifier with 42 positive examples and 84 negative examples...Completed.

The trained classifier has 61 weak learners.

--------------------------------------------

ACF object detector training is completed. Elapsed time is 30.3747 seconds.

Test the ACF detector on a test image.

img = imread('stopSignTest.jpg');

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

Display the detection results and insert the bounding boxes for objects into the image.

for i = 1:length(scores)

annotation = sprintf('Confidence = %.1f',scores(i));

img = insertObjectAnnotation(img,'rectangle',bboxes(i,:),annotation);

end

figure

imshow(img)

e3c0f86b9ce90cc327711ad5b72a9931.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值