Fix instance area method format-change bug (#10432)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Buckler89 2024-05-03 21:13:23 +02:00 committed by GitHub
parent 6268ac8e1e
commit 553fa0e967
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -72,8 +72,11 @@ class Bboxes:
def areas(self):
"""Return box areas."""
self.convert("xyxy")
return (self.bboxes[:, 2] - self.bboxes[:, 0]) * (self.bboxes[:, 3] - self.bboxes[:, 1])
return (
(self.bboxes[:, 2] - self.bboxes[:, 0]) * (self.bboxes[:, 3] - self.bboxes[:, 1]) # format xyxy
if self.format == "xyxy"
else self.bboxes[:, 3] * self.bboxes[:, 2] # format xywh or ltwh
)
# def denormalize(self, w, h):
# if not self.normalized: