facebookarchive / caffe2

Caffe2 is a lightweight, modular, and scalable deep learning framework.
https://caffe2.ai
Apache License 2.0
8.42k stars 1.94k forks source link

Run other model on Android failed #1551

Open MorningMyFriend opened 6 years ago

MorningMyFriend commented 6 years ago

i convert a caffemodel to caffe2 pb model,(actually it is the CMU openpose coco model) and i have succeeded predict on PC using caffe2 python API.

Then i simplely change the model to mine in demo AI Camera Demo and Tutorial But it failed when loadToNetDef ,net->ParseFromArray(data, len) returned false and the log says "Couldn't parse net from data" .

Then i find similar problem on github, someone said it worked after changing the prototxt input layer. So i rewrite the input layer referring to squeezenet like this: before: input: "image" input_shape { dim: 1 dim: 3 dim: 368 dim: 368 }

after: layer { name: "image" type: "Input" top: "image" input_param { shape: { dim: 1 dim: 3 dim: 368 dim: 368 } } }

it still failed when loadToNetDef(mgr, &_initNet, "init_net.pb"); but it worked when loadToNetDef(mgr, &_predictNet,"predict_net.pb");

So, is there ways to solve the problem ? How can i use a new model with caffe2 on Android?

kingofoz commented 6 years ago

what is the size of your model?

xumengwei commented 6 years ago

@RuiZeWu Hi have u solved this problem? I also encounter this issue as well as many other guys.

jerryzh168 commented 6 years ago

I believe the android application is only for squeezenet