提交 3b8d760d 编写于 作者: D dengkaipeng

fix upsample

上级 02953d8d
......@@ -183,13 +183,13 @@ class YOLOv3Head(object):
return route, tip
def _upsample(self, input, scale=2, upsample='nearest', name=None):
upsample = upsample.copy()
if upsample == 'nearest':
out = fluid.layers.resize_nearest(
input=input, scale=float(scale), name=name)
else:
assert isinstance(
upsample, dict), "Unknown upsample method: {}".format(upsample)
upsample = upsample.copy()
assert upsample['type'] in [
'carafe'
], 'Unknown upsample type {}'.format(upsample['type'])
......
......@@ -75,7 +75,6 @@ def _conv_bn(input, ch_out, filter_size, stride, padding, act=None, name=None):
filter_size=filter_size,
stride=stride,
padding=padding,
act=None,
param_attr=ParamAttr(name=name + ".conv.weights"),
bias_attr=False)
......@@ -1588,6 +1587,8 @@ class CARAFEUpsample(object):
w = input_shape[3]
out = fluid.layers.reshape(
out, [b, int(input.shape[1]), -1, h * self.scale, w * self.scale])
weight = fluid.layers.expand_as(weight, out)
out = fluid.layers.reduce_sum(weight * out, dim=2)
return out
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册