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

18 lines
534 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
# 创建 YOLOv8 模型实例,选择适合的配置文件
model = YOLO('yolov8n.yaml') # YOLOv8 Nano 配置文件(这个是从官网上下载的预训练模型)
# 配置训练参数
model.train(
data='data.yaml', # 数据配置文件
epochs=150, # 训练轮数
batch=8, # 批量大小(适合 CPU 计算)
imgsz=320, # 图像尺寸(较小尺寸适合 CPU
device='cpu' # 训练设备设置为 CPU本人用的是cpu
)