Skip to content

RandomErasing does support PIL Images #9415

@turbotimon

Description

@turbotimon

📚 The doc issue

Docstring says "This transform does not support PIL Image." but works fine without warning or error:

from PIL import Image
from torchvision.transforms import v2 as transforms

img_pil = Image.open("astronaut.jpg")

t = transforms.RandomErasing(p=1.0)

img_transformed = t(img_pil)

print(type(img_transformed))

img_transformed.show()

Output:
<class 'PIL.Image.Image'>
Image

Torchvision version: '0.25.0+cu128'

Suggest a potential alternative/fix

Check potential issues, remove sentence from docstring

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions