Graduation-Project/yolov8/yolov8_train.py
2025-05-05 17:30:12 +08:00

13 lines
399 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
# 加载预训练模型
model = YOLO('../yolov8n.pt')
# 开始训练
model.train(
data='./yolov8.yaml', # 数据配置文件路径
epochs=320, # 训练轮数
batch=-1, # 批量大小
imgsz=640, # 输入图片大小
device=0 # 使用的设备0 表示 GPU'cpu' 表示 CPU
)