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

Fixed rounding order of bbox values for yolo format #688

Merged
merged 4 commits into from
Sep 10, 2020
Merged

Conversation

Dipet
Copy link
Collaborator

@Dipet Dipet commented Aug 28, 2020

Issue: #679

Fixed incorrect rounding order for yolo bbox format.

Example:

# Current master
x, y, width, height = (1200.0, 367.5, 158.0, 703.0)
x_min, y_min, x_max, y_max = (1122.0, 17.5, 1280.0, 720.5)

# PR results
x, y, width, height = (1200.0, 367.5, 158.0, 703.0)
x_min, y_min, x_max, y_max = (1122, 17, 1280, 720)

@creafz
Copy link
Contributor

creafz commented Sep 2, 2020

For all other bounding boxes formats, Albumentations returns augmented coordinates as floats. May we should also convert int coordinates to float before returning them to preserve the same output data type?

@Dipet
Copy link
Collaborator Author

Dipet commented Sep 7, 2020

@creafz You a little bit confused me :)
Yolo format is normalized float format, so after transforms we always get floats.
As you can see after conversion to int I call normalize_bbox function that returns floats.

@marcocaccin
Copy link
Contributor

@creafz your suggestion can be a welcome addition, but it is out of scope for fixing this bug (and yes, yolo is float and normalised).

I think it's low on the priority list, but I do find myself having to query the data types of the albu inputs and restoring them afterwards - reason: albumentations transforms are performed inside a tf.numpy_function, which requires strict output types.
Alternatively, just use type annotations and specify that the output bboxes of albumentations will always be float64, that's fair as well

@ternaus ternaus merged commit db8ba0a into master Sep 10, 2020
@ternaus ternaus deleted the fix_bbox_round branch September 10, 2020 16:46
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

Successfully merging this pull request may close these issues.

4 participants