怎麼檢視下載的.npy模型裡面的引數
阿新 • • 發佈:2018-12-03
根據Kevin 訓練VGG教程而來
假設我們這裡已經有了一個VGG16層的引數原始檔案,想要開啟來看一下引數設定,使用以下函式就行了,涉及到的庫自行補充
測試載入進來的引數 def test_load(): data_path = './/VGG-pretrain//vgg16.npy' # 檔案儲存路徑 # 注意這個檔案要到網上自行下載 data_dict = np.load(data_path, encoding='latin1').item() keys = sorted(data_dict.keys()) for key in keys: weights = data_dict[key][0] biases = data_dict[key][1] print('\n') print(key) print('weights shape: ', weights.shape) print('biases shape: ', biases.shape)
結果展示:
conv1_1
weights shape: (3, 3, 3, 64)biases shape: (64,)
conv1_2
weights shape: (3, 3, 64, 64)
biases shape: (64,)
conv2_1
weights shape: (3, 3, 64, 128)
biases shape: (128,)
conv2_2
weights shape: (3, 3, 128, 128)
biases shape: (128,)
conv3_1
weights shape: (3, 3, 128, 256)
biases shape: (256,)
conv3_2
weights shape: (3, 3, 256, 256)
biases shape: (256,)
conv3_3
weights shape: (3, 3, 256, 256)
biases shape: (256,)
conv4_1
weights shape: (3, 3, 256, 512)
biases shape: (512,)
conv4_2
weights shape: (3, 3, 512, 512)
biases shape: (512,)
conv4_3
weights shape: (3, 3, 512, 512)
biases shape: (512,)
conv5_1
weights shape: (3, 3, 512, 512)
biases shape: (512,)
conv5_2
weights shape: (3, 3, 512, 512)
biases shape: (512,)
conv5_3
weights shape: (3, 3, 512, 512)
biases shape: (512,)
fc6
weights shape: (25088, 4096)
biases shape: (4096,)
fc7
weights shape: (4096, 4096)
biases shape: (4096,)
fc8
weights shape: (4096, 1000)
biases shape: (1000,)