Skip to content

Remove inaccurate image validity check #261

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bbergeron0
Copy link

Solves #260

Since we're opening the image with Pillow immediately after the check, we can simply skip it and let Pillow perform its own, more accurate image validity check. Note that the check function itself has been kept, as it’s used elsewhere in the code, apparently for dataset and directory filtering.

It might be worth considering the removal of this function in the remaining places as well, and handling any exceptions when the files are actually loaded. I’ll leave it to the maintainers to decide how this should be addressed.

I’ve also refactored imread2tensor to eliminate the code duplicated from imread2pil.

Since we're opening the image with Pillow immediately after the check, we can simply skip it and let Pillow perform its own, more accurate image validity check. I’ve also refactored `imread2tensor` to eliminate the code duplicated from `imread2pil`. Note that the check function itself has been kept, as it’s used elsewhere in the code, apparently for dataset filtering.
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

Successfully merging this pull request may close these issues.

1 participant