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

Setting a single negative value or a couple of negative values to sigma argument of ElasticTransform() doesn't get error against the error message #8877

Open
hyperkai opened this issue Jan 24, 2025 · 0 comments

Comments

@hyperkai
Copy link

🐛 Describe the bug

Setting a negative and positive value together to sigma argument of ElasticTransform() gets the error messages as shown below:

from torchvision.datasets import OxfordIIITPet
from torchvision.transforms.v2 import ElasticTransform

my_data1 = OxfordIIITPet(
    root="data",             # ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
    transform=ElasticTransform(sigma=[-100, 100])
)

my_data2 = OxfordIIITPet(
    root="data",             # ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
    transform=ElasticTransform(sigma=[100, -100])
)

my_data1[0] # Error
my_data2[0] # Error

ValueError: sigma should have positive values. Got [-100.0, 100.0]

ValueError: sigma should have positive values. Got [100.0, -100.0]

But setting a single negative value or a couple of negative values to sigma argument of ElasticTransform() doesn't get error against the above error message as shown below:

from torchvision.datasets import OxfordIIITPet
from torchvision.transforms.v2 import ElasticTransform

my_data1 = OxfordIIITPet(
    root="data",             # ↓ ↓ ↓ ↓ ↓
    transform=ElasticTransform(sigma=-100)
)

my_data2 = OxfordIIITPet(
    root="data",             # ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
    transform=ElasticTransform(sigma=[-100, -100])
)

my_data1[0]
# (<PIL.Image.Image image mode=RGB size=394x500>, 0)

my_data2[0]
# (<PIL.Image.Image image mode=RGB size=394x500>, 0)

Versions

import torchvision

torchvision.__version__ # '0.20.1'
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