From 5db8a01b764dae2661bc8456aaa4bf322f5de914 Mon Sep 17 00:00:00 2001 From: Radionic Date: Tue, 21 Nov 2023 16:29:36 +0800 Subject: [PATCH] fix: bbox --- js/onnx_helper.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/onnx_helper.js b/js/onnx_helper.js index 058e3b3..a38aade 100644 --- a/js/onnx_helper.js +++ b/js/onnx_helper.js @@ -30,13 +30,13 @@ const modelData = ({ clicks, tensor, modelScale, box }) => { } if (box) { - pointCoords[2 * n] = box.x1; - pointCoords[2 * n + 1] = box.y1; + pointCoords[2 * n] = box.x1 * modelScale.samScale; + pointCoords[2 * n + 1] = box.y1 * modelScale.samScale; pointLabels[n] = 2; - pointCoords[2 * n + 2] = box.x2; - pointCoords[2 * n + 3] = box.y2; - pointLabels[n] = 3; + pointCoords[2 * n + 2] = box.x2 * modelScale.samScale; + pointCoords[2 * n + 3] = box.y2 * modelScale.samScale; + pointLabels[n + 1] = 3; } else { // Add in the extra point/label when only clicks and no box // The extra point is at (0, 0) with label -1