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

Fix Pascal Conversion #424

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

akindofyoga
Copy link

@akindofyoga akindofyoga commented Sep 13, 2022

Data exported from CVAT to the Pascal VOC format does not have the truncated, difficult, or pose fields. It also specifies coordinates using float values instead of ints.

This code was casting obj['bndbox']['xmin'] to a float in one location, and then an int in another. The cast to an int would cause an error when obj['bndbox']['xmin'] contained a float value. This change rounds the float value, which makes the cast to an int successful. It does not change the code's behavior when obj['bndbox']['xmin'] has an int value.

This change does not affect behavior when the difficult, truncated, and pose fields are specified. However, it makes the code work correctly for files that do not contain these fields.

Data exported from CVAT to the Pascal VOC format does not have the truncated or pose fields. It also specifies coordinates using float values instead of ints.

An earlier part of the code casts `obj['bndbox']['xmin']` to a float, so it seems valid to do this in the second place that accesses `obj['bndbox']['xmin']`, and just round this value. The behavior should be identical when values are ints. 

The behavior is identical when difficult and truncated fields are specified. However, this change also makes this code work correctly for files that do not contain these fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review size:S CL Change Size: Small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants