ENCP / CNNdroid

Open Source Library for GPU-Accelerated Execution of Trained Deep Convolutional Neural Networks on Android
MIT License
539 stars 181 forks source link

How can I parse mean.binaryproto file to mean.msg? #10

Open xh2009cn opened 7 years ago

xh2009cn commented 7 years ago

Great Job! I run the Android Demo Project with my custom caffe model,which told me this error:"MessagePack_Init:: Expected array, but got raw value"。

Bellow is my mea file parse code: proto_data = open(mean_filename, "rb").read() buf = msgpack.packb(proto_data, use_single_float=True) mean_msg = file("mean.msg", "wb") mean_msg.write(buf)

Can u tell me how to parse mean.binaryproto file to mean.msg correctly?Thank you!

latifisalar commented 7 years ago

Hi,

We've not embedded the reading process of the mean file in the network run and have assumed that the mean is already subtracted from the inputs to the network. Caffe has utility functions to read protofiles and write them into other formats, maybe it can be useful for you: https://github.com/BVLC/caffe/blob/master/python/caffe/io.py By the way, about the error that you've encountered, does it happen when you read the mean.msg? The reason for that error is dimension mismatch between your function call and actual MessagePack file.

Salar

xh2009cn commented 7 years ago

Thanks for your advise!It help me to solved my problem, but I got another problem. I want to write an age predicate demo base on you project.Here is the caffe model I use: http://www.openu.ac.il/home/hassner/projects/cnn_agegender/

I follow the user guide and everything goes well, except the compute output always return the same value whatever photo I take. I wonder if there was somethin I mistake? Here is my demo: https://github.com/xh2009cn/CNNdroid-Age-Demo

Can you help me to check this out? Sorry to bother you again!