YOLOv3 in PyTorch > ONNX > CoreML > TFLite
bash
# Install the ultralytics package
pip install ultralytics
See the Ultralytics Docs for YOLOv3 for full documentation on training, testing, and deployment using the Ultralytics framework. While YOLOv3-specific documentation may be limited, the general YOLO principles apply. Below are quickstart examples adapted for YOLOv3 concepts.
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).bash
# 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
yolov3.pt
, yolov3-spp.pt
, yolov3-tiny.pt
can be loaded.python
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
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
.bash
# 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'
--batch-size
your hardware allows.bash
# 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
Ultralytics offers robust integrations with leading AI platforms to enhance your workflow, including 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 projects. Explore more at Ultralytics 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. |
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 advanced tools and user-friendly Ultralytics App. Start your journey for Free today!
YOLOv3 marked a major leap forward in real-time object detection at its release. Key advantages include:
While newer models like YOLOv5 and YOLO11 offer further advancements, YOLOv3 remains a reliable and widely adopted baseline, efficiently implemented in PyTorch by Ultralytics.
Get started quickly with our pre-configured environments. Click the icons below for setup details.
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 provides two licensing options to meet different needs:
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!