ValueError: Expected x_max for bbox to be in the range [0.0, 1.0], got 1.0025.
See original GitHub issue🐛 Bug
I tried to transform images using RandomResizedCrop with its bounding box (yolo format). But, there are images that when the program tried to transform the bounding box, I got error saying that the bounding box value (after transformation) is not in the range of 0-1. I already checked the original bounding box, and there is nothing wrong with the original bounding box value.
This is my pipeline
transform = A.Compose([
A.RandomResizedCrop(608, 608),
], bbox_params = A.BboxParams(format='yolo'))
This is the code to place the bounding box to an array and transform it
bboxes = []
for dt in data:
ann = []
# Split string to float
c, x, y, w, h = map(float, dt.split(' '))
ann.append(x)
ann.append(y)
ann.append(w)
ann.append(h)
ann.append(c)
bboxes.append(ann)
transformed = transform(image=img, bboxes=bboxes)
And this is the error
File "C:\Users\Atika Pane\AppData\Roaming\Python\Python38\site-packages\albumentations\core\composition.py", line 180, in __call__
p.preprocess(data)
File "C:\Users\Atika Pane\AppData\Roaming\Python\Python38\site-packages\albumentations\core\utils.py", line 62, in preprocess
data[data_name] = self.check_and_convert(data[data_name], rows, cols, direction="to")
File "C:\Users\Atika Pane\AppData\Roaming\Python\Python38\site-packages\albumentations\core\utils.py", line 70, in check_and_convert
return self.convert_to_albumentations(data, rows, cols)
File "C:\Users\Atika Pane\AppData\Roaming\Python\Python38\site-packages\albumentations\augmentations\bbox_utils.py", line 51, in convert_to_albumentations
return convert_bboxes_to_albumentations(data, self.params.format, rows, cols, check_validity=True)
File "C:\Users\Atika Pane\AppData\Roaming\Python\Python38\site-packages\albumentations\augmentations\bbox_utils.py", line 302, in convert_bboxes_to_albumentations
return [convert_bbox_to_albumentations(bbox, source_format, rows, cols, check_validity) for bbox in bboxes]
File "C:\Users\Atika Pane\AppData\Roaming\Python\Python38\site-packages\albumentations\augmentations\bbox_utils.py", line 302, in <listcomp>
return [convert_bbox_to_albumentations(bbox, source_format, rows, cols, check_validity) for bbox in bboxes]
File "C:\Users\Atika Pane\AppData\Roaming\Python\Python38\site-packages\albumentations\augmentations\bbox_utils.py", line 251, in convert_bbox_to_albumentations
check_bbox(bbox)
File "C:\Users\Atika Pane\AppData\Roaming\Python\Python38\site-packages\albumentations\augmentations\bbox_utils.py", line 327, in check_bbox
raise ValueError(
ValueError: Expected x_max for bbox (0.9675, 0.19469026548672566, 1.0025, 0.3274336283185841, 0.0) to be in the range [0.0, 1.0], got 1.0025.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
ValueError: Expected x_max for bbox (0.94375 ... - GitHub
I tried to use any of transforms like VerticalFlip, RandomSizedBBoxSafeCrop and others box coordinate transformations but always i got the error "Expected x_max ......
Read more >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 >Source code for albumentations.augmentations.bbox_utils
Should be a value in the range [0.0, 1.0]. min_area (float): Minimal area threshold. """ img_height, img_width = original_shape[:2] transformed_img_height, ...
Read more >Questions & Answers - Kaggle
Expected x_max for bbox (tensor(0.7968), tensor(0.4257), tensor(1.0041), tensor(0.5631), tensor(2)) to be in the range [0.0, 1.0], got 1.0040837526321411.
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
It looks like the problem is known. These issues looks the same:
I will try to fix this problem today.
Should be fixed by #924