Fix scaling ratio calculation in ONNX example (#20016)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
MrBlackBigWhiteSheep 2025-04-05 07:32:47 +08:00 committed by GitHub
parent d610180309
commit 608617e598
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -181,7 +181,7 @@ class YOLOv8:
class_ids = []
# Calculate the scaling factors for the bounding box coordinates
gain = min(self.input_height / self.img_height, self.input_width / self.img_height)
gain = min(self.input_height / self.img_height, self.input_width / self.img_width)
outputs[:, 0] -= pad[1]
outputs[:, 1] -= pad[0]