diff --git a/paddlex/cv/nets/hrnet.py b/paddlex/cv/nets/hrnet.py index 561c7594da2904632386c0d88e9d841c047fb2d2..c366f13686a69206c3ee18d84b08c102fba6df92 100644 --- a/paddlex/cv/nets/hrnet.py +++ b/paddlex/cv/nets/hrnet.py @@ -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)) diff --git a/paddlex/cv/nets/segmentation/hrnet.py b/paddlex/cv/nets/segmentation/hrnet.py index 209da9b507ba8e59a073fab616418c378a1e7cd5..5193b3f1cb01efef0fec7c82ef5a24c0fa551a35 100644 --- a/paddlex/cv/nets/segmentation/hrnet.py +++ b/paddlex/cv/nets/segmentation/hrnet.py @@ -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)