-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yolo boxes format overflowing image and thowing an exception #848
Comments
It is not a bug. It is a feature. It is much easier to pre-process labels once before model training, rather than catching the challenging corner cases. Feel free to add one line that clips the bounding boxes to your dataloader :) |
Actually upon further investigation, there is a bug somewhere. |
Could you please provide an example that reproduces the behavior? |
The image might be proprietary, but here is one box causing the issue: Yolo Format: My albumentations conversion: Exception for this box: My conversion code:
|
Before data augmentation, the length and width of GT bboxes are subtracted by one pixel, which has little effect on the label bounding box, but it can prevent the overflow of values and prevent the generation of labels greater than 1. labels format: yolo for i in range(len(bboxes)):
bboxes[i][2] = np.abs(bboxes[i][2] - 0.5 / image.shape[0])
bboxes[i][3] = np.abs(bboxes[i][3] - 0.5 / image.shape[1]) To further reduce the impact of processing, I only subtracted 0.5 pixels from the code. |
Should be fixed by #924 |
🐛 Bug
I have some bounding boxes in yolo format that are off the image.
To Reproduce
\lib\site-packages\albumentations\augmentations\bbox_utils.py", line 330, in check_bbox
"to be in the range [0.0, 1.0], got {value}.".format(bbox=bbox, name=name, value=value)
ValueError: Expected x_max for bbox (0.9967206790123457, 0.5379050925925926, 1.0001929012345678, 0.5529513888888888, 0) to be in the range [0.0, 1.0], got 1.0001929012345678.
Expected behavior
I would prefer it to clip the boxes, or at least give me the option to do so.
Environment
conda
,pip
, source): pipThe text was updated successfully, but these errors were encountered: