Hitesh
Hitesh

Reputation: 1325

Model weights not showing properly in HDFView

I am saving model weight in keras using model.save_weights() which save weights in h5 extension. I seeing h5 file in HDFView2.9. My model summary looks like following:

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

So, 1st layer of my h5 file shold show 32 filters of size (2x2). but when i check in HDFViewer it showing only 1 filter not 32, like following: enter image description here But when i am loading the weights using load_weights weights load correctly. Then how to see weights correctly in HDFView. and also it's not sequentily saving weights. Firslt layer shows only 1 filter then 32 then 32 then 64. and next 64 misses.

Upvotes: 2

Views: 280

Answers (1)

Prabahar Ravichandran
Prabahar Ravichandran

Reputation: 11

In the spreadsheet view, you will only be able to see 3 dimensions. Your 2d filters will have 3 dimensions times the no. of filters = 4d (For example, 32 x 3 x 3 x 3 on your first layer). Make changes in the General Object Info. panel/Show data with Options. HDF needs some serious updates. I hope that helps...

Upvotes: 1

Related Questions