Files
Yolo/train_merged.py
Kevin Wong fec2523b5c 再训练
2026-01-05 12:41:43 +08:00

29 lines
949 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.
# train_merged.py
# -*- coding: utf-8 -*-
"""
合并数据集训练脚本
在服务器上运行python train_merged.py
"""
from ultralytics import YOLO
# 使用标准 YOLO11l-seg 模型(不要用 YOLOE
model = YOLO("/home/rongye/ProgramFiles/Yolo/yolo11l-seg.pt")
# 开始训练
results = model.train(
data="/home/rongye/ProgramFiles/Yolo/datasets/blind_guidance_merged/data.yaml",
epochs=200, # 数据量大,增加轮次
imgsz=640, # 训练分辨率
batch=16, # 3090 显存足够
device=1, # 第二块 3090
workers=16, # 多线程加载
cache='ram', # 192GB 内存全量缓存
optimizer='AdamW',
close_mosaic=15, # 最后15轮关闭mosaic
amp=True, # 混合精度
patience=30, # 早停耐心值
project="blind_guide_project",
name="yolo11l_blind_v2" # 版本2
)