Invalid bounding boxes were removed when use fasterRCNN with Alexnet

1 vue (au cours des 30 derniers jours)
Beatriz Martins
Beatriz Martins le 28 Déc 2019
Commenté : Walter Roberson le 4 Déc 2021
I'm using a database to train model by fasterRCNN.
I have 5000 images with 1024 by 1024. When I use AlexNet i get the followig warning:
Warning: Invalid bounding boxes from 1740 out of 5000 training images were removed.
Bounding boxes must be fully contained within their associated image and must have positive width and height.
I check my bounding boxes and some bounding box might be lying the the boundary of the image, but it doesn't happen with all of them and width and heigth are positve.
Does anyone know how to resolve this?
  4 commentaires
Jyosh Matlab
Jyosh Matlab le 4 Déc 2021
How to apply this code exactly...can you give some example?
Thanks
Walter Roberson
Walter Roberson le 4 Déc 2021
%assuming: YourImage, bounding_x, bounding_y, bounding_width,
%bounding_height
%bounding box must not be empty, and must be strictly inside the
%image, not on the edge of the image. That requires a minimum size of 3
[image_rows, image_columns, ~] = size(YourImage);
assert(image_rows >= 3, 'Image must have at least 3 rows')
assert(image_columns >= 3, 'Image must have at least 3 columns');
%force the start to be strictly inside the margins. The assumption is that
%the existing positions are as close to correct as possible, and that the
%size might need to be adjusted. So for example if you ask for a box of
%width 10 but you are only 6 units from the right edge, the width will be
%shrunk. It is true, though, that if the position is outside to the top or
%left then it will be moved full-size. You have to make SOME decision as to
%what to prioritize; it would certainly be a valid decision to prioritize
%the size of the box and move the box to fit the size.
bounding_x = min(max(2, bounding_x), image_columns-1);
bounding_y = min(max(2, bounding_y), image_rows-1);
%now make box smaller if needed
bounding_width = min(bounding_width, image_columns-bounding_x);
bounding_height = min(bounding_height, image_rows-bounding_y);

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by