Invalid bounding boxes were removed when use fasterRCNN with Alexnet

조회 수: 1 (최근 30일)
Beatriz Martins
Beatriz Martins 2019년 12월 28일
댓글: Walter Roberson 2021년 12월 4일
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
Jyosh Matlab
Jyosh Matlab 2021년 12월 4일
How to apply this code exactly...can you give some example?
Thanks
Walter Roberson
Walter Roberson 2021년 12월 4일
%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);

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by