diff --git a/ultralytics/yolo/utils/instance.py b/ultralytics/yolo/utils/instance.py index 619ac30..0179e70 100644 --- a/ultralytics/yolo/utils/instance.py +++ b/ultralytics/yolo/utils/instance.py @@ -209,9 +209,10 @@ class Instances: """Convert bounding box format.""" self._bboxes.convert(format=format) + @property def bbox_areas(self): """Calculate the area of bounding boxes.""" - self._bboxes.areas() + return self._bboxes.areas() def scale(self, scale_w, scale_h, bbox_only=False): """this might be similar with denormalize func but without normalized sign.""" @@ -328,9 +329,9 @@ class Instances: def remove_zero_area_boxes(self): """Remove zero-area boxes, i.e. after clipping some boxes may have zero width or height. This removes them.""" - good = self._bboxes.areas() > 0 + good = self.bbox_areas > 0 if not all(good): - self._bboxes = Bboxes(self._bboxes.bboxes[good], format=self._bboxes.format) + self._bboxes = self._bboxes[good] if len(self.segments): self.segments = self.segments[good] if self.keypoints is not None: