图像卷积输出尺寸

🖼️ CNN Feature Map Size Calculator

Enter input size, kernel size, stride and padding to compute the feature-map size after convolution or pooling. Built for CNN architecture design and receptive-field checks.

📐 计算公式 / 原理
输出尺寸 = ⌊(W + 2P − K − (K − 1)(D − 1))/S⌋ + 1;感受野 = K + (K − 1)(D − 1)
卷积输出尺寸由输入宽、卷积核、填充、步长与膨胀率共同决定,结果须为整数,非整除时多数框架向下取整(丢弃边缘)。膨胀卷积用 (K−1)(D−1) 扩大感受野而不增加参数,适合密集预测任务。

📐 计算公式与说明

Out = ⌊(W + 2P − K − (K−1)(D−1)) / S⌋ + 1

用于设计 CNN 网络结构。

📚 深度解析:图像卷积输出尺寸

💡 常见使用场景

卷积层尺寸推算
输入 224×224,kernel=3, stride=1, padding=1 → out=224。若 stride=2 → out=⌊(224+2−3)/2⌋+1=112,特征图减半,通道数不变。

❓ 常见问题(FAQ)

padding 有什么用?
same padding(使 out=in/stride)保护边缘信息、控制尺寸;valid(无填充)逐步缩小特征图。边缘像素被卷积覆盖次数少,填充可缓解边缘信息丢失。
输出出现小数或负数说明什么?
说明参数组合非法(如 stride 过大、kernel 超过输入)。需调小 stride、增大 padding 或减小 kernel,直到公式结果≥1。

Formula & Standard References

Item Formula / Note Source / Standard
Convolution output output = floor((input - kernel + 2 x padding) / stride) + 1 Deep learning texts
Pooling output pooling follows the same formula and usually pads nothing Deep learning texts
Receptive field stacked layers expand the receptive field by kernel and stride Deep learning texts