You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to convert a TIFF image, read in through PIL, to Pytorch tensor. I am doing this through transorms.ToTensor(). I get the following error:
RuntimeError: shape '[1460, 1936, 5]' is invalid for input of size 5653120
The reason for the error is that the function is mistakenly extracting the number of channels as 5.
The TiffImage.mode is "I;16B". Since to_tensor hasn't got a hard coded rule for "I;16B" mode, it gets the number of channels using len(TiffImage.mode) which returns the length of the string.
I am trying to convert a TIFF image, read in through PIL, to Pytorch tensor. I am doing this through
transorms.ToTensor()
. I get the following error:RuntimeError: shape '[1460, 1936, 5]' is invalid for input of size 5653120
The reason for the error is that the function is mistakenly extracting the number of channels as
5
.The
TiffImage.mode
is"I;16B"
. Sinceto_tensor
hasn't got a hard coded rule for"I;16B"
mode, it gets the number of channels usinglen(TiffImage.mode)
which returns the length of the string.cc @vfdev-5
The text was updated successfully, but these errors were encountered: