I am converting NHWC to NCHW format because I receive the following error:
RuntimeError: Given groups=1, weight of size [64, 3, 7, 7], expected input[1, 500, 353, 3] to have 3 channels, but got 500 channels instead
My solution is to use permute like so:
torch.permute(imgdata, (0, 3, 1, 2))
But I get this error:
RuntimeError: number of dims don't match in permute
I tried to edit the permute code like this:
torch.permute(imgdata, (0, 2, 1))
but it just goes back to the first error RuntimeError: Given groups=1, weight of size [64, 3, 7, 7], expected input[1, 500, 353, 3] to have 3 channels, but got 500 channels instead
Here is part of my code that is relevant to the errors:
for imname, metaitem in metadata_test.items():
metaitem = metadata_test[imname]
impath = metaitem['impath']
impath = cv2.imread(impath)
imgdata = torch.Tensor(impath)
torch.permute(imgdata, (0, 3, 1, 2))
pred = model(imgdata)
Any ideas for me? Thank you in advance