Hello all,
Could you please help me with a doubt? I have a 2D NumPy array that represents an image in black and white (shape: 1x224x224). After converting the NumPy array to a PyTorch tensor, I want to apply transformations to the image (using ToPILImage). Nevertheless, I got a noisy image as a result.
The NumPy array in matplotlib looks like this:
But the ToPILImage() figures looks noisy:
My question is:
- How can I convert the PyTorch tensor (in black and white) to the PIL object, so it looks more like the first matplotlib image? I am using transforms.ToPILImage() at the moment.
Thank you so much,