获取 pycaffe 图层名称或 blob 类型

Getting pycaffe layer name or blob type

我有一些名为 net 的 CNN,我想知道它的 blob 类型或图层名称。

例如,我可以轻松访问 blob 名称和后续 blob:

for blob in net.blobs:
    print(blob)
    net.blobs[blob]...

或者,我可以访问图层类型:

for x in range(len(net.layers)):
    print(net.layers[x].type)

是否可以访问此信息,例如:

net.blobs[blob].type

或者,

net.layers[x].name

谢谢

一个 blob 没有 type。它是一个 blob:N 维数据的容器。您可以查找 net.blobs[blob].data.shape 以获得其 shape,或查找 net.blobs[blob].diff 以获得计算出的梯度(如果您反向传播梯度...)

层的名称存储在 net._layer_names 中。您可以通过 idx = list(net._layer_names).index('my_layer').

获取图层的索引

有关详细信息,请参阅