Skip to main content
 首页 » 编程设计

python之keras 卷积层中的内核大小是如何定义的

2024年11月24日9jiqing9006

根据文档网站 (https://keras.io/layers/convolutional/),keras 卷积层的内核大小定义为高度 x 宽度:

kernel_size: An integer or tuple/list of 2 integers, specifying the height and width of the 2D convolution window. Can be a single integer to specify the same value for all spatial dimensions.

然而在代码文档中它被定义为完全相反的:

kernel_size: An integer or tuple/list of 2 integers, specifying the width and height of the 2D convolution window. Can be a single integer to specify the same value for all spatial dimensions.

哪个是真的?据我了解,网站的定义应该是正确的,对吗?

请您参考如下方法:

是的,网站上的定义是正确的(高 x 宽)。根据此提交,代码文档已在 2.2.0 版中修复。

https://github.com/keras-team/keras/commit/027d37961afff8a7963836ca87ccdbbf65a78811#diff-d462a3275abee3aa77ba2b341e45cf20L366