kerasでhdf5形式のファイルのweightsを取得したいと思っています。
そこで、下記のサイトを参考にさせて頂きました。
【Python】kerasで保存したweightsをh5pyを使って取得する
しかし、
list(array.get('dense_1').keys())
で
from array import array
を試してみるも実行できません。
もしよろしければご教授お願いいたします。
python
1Python 3.6.6 (default, Sep 12 2018, 18:26:19) 2[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux 3Type "help", "copyright", "credits" or "license" for more information. 4>>> import h5py 5>>> model_weights = h5py.File('./cifar10_cnn.h5', 'r') 6>>> list(model_weights) 7['activation_1', 'activation_2', 'activation_3', 'activation_4', 'activation_5', 'conv2d_1', 'conv2d_2', 'conv2d_3', 'conv2d_4', 'dense_1', 'dense_2', 'dropout_1', 'dropout_2', 'dropout_3', 'flatten_1', 'max_pooling2d_1', 'max_pooling2d_2'] 8>>> list(array.get('dense_1').keys()) 9Traceback (most recent call last): 10 File "<stdin>", line 1, in <module> 11NameError: name 'array' is not defined 12>>> from array import array 13>>> list(array.get('dense_1').keys()) 14Traceback (most recent call last): 15 File "<stdin>", line 1, in <module> 16AttributeError: type object 'array.array' has no attribute 'get'
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/11/19 06:18