[CV] CNN calculate parameter

model.summary()

Model: “sequential” _________________________
Layer (type) Output Shape Param # =================================================================
conv2d (Conv2D) (None, 28, 28, 32) 320

max_pooling2d (MaxPooling2D) (None, 14, 14, 32) 0

conv2d_1 (Conv2D) (None, 14, 14, 64) 18496

max_pooling2d_1 (MaxPooling2D) (None, 7, 7, 64) 0

flatten (Flatten) (None, 3136) 0

dense (Dense) (None, 100) 313700

dropout (Dropout) (None, 100) 0

dense_1 (Dense) (None, 10) 1010

=================================================================
Total params: 333,526
Trainable params: 333,526
Non-trainable params: 0 _________________________

code

model.add(keras.layers.Conv2D(32,
                              kernel_size=3,
                              activation='relu', padding='same',
                              input_shape=(28, 28, 1)))
model.add(keras.layers.MaxPooling2D(2))
model.add(keras.layers.Conv2D(64, kernel_size=(3,3), activation='relu', padding='same'))
model.add(keras.layers.MaxPooling2D(2))
model.add(keras.layers.Flatten())
model.add(keras.layers.Dense(100, activation='relu'))
model.add(keras.layers.Dropout(0.4))
model.add(keras.layers.Dense(10, activation='softmax'))

conv2d (Conv2D) (None, 28, 28, 32) 320 분석

conv2d_1 (Conv2D) (None, 14, 14, 32) 18496 분석