2017-02-02 14 views

答えて

2

簡単です!

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 

層の名前とあなたはこの単純なトリックを使用することができますインデックス間のマッピングするには:私は「ValueErrorを: 『を取得しています

idx = list(net._layer_names).index('my_layer') 
print "The index of \'my_layer\' is ", idx, " and the type is ", net.layers[idx].type 
+0

をデータが』リストにない」私はあなたの第二のスニペットを使用したいときレイヤ名とそのインデックスをマッピングするためのコードどうしましたか? – Breeze

+0

@ Coderx7あなたのネットに '' data "'という名前のレイヤーがない可能性がありますか? – Shai

+0

私はネットから直接レイヤー名を読み込み、forループ内でそれを使用: https://paste.ee/p/g4Llm – Breeze

関連する問題