文章目录

  • 前言
  • 安装
  • 示例
  • 搭建过程中遇到的问题
  • error loading fbgemm.dll or dependencies
  • No module named 'onnx'
  • 引用



前言

工作中遇到点选验证码,尝试基于Yolo训练检测模型,在此从零开始搭建Yolo运行环境

从零搭建Yolo运行环境_目标检测


安装

从零搭建Yolo运行环境_目标检测_02

# Install the ultralytics package from PyPI
pip install ultralytics

ultralytics 与 yolo的关系:
Ultralytics框架中集成了YOLO系列模型,用户可以通过简单的API和命令行工具来训练、评估和部署这些模型。框架还提供了丰富的配置选项,允许用户根据自己的需求对模型进行定制。

示例

from ultralytics import YOLO

# Create a new YOLO model from scratch
model = YOLO("yolov8n.yaml")

# Load a pretrained YOLO model (recommended for training)
model = YOLO("yolov8n.pt")

# Train the model using the 'coco8.yaml' dataset for 3 epochs
results = model.train(data="coco8.yaml", epochs=3)

# Evaluate the model's performance on the validation set
results = model.val()

# Perform object detection on an image using the model
results = model("https://ultralytics.com/images/bus.jpg")

# Export the model to ONNX format
success = model.export(format="onnx")

搭建过程中遇到的问题

error loading fbgemm.dll or dependencies

异常原因: 缺少dll文件
解决方法: 参考引用 [1]

No module named ‘onnx’

pip install onnx