-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
As shown in this line, it says the following:
The imshow commands expects a `numpy array` with shape (3, width, height)This description seems uncorrect, since imshow expects (height, width, 3) and not (3, width, height), Reference for imshow, which has been written correctly in the code.
Also,
Reference for read_image from torchvision that is in the supported code.
Supported code for reference:
import torch
import torchvision
from torchvision.io import read_image
import matplotlib.pyplot as plt
# Read the image as a tensor (C, H, W)
img_tensor = read_image('cat.5077.jpg') # Tensor[3, image_height, image_width]
# Convert to (H, W, C) for matplotlib imshow function
img_np = img_tensor.permute(1, 2, 0).numpy() # np.array > [image_height, image_width, 3]
plt.imshow(img_np)
plt.axis('off')
plt.show()
Metadata
Metadata
Assignees
Labels
No labels