在pycaffe中获取每个层的类型(例如:卷积、数据等)是可能的吗?我搜索了提供的示例,但我什么也找不到。目前我正在使用层名称来做我的工作,这是非常糟糕和有限的。
发布于 2017-02-02 14:59:03
很简单!
import caffe
net = caffe.Net('/path/to/net.prototxt', '/path/to/weights.caffemodel', caffe.TEST)
# get type of 5-th layer
print "type of 5-th layer is ", net.layers[5].type要在图层名称和索引之间进行映射,可以使用这个简单的技巧:
idx = list(net._layer_names).index('my_layer')
print "The index of \'my_layer\' is ", idx, " and the type is ", net.layers[idx].typehttps://stackoverflow.com/questions/41995678
复制相似问题