Training data from a read of the input datastore contains invalid bounding boxes?
3 次查看(过去 30 天)
显示 更早的评论
Hello guys i'm trying this code and i don't know what to do to fix the problem
data = load('Damagevehicle.mat');
trainingData = data.Damaaaage;
rng(0);
shuffledIdx = randperm(height(trainingData));
trainingData = trainingData(shuffledIdx,:);
imds = imageDatastore(trainingData.imageFilename);
blds = boxLabelDatastore(trainingData(:,2:end));
ds = combine(imds, blds);
net = load('yolov2VehicleDetector.mat');
lgraph = net.lgraph;
lgraph.Layers;
options = trainingOptions('sgdm','InitialLearnRate',0.001,...
'Verbose',true,'MiniBatchSize',32,'MaxEpochs',30,...
'Shuffle','never','VerboseFrequency',30,...
'CheckpointPath',tempdir);
[detector,info] = trainYOLOv2ObjectDetector(ds,lgraph,options);
The error i got:
Invalid transform function defined on datastore.
The cause of the error was:
Error using vision.internal.cnn.validation.checkTrainingBoxes (line 12)
Training data from a read of the input datastore contains invalid bounding boxes. Bounding boxes must be non-empty,
fully contained within their associated image and must have positive width and height. Use datastore transform method
and remove invalid bounding boxes.
Error in vision.internal.cnn.yolo.validateImagesAndBoxesTransform (line 22)
vision.internal.cnn.validation.checkTrainingBoxes(images, boxes);
Error in
trainYOLOv2ObjectDetector>@(data)vision.internal.cnn.yolo.validateImagesAndBoxesTransform(data,params.InputSize) (line
285)
transformFcn = @(data)vision.internal.cnn.yolo.validateImagesAndBoxesTransform(data,params.InputSize);
Error in matlab.io.datastore.TransformedDatastore/applyTransforms (line 607)
data = ds.Transforms{ii}(data);
Error in matlab.io.datastore.TransformedDatastore/read (line 222)
[data, info] = ds.applyTransforms(data, info);
Error in nnet.internal.cnn.DataLoader/manageReadQueue (line 182)
data = read(self.Datastore);
Error in nnet.internal.cnn.DataLoader/readAhead (line 213)
manageReadQueue(self);
Error in nnet.internal.cnn.DataLoader (line 81)
readAhead(self);
Error in nnet.internal.cnn.GeneralDatastoreDispatcher (line 275)
this.DataLoader = nnet.internal.cnn.DataLoader(ds,...
Error in nnet.internal.cnn.DataDispatcherFactory.createDataDispatcherMIMO (line 186)
nnet.internal.cnn.GeneralDatastoreDispatcher( ...
Error in vision.internal.cnn.trainNetwork>iCreateTrainingDataDispatcher (line 208)
dispatcher = nnet.internal.cnn.DataDispatcherFactory.createDataDispatcherMIMO( ...
Error in vision.internal.cnn.trainNetwork (line 46)
trainingDispatcher = iCreateTrainingDataDispatcher(ds, mapping, trainedNet,...
Error in trainYOLOv2ObjectDetector>iTrainYOLOv2 (line 434)
[yolov2Net, info] = vision.internal.cnn.trainNetwork(...
Error in trainYOLOv2ObjectDetector (line 198)
[net, info] = iTrainYOLOv2(ds, lgraph, params, mapping, options, checkpointSaver);
Error in final1 (line 17)
[detector,info] = trainYOLOv2ObjectDetector(ds,lgraph,options);
0 个评论
回答(1 个)
Vidip
2024-3-26
编辑:Vidip
2024-3-26
In the case of valid bounding boxes, they must be non-empty, fully contained within their associated image and must have positive width and height.
The function helperSanitizeBoxes is used to clean up invalid bounding box data. Boxes with values <=0 are removed, and fractional values are rounded to integers. If none of the boxes are valid, this function passes the data through to enable downstream processing to issue proper errors.
You can refer to this MATLAB Answer for more information related to this topic:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!