Setting `0` and `1` to `p` argument of `RandomAutocontrast()` gets the same results
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
🐛 Describe the bug
Setting 0 and 1 to p argument of RandomAutocontrast() gets the same results as shown below:
from torchvision.datasets import OxfordIIITPet
from torchvision.transforms.v2 import RandomAutocontrast
origin_data = OxfordIIITPet(
root="data",
transform=None
)
p0_data = OxfordIIITPet(
root="data",
transform=RandomAutocontrast(p=0)
)
p1_data = OxfordIIITPet(
root="data",
transform=RandomAutocontrast(p=1)
)
import matplotlib.pyplot as plt
def show_images1(data, main_title=None):
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)
plt.imshow(X=im)
plt.xticks(ticks=[])
plt.yticks(ticks=[])
plt.tight_layout()
plt.show()
show_images1(data=origin_data, main_title="origin_data")
show_images1(data=p0_data, main_title="p0_data")
show_images1(data=p1_data, main_title="p1_data")
I expected the results of ColorJitter() as shown below:
from torchvision.datasets import OxfordIIITPet
from torchvision.transforms.v2 import ColorJitter
origin_data = OxfordIIITPet(
root="data",
transform=None
)
contrast06_06_data = OxfordIIITPet(
root="data",
transform=ColorJitter(contrast=[0.6, 0.6])
)
contrast4_4_data = OxfordIIITPet(
root="data",
transform=ColorJitter(contrast=[4, 4])
)
import matplotlib.pyplot as plt
def show_images1(data, main_title=None):
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)
plt.imshow(X=im)
plt.xticks(ticks=[])
plt.yticks(ticks=[])
plt.tight_layout()
plt.show()
show_images1(data=origin_data, main_title="origin_data")
show_images1(data=contrast06_06_data, main_title="contrast06_06_data")
show_images1(data=contrast4_4_data, main_title="contrast4_4_data")
Versions
import torchvision
torchvision.__version__ # '0.20.1'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the p=0 and p=1 cases for torchvision.transforms.v2.RandomAutocontrast shown in the report. Inspect the RandomAutocontrast entry point and verify the expected behavior: p=0 should leave inputs unchanged, while p=1 should apply autocontrast; add regression coverage for both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100