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

Allow SanitizeBoundingBoxes to sanitize more labels #8319

Merged
merged 9 commits into from
Mar 15, 2024

Conversation

NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented Mar 15, 2024

Closes #8294

We allow the labels_getter parameter of SanitizeBoudingBoxes to return a tuple. Each entry in the tuple gets sanitized/subsampled, along with the boxes. This enables the sanitization of properties like "area" or "iscrowd" from COCO.

cc @vfdev-5

Copy link

pytorch-bot bot commented Mar 15, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/8319

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit c9bd6c8 with merge base 53869eb (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link
Collaborator

@pmeier pmeier left a comment

Choose a reason for hiding this comment

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

Just minor things. Thanks Nicolas!

test/test_transforms_v2.py Show resolved Hide resolved
labels = tuple(labels)
for entry in labels:
if not isinstance(entry, torch.Tensor):
# TODO: we don't need to enforce tensors, just that entries are indexable as t[bool_mask]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just checking: was this a requirement from the issue or a nice to have?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just a nice to have

torchvision/transforms/v2/_misc.py Outdated Show resolved Hide resolved
@NicolasHug NicolasHug merged commit fa82fd3 into pytorch:main Mar 15, 2024
81 checks passed
@NicolasHug NicolasHug deleted the sanitize_labels_tuple branch March 15, 2024 15:13
@MarcSzafraniec
Copy link

Thanks ! :)

facebook-github-bot pushed a commit that referenced this pull request Mar 21, 2024
Reviewed By: vmoens

Differential Revision: D55062811

fbshipit-source-id: 2216cc6805bff1c69d3dd7e570b80c927b82d19a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: done
Development

Successfully merging this pull request may close these issues.

Cleaner SanitizeBoundingBoxes transform
4 participants