solrex/caffe-mobile

Failed to parse NetParameter file: /storage/emulated/0/lenet.protobin

Closed this issue · 2 comments

在Android端跑caffesimple,lenet.protobin是由prototxt2bin.py转换过来的,用系统提供的可以运行,自己转换的报以下错误,谢谢!
D/MainActivity: onCreate: modelFile:/storage/emulated/0/lenet.protobin
onCreate: weightFIle:/storage/emulated/0/weight.caffemodel
I/caffe: ERROR D:/caffe/caffe-mobile/src/caffe/util/upgrade_proto.cpp:97] ReadProtoFromBinaryFile(param_file, param) Failed to parse NetParameter file: /storage/emulated/0/lenet.protobin
I/caffe: INFO D:/caffe/caffe-mobile/src/caffe/net.cpp:765] Ignoring source layer mnist
INFO D:/caffe/caffe-mobile/src/caffe/net.cpp:765] Ignoring source layer conv1
INFO D:/caffe/caffe-mobile/src/caffe/net.cpp:765] Ignoring source layer pool1
INFO D:/caffe/caffe-mobile/src/caffe/net.cpp:765] Ignoring source layer conv2
INFO D:/caffe/caffe-mobile/src/caffe/net.cpp:765] Ignoring source layer pool2
INFO D:/caffe/caffe-mobile/src/caffe/net.cpp:765] Ignoring source layer ip1
INFO D:/caffe/caffe-mobile/src/caffe/net.cpp:765] Ignoring source layer relu1
I/caffe: INFO D:/caffe/caffe-mobile/src/caffe/net.cpp:765] Ignoring source layer ip2
INFO D:/caffe/caffe-mobile/src/caffe/net.cpp:765] Ignoring source layer loss
INFO D:/caffe/caffe-mobile/src/jni/caffe_mobile.cpp:40] Load (/storage/emulated/0/lenet.protobin,/storage/emulated/0/weight.caffemodel), time:67.293 ms.
ERROR D:/caffe/caffe-mobile/src/jni/caffe_mobile.cpp:43] (net_->num_inputs()) == (1) Network should have exactly one input.
ERROR D:/caffe/caffe-mobile/src/jni/caffe_mobile.cpp:44] (net_->num_outputs()) == (1) Network should have exactly one output.
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 26214 (nbo.caffesimple)

@liutao0913 这个错误信息已经写得很清晰了:

ERROR D:/caffe/caffe-mobile/src/jni/caffe_mobile.cpp:43] (net_->num_inputs()) == (1) Network should have exactly one input.
ERROR D:/caffe/caffe-mobile/src/jni/caffe_mobile.cpp:44] (net_->num_outputs()) == (1) Network should have exactly one output.

你仔细读下 README.md,训练用的 prototxt 是支持 mini batch 的,但是预测时候不需要,就是输入一张图片输出一个结果。

@solrex 你好,我把batch改为1仍然报错 Failed to parse NetParameter File: /storage/emulated/0/lenet.protobin,后来对比正确的和错误的protobin文件发现错误的比正确的多一个回车操作,把回车符去掉就正常了!谢谢!