from PIL import Image
import cv2
for ind in labels[labels[‘LABEL’]==1][‘filename’][-5:]:
path = ind
imgr = cv2.imread(path)
imgr = cv2.resize(imgr,dsize=(224,224))
trans = transforms.ToTensor()
print(imgr.shape) #prints(224,224,3)
plt.imshow(trans(imgr)) #displayes error** invalid shape (3,224,224) for image data