1from ultralytics import YOLO
2import cv2
3
4model = YOLO("model/best.pt")
5image = cv2.imread("test.jpg")
6h, w, c = image.shape
7
8results = model(
9 image,
10 # dimensions required to be multiple of 32
11 imgsz=[(h // 32) * 32, (w // 32) * 32],
12 conf=0.6,
13)[0]
14# save the image with bounding boxes
15results.save("output.jpg")