Closed assia855 closed 7 months ago
Hello,
Thanks for your interest.
Ensure that you use the YOLOv8 model for segmentation, not for detection.
Also, perhaps, the "masks" sliced incorrectly. Check that the "masks" created this way, as in the notebook from this repository:
masks = output0[:,84:]
Which shape the "output0" has? If the model is for YOLO segmentation, it should be (8400, 116), but if it's for some reason for detection, then it is (8400, 84) and if you slice this way, it can result it (8400, 0) in the "masks".
Check these suggestions,
If it does not help, please share your model and notebook, I will look further.
Thanks for your replay. My train yolov8 to segment my own data and here's the shape of my output: Output0: (1, 45, 8400) Output1: (1, 32, 160, 160). I re-just the slicing as follow and now it's working :
boxes = output0[:,:13] masks = output0[:, 13:]
Now I just need to fix the color of the masks according to the classes I have since I have more than one class and the code now color all the polygons with the same color green.
Great. Yes, it's correct. In the demo, I used a pretrained model with 80 classes on COCO dataset, but a general rule is to subtract 32 from number of columns in output0 and use the result for slicing, which is 13 in your case.
Have a good one!
Thanks for sharing the blog and the jupyter notebook. I'm struggling in computing the masks of my model. I don't understand why. Any suggestions would be greatly appreciated.