Skip to content

ultralytics/yolov3

Ultralytics YOLOv3 banner

δΈ­ζ–‡ | ν•œκ΅­μ–΄ | ζ—₯本θͺž | Русский | Deutsch | FranΓ§ais | EspaΓ±ol | PortuguΓͺs | TΓΌrkΓ§e | TiαΊΏng Việt | Ψ§Ω„ΨΉΨ±Ψ¨ΩŠΨ©

YOLOv3 CI YOLOv3 Citation Docker Pulls Discord Ultralytics Forums Ultralytics Reddit
Run on Gradient Open In Colab Open In Kaggle

Ultralytics YOLOv3 is a robust and efficient computer vision model developed by Ultralytics. Based on the PyTorch framework, this implementation builds upon the original YOLOv3 architecture, known for its significant improvements in object detection speed and accuracy compared to its predecessors. It incorporates insights and best practices from extensive research and development, making it a reliable choice for various vision AI tasks.

We hope the resources here help you get the most out of YOLOv3. Please browse the Ultralytics Docs for detailed information (note: specific YOLOv3 docs may be limited, refer to general YOLO principles), raise an issue on GitHub for support, and join our Discord community for questions and discussions!

To request an Enterprise License, please complete the form at Ultralytics Licensing.

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

πŸš€ YOLO11: The Next Evolution

We are excited to announce the launch of Ultralytics YOLO11 πŸš€, the latest advancement in our state-of-the-art (SOTA) vision models! Available now at the Ultralytics YOLO GitHub repository, YOLO11 builds on our legacy of speed, precision, and ease of use. Whether you're tackling object detection, instance segmentation, pose estimation, image classification, or oriented object detection (OBB), YOLO11 delivers the performance and versatility needed to excel in diverse applications.

Get started today and unlock the full potential of YOLO11! Visit the Ultralytics Docs for comprehensive guides and resources:

PyPI version Downloads

# Install the ultralytics package
pip install ultralytics

πŸ“š Documentation

See the Ultralytics Docs for full documentation on training, testing, and deployment using the Ultralytics framework. While specific YOLOv3 documentation might be limited, the general principles apply. See below for quickstart examples adapted for YOLOv3 concepts.

Install

Clone the repository and install dependencies from requirements.txt in a Python>=3.8.0 environment. Ensure you have PyTorch>=1.8 installed. (Note: This repo is originally YOLOv5, dependencies should be compatible but tailored testing for YOLOv3 is recommended).

# 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

Use YOLOv3 via PyTorch Hub for inference. Models like yolov3.pt, yolov3-spp.pt, yolov3-tiny.pt can be loaded.

import torch

# Load a YOLOv3 model (e.g., yolov3, yolov3-spp)
model = torch.hub.load("ultralytics/yolov3", "yolov3", pretrained=True)  # specify 'yolov3' or other variants

# Define the input image source (URL, local file, PIL image, OpenCV frame, numpy array, or list)
img = "https://ultralytics.com/images/zidane.jpg"  # Example image

# Perform inference
results = model(img)

# Process the results (options: .print(), .show(), .save(), .crop(), .pandas())
results.print()  # Print results to console
results.show()  # Display results in a window
results.save()  # Save results to runs/detect/exp
Inference with detect.py

The detect.py script runs inference on various sources. Use --weights yolov3.pt or other YOLOv3 variants. It automatically downloads models and saves results to runs/detect.

# Run inference using a webcam with yolov3-tiny
python detect.py --weights yolov3-tiny.pt --source 0

# Run inference on a local image file with yolov3
python detect.py --weights yolov3.pt --source img.jpg

# Run inference on a local video file with yolov3-spp
python detect.py --weights yolov3-spp.pt --source vid.mp4

# Run inference on a screen capture
python detect.py --weights yolov3.pt --source screen

# Run inference on a directory of images
python detect.py --weights yolov3.pt --source path/to/images/

# Run inference on a text file listing image paths
python detect.py --weights yolov3.pt --source list.txt

# Run inference on a text file listing stream URLs
python detect.py --weights yolov3.pt --source list.streams

