devrimcavusoglu/pybboxes

Bug: `strict=False` behaviour is not working correctly

kadirnar opened this issue · 5 comments

Box:

[0.5362844467163086, 0.781234085559845, 0.5943647623062134, 0.819736897945404]

Pybboxes:

bbox = pbx.convert_bbox(box, from_type="yolo", to_type="voc", image_size=(self.image_width, self.image_height))

Error Message:

ValueError: Top-left axes cannot be negative. To silently skip out of bounds cases pass 'strict=False'.

Should i make the variable strict false?

The box is out-of-bounds (oob) (it exceeds the image bounds). Normally, strict=False should ignore these oob cases. However, when I checked the code, there is actually a bug causing strict=False to throw the same exception. Moreover, out-of-bounds boxes are currently not converted to correct form.

@kadirnar What was the image width & height ?

Hi @devrimcavusoglu ,

I want to use pyboxes library instead of using this code.
https://github.com/kadirnar/sahi/blob/tfhub/sahi/model.py#L1151-L1156

My pybboxes code:

bbox = pbx.convert_bbox(box, from_type="yolo", to_type="voc", image_size=(self.image_width, self.image_height))

@kadirnar The bug is currently fixed on version 0.1.4, there should be no problem.

If you have out-of-bounds boxes, then use it as follows to suppress the error

bbox = pbx.convert_bbox(box, from_type="yolo", to_type="voc", image_size=(self.image_width, self.image_height), strict=False)

I will try soon.