yolov3 README

The project's README from github.com/ultralytics/yolov3. As one markdown file: README.md.

Ultralytics YOLOv3 banner

中文 | 한국어 | 日本語 | Русский | Deutsch | Français | Español | Português | Türkçe | Tiếng Việt | العربية

YOLOv3 CI Docker Pulls Discord Ultralytics Forums Ultralytics Reddit
Open In Colab

Ultralytics YOLOv3 is a PyTorch implementation of the YOLOv3 (You Only Look Once, version 3) real-time object detection model. YOLOv3 frames detection as a single regression problem, predicting bounding boxes and class probabilities directly from full images in one forward pass — making it fast, accurate, and straightforward to train and deploy.

This repository packages the three classic YOLOv3 detection models — YOLOv3, YOLOv3-SPP, and YOLOv3-tiny — with training, validation, inference, and export tooling, and reuses shared utilities from the ultralytics package.

Find detailed guidance in the Ultralytics YOLOv3 Docs. Get support via GitHub Issues, and join the conversation on Discord, Reddit, and the Ultralytics Forums.

For commercial use, request an Enterprise License at Ultralytics Licensing.

Ultralytics GitHub space Ultralytics LinkedIn space Ultralytics Twitter space Ultralytics YouTube space Ultralytics TikTok space Ultralytics BiliBili space Ultralytics Discord

📚 Documentation

See the Ultralytics YOLOv3 Docs for full documentation. The quickstart examples below cover installation, inference, and training with this repository.

Install

Clone the repository and install the dependencies from requirements.txt in a Python>=3.8.0 environment with PyTorch>=1.8.

# Clone the YOLOv3 repository
git clone https://github.com/ultralytics/yolov3

# Navigate to the cloned directory
cd yolov3

# Install required packages
pip install -r requirements.txt
Inference with PyTorch Hub

Load YOLOv3 directly through PyTorch Hub. Weights download automatically on first use.

import torch

# Load a YOLOv3 model (choices: 'yolov3', 'yolov3_spp', 'yolov3_tiny')
model = torch.hub.load("ultralytics/yolov3", "yolov3", pretrained=True)

# Run inference on an image (local file, URL, PIL image, OpenCV frame, or numpy array)
results = model("https://ultralytics.com/images/zidane.jpg")

# Inspect the results
results.print()  # print detections to the console
results.show()  # display the annotated image
results.save()  # save the annotated image to runs/detect/exp
Inference with detect.py

detect.py runs inference on a wide range of sources, downloading models automatically and saving results to runs/detect.

python detect.py --weights yolov3.pt --source 0                              # webcam
python detect.py --weights yolov3.pt --source img.jpg                        # image
python detect.py --weights yolov3.pt --source vid.mp4                        # video
python detect.py --weights yolov3.pt --source screen                         # screenshot
python detect.py --weights yolov3.pt --source path/                          # directory
python detect.py --weights yolov3.pt --source 'path/*.jpg'                   # glob
python detect.py --weights yolov3.pt --source 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream
Training

Train YOLOv3 on the COCO dataset. Models and datasets download automatically. Use the largest --batch-size your hardware allows.

# Train YOLOv3-tiny
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov3-tiny.yaml --batch-size 64

# Train YOLOv3
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov3.yaml --batch-size 32

# Train YOLOv3-SPP
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov3-spp.yaml --batch-size 16

Validate accuracy with python val.py --weights yolov3.pt --data coco.yaml, and export to other formats (TorchScript, ONNX, OpenVINO, TensorRT, CoreML, and PaddlePaddle) with python export.py --weights yolov3.pt --include onnx.

Tutorials

These guides cover the shared Ultralytics training framework and apply to YOLOv3:

🧠 Architecture

YOLOv3 builds detection on a few core ideas that make it both accurate and fast:

The repository ships three variants of this architecture:

Models are defined declaratively in models/*.yaml and built by parse_model() in models/yolo.py, so the architecture can be inspected and modified without writing Python.

🏋️ Pretrained Checkpoints

All three models are trained on COCO (80 classes) and download automatically from the YOLOv3 release assets on first use.

Model Description
yolov3-tiny.pt Lightweight two-scale model — the fastest option, ideal for CPU and edge devices.
yolov3.pt The original Darknet-53 model — a strong balance of speed and accuracy.
yolov3-spp.pt Adds Spatial Pyramid Pooling for a larger receptive field and improved accuracy.

🧩 Integrations

Ultralytics integrates with leading AI platforms to extend dataset labeling, training, visualization, and model management. Explore how partners such as Weights & Biases, Comet ML, Roboflow, and Intel OpenVINO can streamline your workflow at Ultralytics Integrations.

Ultralytics active learning integrations

🤔 Why YOLOv3?

YOLOv3 was a landmark in real-time object detection and remains a dependable, well-understood baseline:

For the broader family of Ultralytics YOLO models, see the Ultralytics repository.

☁️ Environments

Get started quickly with pre-configured environments. Click an icon below for setup details.

Run on Gradient Open In Colab Open In Kaggle Docker Image AWS Marketplace GCP Quickstart

🤝 Contribute

Contributions are welcome! Please see the Contributing Guide to get started, and share your feedback through the Ultralytics Survey. Thank you to all our contributors!

Ultralytics open-source contributors

📜 License

Ultralytics offers two licensing options:

📧 Contact

For bug reports and feature requests, please use GitHub Issues. For questions and discussion, join our Discord, Reddit, and the Ultralytics Forums.


Ultralytics GitHub space Ultralytics LinkedIn space Ultralytics Twitter space Ultralytics YouTube space Ultralytics TikTok space Ultralytics BiliBili space Ultralytics Discord

yolov3 (ultralytics/yolov3)

Searching Database…

10.6K ·GitHub
这是做什么的?这是 Ultralytics 用 PyTorch 实现的 YOLOv3 实时目标检测器,包含三个模型版本——YOLOv3、YOLOv3-SPP 和 YOLOv3-tiny,并配有训练、验证、推理以及多种格式导出的工具。
这是一个我要导入的库,还是一套要运行的脚本?两者都是。你可以在代码里通过 PyTorch Hub 加载模型,也可以在命令行运行自带的脚本:detect.py 用于推理,还有 train.py、val.py 和 export.py。
怎么把它跑起来?克隆这个仓库,在 Python>=3.8.0、PyTorch>=1.8 的环境里安装 requirements.txt 中的依赖,然后运行脚本或者通过 PyTorch Hub 加载模型。
用之前需要装好哪些东西?只需要 Python 3.8+ 和 PyTorch 1.8+,其余依赖都来自 requirements.txt,预训练权重和数据集会自动下载——不需要 API 密钥或注册账号。
YOLOv3 现在还是我该用的模型吗?它提供的是经典且成熟易懂的 YOLOv3 架构——一个可靠的基线,但如果你想用 Ultralytics 更全面、更新的 YOLO 系列,应该改用 Ultralytics 的主仓库。
它能在我的 Windows 电脑上运行吗,还是只支持 Linux?它就是普通的 Python 和 PyTorch 程序,所以在 Linux、macOS 和 Windows 上都能运行。
所有东西都能在我自己的电脑上本地运行吗?可以——这是一个本地的 Python/PyTorch 代码库,没有任何云端部分;训练和推理都在你自己的机器上进行。
我可以把它用在商业产品里吗?默认许可证下不行:AGPL-3.0 面向的是研究和协作用途。商业使用需要向 Ultralytics 购买付费的企业许可证(Enterprise License)。
YOLOv3、YOLOv3-SPP 和 YOLOv3-tiny 有什么区别?YOLOv3 是完整的 Darknet-53 模型,速度和精度平衡最好。YOLOv3-SPP 增加了一个空间金字塔池化(Spatial Pyramid Pooling)模块,感受野更大,精度也有小幅提升。YOLOv3-tiny 是一个紧凑的双尺度模型,速度最快,专门针对 CPU 和边缘设备优化。
开箱即用它能检测什么?自带的预训练模型是在 COCO 数据集上训练的,包含 80 个类别,所以不用你自己做任何训练,它就能直接识别这些物体。
我可以用自己的数据集训练它吗?可以——Train Custom Data 指南会一步步带你操作,而且这套共用的 Ultralytics 训练框架还支持多 GPU 训练、自动超参数调优、测试时增强、模型集成以及冻结层的迁移学习。
训练好的模型可以导出成哪些格式来部署?export.py 支持导出为 TorchScript、ONNX、OpenVINO、TensorRT、CoreML 和 PaddlePaddle,例如:python export.py --weights yolov3.pt --include onnx。
Size
11.1 MB
Stars
10.6K
Age
8y
Commits · 90 Days