Error: Undefined function 'preprocessData' for input arguments of type 'cell'.

9 ビュー (過去 30 日間)
ali raza
ali raza 2019 年 10 月 9 日
コメント済み: jose cabrera 2023 年 4 月 27 日
I am implementing MATLAB 2019b examle "Object Detection Using YOLO v2 Deep Learning"(https://www.mathworks.com/help/vision/ug/train-an-object-detector-using-you-only-look-once.html), but when I run the following line of code:
anchorBoxes = estimateAnchorBoxes(preprocessedTrainingData ,numAnchors)
it gives me error as mentioned in title. Thanks for helping out.
A small piece of code from example is mentioned below:
%...............Code..................................%
unzip vehicleDatasetImages.zip
data = load('vehicleDatasetGroundTruth.mat');
vehicleDataset = data.vehicleDataset;
rng(0)
shuffledIdx = randperm(height(vehicleDataset));
idx = floor(0.6 * height(vehicleDataset));
trainingDataTbl = vehicleDataset(shuffledIdx(1:idx),:);
imdsTrain = imageDatastore(trainingDataTbl{:,'imageFilename'});
bldsTrain = boxLabelDatastore(trainingDataTbl(:,'vehicle'));
trainingData = combine(imdsTrain,bldsTrain);
inputSize = [224 224 3];
preprocessedTrainingData = transform(trainingData, @(data)preprocessData(data,inputSize));
numAnchors = 5;
anchorBoxes = estimateAnchorBoxes(preprocessedTrainingData ,numAnchors)
%.................................................................................................................................................%
  1 件のコメント
Harshveer Singh
Harshveer Singh 2020 年 5 月 6 日
I am also getting the similar error. Unable to resolve it. I copied all the supporting function into a .m file. I then tried calling the function through its name in the command window but unable to do so. Someone please help how to go ahead with it.

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

採用された回答

Steven Lord
Steven Lord 2019 年 10 月 9 日
The preprocessData function is a supporting function that is part of that example and is not on the MATLAB path in general. Scroll down to the Supporting Functions section of that example and make a copy of that function, either as a local function inside the file where you're implementing your own variant of the example or as a separate function file.
  4 件のコメント
TEJAS PHUTANE
TEJAS PHUTANE 2019 年 12 月 29 日
I have changed the code for detection of balls from 1000 images but still stuck on following problem while executing code:
trainingDataForEstimation = transform(trainingData,@(data)preprocessData(data,inputSize));
numAnchors = 7;
[anchorBoxes, meanIoU] = estimateAnchorBoxes(trainingDataForEstimation, numAnchors)
OUTPUT:
Invalid transform function defined on datastore.
The cause of the error was:
Error using bboxresize>iParseInputs (line 89)
The value of 'bboxA' is invalid. Expected input number 1, bboxA, to be integer-valued.
Error in bboxresize (line 49)
params = iParseInputs(bboxA,scale);
Error in training>preprocessData (line 56)
data{2} = bboxresize(data{2},scale);
Error in training>@(data)preprocessData(data,inputSize) (line 17)
trainingDataForEstimation = transform(trainingData,@(data)preprocessData(data,inputSize));
Error in matlab.io.datastore.TransformedDatastore/read (line 148)
data = self.Transforms{ii}(data);
Error in matlab.io.Datastore/readall (line 250)
data = [data; read(copyds)]; %#ok<AGROW>
Error in matlab.io.datastore.TransformedDatastore/readall (line 188)
data = readall@matlab.io.Datastore(copyds);
Error in estimateAnchorBoxes>iReadallBoxes (line 270)
boxes = readall(ds);
Error in estimateAnchorBoxes>iCheckBoxesFromDatastore (line 215)
boxes = iReadallBoxes(ds);
Error in estimateAnchorBoxes>iParseInputs (line 168)
boxes = iCheckBoxesFromDatastore(datastore);
Error in estimateAnchorBoxes (line 136)
[boxes, numAnchors, params] = iParseInputs(datastore, numAnchors, varargin{:});
Error in training (line 19)
[anchorBoxes, meanIoU] = estimateAnchorBoxes(trainingDataForEstimation, numAnchors)
jose cabrera
jose cabrera 2023 年 4 月 27 日
Hi, Did you find the solution??
Im getting the same problem

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

その他の回答 (2 件)

michael scheinfeild
michael scheinfeild 2020 年 3 月 7 日
some fix needed in preprocessing , first round and be sure it is positive top left , i think maybe check box outside image will be good , i didnt did it . also rounding of box cordinates is important !. also see that in image we have several bounding boxes and we check them all !
function data = preprocessData(data,targetSize)
% Resize image and bounding boxes to the targetSize.
scale = targetSize(1:2)./size(data{1},[1 2]);
data{1} = imresize(data{1},targetSize(1:2));
boxEstimate=round(data{2});
boxEstimate(:,1)=max(boxEstimate(:,1),1);
boxEstimate(:,2)=max(boxEstimate(:,2),1);
data{2} = bboxresize(boxEstimate,scale);
end
  9 件のコメント
Vladimir Socha
Vladimir Socha 2021 年 8 月 27 日
cool thx
userlifeline
userlifeline 2021 年 8 月 28 日
THX!!!

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


Samuel Manickavasagam S
Samuel Manickavasagam S 2020 年 1 月 23 日
Tejas Phutane i too have this error
  1 件のコメント
TEJAS PHUTANE
TEJAS PHUTANE 2020 年 3 月 2 日
I tried verifying 1000 images in batches of 50 images and found errors in total 60 images.This method solved my problem

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

カテゴリ

Help Center および File ExchangeRecognition, Object Detection, and Semantic Segmentation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by