评估估计
Evaluate precision metric for object detection
句法
描述
例子
评估Yolo V2对象检测器的精度
此示例显示了如何评估验证的Yolo V2对象检测器。
加载车辆地面真相数据
加载包含车辆训练数据的表。第一列包含训练图像,其余列包含标记的边界框。
数据=负载('vehicleTrainingData.mat');trainingData = data.vehicleTrainingData;
Add fullpath to the local vehicle data folder.
dataDir = fullfile(toolboxdir('想象'),'VisionData');triendingdata.imagefileName = fullfile(datadir,trienchdata.imagefileName);
使用表中的文件创建Imagedatastore。
IMD= imageDatastore(trainingData.imageFilename);
使用表中的标签列创建一个BoxLabelDatastore。
blds = boxlabeldatastore(triendingdata(:,2:end));
Load YOLOv2 Detector for Detection
加载包含用于训练的层图的检测器。
vehicleDetector = load('yolov2VehicleDetector.mat');检测器= vehicledetector.detector;
Evaluate and Plot the Results
使用Imagedatastore运行检测器。
结果=检测(检测器,IMD);
根据地面真实数据评估结果。
[AP,召回,精度] = RestectectionEtectionPrecision(结果,大厦);
Plot the precision/recall curve.
figure; plot(recall, precision); gridon标题(sprintf(sprintf)('Average precision = %.1f',AP))
评估停止符号检测器的精度
使用预加载的地面真相信息培训基于ACF的检测器。在训练图像上运行检测器。评估检测器并显示Precision-Recall曲线。
Load the ground truth table.
加载(“ stopsignsandcars.mat”)stopSigns = stopSignSandCars(:,1:2);stopSigns.imageFileName = fullfile(toolboxDir(toolboxDir)('想象'),'VisionData',,,,...stopSigns.imageFileName);
训练基于ACF的检测器。
detector = trainACFObjectDetector(stopSigns,“否定样本”,2);
ACF对象探测器训练培训将进行4个阶段。型号的大小为34x31。样本阳性示例(〜100%完成)计算近似系数...完成。计算汇总的通道功能...完成。-------------------------------------------- Stage 1: Sample negative examples(〜100%完成)计算汇总的通道功能...完成。火车分类器,有42个积极的例子和84个负面示例...完成。训练有素的分类器有19个薄弱的学习者。-------------------------------------------- Stage 2: Sample negative examples(〜100%完成)发现了84个新的负面示例用于培训。计算汇总的通道功能...完成。火车分类器,有42个积极的例子和84个负面示例...完成。 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 14.4221 seconds.
Create a table to store the results.
numImages =高度(stopsigns);结果=表('尺寸',[数字2],...'VariableTypes',,,,{'细胞',,,,'细胞'},,...'variablenames',,,,{“盒子”,,,,“得分”});
在训练图像上运行检测器。Store the results as a table.
为了i = 1:numImages i = imread(stopSigns.imageFileName {i});[bboxes,分数] =检测(检测器,i);results.boxes {i} = bboxes;results.scores {i} = scores;结尾
根据地面真实数据评估结果。获取精度统计。
[[ap,recall,precision] = evaluateDetectionPrecision(results,stopSigns(:,2));
绘制Precision-Recall曲线。
图图(召回,精度)网格on标题(sprintf(sprintf)('平均精度=%.1F',AP))
输入参数
检测
-对象位置和分数
桌子
对象位置和分数,指定为一个两列表,其中包含每个检测到的对象的边界框和得分。对于多类检测,第三列包含每个检测的预测标签。边界框必须存储在一个m-by-4单元阵列。分数必须存储在m-b-1单元阵列,标签必须存储为分类向量。
检测对象时,您可以使用imageDatastore
。
ds = imageDatastore(stopSigns.imageFilename); detectionResults = detect(detector,ds);
数据类型:桌子
地面图
-标记为地面真相
数据存储|桌子
标记为地面真相,指定为数据存储或表格。
每个边界框必须以格式[Xy宽度高度]。
数据存储 - 一个数据存储
read
and读取
functions return a cell array or a table with at least two columns of bounding box and labels cell vectors. The bounding boxes must be in a cell array ofm-by-4 matrices in the format [X,,,,y,,,,宽度,,,,高度]。数据存储read
and读取
功能必须返回其中一种格式:{盒子,,,,标签} — The
BoxLabeldatastore
创建这种类型的数据存储。{图片,,,,盒子,,,,标签} - 一个组合的数据存储。例如,使用
combine
((IMD
,,,,大厦
)。
表 - 一个或多个列。所有列都包含边界框。每列必须是包含的单元向量m- 代表单个对象类的by-4矩阵,例如停止标志,,,,Carrear, 或者卡饰。这些列包含4个元素的双阵列mbounding boxes in the format [X,,,,y,,,,宽度,,,,高度]。The format specifies the upper-left corner location and size of the bounding box in the corresponding image.
阈值
-重叠阈值
0。5
(默认)|numeric scalar
将检测分配到地面真相框的重叠阈值,该框指定为数字标量。重叠比计算为与联合的交集。
输出参数
平均推荐
- 平均精度
numeric scalar | vector
在所有检测结果中,平均精度为数字标量或向量。精确是真正的积极实例与基于地面真理中对象中的所有积极实例的比率。对于多类检测器,the average precision is a vector of average precision scores for each object class.
记起
- 从每个检测中召回值
数字标量的向量|单元阵列
记起values from each detection, returned as anm-1数字标量或单元阵列的by-1矢量。长度mequals 1 + the number of detections assigned to a class. For example, if your detection results contain 4 detections with class label'车'
, 然后记起
包含5个元素。召回的第一个价值总是0
。
记起是真正的积极实例与基于地面真理的真实积极因素和虚假的总和的比例。对于多类检测器,记起
and精确
是单元格数,每个单元格包含每个对象类的数据点。
精确
- 每个检测中的精确值
数字标量的向量|单元阵列
每个检测中的精确值,返回为m-1数字标量或单元阵列的by-1矢量。长度mequals 1 + the number of detections assigned to a class. For example, if your detection results contain 4 detections with class label'车'
, 然后精确
包含5个元素。第一个值精确
总是1
。
精确是真正的积极实例与基于地面真理中对象中的所有积极实例的比率。对于多级检测器,记起
and精确
是单元格数,每个单元格包含每个对象类的数据点。
版本历史记录
matlab명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
Matlab명령명령명령에입력하십시오하십시오하십시오하십시오하십시오하십시오。Matlab명령명령을지원않습니다않습니다않습니다않습니다。
你也可以选择一个网站的following list:
如何获得最佳网站性能
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。
美洲
- América Latina((Español)
- 加拿大(英语)
- 美国(英语)