|
|
@ -209,9 +209,10 @@ class Instances:
|
|
|
|
"""Convert bounding box format."""
|
|
|
|
"""Convert bounding box format."""
|
|
|
|
self._bboxes.convert(format=format)
|
|
|
|
self._bboxes.convert(format=format)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
def bbox_areas(self):
|
|
|
|
def bbox_areas(self):
|
|
|
|
"""Calculate the area of bounding boxes."""
|
|
|
|
"""Calculate the area of bounding boxes."""
|
|
|
|
self._bboxes.areas()
|
|
|
|
return self._bboxes.areas()
|
|
|
|
|
|
|
|
|
|
|
|
def scale(self, scale_w, scale_h, bbox_only=False):
|
|
|
|
def scale(self, scale_w, scale_h, bbox_only=False):
|
|
|
|
"""this might be similar with denormalize func but without normalized sign."""
|
|
|
|
"""this might be similar with denormalize func but without normalized sign."""
|
|
|
@ -328,9 +329,9 @@ class Instances:
|
|
|
|
|
|
|
|
|
|
|
|
def remove_zero_area_boxes(self):
|
|
|
|
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."""
|
|
|
|
"""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):
|
|
|
|
if not all(good):
|
|
|
|
self._bboxes = Bboxes(self._bboxes.bboxes[good], format=self._bboxes.format)
|
|
|
|
self._bboxes = self._bboxes[good]
|
|
|
|
if len(self.segments):
|
|
|
|
if len(self.segments):
|
|
|
|
self.segments = self.segments[good]
|
|
|
|
self.segments = self.segments[good]
|
|
|
|
if self.keypoints is not None:
|
|
|
|
if self.keypoints is not None:
|
|
|
|