ValueError: Expected x_min for bbox (-0.02666666666666667, 0.3022222222222222, 0.10666666666666667, 0.48444444444444446, tensor(1)) to be in the range [0.0, 1.0], got -0.02666666666666667.
See original GitHub issue🐛 Bug
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Environment
- Albumentations version (e.g., 0.1.8):
- Python version (e.g., 3.7): 3.7
- OS (e.g., Linux): ubuntu
- How you installed albumentations (
conda
,pip
, source): pip - Any other relevant information:
Additional context
I’m getting ValueError: Expected x_min for bbox (-0.02666666666666667, 0.3022222222222222, 0.10666666666666667, 0.48444444444444446, tensor(1)) to be in the range [0.0, 1.0], got -0.02666666666666667.
message
my original box is
new_boxes->[[442. 79. 972. 564.]]
its x_min, y_min, x_max, y_max format then it only give this error message when
if random.random() < 0.2:
print('horizontalFlip')
print(f'new_boxes->{new_boxes}')
augment = albumentations.HorizontalFlip(p=0.5)
aug = albumentations.Compose([augment],bbox_params={'format': 'pascal_voc', 'label_fields': ['labels']})
aug_result = aug(image=np.array(new_image), bboxes=new_boxes, labels=labels)
new_image = aug_result['image']
new_boxes = aug_result['bboxes']
new_image = FT.to_pil_image(new_image)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
ValueError: Expected x_max for bbox (0.65, 0.51, 1.12, 0.64, 3 ...
I want to apply data augmentations from PyTorch's Albumentations to images with bounding boxes. When I apply the HorizontalFlip Transformation, ...
Read more >ValueError: Expected x_max for bbox (tensor(0.9297, dtype ...
Hi, It looks like the issue is that you ask for boxes that are outside the image as one of the bounding box...
Read more >Questions & Answers - Kaggle
hi guys could any one tell me why im getting this error an how to fixe it ??? ... tensor(0.5631), tensor(2)) to be...
Read more >Source code for detectron2.structures.boxes
(x0, y0, w, h) in range [0, 1]. They are relative to the size of the image. """ XYWHA_ABS = 4 """ (xc,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This unfortunately is regularly happening for me as well. Here’s my env along with a reproducible script.
It seems to me that all of these errors seem to deal with numerical errors when doing geometric operations on totally legit bounding boxes right at the image boundary. One way to deal with the issue would be to allow an “unsafe” transformation by letting the user control the
check_validity
flag fromBBoxParams
and deal with truncations manually afterwards: that’s still a better option than having a training job fail because of uncontrollable exceptions.CC: @BeckerFelix
Environment
Should be fixed by #924