From 28fa054fdcd84587d2c37ad8f893f98a489731b7 Mon Sep 17 00:00:00 2001 From: Soham Date: Sat, 30 Nov 2024 13:56:18 +0530 Subject: [PATCH] fix: is_empty check for filtering --- supervision/detection/core.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 74c663a8..e4320a16 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -1203,6 +1203,8 @@ class Detections: return self.data.get(index) if isinstance(index, int): index = [index] + if self.is_empty(): + return Detections.empty() return Detections( xyxy=self.xyxy[index], mask=self.mask[index] if self.mask is not None else None,