This is a tutorial code:
img = img / 2 + 0.5 # unnormalize
npimg = img.numpy()
plt.imshow(np.transpose(npimg, (1, 2, 0)))
get some random training images
dataiter = iter(trainloader)
images, labels = dataiter.next()
print(’ ‘.join(’%5s’ % classes[labels[j]] for j in range(4)))
What is function of ‘torchvision.utils.make_grid’ ?why don’t show image using functions 'imshow (images) directly?
torchvision.utils.make_grid creates a single image containing all passed image tensors as a grid, which might be more convenient in case you want to display a few images.
Still concerning this topic:
In the tutorial, the
img_grid is sent to tensorboard without normalization:
while the function
matplotlib_imshow unnormalizes the images.
As the images are sent to tensorboard to be visualized, shouldn’t tensorboard also receive unnormalized images?