From 78935098451c858a193d3521e81335a3a3b19456 Mon Sep 17 00:00:00 2001 From: WJJ1995 Date: Mon, 5 Jul 2021 14:04:50 +0800 Subject: [PATCH] Support ppocr_mobile_det model of op11 (#272) * fixed ppocr_det op11 has huge diff * fixed some bugs * fixed nearest bugs * fixed nearest bugs --- paddle2onnx/op_mapper/tensor.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/paddle2onnx/op_mapper/tensor.py b/paddle2onnx/op_mapper/tensor.py index 0a301257a..d69c46102 100644 --- a/paddle2onnx/op_mapper/tensor.py +++ b/paddle2onnx/op_mapper/tensor.py @@ -1027,12 +1027,21 @@ def opset_11(cls, graph, node, **kw): in_shape, out_shape = cls.compute_output_shape_by_size(graph, node) inputs += [empty_node, out_shape] - graph.make_node( - 'Resize', - inputs=inputs, - outputs=node.output('Out'), - mode=resize_type, - coordinate_transformation_mode=coordinate_transformation_mode) + if resize_type == 'nearest' and coordinate_transformation_mode == 'asymmetric': + graph.make_node( + 'Resize', + inputs=inputs, + outputs=node.output('Out'), + mode=resize_type, + coordinate_transformation_mode=coordinate_transformation_mode, + nearest_mode='floor') + else: + graph.make_node( + 'Resize', + inputs=inputs, + outputs=node.output('Out'), + mode=resize_type, + coordinate_transformation_mode=coordinate_transformation_mode) @classmethod def compute_output_shape(cls, graph, node, opset_version=10):