YOLO26X模型在工业检测中的训练环境配置

1、环境配置

默认已经安装好Anaconda Prompt(Miniconda)

在官网地址https://github.com/ultralytics/ultralytics下载源代码

按顺序执行如下指令

conda create -n yolo26 python=3.10

目前使用python3.10以下版本没有配置成功

conda activate yolo26

pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121

pip install ultralytics -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install torchsummary -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install onnx==1.14.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install onnxruntime==1.15.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install pycocotools==2.0.7 -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install PyYAML==6.0.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install scipy==1.13.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install onnxsim==0.4.36 -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install onnxruntime-gpu==1.18.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install timm thop einops grad-cam dill albumentations pytorch_wavelets tidecv PyWavelets -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install -U openmim -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install flash_attn -i https://pypi.tuna.tsinghua.edu.cn/simple

mim install mmengine -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install mmcv==2.2.0 -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.3/index.html

pip install torchsummary -i https://pypi.tuna.tsinghua.edu.cn/simple -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install easydict -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install antialiased_cnns -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install torch_dct -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install tensorboard -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install numpy==1.23.5 -i https://pypi.tuna.tsinghua.edu.cn/simple

2、pt模型转换

执行如下代码

python 复制代码
from ultralytics import YOLO

#model = YOLO("yolo26x.pt")
model = YOLO("yolo26l.pt")

# Use one-to-one head (default, no NMS required)
#results = model.predict("image.jpg")  # inference
#metrics = model.val(data="coco.yaml")  # validation
#model.export(format="onnx")  # export

# Use one-to-many head (requires NMS)
#results = model.predict("bus.jpg", end2end=False)  # inference
#metrics = model.val(data="cfg/datasets/coco.yaml", end2end=False)  # validation
model.export(format="onnx", end2end=False)  # export

说明:end2end=false的原因如下:

选择取决于您的部署需求:若追求最高速度和简便性,请选用一对一处理器end2end=True;若精度是首要考量,则应选用多对一处理器end2end=False。工业上应用一般选择end2end=False来追求准确率。

3、部署

对于end2end=false与原来的用法没事差别,直接参考D:\YOLO26\ultralytics-main\examples\YOLOv8-CPP-Inference下的应用代码即可。

相关推荐
菩提树下的凡夫7 小时前
DINOv3中Patch及图像对齐含义
工业异常检测
菩提树下的凡夫1 天前
DINOv3如何部署及零样本或少样本的工业异常缺陷检测?
工业异常检测
菩提树下的凡夫9 天前
工业异常缺陷检测精度提高方法
工业异常检测
心 爱心 爱3 个月前
Shape-Guided Dual-Memory Learning for 3D Anomaly Detection 论文精读
计算机视觉·3d·异常检测·工业异常检测·三维异常检测·多模态工业异常检测·二维异常检测
知来者逆2 年前
AnomalyGPT——使用大型视觉语言模型进行工业异常检测的算法解析与应用
gpt·chatgpt·缺陷检测·视觉语言·anomalygpt·工业异常检测