From f66444bc913f3e6c4fe9e4a4df69d60a37811b7f Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 25 Jun 2024 15:59:49 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9E=20add=20if=20condition=20fo?= =?UTF-8?q?r=20check=20existince=20of=20'pred=5Fmasks'=20for=20detectron2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- 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 1a5c86ea..726813bd 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -540,7 +540,9 @@ class Detections: return cls( xyxy=detectron2_results["instances"].pred_boxes.tensor.cpu().numpy(), confidence=detectron2_results["instances"].scores.cpu().numpy(), - mask=detectron2_results["instances"].pred_masks.detach().cpu().numpy(), + mask=detectron2_results["instances"].pred_masks.cpu().numpy() + if hasattr(detectron2_results["instances"], "pred_masks") + else None, class_id=detectron2_results["instances"] .pred_classes.cpu() .numpy()