简体   繁体   English

计算卷积神经网络中特征映射的维数

[英]Calculate dimension of feature maps in convolutional neural network

I have convolutional neural network in Keras. 我在Keras有卷积神经网络。 I need to know the dimensions of the feature maps in each layer. 我需要知道每一层中要素图的尺寸。 My input is 28 by 28 pixel image. 我的输入是28乘28像素的图像。 I know theres a way to calculate this I not sure how. 我知道有一种计算方法,我不确定如何。 Below is my code snippet using Keras. 下面是我使用Keras的代码片段。

img_rows, img_cols = 28, 28
nb_filters = 32
nb_pool = 2
nb_conv = 3

model = Sequential()

model.add(Convolution2D(nb_filters, nb_conv, nb_conv, border_mode='valid', input_shape=(1, img_rows, img_cols)))
model.add(Activation('relu'))
model.add(Convolution2D(nb_filters, nb_conv, nb_conv))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(nb_pool, nb_pool)))
model.add(Dropout(0.25))

model.add(Convolution2D(64, nb_conv, nb_conv, border_mode='valid'))
model.add(Activation('relu'))
model.add(Convolution2D(64, nb_conv, nb_conv))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(nb_pool, nb_pool)))
model.add(Dropout(0.25))

model.add(Flatten())
model.add(Dense(512))
model.add(Activation('relu'))
model.add(Dropout(0.5))


model.add(Dense(nb_classes))
model.add(Activation('softmax'))

我想画的是什么

At the end of the day, this is what i want to draw. 在一天结束时,这是我想要绘制的。 Thank you. 谢谢。

Check this article. 看看这篇文章。

Formula for spatial size of the output volume: K*((W−F+2P)/S+1) , where W - input volume size, F the receptive field size of the Conv Layer neurons, S - the stride with which they are applied, P - the amount of zero padding used on the border, K - the depth of conv layer. 输出体积空间大小的公式: K *((W-F + 2P)/ S + 1) ,其中W - 输入体积大小, F是Conv层神经元的感受野大小, S - 它们的步幅应用, P - 边界上使用的零填充量, K - 转换层的深度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM