Fix instance area method format-change bug (#10432)
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
6268ac8e1e
commit
553fa0e967
1 changed files with 5 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue