Sleeping-post-detection-fir.../wzq.py

17 lines
667 B
Python
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from ultralytics import YOLO
import os
os.environ["GIT_PYTHON_REFRESH"] = "quiet"
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
if __name__ == '__main__':
# # 训练数据集:
# model = YOLO('yolov8n.pt') # 如果要训练如pose该对应的权重即可
# results = model.train(data='data.yaml', epochs=200)
#预测结果
model = YOLO('yolov8n.pt') #常用模型yolov8n-seg.pt、yolov8n.pt、yolov8n-pose.pt
model.predict("ultralytics/assets", save=True) #测试图片文件夹并且设置保存True
#如果中断后,可以改为以下代码:
# model = YOLO('last.pt') # last.pt文件的路径
# results = model.train(resume=True)