shicai / MobileNet-Caffe

Caffe Implementation of Google's MobileNets (v1 and v2)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to run eval_image.py

kushagraagrawal opened this issue · comments

When I try to run the following :

python eval_image.py --proto mobilenet_deploy.prototxt --model mobilenet.caffemodel --image ./cat.jpg

I get the following error:
WARNING: Logging before InitGoogleLogging() is written to STDERR W0207 13:16:05.342907 19952 _caffe.cpp:139] DEPRECATION WARNING - deprecated use of Python interface W0207 13:16:05.342963 19952 _caffe.cpp:140] Use this instead (with the named "weights" parameter): W0207 13:16:05.342973 19952 _caffe.cpp:142] Net('mobilenet_deploy.prototxt', 1, weights='mobilenet.caffemodel') [libprotobuf ERROR google/protobuf/text_format.cc:245] Error parsing text-format caffe.NetParameter: 1:1: Expected identifier. F0207 13:16:05.344348 19952 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: mobilenet_deploy.prototxt *** Check failure stack trace: *** Aborted (core dumped)

Any idea why this is caused?

Replace input field of deploy.prototxt with below,

name: "MOBILENET_V2"
input: "data"
input_dim: 1
input_dim: 3
input_dim: 224
input_dim: 224

That was already there. I replaced that with:
layer { name: "data" type: "Input" top: "data" input_param { shape{ dim: 1 dim: 3 dim: 224 dim: 224 } } }
and it worked. Thanks

Have you measured the performance of V2? I got worse performance than V1. 85 ms vs 50 ms.

No I haven't. How do you do that?

layer {
  name: "data"
  type: "Input"
  top: "data"
  input_param { shape: { dim: 1 dim: 3 dim: 224 dim: 224 } }
}

this should be work with a recent caffe version.
input and input_dim is compatible with caffe of old versions.