Setting the 1D list of 1 element to RandomRotation()
and RandomAffine()
works against an error message #8863
Open
Description
🐛 Describe the bug
Setting the 1D list of 2 elements to RandomRotation() and RandomAffine() got the error message as shown below:
from torchvision.datasets import OxfordIIITPet
from torchvision.transforms.v2 import RandomRotation
from torchvision.transforms.v2 import RandomAffine
my_data = OxfordIIITPet(
root="data",
transform=RandomRotation(degrees=[0.0, 0.0],
fill=[50.0, 50.0])
)
my_data[0] # Error
my_data = OxfordIIITPet(
root="data",
transform=RandomAffine(degrees=[0.0, 0.0],
fill=[50.0, 50.0])
)
my_data[0] # Error
ValueError: The number of elements in 'fill' does not match the number of channels of the image (2 != 3)
But setting the 1D list of 1 element to RandomRotation()
and RandomAffine()
works against the above error message as shown below:
from torchvision.datasets import OxfordIIITPet
from torchvision.transforms.v2 import RandomRotation
from torchvision.transforms.v2 import RandomAffine
my_data = OxfordIIITPet(
root="data",
transform=RandomRotation(degrees=[0.0, 0.0],
fill=[50.0])
)
my_data[0]
# (<PIL.Image.Image image mode=RGB size=394x500>, 0)
my_data = OxfordIIITPet(
root="data",
transform=RandomAffine(degrees=[0.0, 0.0],
fill=[50.0])
)
my_data[0]
# (<PIL.Image.Image image mode=RGB size=394x500>, 0)
Versions
import torchvision
torchvision.__version__ # '0.20.1'
Metadata
Assignees
Labels
No labels