From f12504b0dd3e7993e259439ba7a80b93e6f4a577 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 11 Apr 2023 13:50:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20fix=20`Detections.=5F?= =?UTF-8?q?=5Fgetitem=5F=5F`=20and=20`Detections.area`=20bugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 6a00a923..0466856d 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -319,6 +319,9 @@ class Detections: ): return Detections( xyxy=self.xyxy[index], + mask=self.mask[index] + if self.mask is not None + else None, confidence=self.confidence[index] if self.confidence is not None else None, @@ -341,7 +344,7 @@ class Detections: np.ndarray: An array of floats containing the area of each detection in the format of `(area_1, area_2, ..., area_n)`, where n is the number of detections. """ if self.mask is not None: - return np.ndarray([np.sum(mask) for mask in self.mask]) + return np.array([np.sum(mask) for mask in self.mask]) else: return self.box_area