# Run inference using a glob pattern for images
python detect.py --weights yolov3.pt --source 'path/to/*.jpg'

# Run inference on a YouTube video URL
python detect.py --weights yolov3.pt --source 'https://youtu.be/LNwODJXcvt4'

# Run inference on an RTSP, RTMP, or HTTP stream
python detect.py --weights yolov3.pt --source 'rtsp://example.com/media.mp4'
Training

The commands below show how to train YOLOv3 models on the COCO dataset. Models and datasets are downloaded automatically. Use the largest --batch-size your hardware allows.

# Train YOLOv3-tiny on COCO for 300 epochs (example settings)
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov3-tiny.yaml --batch-size 64

# Train YOLOv3 on COCO for 300 epochs (example settings)
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov3.yaml --batch-size 32

# Train YOLOv3-SPP on COCO for 300 epochs (example settings)
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov3-spp.yaml --batch-size 16
Tutorials

Note: These tutorials primarily use YOLOv5 examples but the principles often apply to YOLOv3 within the Ultralytics framework.

🧩 Integrations

Our key integrations with leading AI platforms extend the functionality of Ultralytics' offerings, enhancing tasks like dataset labeling, training, visualization, and model management. Discover how Ultralytics, in collaboration with partners like Weights & Biases, Comet ML, Roboflow, and Intel OpenVINO, can optimize your AI workflow. Explore more at Ultralytics Integrations.

Ultralytics active learning integrations

Ultralytics HUB 🌟 Weights & Biases Comet Neural Magic
Streamline YOLO workflows: Label, train, and deploy effortlessly with Ultralytics HUB. Try now! Track experiments, hyperparameters, and results with Weights & Biases. Free forever, Comet ML lets you save YOLO models, resume training, and interactively visualize predictions. Run YOLO inference up to 6x faster with Neural Magic DeepSparse.

⭐ Ultralytics HUB

Experience seamless AI development with Ultralytics HUB ⭐, the ultimate platform for building, training, and deploying computer vision models. Visualize datasets, train YOLOv3, YOLOv5 and YOLOv8 πŸš€ models, and deploy them to real-world applications without writing any code. Transform images into actionable insights using our cutting-edge tools and user-friendly Ultralytics App. Start your journey for Free today!

Ultralytics HUB Platform Screenshot

πŸ€” Why YOLOv3?

YOLOv3 represented a significant step forward in real-time object detection upon its release. Key advantages include:

  • Improved Accuracy: Better detection of small objects compared to YOLOv2.
  • Multi-Scale Predictions: Detects objects at three different scales, enhancing performance across various object sizes.
  • Class Prediction: Uses logistic classifiers for predicting object classes instead of softmax, allowing for multi-label classification.
  • Feature Extractor: Utilizes a deeper network (Darknet-53) compared to Darknet-19 used in YOLOv2.

While newer models like YOLOv5 and YOLO11 offer further improvements, YOLOv3 remains a solid and widely understood baseline implemented efficiently in PyTorch by Ultralytics.

☁️ Environments

Get started quickly with our pre-configured environments. Click the icons below for setup details.

🀝 Contribute

We welcome your contributions! Making YOLO models accessible and effective is a community effort. Please see our Contributing Guide to get started. Share your feedback through the Ultralytics Survey. Thank you to all our contributors for making Ultralytics YOLO better!

Ultralytics open-source contributors

πŸ“œ License

Ultralytics provides two licensing options to meet different needs:

  • AGPL-3.0 License: An OSI-approved open-source license ideal for academic research, personal projects, and testing. It promotes open collaboration and knowledge sharing. See the LICENSE file for details.
  • Enterprise License: Tailored for commercial applications, this license allows seamless integration of Ultralytics software and AI models into commercial products and services, bypassing the open-source requirements of AGPL-3.0. For commercial use cases, please contact us via Ultralytics Licensing.

πŸ“§ Contact

For bug reports and feature requests related to Ultralytics YOLO implementations, please visit GitHub Issues. For general questions, discussions, and community support, join our Discord server!


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