Home > Software design >  What does model.summary in keras means?
What does model.summary in keras means?

Time:05-19

Hi I am new to keras and have obtained the following information of my model.

=================================================================
 reshape (Reshape)           (None, 66, 1)             0         
                                                                 
 conv1d (Conv1D)             (None, 66, 32)            128       
                                                                 
 max_pooling1d (MaxPooling1D  (None, 33, 32)           0         
 )                                                               
                                                                 
 conv1d_1 (Conv1D)           (None, 33, 64)            6208      
                                                                 
 max_pooling1d_1 (MaxPooling  (None, 17, 64)           0         
 1D)                                                             
                                                                 
 flatten (Flatten)           (None, 1088)              0         
                                                                 
 dropout (Dropout)           (None, 1088)              0         
                                                                 
 y_pred (Dense)              (None, 2)                 2178      
                                                                 
=================================================================
Total params: 8,514
Trainable params: 8,514
Non-trainable params: 0

I understand that for the output shape none it means the batch size, while the 32 in conv1d is the output of the layer. How about 66 in conv1d is it the input shape of conv1d?

model.add(Reshape((int(input_length / 1), 1), input_shape=(input_length, )))

model.add(Conv1D(32, kernel_size=3, activation='relu', padding='same'))

model.add(MaxPooling1D(pool_size=2, strides=2, padding='same'))

model.add(Conv1D(64, kernel_size=3, activation='relu', padding='same'))

model.add(MaxPooling1D(pool_size=2, strides=2, padding='same'))

model.add(Flatten())

model.add(Dropout(0.5))
model.add(Dense(classes, activation='softmax', name='y_pred'))```
 


 

CodePudding user response:

The comment from Mahrkeenerh is not correct. The 66 in the example is the output size, whilst I would rather call the 32 the output dimension or amount of kernels (in convolutional context).

CodePudding user response:

Model Summarize

Keras provides a way to summarize a model. The summary is textual and includes information about: The layers and their order in the model. The output shape of each layer. The number of parameters (weights) in each layer.

  • Related