我有一个 8x8 矩阵,如下所示:
[[ 0.3 0.3 0.3 0.3 0.3 0.5 0.1 -0.1]
[ 0.1 0.1 -0.1 0.3 0.3 -0.1 -0.1 -0.5]
[-0.1 0.1 0.3 -0.1 0.3 -0.1 -0.1 -0.1]
[-0.1 0.1 0.5 0.3 -0.3 -0.1 -0.3 -0.1]
[ 0.5 0.1 -0.1 0.1 -0.1 -0.1 -0.3 -0.5]
[ 0.1 -0.1 -0.3 -0.5 -0.5 -0.1 -0.1 -0.3]
[-0.5 -0.3 -0.3 -0.3 -0.1 -0.5 -0.1 -0.3]
[-0.3 -0.3 -0.3 -0.3 -0.1 -0.1 -0.5 -0.3]]
我的窗口是 2x2。我想要做的是将四个数字放在一起(上下数字)用于池化。示例输出如下所示:
[[0.3 0.3
0.1 0.1]
[0.3 0.3
-0.1 0.3]
.......
.......
[-0.1 -0.3
-0.5 -0.3]]
我使用的是print arr.reshape(16,2,2)
我无法理解的是如何为这个要求设置轴。我的输出是:
[[[ 0.3 0.3]
[ 0.3 0.3]]
[[ 0.3 0.1]
[ 0.5 -0.1]]
[[ 0.1 -0.1]
[ 0.1 0.3]]
[[ 0.3 -0.1]
[-0.1 -0.5]]
[[-0.1 0.3]
[ 0.1 -0.1]]
[[ 0.3 -0.1]
[-0.1 -0.1]]
[[-0.1 0.5]
[ 0.1 0.3]]
[[-0.3 -0.3]
[-0.1 -0.1]]
[[ 0.5 -0.1]
[ 0.1 0.1]]
[[-0.1 -0.3]
[-0.1 -0.5]]
[[ 0.1 -0.3]
[-0.1 -0.5]]
[[-0.5 -0.1]
[-0.1 -0.3]]
[[-0.5 -0.3]
[-0.3 -0.3]]
[[-0.1 -0.1]
[-0.5 -0.3]]
[[-0.3 -0.3]
[-0.3 -0.3]]
[[-0.1 -0.5]
[-0.1 -0.3]]]
请解释在这种情况下如何应用轴。或者,如果他们是获得最大池的更好方法,请提及。
注意:所有这些都是为了最大池化。我在 python 上使用 NumPy、SciPy。