From 75bb07078c19a4a313752a492418711a36f3d5c0 Mon Sep 17 00:00:00 2001 From: Kader Miyanyedi Date: Wed, 14 Feb 2024 21:46:50 +0300 Subject: [PATCH] fix(detection): add class name to detection data even if empty Signed-off-by: Kader Miyanyedi --- supervision/detection/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index e727426b..f170563c 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -487,7 +487,9 @@ class Detections: ) if np.asarray(xyxy).shape[0] == 0: - return cls.empty() + empty_detection = cls.empty() + empty_detection.data = {CLASS_NAME_DATA_FIELD: np.empty(0)} + return empty_detection return cls( xyxy=xyxy,