In order to commemorate the silly bugs that appeared in the programming career, this note is hereby made for reference.
- The ToPILImage() function in torchvision
torchvision.transforms.TOPILImage()
is used to convert atensor
form of picture into aPIL
picture format for subsequent processing, such ascrop
,resize
etc. But the input tensor shape of this function should be the same(Channels, Height, Width)
, don't put the channel to the end, otherwise there will be unexpected errors, and it is not easy to find. Inpytorch
, all input and output should be channel first (channel first).