Search code examples
machine-learningneural-networkdeep-learningcaffemnist

caffe test error no field named "net" on testing MNIST


I have the same problem as Caffe error: no field named "net" on testing MNIST.

Running

keides2@ubuntu:~/caffe$ build/tools/caffe test -model examples/mnist/lenet_solver.prototxt 
                       -weights examples/mnist/lenet_iter_10000.caffemodel -iterations 100

I get the following output:

 I0820 11:31:33.820005 113569 caffe.cpp:279] Use CPU. [libprotobuf ERROR google/protobuf/text_format.cc:245] Error parsing text-format caffe.NetParameter: 2:4: Message type "caffe.NetParameter" has no field named "net".
F0820 11:31:33.844912 113569 upgrade_proto.cpp:79] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: examples/mnist/lenet_solver.prototxt
Check failure stack trace:
@     0x7f3f9744edaa  (unknown) 
@     0x7f3f9744ece4  (unknown) 
@     0x7f3f9744e6e6  (unknown) 
@     0x7f3f97451687  (unknown) 
@     0x7f3f977fc0c7  caffe::ReadNetParamsFromTextFileOrDie() 
@     0x7f3f97834b0f  caffe::Net<>::Net() 
@           0x407843  test() 
@           0x405f7b  main 
@     0x7f3f9645af45  (unknown) 
@           0x406677  (unknown) 
@              (nil)  (unknown)

'lenet_solver.prototxt' and 'lenet_train_test.prototxt' are original (not modified).

And then,

keides2@ubuntu:~/caffe$ printenv PYTHONPATH
/home/keides2/caffe/python

Could you help me?


Solution

  • When running caffe test you do not need the solver file (lenet_solver.prototxt in your case), but rather use the net prototxt directly.
    Try:

     build/tools/caffe test -model examples/mnist/lenet_train_test.prototxt 
                       -weights examples/mnist/lenet_iter_10000.caffemodel -iterations 100