pytorch / pytorch/vision

`alpha` argument of `ElasticTransform()` should completely avoid negative values, giving error and the doc should have the explanation.

Open
#8,880 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

📚 The doc issue

Setting 1000 and -1000 to alpha argument of ElasticTransform() gets the same kind of results as shown below:

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

my_data = OxfordIIITPet(
    root="data"
)

import matplotlib.pyplot as plt

def show_images2(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="alpha1000_data", a=1000) # Here
show_images2(data=my_data, main_title="alpha-1000_data", a=-1000) # Here

Image

Image

Suggest a potential alternative/fix

So, alphe argument should completely avoid negative values, giving error and the doc should have the explanation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the torchvision.transforms.v2.ElasticTransform entry point and reproduce the documented example with positive and negative alpha values. Update the behavior so negative alpha is rejected, then update the linked ElasticTransform documentation to explain the constraint and verify the example no longer produces equivalent results.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.