英文:
Data Flow in CNN
问题
32个单元的第一个卷积层,接着是步幅为2且k=2的池化层,然后是64个单元的另一个卷积层,再接着是步幅为2且k=2的另一个池化层,输入图像尺寸为28281。
英文:
What would be the output of a network with 32 units in 1st convolutional layer followed by a pooling layer with stride=2 and k=2 followed by another convolutional layer with 64 units followed by another pooling layer with stride = 2 and k=2 , input image dimensions are 28281
答案1
得分: 1
我将假设您在每个卷积层中都使用了相同的填充(same padding),那么您的模型的输出将是形状为(7, 7, 64)。您可以在Keras中使用类似以下代码的方式,如果您不想手动计算尺寸:
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
model = Sequential()
model.add(Conv2D(32, 3, padding="same", input_shape=(28, 28, 1)))
model.add(MaxPooling2D(2, 2))
model.add(Conv2D(64, 3, padding="same"))
model.add(MaxPooling2D(2, 2))
print(model.summary())
请注意,这是您提供的代码的中文翻译。
英文:
I will assume that you are using same padding in each convolution, then the output of you model will be of shape (7, 7, 64). You can use a code similar to this one in keras if you don't want to compute the size by hand:
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
model = Sequential()
model.add(Conv2D(32, 3, padding="same", input_shape=(28, 28, 1)))
model.add(MaxPooling2D(2, 2))
model.add(Conv2D(64, 3, padding="same"))
model.add(MaxPooling2D(2, 2))
print(model.summary())
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论