How to create a binary mask from a yolo8 segmentation result
How to create a binary mask from a yolo8 segmentation result Question: I want to segment an image using yolo8 and then create a mask for all objects in the image with specific class. I have developed this code: img=cv2.imread(‘images/bus.jpg’) model = YOLO(‘yolov8m-seg.pt’) results = model.predict(source=img.copy(), save=False, save_txt=False) class_ids = np.array(results[0].boxes.cls.cpu(), dtype="int") for i in …