模型权重在HDFView中无法正确显示

时间:2018-05-28 07:46:58

标签: python keras hdf5 h5py hdf

我使用model.save_weights()在keras中保存模型权重,这会在h5扩展名中保存权重。我在HDFView2.9中看到了h5文件。我的模型摘要如下所示:

Layer (type)                 Output Shape              Param #   
=================================================================
conv2d_37 (Conv2D)           (None, 49, 49, 32)        160       
_________________________________________________________________
conv2d_38 (Conv2D)           (None, 48, 48, 32)        4128      
_________________________________________________________________
max_pooling2d_19 (MaxPooling (None, 24, 24, 32)        0         
_________________________________________________________________
dropout_28 (Dropout)         (None, 24, 24, 32)        0         
_________________________________________________________________
conv2d_39 (Conv2D)           (None, 23, 23, 64)        8256      
_________________________________________________________________
conv2d_40 (Conv2D)           (None, 22, 22, 64)        16448     
_________________________________________________________________
max_pooling2d_20 (MaxPooling (None, 11, 11, 64)        0         
_________________________________________________________________
dropout_29 (Dropout)         (None, 11, 11, 64)        0         
_________________________________________________________________
flatten_10 (Flatten)         (None, 7744)              0         
_________________________________________________________________
dense_19 (Dense)             (None, 256)               1982720   
_________________________________________________________________
dropout_30 (Dropout)         (None, 256)               0         
_________________________________________________________________
dense_20 (Dense)             (None, 2)                 514       
=================================================================
Total params: 2,012,226
Trainable params: 2,012,226
Non-trainable params: 0

因此,我的h5文件的第一层显示32个大小(2x2)的过滤器。但是当我检查HDFViewer时它只显示1个过滤器而不是32,如下所示: enter image description here 但是当我使用load_weights权重加载正确加载权重时。那么如何在HDFView中正确地看到权重。并且它没有按顺序保存重量。 Firslt层仅显示1个过滤器,然后是32,然后是32,然后是64.接下来的64个未命中。

1 个答案:

答案 0 :(得分:1)

在电子表格视图中,您将只能看到3个维度。您的2D滤镜将具有3倍的尺寸。滤镜数量= 4d(例如,第一层为32 x 3 x 3 x 3)。在常规对象信息中进行更改。面板/使用选项显示数据。 HDF需要进行一些认真的更新。希望对您有帮助...