本课程中的 Colab 已过时,将于 2024 年 7 月移除。
机器学习实践课程:图像分类
检查您的理解情况:卷积
将一个二维 3x3 卷积过滤器应用到一个二维 4x4 输入特征图(未添加内边距):
![](https://developers.google.cn/static/machine-learning/practica/image-classification/images/cyu_convolution_shape.svg?authuser=19&hl=zh-cn)
输出特征图是形状什么的?
2x2
当 3x3 过滤器在 4x4 特征图上滑动时,过滤器可以放置在 4 个不同位置,生成一个 2x2 输出特征图:
![动画展示的是 3x3 卷积过滤器在 4x4 特征图上滑动。
有 4 个独特的位置可以放置 3x3 过滤器,每个位置对应于 2x2 输出特征图中的 4 个元素之一。](https://developers.google.cn/static/machine-learning/practica/image-classification/images/cyu_convolution_shape_answer.gif?authuser=19&hl=zh-cn)
3x3
虽然滤波器本身为 3x3,但输出特征图可能较小,这是因为在 4x4 输入特征图上可放置滤波器的位置不到 9(3 乘以 3)个位置。
4x4
为了生成大小与输入特征图无内边距的输出特征图,卷积过滤器的形状必须为 1x1。大于 1x1 的过滤器将生成小于输入特征图的输出特征图。由于我们的过滤器为 3x3,因此输出特征图必须小于 4x4。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2022-09-27。
[null,null,["最后更新时间 (UTC):2022-09-27。"],[[["Applying a 3x3 convolutional filter to a 4x4 input feature map without padding results in a 2x2 output feature map."],["The output feature map is smaller than the input because the filter's size limits the number of positions it can occupy on the input."],["A 1x1 filter would be required to maintain the input's dimensions in the output without padding."]]],[]]