Ask Your Question
0

What is the best way to get weights from a layer in DNN after loading some model?

asked 2018-11-12 14:12:19 -0600

kkudryavtsev gravatar image

There is a function to SetWeights, but I did not find any function to read the weights?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-11-13 01:22:19 -0600

berak gravatar image

updated 2018-11-13 01:35:13 -0600

have a look at the docs , each Layer has a blobs member , which contains weights & biases. like:

for (auto b: layer->blobs) {
     for (int d=0; d<b.dims; d++)
         cout << b.size[d] << " ";
}
edit flag offensive delete link more

Comments

1

Thanks a lot! I figured out yesterday a little bit different approach with

...
for n in range( len( layer.blobs ) ):
         blob_ = net.getParam(LayerId, n )
kkudryavtsev gravatar imagekkudryavtsev ( 2018-11-13 10:29:55 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-12 14:12:19 -0600

Seen: 544 times

Last updated: Nov 13 '18