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

Yolo Bboxes will generate tags larger than 1. #862

Closed
sang-yc opened this issue Mar 31, 2021 · 3 comments
Closed

Yolo Bboxes will generate tags larger than 1. #862

sang-yc opened this issue Mar 31, 2021 · 3 comments

Comments

@sang-yc
Copy link

sang-yc commented Mar 31, 2021

Bboxes will generate tags larger than 1 when using 'albumentations' for data augmentation. Why? What should be done?

The error is as follows:
ValueError: Expected x_max for bbox (0.284, 0.15315315315315314, 1.002, 0.993993993993994, 6.0) to be in the range [0.0, 1.0], got 1.002.

@sang-yc
Copy link
Author

sang-yc commented Apr 1, 2021

I have found a solution to this problem.
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
image.shape[0]: width of image
image.shape[1]: length of image
bboxes: [[x, y, w, h, class], [x, y, w, h, class], ...]

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.

@christian-cahig
Copy link

Bboxes will generate tags larger than 1 when using 'albumentations' for data augmentation. Why? What should be done?

The error is as follows:
ValueError: Expected x_max for bbox (0.284, 0.15315315315315314, 1.002, 0.993993993993994, 6.0) to be in the range [0.0, 1.0], got 1.002.

I raised an issue (#883) that could possibly explain this.

@Dipet
Copy link
Collaborator

Dipet commented Jul 7, 2021

Should be fixed by #924

@Dipet Dipet closed this as completed Jul 7, 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

3 participants