roboflow / notebooks

Examples and tutorials on using SOTA computer vision models and techniques. Learn everything from old-school ResNet, through YOLO and object-detection transformers like DETR, to the latest models like Grounding DINO and SAM.
https://roboflow.com/models
4.78k stars 744 forks source link

Segmentation mask without bounding box #175

Closed deepak36ccny closed 9 months ago

deepak36ccny commented 11 months ago

Hi, I want to get the segmented mask, but not the bounding box and the labeling that comes with it. How can I do this with Ultralytics Yolov8 segmentation model? Thank you.

github-actions[bot] commented 11 months ago

👋 Hello @deepak36ccny, thank you for leaving an issue on Roboflow Notebooks.

🐞 Bug reports

If you are filing a bug report, please be as detailed as possible. This will help us more easily diagnose and resolve the problem you are facing. To learn more about contributing, check out our Contributing Guidelines.

If you require support with custom code that is not part of Roboflow Notebooks, please reach out on the Roboflow Forum or on the GitHub Discussions page associated with this repository.

💬 Get in touch

Do you have more questions about Roboflow that we haven't responded to yet? Feel free to ask them on the Roboflow Discuss forum. Our developer advocates and community team actively respond to questions there.

To ask questions about Notebooks, head over to the GitHub Discussions section of this repository.

Aryan8912 commented 9 months ago

Assign to me, so I can working on it

SkalskiP commented 9 months ago

Hi @deepak36ccny 👋🏻 You can do it using supervision.

pip install supervision in your project, and than add this to your code:

import supervision as sv
from ultralytics import YOLO

model = YOLO('yolov8x-seg.pt')

image = ...
result = model(image)[0]
detections = sv.Detections.from_ultralytics(result)

mask_annotator = sv.MaskAnnotator()
annotated_image = mask_annotator.annotate(
    scene=image.copy(),
    detections=detections
)

You can learn more about supervision annotators here: https://supervision.roboflow.com/annotators

Feel free to reopen this issue if you will face any problems.