Invalid bounding boxes problem while using faster rcnn
Afficher commentaires plus anciens
Hi everyone I am facing this problem while using faster rcnn : The cause of the error was:
Error using vision.internal.cnn.validation.checkTrainingBoxes 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.fastrcnn.validateImagesAndBoxesTransform (line 20) boxes = vision.internal.cnn.validation.checkTrainingBoxes(images, boxes);
Error in trainFasterRCNNObjectDetector>@(data)vision.internal.cnn.fastrcnn.validateImagesAndBoxesTransform(data,params.ColorPreprocessing) (line 1754) transformFcn = @(data)vision.internal.cnn.fastrcnn.validateImagesAndBoxesTransform(data,params.ColorPreprocessing);
Error in matlab.io.datastore.TransformedDatastore/applyTransforms (line 723) data = ds.Transforms{ii}(data);
Error in matlab.io.datastore.TransformedDatastore/read (line 235) [data, info] = ds.applyTransforms(data, info);
Error in vision.internal.cnn.rcnnDatasetStatistics>readThroughAndGetInformation (line 72) batch = read(datastore);
Error in vision.internal.cnn.rcnnDatasetStatistics (line 29) out = readThroughAndGetInformation(datastore, params, layerGraph);
Error in trainFasterRCNNObjectDetector>iCollectImageInfo (line 1761) imageInfo = vision.internal.cnn.rcnnDatasetStatistics(trainingData, rpnLayerGraph, imageInfoParams);
Error in trainFasterRCNNObjectDetector (line 459) [imageInfo,trainingData,options] = iCollectImageInfo(trainingData, fastRCNN, iRPNParamsEndToEnd(params), params, options);
Error in FASTERRCNN (line 73) [detector , info ]= trainFasterRCNNObjectDetector(trainingDataForEstimation, lgraph, options,'NegativeOverl
3 commentaires
Walter Roberson
le 25 Nov 2023
That typically means that some of the bounding boxes ended up empty. That can happen with detectors, especially ones that can output long narrow rectangles: it is not uncommon for "inside" boundaries to be stored, and the "inside" of a something-by-1 rectangle is empty.
ahmad
le 26 Nov 2023
Réponses (1)
Hi Ahmad,
I understand that you are facing an “Invalid bounding boxes" error while using Faster RCNN. As pointed out in the error message the probable reasons for the error are:
- Bounding boxes are empty.
- The bounding box is not fully contained within the associated image.
- The height or width is negative.
To overcome the error, you should check for whether the bounding boxes are empty or overextending or with negative dimensions and remove the invalid bounding boxes before training the model.
An example of this check is provided in the documentation for “fasterRCNNObjectDetector” where they call a supporting function “helperSanitizeBoxes” which checks for invalid bounding boxes:
As suggested by @Walter Roberson you could refer to a closely related MATLAB Answer which address more details regarding the “helperSanitizeBoxes” function:
Hope it helps!
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!