【发布时间】:2023-03-21 02:00:01
【问题描述】:
标题已经包含完整的问题:如何使用 Pycaffe 获得 Caffe 模型给定层的输出形状?
我有一个caffe.Net() 对象,现在我想要模型中特定层的输出形状。
【问题讨论】:
标签: machine-learning neural-network deep-learning caffe pycaffe
标题已经包含完整的问题:如何使用 Pycaffe 获得 Caffe 模型给定层的输出形状?
我有一个caffe.Net() 对象,现在我想要模型中特定层的输出形状。
【问题讨论】:
标签: machine-learning neural-network deep-learning caffe pycaffe
给定图层名称,您可以通过以下方式获取其索引:
l_idx = list(net._layer_names).index(my_layer_name)
一旦你有了l_idx,你就可以得到它的输出(又名"top"s):
tops = [(net._blob_names[bi], net.blobs[net._blob_names[bi]].data.shape)
for bi in list(net._top_ids(li))]
对于每个"top",您可以获得信息
for tn in tops:
print "output name {} has shape {}".format(tn, net.blobs[tn].data.shape)
关于如何通过pycaffe接口访问网络结构的更详细的例子可以找到here。
【讨论】: