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

Example on Semantic segmentation contains bug #6865

Open
ducha-aiki opened this issue May 3, 2024 · 0 comments
Open

Example on Semantic segmentation contains bug #6865

ducha-aiki opened this issue May 3, 2024 · 0 comments

Comments

@ducha-aiki
Copy link

Describe the bug

https://huggingface.co/docs/datasets/en/semantic_segmentation shows wrong example with torchvision transforms.
Specifically, as one can see in screenshot below, the object boundaries have weird colors.

image

Original example with albumentations is correct
image

That is because torch vision.transforms.Resize interpolates with bilinear everything which is wrong when used for segmentation labels - you just cannot mix them. Overall, torchvision.transforms is designed for classification only and cannot be used to images and masks together, unless you write two separate branches of augmentations.

The correct way would be to use v2 version of transforms and convert the segmentation labels to https://pytorch.org/vision/main/generated/torchvision.tv_tensors.Mask.html#torchvision.tv_tensors.Mask object

Steps to reproduce the bug

Go to the website.
image

https://huggingface.co/docs/datasets/en/semantic_segmentation

Expected behavior

Results, similar to albumentation. Or remove the torch vision part altogether. Or use kornia instead.

Environment info

Irrelevant

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

1 participant