简体   繁体   English

dnn模块的权重和偏差的内存布局是什么?

[英]What is the memory layout of the weights and bias of dnn module?

I would like to know memory layout of dnn module so I could port the weights to another library. 我想知道dnn模块的内存布局,因此我可以将权重移植到另一个库。

I can access the weight and bias as following 我可以按以下方式访问权重和偏见

cv::Mat weight = input_net.getParam(input_layer_name.c_str(), 0);
cv::Mat bias = input_net.getParam(input_layer_name.c_str(), 1);

If I have a convolution layer, with 3 input filters, 64 output filters and 3x3 kernel, how would the memory layout looks like? 如果我有一个带3个输入过滤器,64个输出过滤器和3x3内核的卷积层,那么内存布局将如何? If it is convolution layer, I should have 3*3*3*64 weights and 64 bias. 如果是卷积层,则应具有3 * 3 * 3 * 64权重和64偏差。 How could I know the position of each weigh and bias in the weight and bias matrix? 我如何知道每个重量和偏差在重量和偏差矩阵中的位置?

More precisely, how could I access the weight shown in the graph(A,C,N)? 更确切地说,我如何访问图中的重量(A,C,N)?

例

It has W x H x InCh x OutCh layout. 它具有W x H x InCh x OutCh布局。 From the lowest to the highest index. 从最低到最高的索引。 Something like: 就像是:

w[0]: (x1, y1, inc1, outc1)
w[1]: (x2, y1, inc1, outc1)
...
w[n-1]: (xn, y1, inc1, outc1)
w[n]:   (x1, y2, inc1, outc1)
w[n+1]: (x2, y2, inc1, outc1)
...

and further. 并进一步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM