提交 a20bc127 编写于 作者: C Channingss

resize_bilinear of HRnet changed for onnx opset10

上级 3066636d
......@@ -235,7 +235,10 @@ class HRNet(object):
name=name + '_layer_' + str(i + 1) + '_' + str(j + 1))
if self.feature_maps == "stage4":
y = fluid.layers.resize_bilinear(
input=y, out_shape=[height, width])
input=y,
out_shape=[height, width],
align_corners=False,
align_mode=1)
else:
y = fluid.layers.resize_nearest(
input=y, scale=2**(j - i))
......
......@@ -77,9 +77,12 @@ class HRNet(object):
st4 = self.backbone(image)
# upsample
shape = fluid.layers.shape(st4[0])[-2:]
st4[1] = fluid.layers.resize_bilinear(st4[1], out_shape=shape)
st4[2] = fluid.layers.resize_bilinear(st4[2], out_shape=shape)
st4[3] = fluid.layers.resize_bilinear(st4[3], out_shape=shape)
st4[1] = fluid.layers.resize_bilinear(
st4[1], out_shape=shape, align_corners=False, align_mode=1)
st4[2] = fluid.layers.resize_bilinear(
st4[2], out_shape=shape, align_corners=False, align_mode=1)
st4[3] = fluid.layers.resize_bilinear(
st4[3], out_shape=shape, align_corners=False, align_mode=1)
out = fluid.layers.concat(st4, axis=1)
last_channels = sum(self.backbone.channels[str(self.backbone.width)][
......@@ -104,7 +107,8 @@ class HRNet(object):
bias_attr=False)
input_shape = fluid.layers.shape(image)[-2:]
logit = fluid.layers.resize_bilinear(out, input_shape)
logit = fluid.layers.resize_bilinear(
out, input_shape, align_corners=False, align_mode=1)
if self.num_classes == 1:
out = sigmoid_to_softmax(logit)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册