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

Error in Visualize_video.py when using result/SINet/SINet.pth #25

Closed
Novaal opened this issue May 13, 2020 · 5 comments
Closed

Error in Visualize_video.py when using result/SINet/SINet.pth #25

Novaal opened this issue May 13, 2020 · 5 comments

Comments

@Novaal
Copy link

Novaal commented May 13, 2020

Hello @HYOJINPARK ,

when i try to use the result/SINet/SINet.pth with ./etc/Visualize_video.py i get the following Error:

RuntimeError: Error(s) in loading state_dict for SINet:
	size mismatch for encoder.classifier.conv.weight: copying a param of torch.Size([1, 144, 1, 1]) from checkpoint, where the shape is torch.Size([2, 144, 1, 1]) in current model.
	size mismatch for bn_3.weight: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for bn_3.bias: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for bn_3.running_mean: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for bn_3.running_var: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for level2_C.conv.weight: copying a param of torch.Size([1, 48, 1, 1]) from checkpoint, where the shape is torch.Size([2, 48, 1, 1]) in current model.
	size mismatch for level2_C.bn.weight: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for level2_C.bn.bias: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for level2_C.bn.running_mean: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for level2_C.bn.running_var: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for level2_C.act.weight: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for bn_2.weight: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for bn_2.bias: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for bn_2.running_mean: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for bn_2.running_var: copying a param of torch.Size([1]) from checkpoint, where the shape is torch.Size([2]) in current model.
	size mismatch for classifier.1.weight: copying a param of torch.Size([1, 1, 3, 3]) from checkpoint, where the shape is torch.Size([2, 2, 3, 3]) in current model.

With self trained models i don't get this error. How can i fix this?

Your response would be highly appreciated. Thank you!

@cyf518
Copy link

cyf518 commented May 29, 2020

same issue

@qiutzh
Copy link

qiutzh commented May 29, 2020

@cyf518 Hi, did you solve the problem?

@cyf518
Copy link

cyf518 commented May 29, 2020

@qiutzh
i change net = Dnc_SINet(classes=1, p=2, q=8, chnn=1) to net = Dnc_SINet(classes=2, p=2, q=8, chnn=1)

@YAwei666
Copy link

@qiutzh
i change net = Dnc_SINet(classes=1, p=2, q=8, chnn=1) to net = Dnc_SINet(classes=2, p=2, q=8, chnn=1)
RuntimeError: weight tensor should be defined either for all or no classes at /pytorch/aten/src/THCUNN/generic/SpatialClassNLLCriterion.cu:27
when I changed this,another problem accurs. do you know how to solve this ?

@aguthrie19
Copy link

aguthrie19 commented Nov 21, 2020

It looks like at least one of these, maybe both, is incorrect:

  • the "chnn" integer in your .json (ex setting/SINet.json or whichever you're using when loading your model)
  • or the "resume" checkpoint in your .json (ex result/training_session/checkpoint.pth.tar)

For whatever reason, your code is trying to combine a SINet.pth model with a checkpoint model, but it can't because SINet.pth expects 2 channels and your checkpoint provides configurations for only 1 channel.

Hope this helps! Share a snippet of the code you're running for more help.

@Novaal Novaal closed this as completed Dec 14, 2020
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

5 participants