Keras - 关于输入层节点数量的困惑
Keras - Confusion about number of input layer nodes
那么,当input_dim=3的时候,就意味着一层的输入是三个节点对吧?
但是当使用 input_shape 属性并且有多个值时呢?
例如:
model = Sequential()
model.add(Conv2D(32, (3, 3), input_shape=(82, 82, 3)))
这里,卷积层有32个输出节点,但是它有多少个输入节点?
model.summary() 给出这个:
Model: "sequential_1"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
conv2d_1 (Conv2D) (None, 80, 80, 32) 896
_________________________________________________________________
activation_1 (Activation) (None, 80, 80, 32) 0
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 40, 40, 32) 0
_________________________________________________________________
conv2d_2 (Conv2D) (None, 38, 38, 32) 9248
_________________________________________________________________
activation_2 (Activation) (None, 38, 38, 32) 0
_________________________________________________________________
max_pooling2d_2 (MaxPooling2 (None, 19, 19, 32) 0
_________________________________________________________________
conv2d_3 (Conv2D) (None, 17, 17, 64) 18496
_________________________________________________________________
activation_3 (Activation) (None, 17, 17, 64) 0
_________________________________________________________________
max_pooling2d_3 (MaxPooling2 (None, 8, 8, 64) 0
_________________________________________________________________
flatten_1 (Flatten) (None, 4096) 0
_________________________________________________________________
dense_1 (Dense) (None, 64) 262208
_________________________________________________________________
activation_4 (Activation) (None, 64) 0
_________________________________________________________________
dropout_1 (Dropout) (None, 64) 0
_________________________________________________________________
dense_2 (Dense) (None, 1) 65
_________________________________________________________________
activation_5 (Activation) (None, 1) 0
=================================================================
Total params: 290,913
Trainable params: 290,913
Non-trainable params: 0
_________________________________________________________________
此处Input_shape用于图片:
您的示例包含图像形状 82x82x3 ==20172 等于输入节点:
** 你会如何检查这个 **
print(model.summary())
model.summary 为您提供每一层的完整细节
那么,当input_dim=3的时候,就意味着一层的输入是三个节点对吧? 但是当使用 input_shape 属性并且有多个值时呢? 例如:
model = Sequential()
model.add(Conv2D(32, (3, 3), input_shape=(82, 82, 3)))
这里,卷积层有32个输出节点,但是它有多少个输入节点?
model.summary() 给出这个:
Model: "sequential_1"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
conv2d_1 (Conv2D) (None, 80, 80, 32) 896
_________________________________________________________________
activation_1 (Activation) (None, 80, 80, 32) 0
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 40, 40, 32) 0
_________________________________________________________________
conv2d_2 (Conv2D) (None, 38, 38, 32) 9248
_________________________________________________________________
activation_2 (Activation) (None, 38, 38, 32) 0
_________________________________________________________________
max_pooling2d_2 (MaxPooling2 (None, 19, 19, 32) 0
_________________________________________________________________
conv2d_3 (Conv2D) (None, 17, 17, 64) 18496
_________________________________________________________________
activation_3 (Activation) (None, 17, 17, 64) 0
_________________________________________________________________
max_pooling2d_3 (MaxPooling2 (None, 8, 8, 64) 0
_________________________________________________________________
flatten_1 (Flatten) (None, 4096) 0
_________________________________________________________________
dense_1 (Dense) (None, 64) 262208
_________________________________________________________________
activation_4 (Activation) (None, 64) 0
_________________________________________________________________
dropout_1 (Dropout) (None, 64) 0
_________________________________________________________________
dense_2 (Dense) (None, 1) 65
_________________________________________________________________
activation_5 (Activation) (None, 1) 0
=================================================================
Total params: 290,913
Trainable params: 290,913
Non-trainable params: 0
_________________________________________________________________
此处Input_shape用于图片:
您的示例包含图像形状 82x82x3 ==20172 等于输入节点:
** 你会如何检查这个 **
print(model.summary())
model.summary 为您提供每一层的完整细节