“Data Flow in CNN” 的中文翻译是 “CNN 中的数据流”。

huangapple go评论69阅读模式
英文:

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())

huangapple
  • 本文由 发表于 2020年1月3日 21:05:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/59579146.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定