我的问题与这些问题有所不同,因为它与内置模型有关。
Keras cnn model output shape doesn't match model summary
Keras - CNN Model Summary Diemension Interpretation
我试图检查用于转移学习的内置Xception模型并使用 model.summary():
以下是Xception模型的前几层
Layer (type) Output Shape Param Connected to
==================================================================================================
input_1 (InputLayer) (None, None, None, 3 0
__________________________________________________________________________________________________
block1_conv1 (Conv2D) (None, None, None, 3 864 input_1[0][0]
__________________________________________________________________________________________________
block1_conv1_bn (BatchNormaliza (None, None, None, 3 128 block1_conv1[0][0]
______________________________________________________________________________________
我关心的是深度渠道。 不应该将block1_conv1(Conv2D)的深度输出设为32而不是3?
如果我通过get_layer找出输出,我得到正确的输出:
base_model.get_layer(index = 1).output
<tf.Tensor 'block1_conv1/convolution:0' shape=(?, ?, ?, 32) dtype=float32>
base_model = Xception(weights='imagenet', include_top=False)
print(base_model.summary())