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

Converted Caffe model causes exception when loading #29

Open
unanan opened this issue Nov 29, 2018 · 0 comments
Open

Converted Caffe model causes exception when loading #29

unanan opened this issue Nov 29, 2018 · 0 comments

Comments

@unanan
Copy link

unanan commented Nov 29, 2018

Hi, @starimeL . I use this converter to convert my model of trained MTCNN, from pytorch to caffe.
I also convert it to NCNN to test if the error comes from my network or binary file, but it runs well in NCNN. But I convert it to caffe *.prototxt and *.caffemodel. It causes exception when running:

	pnet_ = new caffe::Net<float>(".\\models\\PNet.prototxt", caffe::TEST);
	pnet_->CopyTrainedLayersFrom(".\\models\\PNet.caffemodel");

The error log:

Cannot copy param 0 weights from layer 'PReLU_1'; shape mismatch.  Source param shape is 1 (1); target param shape is 10 (10). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.
*** Check failure stack trace: ***

The network:

PNet (
    (pre_layer): Sequential (
      (0): Conv2d(3, 10, kernel_size=(3, 3), stride=(1, 1))
      (1): PReLU (1)
      (2): MaxPool2d (size=(2, 2), stride=(2, 2), dilation=(1, 1))
      (3): Conv2d(10, 16, kernel_size=(3, 3), stride=(1, 1))
      (4): PReLU (1)
      (5): Conv2d(16, 32, kernel_size=(3, 3), stride=(1, 1))
      (6): PReLU (1)
    )
    (conv4_1): Conv2d(32, 1, kernel_size=(1, 1), stride=(1, 1))
    (conv4_2): Conv2d(32, 4, kernel_size=(1, 1), stride=(1, 1))
    (conv4_3): Conv2d(32, 10, kernel_size=(1, 1), stride=(1, 1))
  )
)

Thank you.

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

1 participant