caffe2_cpp_tutorial
caffe2_cpp_tutorial copied to clipboard
Saving model
Hi,
I am trying to use the write function of the ModelUtil, but I suspect it's not saving the weights of my neural net.
First question is: using your code, how do you save a net with its trained weights? Second question is: how to see if the weights are saved in the pb file?
Thanks
Hi, it's not that easy to inspect the pb file directly, but simply writing and reading it back in should give you the exact same weights. workspace.GetBlob("nameofparameter")).data<float>()
should give you a vector with the float weights in that parameter. Make sure to save the full model, including init and predict net. I recently added ModelUtil.WriteBundle(..)
, which writes both to a single file.