vision icon indicating copy to clipboard operation
vision copied to clipboard

the doc of `alpha` and `sigma` argument of `ElasticTransform()` should have the explanation about if it's a single value

Open hyperkai opened this issue 11 months ago • 1 comments

📚 The doc issue

And, setting a single value and a couple of values to alpha and sigma argument of ElasticTransform() gets the same kind of results as shown below so it seems like a single value is [alpha, alpha] and [sigma, sigma]:

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

my_data = OxfordIIITPet(
    root="data"
)

import matplotlib.pyplot as plt

def show_images(data, main_title=None, a=50, s=5, f=0):
    plt.figure(figsize=(10, 5))
    plt.suptitle(t=main_title, y=0.8, fontsize=14)
    for i, (im, _) in zip(range(1, 6), data):
        plt.subplot(1, 5, i)
        et = ElasticTransform(alpha=a, sigma=s, fill=f) # Here
        plt.imshow(X=et(im)) # Here
        plt.xticks(ticks=[])
        plt.yticks(ticks=[])
    plt.tight_layout()
    plt.show()

show_images2(data=my_data, main_title="alpha1000sigma10_data", a=1000, s=10) # Here
show_images2(data=my_data, main_title="alpha1000_1000sigma10_10_data", a=[1000, 1000], s=[10, 10]) # Here

Image

Image

Suggest a potential alternative/fix

So for alpha and sigma argument, the doc should have the explanation something like as shown below:

A single value is [alpha, alpha]`.

A single value is [sigma, sigma]`.

hyperkai avatar Jan 24 '25 03:01 hyperkai

Agreed this should be documented, happy to consider a PR. Thanks @hyperkai

NicolasHug avatar Feb 19 '25 13:02 NicolasHug