yolo26训练自己数据集

安装GPU版本显示cuda不可用

1 修复驱动

nvidia-smi NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

查看 /usr/src/ 目录下已安装的 NVIDIA 驱动源码包版本号

ls -l /usr/src/ | grep nvidia

drwxr-xr-x 8 root root 4096 Sep 10 2025 nvidia-580.82.07

重安装dkms

sudo apt update

sudo apt install -y dkms build-essential linux-headers-$(uname -r)

再安装

sudo dkms install -m nvidia -v 580.82.07

2 创建软链接

查看ultralytics安装目录

pip show ultralytics

Location: /yolo26/lib/python3.12/site-packages

创建软链接

ln -s /yolo26/lib/python3.12/site-packages/ultralytics ultralytics

3 训练脚本

from ultralytics import YOLO

1. 加载你复制并重命名后的 YOLO26 模型配置文件

model = YOLO('yolo26n.yaml')

2. (可选) 如果你想从头训练,请确保注释掉下面这行

model.load('yolo26n.pt')

3. 开始训练

results = model.train(

data='datasets/yolo.yaml', # 使用相对路径,更简洁

epochs=300,

imgsz=640,

batch=16,

device=0,

name='yolo26'

)

yolo26.yaml nc类别数根据实际修改

Parameters

nc: 80 # number of classes

end2end: True # whether to use end-to-end mode

reg_max: 1 # DFL bins

scales: # model compound scaling constants, i.e. 'model=yolo26n.yaml' will call yolo26.yaml with scale 'n'

depth, width, max_channels

n: 0.50, 0.25, 1024 # summary: 260 layers, 2,572,280 parameters, 2,572,280 gradients, 6.1 GFLOPs

s: 0.50, 0.50, 1024 # summary: 260 layers, 10,009,784 parameters, 10,009,784 gradients, 22.8 GFLOPs

m: 0.50, 1.00, 512 # summary: 280 layers, 21,896,248 parameters, 21,896,248 gradients, 75.4 GFLOPs

l: 1.00, 1.00, 512 # summary: 392 layers, 26,299,704 parameters, 26,299,704 gradients, 93.8 GFLOPs

x: 1.00, 1.50, 512 # summary: 392 layers, 58,993,368 parameters, 58,993,368 gradients, 209.5 GFLOPs

yolo.yaml

path: /yolo26/datasets/yoloWheat # dataset root dir

train: images/train2007 # train images (relative to 'path')

val: images/val2007 # val images (relative to 'path')

test: # test images (optional)

Classes

nc: 6 # number of classes

names: 'xmhh','xmbh','xmcmb','xmsy','xmyf','xmjs'

相关推荐
jooloo3 小时前
Codex 间歇性 400 之谜:一条对话里,它为什么有时候用 chat/completions,有时候切到 responses?
人工智能
用户5191495848453 小时前
OpenSSL PKCS#12 PBMAC1 堆栈缓冲区溢出漏洞 (CVE-2025-11187) 分析与验证
人工智能·aigc
用户5191495848454 小时前
HP Sound Research SECOMNService 权限提升漏洞利用工具
人工智能·aigc
用户018349301694 小时前
给 AI 智能体能力包一层 BFF,前端只调一个接口
人工智能
这token有力气8 小时前
Function Calling 格式漂移
人工智能
onething3658 小时前
Spring Boot + Spring AI 从入门到实战:7天转型计划 Day 5 —— SSE 流式输出 + 打字机效果
人工智能·后端·全栈
onething3659 小时前
Spring Boot + Spring AI 从入门到实战:7天转型计划 Day 6 —— 业务完善 + 会话消息预览
人工智能·后端·全栈
IT_陈寒9 小时前
SpringBoot自动配置的坑,我爬了三天才出来
前端·人工智能·后端
甲维斯10 小时前
笑抽了!DeepSeek识图,豆包完胜了!
人工智能·deepseek
Lei活在当下19 小时前
【AI手记系列-2026/6/18】iSparto & Harness,Caveman 以及AI时代的生存指南
人工智能·llm·openai