YOLOv13 模型部署教程YOLOv13 隆重推出 ——新一代实时检测器,拥有尖端的性能和效率。YOLOv13 系列包含四个版本:Nano、Small、Large 和 X-Large,并由以下技术提供支持:

基础环境最低要求说明:
| 环境名称 | 版本信息 |
|---|---|
| Ubuntu | 22.04.5 LTS |
| python | 3.11 |
| Cuda | 12.4.1 |
| NVIDIA Corporation | 3060 |

conda create -n yolov13 python=3.11 -y

git clone https://github.com/iMoonLab/yolov13.git

conda activate yolov13
cd yolov13
wget https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu11torch2.2cxx11abiFALSE-cp311-cp311-linux_x86_64.whl
pip install -r requirements.txt
pip install -e .

wget https://github.com/iMoonLab/yolov13/releases/download/yolov13/yolov13n.pt
YOLOv13-N YOLOv13-S YOLOv13-L YOLOv13-X
使用以下代码在 COCO 数据集上验证 YOLOv13 模型。请务必将其替换 {n/s/l/x} 为所需的模型规模(nano、small、plus 或 ultra)。
from ultralytics import YOLO
model = YOLO('yolov13{n/s/l/x}.pt') # Replace with the desired model scale
使用以下代码训练 YOLOv13 模型。请确保将 替换 yolov13n.yaml 为所需的模型配置文件路径,并将其 coco.yaml 替换为你的 Coco 数据集配置文件。
from ultralytics import YOLO
model = YOLO('yolov13n.yaml')
# Train the model
results = model.train(
data='coco.yaml',
epochs=600,
batch=256,
imgsz=640,
scale=0.5, # S:0.9; L:0.9; X:0.9
mosaic=1.0,
mixup=0.0, # S:0.05; L:0.15; X:0.2
copy_paste=0.1, # S:0.15; L:0.5; X:0.6
device="0,1,2,3",
)
# Evaluate model performance on the validation set
metrics = model.val('coco.yaml')
# Perform object detection on an image
results = model("path/to/your/image.jpg")
results[0].show()
使用以下代码,使用 YOLOv13 模型执行对象检测。请确保将其替换 {n/s/l/x} 为所需的模型比例。
from ultralytics import YOLO
model = YOLO('yolov13{n/s/l/x}.pt') # Replace with the desired model scale
model.predict()
使用以下代码将 YOLOv13 模型导出为 ONNX 或 TensorRT 格式。请确保将其替换 {n/s/l/x} 为所需的模型比例。
from ultralytics import YOLO
model = YOLO('yolov13{n/s/l/x}.pt') # Replace with the desired model scale
model.export(format="engine", half=True) # or format="onnx"
启动app_demo.py文件
python app_demo.py

点击此处,立即体验YOLOv13!
