-
Notifications
You must be signed in to change notification settings - Fork 7k
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
16 bits png support and compatibility with current transforms #4731
Comments
FYI adding a new |
Thanks for the feedback, I'd be very interested in reading those references - if we have enough good reasons to include a new param this could be a decent solution. For now I'm only aware of one reason (that issue), so it doesn't seem worth it, but if we have more it could be a serious candidate |
@NicolasHug I'll try to have a look to get these examples. Another idea discussed on Github issues was also to store this information on the new Image classes that @pmeier is working on. This way we won't have to pass an extra parameter and we can read this info directly from the input tensor meta-data. |
Trying to package torchvision 0.12 for conda-forge, all the test failures I see are:
Is there like a secret switch to allow these to pass - because (from what I can tell) it seems the respective images are there in the sources... |
For context, in the so-called feedstock for conda-forge (latest PR), we're running the full torchvision test suite based on the github sources. So AFAIU, running into these "private" tests will be unavoidable, unless we skip/delete them, or there's a secret switch (I presume that's how the CI here does it, but haven't investigated yet...). |
Thanks for the report @h-vetinari . The secret switch is just and the offending test calls which itself will call I'm unable to reproduce the issue locally. If I had to take a wild guess, I would bet that your CI pipeline is setup in such a way that If that's the case please let us know and we'll make that check more robust |
That was a great guess:
That would be wonderful, thanks a lot! 🙃 |
We added support for decoding 16 bit pngs in #4657.
Pytorch doesn't support
uint16
dtype, so we have to return aint32
tenor instead. However as @nairbv pointed out, this can lead to unexpected behaviour for theconvert_image_dtype()
, because this function relies on the max value of a given dtype to carry the conversions.While the actual max value of a 16 bits image is
2**16 - 1
,convert_image_dtype()
will assume that it's(2**31 - 1)
because the image is in aint32
tensor. This leads to e.g. a tensor full of zeros when converting to uint8.Potential solutions are:
input_range=None
parameter toconvert_image_dtype()
(not a fan of that)For now, I'll just make this a private API (e.g.
_decode_16bits_png()
or something). It will still allow to continue the work on RAFT, which was the main reason I needed 16bits decoding in the first place.The text was updated successfully, but these errors were encountered: