1. 程式人生 > >Cannot copy param 0 weights from layer 'fc160_1'; shape mismatch.

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