File size: 473 Bytes
2c67080
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# coding: utf-8
from doclayout_yolo import YOLOv10

# Load the pre-trained model
model = YOLOv10("doclayout_yolo_docstructbench_imgsz1024.pt")
img = 'docs/examples/page-authors-1.png'
# img = 'docs/examples/page.png'
# Perform prediction
det_res = model.predict(
    img,   # Image to predict
    imgsz=1024,        # Prediction image size
    conf=0.2,          # Confidence threshold
    device="mps"    # Device to use (e.g., 'cuda:0' or 'cpu')
)[0]
print(det_res.boxes)