【发布时间】:2020-06-26 07:21:21
【问题描述】:
我不明白 Keras 中 Upsampling2d 层的输出是如何计算的。 举个例子:
img_input = Input((2,2, 1))
out = UpSampling2D(size=2, interpolation="bilinear")(img_input)
model = Model(img_input, out, name='test')
input = np.array([[100, 200], [6, 8]]).reshape(1, 2, 2, 1)
model.predict(input).reshape(4, 4)
这样的结果是:
array([[100. , 150. , 200. , 200. ],
[ 53. , 78.5, 104. , 104. ],
[ 6. , 7. , 8. , 8. ],
[ 6. , 7. , 8. , 8. ]], dtype=float32)
对我来说,双线性插值会得到 s.th。不同的。让我们以第一行的 150 为例。对我来说,这实际上应该是100*(2/3) + 200*(1/3) = 133.33
。这一层有什么不同?
谢谢!
【问题讨论】:
标签: image tensorflow machine-learning keras conv-neural-network