Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error occurs when running the test.py file #2

Open
iSuerte opened this issue Sep 23, 2021 · 2 comments
Open

An error occurs when running the test.py file #2

iSuerte opened this issue Sep 23, 2021 · 2 comments

Comments

@iSuerte
Copy link

iSuerte commented Sep 23, 2021

When I run the test.py file,I get an error saying ' RuntimeError : The expanded size of the tensor(256)must match the existing size(1024)at non-singleton dimension 3.Target sizes:[1,16,256,256].Implication of sizes:[16,1024,1024]'have you ever had this problem and how do you solve it?
I am looking forward to your reply.
Thank you.

@LinkaSage
Copy link

Hello,I have the same problem. Have you solved it?

@haimeilv
Copy link

haimeilv commented May 3, 2022

#I solved this problem, which is caused by the inconsistency between the input image size and the training. You need to find this code:

trf = transforms.Compose([
transforms.ToTensor(),
# transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.255])
])

#You need to replace the above code with the following code:

trf = transforms.Compose([
transforms.Resize(img_size),
transforms.CenterCrop(img_size),
transforms.ToTensor(),
# transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.255])
])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants