# Load a model
#model = YOLO("yolo11n.pt")  # load an official model
model = YOLO("./down.pt")  # load a custom model

# Predict with the model
results = model("./dd.png")  # predict on an image

# Access the results
for result in results:
    xywh = result.boxes.xywh  # center-x, center-y, width, height
    xywhn = result.boxes.xywhn  # normalized
    xyxy = result.boxes.xyxy  # top-left-x, top-left-y, bottom-right-x, bottom-right-y
    xyxyn = result.boxes.xyxyn  # normalized
    names = [result.names[cls.item()] for cls in result.boxes.cls.int()]  # class name of each box
    confs = result.boxes.conf  # confidence score of each box
    result.show()  # display to screen
xywh
tensor([[114.5128,  71.2331, 204.0481, 138.8251],
        [117.1841, 260.4524, 207.6318, 220.8952]], device='cuda:0')
 cropped_image.shape
 (681, 221, 3)

图片的 高=681 宽=221

原点在左上角

原点

--------------------------------->x 宽=221

/ p1 (114.5128, 71.2331)第一个中心点坐标
+
+
+
+
+ p2 (117.1841, 260.4524)第二个中心点坐标
+
+
+
+

Y 高=681

在这里插入图片描述

更多推荐