Cannot copy param 0 weights from layer 'fc160_1'; shape mismatch.

caffe 模型训练好了,拿去使用时出现以下错误:

Cannot copy param 0 weights from layer 'fc160_1'; shape mismatch.  Source param shape is 160 26460 (4233600); target param shape is 160 5940 (950400). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.

*** Check failure stack trace: ***

因为shape不匹配。训练时的图片大小和运行时输入的图片大小不一致:

我的数据集采用lmdb的形式:

数据集中的图片大小为96 * 96

在deploy.protxt中

所以才出现这样的错误,解决方法:在deploy.protxt中将 输入图片的width, height 改成和数据集一样。

在使用该模型时,要注意,对于输入图片的处理也要改成96*96

猜你喜欢

转载自blog.csdn.net/qq_35759574/article/details/84028010