From d43b27d851dc64aabd6170a7a80710738c2c521e Mon Sep 17 00:00:00 2001 From: Channingss Date: Mon, 20 Jul 2020 03:29:49 +0000 Subject: [PATCH] set Clip-9 defalut attr max=3.4028235e+38 --- .../opset9/paddle_custom_layer/yolo_box.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/x2paddle/op_mapper/paddle2onnx/opset9/paddle_custom_layer/yolo_box.py b/x2paddle/op_mapper/paddle2onnx/opset9/paddle_custom_layer/yolo_box.py index c1a3703..521804c 100644 --- a/x2paddle/op_mapper/paddle2onnx/opset9/paddle_custom_layer/yolo_box.py +++ b/x2paddle/op_mapper/paddle2onnx/opset9/paddle_custom_layer/yolo_box.py @@ -16,6 +16,9 @@ import onnx import numpy as np from onnx import onnx_pb, helper +MAX_FLOAT32 = np.asarray( + [255, 255, 127, 127], dtype=np.uint8).view(np.float32)[0] + def get_old_name(arg, name_prefix=''): prefix_index = arg.find(name_prefix) @@ -766,7 +769,7 @@ def yolo_box(op, block): inputs=outputs_pred_box_x1_decode, outputs=outputs_pred_box_x1_clip, min=0.0, - max=float(np.inf)) + max=MAX_FLOAT32) node_list.append(node_pred_box_x1_clip) node_pred_box_y1_clip = onnx.helper.make_node( @@ -774,7 +777,7 @@ def yolo_box(op, block): inputs=outputs_pred_box_y1_decode, outputs=outputs_pred_box_y1_clip, min=0.0, - max=float(np.inf)) + max=MAX_FLOAT32) node_list.append(node_pred_box_y1_clip) node_pred_box_x2_clip = onnx.helper.make_node( @@ -782,7 +785,7 @@ def yolo_box(op, block): inputs=outputs_pred_box_x2_sub_w, outputs=outputs_pred_box_x2_clip, min=0.0, - max=float(np.inf)) + max=MAX_FLOAT32) node_list.append(node_pred_box_x2_clip) node_pred_box_y2_clip = onnx.helper.make_node( @@ -790,7 +793,7 @@ def yolo_box(op, block): inputs=outputs_pred_box_y2_sub_h, outputs=outputs_pred_box_y2_clip, min=0.0, - max=float(np.inf)) + max=MAX_FLOAT32) node_list.append(node_pred_box_y2_clip) outputs_pred_box_x2_res = [model_name + "@box_x2_res"] -- GitLab