[Python] Select box with highest confidence YOLO v11

Discussão em 'Python' iniciado por Stack, Maio 28, 2025.

  1. Stack

    Stack Membro Participativo

    I have a YOLO v11 model that is predicting a single class from images. In some cases it is misinterpreting the image and predicting multiple of the class in one image while there is only one. I have noticed that the correct one has the highest confidence value. Here is my code for predicting:

    results = model([imagepath+imgs[997]]) # return a list of Results objects
    for result in results:
    boxes = result.boxes

    print(boxes.conf.tolist())
    print(boxes.data.tolist())

    print(boxes)


    Here is the relevant output:

    [​IMG]

    The box with 0.8853 confidence shows up as the first entry in the conf tensor but shows up last at the data tensor. How do I choose the box with the highest confidence and find its data?

    Continue reading...

Compartilhe esta Página