2024-09-08 14:08:46 +08:00

17 lines
667 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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)