如何在Keras中使用序列号获取模型摘要

时间:2019-03-19 09:30:09

标签: python tensorflow keras

model.summary()以以下格式提供模型信息:

Layer (type)                    Output Shape         Param #     Connected to                     
==============================================================================
input_1 (InputLayer)            (None, 50, 50, 1)    0                                            
______________________________________________________________________________
conv2d_1 (Conv2D)               (None, 48, 48, 4)    40          input_1[0][0]                    
______________________________________________________________________________
conv2d_2 (Conv2D)               (None, 46, 46, 4)    148        conv2d_1[0][0]                   
______________________________________________________________________________

我想知道层的序列号,如下所示:

S. No.      Layer (type)         Output Shape         Param #     Connected to                     
==============================================================================
0      input_1 (InputLayer)     (None, 50, 50, 1)    0                                            
______________________________________________________________________________
1      conv2d_1 (Conv2D)        (None, 48, 48, 4)    40          input_1[0][0]                    
______________________________________________________________________________
2      conv2d_2 (Conv2D)        (None, 46, 46, 4)    148        conv2d_1[0][0]                   
______________________________________________________________________________

如何为此编写keras代码?

0 个答案:

没有答案