【发布时间】:2017-08-22 09:07:18
【问题描述】:
我正在练习 CNN。我阅读了一些关于使用 CNNs 训练 MNIST 数据集的论文。图像大小为 28x28 并使用 5 层架构:输入>conv1-maxpool1>conv2-maxpool2>fully connected>output
Convolutional Layer #1
- Computes 32 features using a 5x5 filter with ReLU activation.
- Padding is added to preserve width and height.
- Input Tensor Shape: [batch_size, 28, 28, 1]
- Output Tensor Shape: [batch_size, 28, 28, 32]
Pooling Layer #1
- First max pooling layer with a 2x2 filter and stride of 2
- Input Tensor Shape: [batch_size, 28, 28, 32]
- Output Tensor Shape: [batch_size, 14, 14, 32]
Convolutional Layer #2
- Computes 64 features using a 5x5 filter.
- Padding is added to preserve width and height.
- Input Tensor Shape: [batch_size, 14, 14, 32]
- Output Tensor Shape: [batch_size, 14, 14, 64]
Pooling Layer #2
- Second max pooling layer with a 2x2 filter and stride of 2
- Input Tensor Shape: [batch_size, 14, 14, 64]
- Output Tensor Shape: [batch_size, 7, 7, 64]
Flatten tensor into a batch of vectors
- Input Tensor Shape: [batch_size, 7, 7, 64]
- Output Tensor Shape: [batch_size, 7 * 7 * 64]
Fully Connected Layer
- Densely connected layer with 1024 neurons
- Input Tensor Shape: [batch_size, 7 * 7 * 64]
- Output Tensor Shape: [batch_size, 1024] Output layer
- Input Tensor Shape: [batch_size, 1024]
- Output Tensor Shape: [batch_size, 10]
在 conv1 中,1 个输入使用 5x5 滤波器计算 32 个特征,而在 conv2 中,来自 conv1 的 32 个输入使用相同的滤波器计算 64 个特征。 32、64、2x2滤波器等参数是根据什么选择的?它们是否基于图像的大小?
如果图像尺寸大于 28x28,例如 128x128。我应该将层数增加到 5 层以上吗?上述参数如何随其他尺寸的图片变化?
提前感谢
【问题讨论】:
标签: python tensorflow deep-learning convolution