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,