Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xh2009cn opened this issue Feb 17, 2017 · 2 comments
Open

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

xh2009cn opened this issue Feb 17, 2017 · 2 comments

Comments

@xh2009cn
Copy link

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
Copy link
Member

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
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants