Spaces:
Sleeping
Sleeping
File size: 494 Bytes
908e980 |
1 2 3 4 5 6 7 8 9 10 11 12 |
import os
from ultralytics import YOLO
PROJECT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
yolo_model = os.path.join(PROJECT_DIR, 'output/yolov8n_custom/weights/best.pt')
model = YOLO(yolo_model)
# save plotted images
plotted_result_path = os.path.join(PROJECT_DIR, 'scripts\inference')
image_path = os.path.join(PROJECT_DIR, 'data_for_inference\img')
results = model.predict(source=image_path, save=True, save_txt=True, show=True, project=plotted_result_path) |