ValueError: Could not resolve color by class becauseDetections do not have class_id #428
-
Search before asking
BugHi!! I'm using supervision for it can view the result of segment-anything following tutorial: https://blog.roboflow.com/how-to-use-segment-anything-model-sam/ The problem is when I want to draw masks on an image using provided detections with Segment-Anything (SAM). The error is: annotated_image = mask_annotator.annotate(scene=image_bgr.copy(), detections=detections) Environment
Minimal Reproducible Exampleimport cv2 IMAGE_PATH = "image1.jpg" if name == 'main':
AdditionalNo response Are you willing to submit a PR?
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 12 replies
-
Hello there, thank you for opening an Issue ! 🙏🏻 The team was notified and they will get back to you asap. |
Beta Was this translation helpful? Give feedback.
-
Hello, please do this
|
Beta Was this translation helpful? Give feedback.
-
Hi, @bb6698 👋🏻! Please use the tip provided by @onuralpszr. I just updated our blog post to use the latest API. I'm closing the issue, but feel free to reopen it if you will face more issues. |
Beta Was this translation helpful? Give feedback.
-
Thanks!! I probe mask_annotator = sv.MaskAnnotator(color_map = "index") and now it works. Cheers :) |
Beta Was this translation helpful? Give feedback.
-
In the latest update, it seems there is no argument called 'color_map' in MaskAnnotator, and neither does 'color_lookup' exist, which is given in the documentation of MaskAnnotator on Roboflow, and seems to be similar in functionality to 'color_map' |
Beta Was this translation helpful? Give feedback.
-
Since this is a old discussion and answered already multiple time, for avoid conflicts I am closing and looking this discussion. Thank you. |
Beta Was this translation helpful? Give feedback.
Hello, please do this
mask_annotator = sv.MaskAnnotator(color_map = "index")
should work. Default color map is "class" but for sam it doesn't have "class_id" so you need to use "index"