Hello everyone.
Today I faced something strange. When using torchvision.utils.make_grid()
, I noticed when ever I display the resulting image in matplotib, the image is washedout! but when I save it using save_img , it turns out just fine.
This is how it looks when I display the output of make_grid()
in matplotlib :
and this is how it got saved to the disk :
and this is the snippet I wrote :
from` torchvision.utils` import save_image, make_grid
fig = plt.figure(figsize=(28, 28))
for i in range(5):
grid_imgs = make_grid(torch.from_numpy(img_pairs[i]),
nrow=5,
normalize=True)
save_image(grid_imgs,f'results/imgs_{i}.jpg')
ax = fig.add_subplot(5, 1, i+1, xticks=[], yticks=[])
ax.imshow(grid_imgs.numpy().transpose(1,2,0),cmap='Greys_r')
normalizing and not doesnt affect anything.
What am I missing here ?
Your kind help is greatly appreciated