Files
Yolo/train.py
2026-01-05 12:19:48 +08:00

21 lines
1.0 KiB
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
# 加载 YOLOv11-Large 分割模型 (标准版本,支持自定义训练)
# 注意YOLOE 不支持自定义类别数训练,需使用标准 YOLO11
model = YOLO("/home/rongye/ProgramFiles/Yolo/yolo11l-seg.pt")
# 开始训练
results = model.train(
data="/home/rongye/ProgramFiles/Yolo/datasets/indoor_blind/data.yaml",
epochs=150, # 导盲任务建议150轮以确保收敛
imgsz=640, # 训练分辨率保持 640
batch=16, # 3090 显存大16-32 均可
device=1, # 指定第二块 3090
workers=16, # 利用双路 Xeon CPU 的多线程能力
cache='ram', # 【核心优化】192GB内存足够载入全部数据极大缩短IO等待
optimizer='AdamW', # 分割任务建议使用 AdamW
close_mosaic=10, # 最后 10 轮关闭增强,提升 Mask 边缘的细腻程度
amp=True, # 开启混合精度,提速并省显存
project="blind_guide_project",
name="yoloe_seg_blind_v1"
)