I’m using Yolov9 for segmentation task, I want to disable the Attributes of class ultralytics.engine.results.Boxes. The attributes that i want to disable are the bounding box and the class label, I’m struck on this could anyone help me out with this
Thanks in advance
This isn’t the typical type of request, but maybe I misunderstood your meaning. I will refer you to Advice on asking for Support as (from my perspective) you’re asking about how to do Y, when you might need accomplish X. “Disabling” these class attributes is not going to be straightforward, as they are going to get used in many places, and I would not recommend doing this.
As a guess as to what you might actually intend to accomplish, is to remove the boxes and class names from the annotated results/images. This can be accomplished by providing the correct arguments for the plot()
method, which you can find in the docs pages for plotting inference results, but here’s a quick example.
from ultralytics import YOLO
model = YOLO("yolov9c-seg.pt")
result = model.predict("path/to/image.png")
img_masks = result[0].plot(boxes=False, labels=False)
# Numpy array of annotated image w/o boxes or class labels
If this is not what you meant, please provide some more information on what you’re looking to accomplish overall, as my initial reading is that you’re attempting to disable the class attributes, which seems quite an odd thing to do (from my view).
Thanks you @BurhanQ for helping me with the solution.
1 Like