You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
500 B

from ultralytics import YOLO
import cv2
model = YOLO('./models/yolov9e_object_classification.pt')
image_path = './assets/classification_images/rgb_web_ex.jpeg'
image = cv2.imread(image_path)
results = model(image)
annotated_image = results[0].plot()
output_path = './assets/classification_images/annotated_image.jpg'
cv2.imwrite(output_path, annotated_image)
print(f"Annotated image saved to {output_path}")
cv2.imshow('Detected Objects', annotated_image)
cv2.waitKey(0)
cv2.destroyAllWindows()