icevision icon indicating copy to clipboard operation
icevision copied to clipboard

reported autofix bounding box is incorrect compared to bounding box result parsed without autofix

Open rbavery opened this issue 3 years ago • 1 comments

🐛 Bug

Describe the bug When I use

train_records = parser.parse(data_splitter=SingleSplitSplitter(), autofix=False)

the bounding box in my single record coco is

train_records[0][0].as_dict()['detection']['bboxes'][1].xyxy
(2945.0, 6249.0, 3005.0, 6376.0)

this is correct

But when I use autofix, I get an autofix report and then an error that remove_annotation doesn't work on detections. but this is wrong since autofix shouldn't be activated on this bounding box. I wasn't able to follow all the components code but this is the result of the autofix, where one value, ymax appears to have been altered in the autofix process to 4176 (I'm not sure where this value comes from)

AUTOFIX-SUCCESS - (record_id: 0) - Clipping bbox ymax from 6376.0 to image height 4176 (Before: <BBox (xmin:2945.0, ymin:6249.0, xmax:3005.0, ymax:6376.0)>) | icevision.utils.logger_utils:autofix_log:17
AUTOFIX-FAIL - (record_id: 0) - Cannot auto-fix coordinates: <BBox (xmin:2945.0, ymin:6249.0, xmax:3005.0, ymax:4176)>
        y_min:6249.0 is greater than or equal to y_max:4176 | icevision.utils.logger_utils:autofix_log:17

I've comfirmed that I'm not getting this error for another bbox or another record. I only have one record in train_records and only 3 bboxes in that record. they are all valid

	- BBoxes: [<BBox (xmin:1025.0, ymin:5659.0, xmax:1298.0, ymax:6155.0)>, <BBox (xmin:2945.0, ymin:6249.0, xmax:3005.0, ymax:6376.0)>, <BBox (xmin:3655.0, ymin:1569.0, xmax:3827.0, ymax:2014.0)>]

To Reproduce The image I'm working with is large and I can't provide the data. but this is the code I'm running

from icevision.parsers import COCOMaskParser
from icevision.data import SingleSplitSplitter

parser = COCOMaskParser(
    annotations_filepath="./no-tiles-dataset/instances.json",
    img_dir="./no-tiles-dataset/untiled_images/",
)

train_records = parser.parse(data_splitter=SingleSplitSplitter())

Expected behavior I'd expect autofixing to work with instance masks and for the autofixing to not return that records need to be fixed when the bboxes are valid.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04

rbavery avatar May 04 '22 01:05 rbavery

I confirm that I have encountered this problem which is a serious one. In my case, it appears for few records. It has blocked me from training models as whenever I disable it and start training it raises the exception. This seems to be a process operating on records that it is used for autofix and dataloader for training.

iskode avatar Jun 20 '22 08:06 iskode