Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

torchvision.io.read_image() to accept PosixPath ? #4891

Closed
vfdev-5 opened this issue Nov 9, 2021 · 1 comment
Closed

torchvision.io.read_image() to accept PosixPath ? #4891

vfdev-5 opened this issue Nov 9, 2021 · 1 comment

Comments

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Nov 9, 2021

🚀 The feature

What do you think about supporting PosixPath objects while reading the images with io.read_image ?

from pathlib import Path
import torchvision.io as io

p = Path("test-image.jpg")
assert p.exists()
mode = io.ImageReadMode.RGB
tensor = io.read_image(p, mode)

Today, it fails with the following error:

RuntimeError: image::read_file() Expected a value of type 'str' for argument '_0' but instead found type 'PosixPath'.

Motivation, pitch

Alternatives

No response

Additional context

No response

@vfdev-5
Copy link
Collaborator Author

vfdev-5 commented Nov 9, 2021

Duplicate : #2962

@vfdev-5 vfdev-5 closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant