Hi, I doing a project that load a roadsigns.mat, which a exported from Image Lableler. Can someone help me to fix the error below ?

3 ビュー (過去 30 日間)
'Error using trainCascadeObjectDetector>parseInputs (line 310) The value of 'positiveInstances' is invalid. Expected input number 2, positiveInstances, to be one of these types: struct, char'
load('roadSignals.mat');
imDir = fullfile('/Users/Anisio/Documents/MATLAB/IMAGE');
%Add the images location to the MATLAB path.
addpath(imDir);
%Specify the folder for negative images.
negativeFolder = fullfile('/Users/Anisio/Documents/MATLAB/IMAGE');
%Train a cascade object detector called 'stopSignDetector.xml' using HOG features. The following command may take several minutes to run:
trainCascadeObjectDetector('SignDetector.xml',labelingSession,negativeFolder,'FalseAlarmRate',0.2,'NumCascadeStages',5);
%Use the newly trained classifier to detect a stop sign in an image.
detector = vision.CascadeObjectDetector('stopSignDetector.xml');
%Read the test image.
img = imread('SpeedCameraSample.jpg');
%Detect a stop sign.
bbox = step(detector,img);
%Insert bounding boxes and return marked image.
detectedImg = insertObjectAnnotation(img,'rectangle',bbox,'stop sign');
%Display the detected stop sign.
figure;
imshow(detectedImg);
%Remove the image directory from the path.
rmpath(imDir);

採用された回答

Dima Lisin
Dima Lisin 2016 年 2 月 23 日
You should export the ROIs using the "Export" button. That will create a variable in the workspace that you can pass into trainCascadeObjectDetector.
You have saved a labeling session. It is for resuming labeling after a break, not for passing into a function.
  2 件のコメント
yang liu
yang liu 2016 年 2 月 24 日
I had the same problem. As you described above, I then use "Export ROIs", and gave a variable named as "data".
It gives me the following error: "Error using trainCascadeObjectDetector (line 245) Unable to determine file format."
Attached image shows all the cmd, error, and all.
Dima Lisin
Dima Lisin 2016 年 2 月 24 日
It looks like one of your negative images may be corrupt. Please check what's in your nonHardHat directory, and make sure you can read all of the images from it into MATLAB with imread.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by