Skip to content
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

在自己数据集下运行preview.py报错 ValueError: Expected y_max for bbox #22

Closed
TIMEXue opened this issue Sep 15, 2021 · 2 comments

Comments

@TIMEXue
Copy link

TIMEXue commented Sep 15, 2021

信息如下:
Traceback (most recent call last):24493 .........] ETA: 41m
File "preview.py", line 33, in
for i, sample in enumerate(preview):
File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in next
data = self._next_data()
File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/lungchi/easy_detection/dataloader/list_dataset.py", line 21, in getitem
return dataset[index - total]
File "/home/lungchi/easy_detection/dataloader/voc.py", line 213, in getitem
'labels': labels
File "/opt/conda/lib/python3.7/site-packages/albumentations/core/composition.py", line 188, in call
p.preprocess(data)
File "/opt/conda/lib/python3.7/site-packages/albumentations/core/utils.py", line 84, in preprocess
data[data_name] = self.check_and_convert(data[data_name], rows, cols, direction="to")
File "/opt/conda/lib/python3.7/site-packages/albumentations/core/utils.py", line 92, in check_and_convert
return self.convert_to_albumentations(data, rows, cols)
File "/opt/conda/lib/python3.7/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 "/opt/conda/lib/python3.7/site-packages/albumentations/augmentations/bbox_utils.py", line 306, in convert_bboxes_to_albumentations
return [convert_bbox_to_albumentations(bbox, source_format, rows, cols, check_validity) for bbox in bboxes]
File "/opt/conda/lib/python3.7/site-packages/albumentations/augmentations/bbox_utils.py", line 306, in
return [convert_bbox_to_albumentations(bbox, source_format, rows, cols, check_validity) for bbox in bboxes]
File "/opt/conda/lib/python3.7/site-packages/albumentations/augmentations/bbox_utils.py", line 254, in convert_bbox_to_albumentations
check_bbox(bbox)
File "/opt/conda/lib/python3.7/site-packages/albumentations/augmentations/bbox_utils.py", line 333, in check_bbox
"to be in the range [0.0, 1.0], got {value}.".format(bbox=bbox, name=name, value=value)
ValueError: Expected y_max for bbox (0.19440914866581957, 0.14192139737991266, 0.7903430749682337, 1.0087336244541485, 1) to be in the range [0.0, 1.0], got 1.0087336244541485.

@misads
Copy link
Owner

misads commented Sep 17, 2021

可能是数据集格式有问题 boundind box的范围超出了图像的宽高,可以分别尝试以下方法:

  1. 修改preview.py Line31
    preview = train_dataloader # train_dataloader, val_dataloader

    改为
preview = val_dataloader 
  1. 修改 dataloader/voc.py
    width = int(size.find('width').text)
    height = int(size.find('height').text)

    改为
image = cv2.imread(abspath)
height, width, _ = image.shape
  1. preview报错时打印出文件路径sample['path'],检查数据集Annotations中该图像的标注,width与height是否与图像对应,以及目标框是否超出图像长宽范围。

@TIMEXue
Copy link
Author

TIMEXue commented Sep 17, 2021

数据格式的问题,昨天解决了,谢谢

@TIMEXue TIMEXue closed this as completed Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants