Scripts2026年7月6日·1 分钟阅读

YOLOv5 — Real-Time Object Detection in PyTorch

YOLOv5 is a family of object detection architectures pre-trained on COCO, offering a range of model sizes from nano to extra-large for real-time inference on images, video, and webcam streams.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
YOLOv5 Overview
直接安装命令
npx -y tokrepo@latest install db0047d3-7912-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

YOLOv5 is a widely adopted object detection framework built on PyTorch by Ultralytics. It provides five model sizes (n/s/m/l/x) that trade off speed against accuracy, making it suitable for everything from edge deployment on mobile devices to high-accuracy server workloads.

What YOLOv5 Does

  • Detects objects in images and video with bounding boxes and class labels
  • Supports classification, instance segmentation, and oriented bounding boxes
  • Exports to ONNX, CoreML, TFLite, TensorRT, and OpenVINO for cross-platform deployment
  • Trains custom models on user datasets with built-in data augmentation (mosaic, mixup, HSV shifts)
  • Provides a command-line and Python API for inference, training, and validation

Architecture Overview

YOLOv5 uses a CSPDarknet53 backbone for feature extraction, a PANet neck for multi-scale feature fusion, and a single-stage detection head that predicts bounding boxes, objectness scores, and class probabilities at three scales. The architecture is defined in YAML config files, which allows users to modify depth and width multipliers to create custom-sized models. Anchor-based detection is used by default, but anchor-free heads are available in newer variants.

Self-Hosting & Configuration

  • Install via pip (pip install ultralytics) or clone the repository directly
  • Pre-trained weights are downloaded automatically on first use from GitHub releases
  • Training configs live in YAML files specifying backbone, neck, head, and hyperparameters
  • Use --device cpu or --device 0 to select CPU or GPU inference
  • Deploy with TorchServe, Triton Inference Server, or as a Flask/FastAPI microservice

Key Features

  • Five model sizes from YOLOv5n (1.9M params) to YOLOv5x (86.7M params)
  • AutoAnchor computes optimal anchors for custom datasets during training
  • Multi-GPU and distributed training supported out of the box
  • Built-in TensorBoard and Weights & Biases logging
  • Active ecosystem with thousands of community-trained models on Ultralytics HUB

Comparison with Similar Tools

  • YOLOv8/YOLO11 — newer Ultralytics models with anchor-free heads and improved accuracy; YOLOv5 remains popular for its maturity and broad deployment tooling
  • Detectron2 — Meta's modular detection platform with more research-oriented flexibility, but heavier setup
  • MMDetection — OpenMMLab framework supporting dozens of architectures; more complex configuration than YOLOv5
  • YOLOX — anchor-free YOLO variant by Megvii with decoupled head design; less ecosystem support
  • EfficientDet — Google's compound-scaling detector; slower inference than comparable YOLOv5 models

FAQ

Q: Is YOLOv5 still maintained now that YOLOv8 exists? A: Yes. Ultralytics continues to maintain YOLOv5 and it receives bug fixes and compatibility updates. Many production systems rely on it.

Q: How do I train on a custom dataset? A: Organize images and labels in YOLO format, create a dataset YAML, then run yolo detect train data=custom.yaml model=yolov5s.pt epochs=100.

Q: Can I run YOLOv5 on a Raspberry Pi? A: Yes. Export to TFLite or NCNN and use the nano model (YOLOv5n) for real-time inference on ARM devices.

Q: What license does YOLOv5 use? A: YOLOv5 is released under AGPL-3.0. Commercial use requires an Ultralytics Enterprise License.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产