From 5b9eef363dd79ca09d739e39bcdc9bcbef6a16b5 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Sun, 9 Apr 2023 22:16:12 +0200 Subject: [PATCH] small fix :) --- supervision/detection/core.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 40a391c6..e4508d27 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -17,7 +17,7 @@ def _validate_xyxy(xyxy: Any, n: int) -> None: def _validate_mask(mask: Any, n: int) -> None: is_valid = mask is None or ( - isinstance(mask, np.ndarray) and len(mask.shape) == 3 and mask[0] == n + isinstance(mask, np.ndarray) and len(mask.shape) == 3 and mask.shape[0] == n ) if not is_valid: raise ValueError("mask must be 3d np.ndarray with (n, W, H) shape") @@ -239,6 +239,10 @@ class Detections: class_id=np.array(class_id).astype(int), ) + @classmethod + def from_segment_anything_model(cls, segment_anything_model_result: List[dict]) -> Detections: + pass + @classmethod def from_coco_annotations(cls, coco_annotation: dict) -> Detections: xyxy, class_id = [], []