I’ve trained my own model in pytorch and I want to test it with an unused image for my own training and testing, but it doesn’t work.
from torchvision import transforms
img=(Image.open(r"C:\Users\yasar\Desktop\Pytorch\ferrari.jpg"))
transform = transforms.Compose([        # Defining a variable transforms
 transforms.Resize(256),                # Resize the image to 256×256 pixels
 transforms.CenterCrop(224),            # Crop the image to 224×224 pixels about the center
 transforms.ToTensor(),                 # Convert the image to PyTorch Tensor data type
 transforms.Normalize(                  # Normalize the image
 mean=[0.485, 0.456, 0.406],            # Mean and std of image as also used when training the network
 std=[0.229, 0.224, 0.225]      
 )])

img_t = transform(img)
img_t.shape

batch_t = torch.unsqueeze(img_t, 0)
model.eval()

out = model(batch_t)
out.shape

RuntimeError: shape ‘[1, 519840]’ is invalid for input of size 20000