From ed6e46a3af82e501d528b0ca9632e14ae8ba905f Mon Sep 17 00:00:00 2001 From: Katsuya Hyodo Date: Sun, 22 Oct 2023 22:21:28 +0900 Subject: [PATCH] scale convertion bug fix --- 420_Gold-YOLO-Hand/demo/demo_goldyolo_onnx.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/420_Gold-YOLO-Hand/demo/demo_goldyolo_onnx.py b/420_Gold-YOLO-Hand/demo/demo_goldyolo_onnx.py index 3f5ac7a18b..acbc057a48 100644 --- a/420_Gold-YOLO-Hand/demo/demo_goldyolo_onnx.py +++ b/420_Gold-YOLO-Hand/demo/demo_goldyolo_onnx.py @@ -202,10 +202,10 @@ def __postprocess( if len(boxes_keep) > 0: for box, score in zip(boxes_keep, scores_keep): - x_min = max(int(box[2]), 0) - y_min = max(int(box[3]), 0) - x_max = min(int(box[4]), image_width) - y_max = min(int(box[5]), image_height) + x_min = int(max(box[2], 0) * image_width / self.input_shapes[0][3]) + y_min = int(max(box[3], 0) * image_height / self.input_shapes[0][2]) + x_max = int(min(box[4], self.input_shapes[0][3]) * image_width / self.input_shapes[0][3]) + y_max = int(min(box[5], self.input_shapes[0][2]) * image_height / self.input_shapes[0][2]) result_boxes.append( [x_min, y_min, x_max, y_max]