YOLOv5 - Object Detection¶
YOLOv5 is a widely-used object detection model developed by Ultralytics, known for its balance of speed and accuracy. It remains popular for production deployments.
Overview¶
YOLOv5 for object detection features:
- Mature and stable - Well-tested in production environments
- Efficient architecture - Good balance of speed and accuracy
- Multiple model sizes - From nano to extra-large variants
- Wide adoption - Extensive community support and resources
License¶
AGPL-3.0
Commercial Licensing
- AGPL-3.0: Free for open-source projects. Requires derivative works to be open-sourced.
- Paid Roboflow customers: Automatically get access to use any YOLOv5 models trained on or uploaded to the Roboflow platform for commercial use.
- Free Roboflow customers: Can use YOLOv5 via the serverless hosted API, or commercially self-hosted with a paid plan.
Learn more: Roboflow Licensing | YOLOv5 License Details
Pre-trained Model IDs¶
No pre-trained model aliases are available. Train custom models on Roboflow.
Supported Backends¶
| Backend | Extras Required |
|---|---|
onnx |
onnx-cpu, onnx-cu12, onnx-cu118, onnx-jp6-cu126 |
Roboflow Platform Compatibility¶
| Feature | Supported |
|---|---|
| Training | ❌ Not available for training |
| Upload Weights | ✅ Upload pre-trained weights (guide) |
| Serverless API (v2) | ✅ Deploy via hosted API |
| Workflows | ✅ Use in Workflows via Object Detection block |
| Edge Deployment (Jetson) | ✅ Deploy on NVIDIA Jetson devices |
| Self-Hosting | ✅ Deploy with inference-models |
Custom model ID format: project-url/version (e.g., my-project-abc123/2)
Installation¶
Install with one of the following extras:
- ONNX:
onnx-cpu,onnx-cu12
Usage Example¶
import cv2
import supervision as sv
from inference_models import AutoModel
# Load model and image
model = AutoModel.from_pretrained("my-project-abc123/2", api_key="your_roboflow_api_key")
image = cv2.imread("path/to/image.jpg")
# Run inference and convert to supervision Detections
predictions = model(image)
detections = predictions[0].to_supervision()
# Annotate image
bounding_box_annotator = sv.BoxAnnotator()
annotated_image = bounding_box_annotator.annotate(image, detections)
# Save or display
cv2.imwrite("annotated.jpg", annotated_image)