边界框必须非空,完全包含在他们相关的图像,必须积极的宽度和高度。

25日视图(30天)
我试图使用对象检测器训练数据创建使用图像数据贴标签机训练YOLOv2模型。我一直把错误:
无效的变换函数上定义数据存储。
错误的原因是:
错误使用vision.internal.cnn.validation.checkTrainingBoxes(12)行
训练数据的读取输入数据存储包含无效的边界框。边界框必须
非空,完全包含在他们相关的图像,必须积极的宽度和高度。使用
数据存储转换方法和删除无效的边界框。
错误vision.internal.cnn.yolo.validateImagesAndBoxesTransform(22)行
vision.internal.cnn.validation.checkTrainingBoxes(图像、盒);
错误
trainYOLOv2ObjectDetector > @(数据)vision.internal.cnn.yolo.validateImagesAndBoxesTransform(数据、params.InputSize)
(第285行)
transformFcn = @(数据)vision.internal.cnn.yolo.validateImagesAndBoxesTransform(数据,params.InputSize);
在matlab.io.datastore错误。TransformedDatastore / applyTransforms(第619行)
data = ds.Transforms{2}(数据);
在matlab.io.datastore错误。TransformedDatastore /读(第222行)
(数据、信息)= ds。applyTransforms(数据、信息);
错误nnet.internal.cnn.DataLoader / manageReadQueue(第182行)
data =阅读(self.Datastore);
错误nnet.internal.cnn.DataLoader /预读(第213行)
manageReadQueue(自我);
错误nnet.internal.cnn.DataLoader(第81行)
预读(自我);
错误nnet.internal.cnn.GeneralDatastoreDispatcher(第275行)
这一点。DataLoader = nnet.internal.cnn.DataLoader (ds,…
错误nnet.internal.cnn.DataDispatcherFactory.createDataDispatcherMIMO(第186行)
nnet.internal.cnn.GeneralDatastoreDispatcher (…
错误vision.internal.cnn.trainNetwork > iCreateTrainingDataDispatcher(第200行)
调度程序= nnet.internal.cnn.DataDispatcherFactory.createDataDispatcherMIMO (…
错误vision.internal.cnn.trainNetwork(40行)
trainingDispatcher = iCreateTrainingDataDispatcher (ds,映射、trainedNet…
错误trainYOLOv2ObjectDetector > iTrainYOLOv2(第435行)
[yolov2Net,信息]= vision.internal.cnn.trainNetwork (…
错误trainYOLOv2ObjectDetector(第198行)
(网络,信息)= iTrainYOLOv2 (params, ds, lgraph映射,选择,checkpointSaver);
我的代码
加载bedlabels.mat;
trainingDataTable = objectDetectorTrainingData (gTruth)
%显示前几排的数据集。
:trainingDataTable (1:4);
rng (0);
shuffledIndices = randperm(高度(trainingDataTable));
地板idx =(0.6 *长度(shuffledIndices))
trainingIdx = 1: idx;
trainingDataTbl = trainingDataTable (shuffledIndices (trainingIdx):);
validationIdx = idx + 1: idx + 1 +地板(0.1 *长度(shuffledIndices));
validationDataTbl = trainingDataTable (shuffledIndices (validationIdx):);
testIdx = validationIdx(结束)+ 1:长度(shuffledIndices);
testDataTbl = trainingDataTable (shuffledIndices (testIdx):);
imdsTrain = imageDatastore (trainingDataTbl {:,“imageFilename”});
bldsTrain = boxLabelDatastore (trainingDataTbl(:,“床”));
imdsValidation = imageDatastore (validationDataTbl {:,“imageFilename”});
bldsValidation = boxLabelDatastore (validationDataTbl(:,“床”));
imdsTest = imageDatastore (testDataTbl {:,“imageFilename”});
bldsTest = boxLabelDatastore (testDataTbl(:,“床”));
trainingData =结合(imdsTrain bldsTrain);
validationData =结合(imdsValidation bldsValidation);
testData =结合(imdsTest bldsTest);
data =阅读(trainingData);
我={1}数据;
bbox ={2}数据;
annotatedImage = insertShape(我,“矩形”,bbox);
annotatedImage = imresize (annotatedImage 2);
imshow (annotatedImage)
%创建YOLO v2意思对象检测网络
网= resnet50 ();
lgraph = layerGraph(净);
imageInputSize = (512 1024 3);
imgLayer = imageInputLayer (imageInputSize,“名字”,“input_1”);
lgraph = replaceLayer (lgraph“input_1 imgLayer);
numClasses =宽度(trainingDataTable) 1;
numAnchors = 7;
[anchorBoxes, meanIoU] = estimateAnchorBoxes (trainingData numAnchors)
featureLayer =“activation_40_relu”;
lgraph = yolov2Layers (imageInputSize numClasses anchorBoxes,净,featureLayer);
% =数据读取(trainingData);
% I ={1}的数据;
% bbox ={2}数据;
% annotatedImage = insertShape(我,“矩形”,bbox);
% annotatedImage = imresize (annotatedImage 2);
%图
% imshow (annotatedImage)
选择= trainingOptions(“个”、“MiniBatchSize”, 16日InitialLearnRate, 1 e - 3, MaxEpochs, 20日ValidationData, ValidationData);
[探测器,信息]= trainYOLOv2ObjectDetector (trainingData、lgraph选项);
4评论
阿什利·库克
阿什利·库克 2021年8月2日
我也有这个错误,没有看到任何明显错误的边界框。也有办法识别问题盒子吗?

登录置评。

答案(1)

Vivek Akkala
Vivek Akkala 2022年6月9日
编辑:Vivek Akkala 2022年6月9日
你好,
这里的groundtruth可能空边界框或有可能边界框的大小大于图像大小。虽然这可能不是原groundtruth,你可能会在这个场景中,使用数据增强技术。

下载188bet金宝搏

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!