I have some CNN called net for which I'd like to know the type of the blob or the name of the layer.
For example, I can easily access the blob name and the subsequent blob:
for blob in net.blobs:
print(blob)
net.blobs[blob]...
Or, I can access the layer type:
for x in range(len(net.layers)):
print(net.layers[x].type)
Is there anyway to access this information like:
net.blobs[blob].type
or,
net.layers[x].name
Thanks
A blob does not have type. It's a blob: a container for N-dimensional data. You may look for net.blobs[blob].data.shape for its shape, or look for net.blobs[blob].diff for computed gradients (if you backprop the gradients...)
Layers' names are stored in net._layer_names. You can get the index of a layer by idx = list(net._layer_names).index('my_layer').
See this thread for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With