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 COCO box format in dataset wrapper #7225

Merged
merged 1 commit into from
Feb 13, 2023
Merged

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Feb 13, 2023

See this manual XYWH -> XYXY conversion in the references

boxes = torch.as_tensor(boxes, dtype=torch.float32).reshape(-1, 4)
boxes[:, 2:] += boxes[:, :2]
boxes[:, 0::2].clamp_(min=0, max=w)
boxes[:, 1::2].clamp_(min=0, max=h)

or this from the datasets v2:

bounding_boxes=BoundingBox(
[ann["bbox"] for ann in anns],
format="xywh",
spatial_size=spatial_size,
),

cc @vfdev-5 @bjuncek

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Philip

@NicolasHug NicolasHug merged commit c73411a into pytorch:main Feb 13, 2023
@pmeier pmeier deleted the coco-wrapper branch February 13, 2023 09:48
facebook-github-bot pushed a commit that referenced this pull request Mar 28, 2023
Reviewed By: vmoens

Differential Revision: D44416270

fbshipit-source-id: d24fd35c6edff46e177d0145cde33a24a7a67af9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants