ComputeLibrary icon indicating copy to clipboard operation
ComputeLibrary copied to clipboard

How do I load weights of a pre-trained model?

Open mo-morikawa opened this issue 9 years ago • 5 comments

With the recent update and also your support, I can now build and run deep neural network models. How do I load weights, biases etc. from a file so that I can use the network for classification?

mo-morikawa avatar Apr 14 '17 08:04 mo-morikawa

Hello @mo-morikawa , it's really nice that you can run your deep network models :smile: Currently, the only way of loading the weights and biases are to load them manually, meaning that you have to open and read the values from the file and then use them to fill the tensor manually. You can use some iterators to do this easily. Have a look here for some examples on how to fill a tensor.

I think it would be useful to have a function to automate and simplify this process so we will try to have something in place for the next release.

GeorgeARM avatar Apr 17 '17 13:04 GeorgeARM

Hello @GeorgeARM , The example you gave is just for the formulation with NHW(batch, height, width), but how about the in-out channels? Is it the (out channels, height, width, in channels) formulation? I want to know something about convolution kernel shape.

SunAriesCN avatar Sep 11 '17 07:09 SunAriesCN

Hell @SunAriesCN,

Apologies for my late response. Convolution kernels shape is [OFM, IFM, H, W] with faster changing dimensions from right to left, where OFM are the output feature maps and IFM the input feature maps. Does this answer your question?

GeorgeARM avatar Sep 29 '17 12:09 GeorgeARM

Latest release 17.09 adds initial support of a graph API. An example can be found here. A numpy loader is provided as well here where you can load weights dumped from caffe or tensorflow. Have a look for more details on how to do this here

GeorgeARM avatar Oct 02 '17 10:10 GeorgeARM

Closing issue. Reopen if needed.

GeorgeARM avatar Oct 02 '17 10:10 GeorgeARM