Rah*_*and 6 python deep-learning conv-neural-network keras tensorflow
I am having trouble understanding the way 2 or more convolutional layers (each followed by a pooling layer) work in a CNN.
Consider the input to be a 3 channel 300x300 image. If the first convolution layer has 32 convolutions and the second layers have 64 convolutional layers, then the first layer creates 32 feature maps. But how many feature maps does the second layer create? Does every convolution out of 64 act on the previously generated 32 feature maps, thus creating 32*64 = 2048 feature maps in total? Or does something else take place?
A simple code relating the question is:
model = keras.models.Sequential([
keras.layers.Conv2D(32, (3, 3), activation='relu', input_shape=(300, 300, 3)),
keras.layers.MaxPooling2D(2, 2),
keras.layers.Conv2D(64, (3, 3), activation='relu'),
keras.layers.MaxPooling2D(2, 2)])
Run Code Online (Sandbox Code Playgroud)
第一个卷积层有 32 个滤波器,但它适用于图像的所有三个通道,因此第一个 Conv2D 之后的特征图为 32x3 = 96,然后第二个 Conv2D 的 64 个滤波器分别适用于这 96 个特征图,所以在第二次 Conv2D 之后它是 64x96 = ...(填空)。
但为了简单起见,Keras 仅显示 (..., 32) 或 (..., 64)。您可以使用 model.summary() 来检查。
归档时间: |
|
查看次数: |
4395 次 |
最近记录: |