1. Project Overview & Quickstart (ultralytics/yolov5)
File: README.md
Ultralytics YOLOv5 ๐ is a fast, accurate, and easy-to-use computer vision model developed by Ultralytics. Based on the PyTorch framework, YOLOv5 is renowned for its speed, accuracy, and simplicity. It incorporates insights and best practices from extensive research and development, making it a popular and reliable choice for a wide range of vision AI tasks, including object detection, image segmentation, and image classification.
We hope the resources here help you get the most out of YOLOv5. Please browse the YOLOv5 Docs for detailed information, 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.
๐ Explore the Ultralytics YOLO Ecosystem
YOLOv5 is a mature, production-proven model that remains an excellent choice for fast and reliable object detection, instance segmentation, and image classification. If your project calls for the newest architectures, additional tasks such as pose estimation and oriented object detection (OBB), or a unified Python and CLI interface, the actively maintained ultralytics package brings the latest Ultralytics YOLO models together in one place. Explore the Ultralytics Docs to find the best fit for your use case.
# Install the ultralytics package for the latest Ultralytics YOLO models
pip install ultralytics๐ Documentation
See the YOLOv5 Docs for full documentation on training, testing, and deployment. See below for quickstart examples.
Install
Clone the repository and install dependencies in a Python>=3.8.0 environment. Ensure you have PyTorch>=1.8 installed.
# Clone the YOLOv5 repository
git clone https://github.com/ultralytics/yolov5
# Navigate to the cloned directory
cd yolov5
# Install required packages
pip install -r requirements.txtInference with PyTorch Hub
Use YOLOv5 via PyTorch Hub for inference. Models are automatically downloaded from the latest YOLOv5 release.
import torch
# Load a YOLOv5 model (options: yolov5n, yolov5s, yolov5m, yolov5l, yolov5x)
model = torch.hub.load("ultralytics/yolov5", "yolov5s") # Default: yolov5s
# 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 (handles batching, resizing, normalization automatically)
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/expInference with detect.py
The detect.py script runs inference on various sources. It automatically downloads models from the latest YOLOv5 release and saves the results to the runs/detect directory.
# Run inference using a webcam
python detect.py --weights yolov5s.pt --source 0
# Run inference on a local image file
python detect.py --weights yolov5s.pt --source img.jpg
# Run inference on a local video file
python detect.py --weights yolov5s.pt --source vid.mp4
# Run inference on a screen capture
python detect.py --weights yolov5s.pt --source screen
# Run inference on a directory of images
python detect.py --weights yolov5s.pt --source path/to/images/
# Run inference on a text file listing image paths
python detect.py --weights yolov5s.pt --source list.txt
# Run inference on a text file listing stream URLs
python detect.py --weights yolov5s.pt --source list.streams
# Run inference using a glob pattern for images
python detect.py --weights yolov5s.pt --source 'path/to/*.jpg'
# Run inference on a YouTube video URL
python detect.py --weights yolov5s.pt --source 'https://youtu.be/LNwODJXcvt4'
# Run inference on an RTSP, RTMP, or HTTP stream
python detect.py --weights yolov5s.pt --source 'rtsp://example.com/media.mp4'Training
The commands below demonstrate how to reproduce YOLOv5 COCO dataset results. Both models and datasets are downloaded automatically from the latest YOLOv5 release. Training times for YOLOv5n/s/m/l/x are approximately 1/2/4/6/8 days on a single NVIDIA V100 GPU. Using Multi-GPU training can significantly reduce training time. Use the largest --batch-size your hardware allows, or use --batch-size -1 for YOLOv5 AutoBatch. The batch sizes shown below are for V100-16GB GPUs.
# Train YOLOv5n on COCO for 300 epochs
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5n.yaml --batch-size 128
# Train YOLOv5s on COCO for 300 epochs
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5s.yaml --batch-size 64
# Train YOLOv5m on COCO for 300 epochs
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5m.yaml --batch-size 40
# Train YOLOv5l on COCO for 300 epochs
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5l.yaml --batch-size 24
# Train YOLOv5x on COCO for 300 epochs
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5x.yaml --batch-size 16Tutorials
- Train Custom Data ๐ RECOMMENDED: Learn how to train YOLOv5 on your own datasets.
- Tips for Best Training Results โ๏ธ: Improve your model's performance with expert tips.
- Multi-GPU Training: Speed up training using multiple GPUs.
- PyTorch Hub Integration: Easily load models using PyTorch Hub.
- Model Export (TFLite, ONNX, CoreML, TensorRT) ๐: Convert your models to various deployment formats like ONNX or TensorRT.
- NVIDIA Jetson Deployment: Deploy YOLOv5 on NVIDIA Jetson devices.
- Test-Time Augmentation (TTA): Enhance prediction accuracy with TTA.
- Model Ensembling: Combine multiple models for better performance.
- Model Pruning/Sparsity: Optimize models for size and speed.
- Hyperparameter Evolution: Automatically find the best training hyperparameters.
- Transfer Learning with Frozen Layers: Adapt pretrained models to new tasks efficiently using transfer learning.
- Architecture Summary: Understand the YOLOv5 model architecture.
- Ultralytics Platform Training ๐ RECOMMENDED: Train and deploy YOLO models using Ultralytics Platform.
- ClearML Logging: Integrate with ClearML for experiment tracking.
- Neural Magic DeepSparse Integration: Accelerate inference with DeepSparse.
- Comet Logging: Log experiments using Comet ML.
๐งฉ 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.
๐ค Why YOLOv5?
YOLOv5 is designed for simplicity and ease of use. We prioritize real-world performance and accessibility.
YOLOv5-P5 640 Figure
Figure Notes
- COCO AP val denotes the mean Average Precision (mAP) at Intersection over Union (IoU) thresholds from 0.5 to 0.95, measured on the 5,000-image COCO val2017 dataset across various inference sizes (256 to 1536 pixels).
- GPU Speed measures the average inference time per image on the COCO val2017 dataset using an AWS p3.2xlarge V100 instance with a batch size of 32.
- EfficientDet data is sourced from the google/automl repository at batch size 8.
- Reproduce these results using the command:
python val.py --task study --data coco.yaml --iou 0.7 --weights yolov5n6.pt yolov5s6.pt yolov5m6.pt yolov5l6.pt yolov5x6.pt
Pretrained Checkpoints
This table shows the performance metrics for various YOLOv5 models trained on the COCO dataset.
| Model | Size(pixels) | mAPval50-95 | mAPval50 | SpeedCPU b1(ms) | SpeedV100 b1(ms) | SpeedV100 b32(ms) | Params(M) | FLOPs@640 (B) |
|---|---|---|---|---|---|---|---|---|
| YOLOv5n | 640 | 28.0 | 45.7 | 45 | 6.3 | 0.6 | 1.9 | 4.5 |
| YOLOv5s | 640 | 37.4 | 56.8 | 98 | 6.4 | 0.9 | 7.2 | 16.5 |
| YOLOv5m | 640 | 45.4 | 64.1 | 224 | 8.2 | 1.7 | 21.2 | 49.0 |
| YOLOv5l | 640 | 49.0 | 67.3 | 430 | 10.1 | 2.7 | 46.5 | 109.1 |
| YOLOv5x | 640 | 50.7 | 68.9 | 766 | 12.1 | 4.8 | 86.7 | 205.7 |
| YOLOv5n6 | 1280 | 36.0 | 54.4 | 153 | 8.1 | 2.1 | 3.2 | 4.6 |
| YOLOv5s6 | 1280 | 44.8 | 63.7 | 385 | 8.2 | 3.6 | 12.6 | 16.8 |
| YOLOv5m6 | 1280 | 51.3 | 69.3 | 887 | 11.1 | 6.8 | 35.7 | 50.0 |
| YOLOv5l6 | 1280 | 53.7 | 71.3 | 1784 | 15.8 | 10.5 | 76.8 | 111.4 |
| YOLOv5x6+ [TTA] | 12801536 | 55.055.8 | 72.772.7 | 3136- | 26.2- | 19.4- | 140.7- | 209.8- |
Table Notes
- The 640-pixel rows report the legacy anchor-based YOLOv5 checkpoints, while their links open the corresponding anchor-free YOLOv5u successor models on Ultralytics Platform. P6 links continue to download the legacy 1280-pixel checkpoints directly.
- All checkpoints were trained for 300 epochs using default settings. Nano (n) and Small (s) models use hyp.scratch-low.yaml hyperparameters, while Medium (m), Large (l), and Extra-Large (x) models use hyp.scratch-high.yaml.
- mAPval values represent single-model, single-scale performance on the COCO val2017 dataset.Reproduce using:
python val.py --data coco.yaml --img 640 --conf 0.001 --iou 0.65 - Speed metrics are averaged over COCO val images using an AWS p3.2xlarge V100 instance. Non-Maximum Suppression (NMS) time (~1 ms/image) is not included.Reproduce using:
python val.py --data coco.yaml --img 640 --task speed --batch 1 - TTA (Test Time Augmentation) includes reflection and scale augmentations for improved accuracy.Reproduce using:
python val.py --data coco.yaml --img 1536 --iou 0.7 --augment
๐ผ๏ธ Segmentation
The YOLOv5 release v7.0 introduced instance segmentation models designed for easy training, validation, and deployment. For full details, see the Release Notes and explore the YOLOv5 Segmentation Colab Notebook for quickstart examples.
Segmentation Checkpoints
YOLOv5 segmentation models were trained on the COCO dataset for 300 epochs at an image size of 640 pixels using A100 GPUs. Models were exported to ONNX FP32 for CPU speed tests and TensorRT FP16 for GPU speed tests. All speed tests were conducted on Google Colab Pro notebooks for reproducibility.
| Model | Size(pixels) | mAPbox50-95 | mAPmask50-95 | Train Time300 epochsA100 (hours) | SpeedONNX CPU(ms) | SpeedTRT A100(ms) | Params(M) | FLOPs@640 (B) |
|---|---|---|---|---|---|---|---|---|
| YOLOv5n-seg | 640 | 27.6 | 23.4 | 80:17 | 62.7 | 1.2 | 2.0 | 7.1 |
| YOLOv5s-seg | 640 | 37.6 | 31.7 | 88:16 | 173.3 | 1.4 | 7.6 | 26.4 |
| YOLOv5m-seg | 640 | 45.0 | 37.1 | 108:36 | 427.0 | 2.2 | 22.0 | 70.8 |
| YOLOv5l-seg | 640 | 49.0 | 39.9 | 66:43 (2x) | 857.4 | 2.9 | 47.9 | 147.7 |
| YOLOv5x-seg | 640 | 50.7 | 41.4 | 62:56 (3x) | 1579.2 | 4.5 | 88.8 | 265.7 |
All checkpoints were trained for 300 epochs using the SGD optimizer with
lr0=0.01andweight_decay=5e-5at an image size of 640 pixels, using default settings.Training runs are logged at https://wandb.ai/glenn-jocher/YOLOv5_v70_official.Accuracy values represent single-model, single-scale performance on the COCO dataset.Reproduce using:
python segment/val.py --data coco.yaml --weights yolov5s-seg.ptSpeed metrics are averaged over 100 inference images using a Colab Pro A100 High-RAM instance. Values indicate inference speed only (NMS adds approximately 1ms per image).Reproduce using:
python segment/val.py --data coco.yaml --weights yolov5s-seg.pt --batch 1Export to ONNX (FP32) and TensorRT (FP16) was performed using
export.py.Reproduce using:python export.py --weights yolov5s-seg.pt --include engine --device 0 --half
Train
YOLOv5 segmentation training supports automatic download of the COCO128-seg dataset via the --data coco128-seg.yaml argument. For the full COCO-segments dataset, download it manually using bash data/scripts/get_coco.sh --train --val --segments and then train with python segment/train.py --data coco.yaml.
# Train on a single GPU
python segment/train.py --data coco128-seg.yaml --weights yolov5s-seg.pt --img 640
# Train using Multi-GPU Distributed Data Parallel (DDP)
python -m torch.distributed.run --nproc_per_node 4 --master_port 1 segment/train.py --data coco128-seg.yaml --weights yolov5s-seg.pt --img 640 --device 0,1,2,3Val
Validate the mask mean Average Precision (mAP) of YOLOv5s-seg on the COCO dataset:
# Download COCO validation segments split (780MB, 5000 images)
bash data/scripts/get_coco.sh --val --segments
# Validate the model
python segment/val.py --weights yolov5s-seg.pt --data coco.yaml --img 640Predict
Use the pretrained YOLOv5m-seg.pt model to perform segmentation on bus.jpg:
# Run prediction
python segment/predict.py --weights yolov5m-seg.pt --source data/images/bus.jpg# Load model from PyTorch Hub (Note: Inference support might vary)
model = torch.hub.load("ultralytics/yolov5", "custom", "yolov5m-seg.pt")Export
Export the YOLOv5s-seg model to ONNX and TensorRT formats:
# Export model
python export.py --weights yolov5s-seg.pt --include onnx engine --img 640 --device 0๐ท๏ธ Classification
YOLOv5 release v6.2 introduced support for image classification model training, validation, and deployment. Check the Release Notes for details and the YOLOv5 Classification Colab Notebook for quickstart guides.
Classification Checkpoints
YOLOv5-cls classification models were trained on ImageNet for 90 epochs using a 4xA100 instance. ResNet and EfficientNet models were trained alongside under identical settings for comparison. Models were exported to ONNX FP32 (CPU speed tests) and TensorRT FP16 (GPU speed tests). All speed tests were run on Google Colab Pro for reproducibility.
| Model | Size(pixels) | Acctop1 | Acctop5 | Training90 epochs4xA100 (hours) | SpeedONNX CPU(ms) | SpeedTensorRT V100(ms) | Params(M) | FLOPs@224 (B) |
|---|---|---|---|---|---|---|---|---|
| YOLOv5n-cls | 224 | 64.6 | 85.4 | 7:59 | 3.3 | 0.5 | 2.5 | 0.5 |
| YOLOv5s-cls | 224 | 71.5 | 90.2 | 8:09 | 6.6 | 0.6 | 5.4 | 1.4 |
| YOLOv5m-cls | 224 | 75.9 | 92.9 | 10:06 | 15.5 | 0.9 | 12.9 | 3.9 |
| YOLOv5l-cls | 224 | 78.0 | 94.0 | 11:56 | 26.9 | 1.4 | 26.5 | 8.5 |
| YOLOv5x-cls | 224 | 79.0 | 94.4 | 15:04 | 54.3 | 1.8 | 48.1 | 15.9 |
| ResNet18 | 224 | 70.3 | 89.5 | 6:47 | 11.2 | 0.5 | 11.7 | 3.7 |
| ResNet34 | 224 | 73.9 | 91.8 | 8:33 | 20.6 | 0.9 | 21.8 | 7.4 |
| ResNet50 | 224 | 76.8 | 93.4 | 11:10 | 23.4 | 1.0 | 25.6 | 8.5 |
| ResNet101 | 224 | 78.5 | 94.3 | 17:10 | 42.1 | 1.9 | 44.5 | 15.9 |
| EfficientNet_b0 | 224 | 75.1 | 92.4 | 13:03 | 12.5 | 1.3 | 5.3 | 1.0 |
| EfficientNet_b1 | 224 | 76.4 | 93.2 | 17:04 | 14.9 | 1.6 | 7.8 | 1.5 |
| EfficientNet_b2 | 224 | 76.6 | 93.4 | 17:10 | 15.9 | 1.6 | 9.1 | 1.7 |
| EfficientNet_b3 | 224 | 77.7 | 94.0 | 19:19 | 18.9 | 1.9 | 12.2 | 2.4 |
Table Notes (click to expand)
All checkpoints were trained for 90 epochs using the SGD optimizer with
lr0=0.001andweight_decay=5e-5at an image size of 224 pixels, using default settings.Training runs are logged at https://wandb.ai/glenn-jocher/YOLOv5-Classifier-v6-2.Accuracy values (top-1 and top-5) represent single-model, single-scale performance on the ImageNet-1k dataset.Reproduce using:
python classify/val.py --data ../datasets/imagenet --img 224Speed metrics are averaged over 100 inference images using a Google Colab Pro V100 High-RAM instance.Reproduce using:
python classify/val.py --data ../datasets/imagenet --img 224 --batch 1Export to ONNX (FP32) and TensorRT (FP16) was performed using
export.py.Reproduce using:python export.py --weights yolov5s-cls.pt --include engine onnx --imgsz 224
Train
YOLOv5 classification training supports automatic download for datasets like MNIST, Fashion-MNIST, CIFAR10, CIFAR100, Imagenette, Imagewoof, and ImageNet using the --data argument. For example, start training on MNIST with --data mnist.
# Train on a single GPU using CIFAR-100 dataset
python classify/train.py --model yolov5s-cls.pt --data cifar100 --epochs 5 --img 224 --batch 128
# Train using Multi-GPU DDP on ImageNet dataset
python -m torch.distributed.run --nproc_per_node 4 --master_port 1 classify/train.py --model yolov5s-cls.pt --data imagenet --epochs 5 --img 224 --device 0,1,2,3Val
Validate the accuracy of the YOLOv5m-cls model on the ImageNet-1k validation dataset:
# Download ImageNet validation split (6.3GB, 50,000 images)
bash data/scripts/get_imagenet.sh --val
# Validate the model
python classify/val.py --weights yolov5m-cls.pt --data ../datasets/imagenet --img 224Predict
Use the pretrained YOLOv5s-cls.pt model to classify the image bus.jpg:
# Run prediction
python classify/predict.py --weights yolov5s-cls.pt --source data/images/bus.jpg# Load model from PyTorch Hub
model = torch.hub.load("ultralytics/yolov5", "custom", "yolov5s-cls.pt")Export
Export trained YOLOv5s-cls, ResNet50, and EfficientNet_b0 models to ONNX and TensorRT formats:
# Export models
python export.py --weights yolov5s-cls.pt resnet50.pt efficientnet_b0.pt --include onnx engine --img 224โ๏ธ Environments
Get started quickly with our pre-configured environments. Click the icons below for setup details.
๐ค Contribute
We welcome your contributions! Making YOLOv5 accessible and effective is a community effort. Please see our Contributing Guide to get started. Share your feedback through the YOLOv5 Survey. Thank you to all our contributors for making YOLOv5 better!
๐ 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 YOLOv5, please visit GitHub Issues. For general questions, discussions, and community support, join our Discord server!
File: utils/flask_rest_api/README.md
Flask REST API for YOLOv5
Representational State Transfer (REST) Application Programming Interfaces (APIs) provide a standardized way to expose Machine Learning (ML) models for use by other services or applications. This directory contains an example REST API built with the Flask web framework to serve the Ultralytics YOLOv5s model, loaded directly from PyTorch Hub. This setup allows you to easily integrate YOLOv5 object detection capabilities into your web applications or microservices, aligning with common model deployment options.
๐ป Requirements
The primary requirement is the Flask web framework. You can install it using pip:
pip install FlaskYou will also need torch and yolov5. These are implicitly handled by the script when it loads the model from PyTorch Hub. Ensure you have a functioning Python environment set up.
โถ๏ธ Run the API
Once Flask is installed, you can start the API server using the following command:
python restapi.py --port 5000The server will begin listening on the specified port (defaulting to 5000). You can then send inference requests to the API endpoint using tools like curl or any other HTTP client.
To test the API with a local image file (e.g., zidane.jpg located in the yolov5/data/images directory, which is ../../data/images/zidane.jpg relative to the script):
curl -X POST -F image=@../../data/images/zidane.jpg 'http://localhost:5000/v1/object-detection/yolov5s'The API processes the submitted image using the YOLOv5s model and returns the detection results in JSON format. Each object within the JSON array represents a detected item, including its pixel bounding box coordinates (xmin, ymin, xmax, ymax), confidence score, class ID, and class name.
[
{
"xmin": 749.5,
"ymin": 43.5,
"xmax": 1148.0,
"ymax": 704.5,
"confidence": 0.8900438547,
"class": 0,
"name": "person"
},
{
"xmin": 113.5,
"ymin": 196.0,
"xmax": 1093.0,
"ymax": 711.0,
"confidence": 0.8440024257,
"class": 0,
"name": "person"
},
{
"xmin": 437.5,
"ymin": 433.5,
"xmax": 529.5,
"ymax": 717.5,
"confidence": 0.3771208823,
"class": 27,
"name": "tie"
},
{
"xmin": 1090.0,
"ymin": 312.0,
"xmax": 1135.0,
"ymax": 410.0,
"confidence": 0.3527112305,
"class": 27,
"name": "tie"
}
]An example Python script, example_request.py, is included to demonstrate how to perform inference using the popular requests library. This script offers a straightforward method for interacting with the running API programmatically.
To require authentication, set API_KEY when starting the server and include it in each request:
API_KEY=mysecretkey python restapi.py --port 5000
curl -H 'X-API-Key: mysecretkey' -F image=@../../data/images/zidane.jpg 'http://localhost:5000/v1/object-detection/yolov5s'๐ค Contribute
Contributions to enhance this Flask API example are highly encouraged! Whether you're interested in adding support for different YOLO models, improving error handling, or implementing new features, please feel free to fork the repository, apply your changes, and submit a pull request. For more comprehensive contribution guidelines, please refer to the main Ultralytics YOLOv5 repository and the general Ultralytics documentation.
File: utils/loggers/clearml/README.md
ClearML Integration with Ultralytics YOLO
โน๏ธ About ClearML
ClearML is an open-source MLOps platform. Integrating it with Ultralytics YOLO provides experiment tracking, data management, and remote execution:
- Experiment Management: Track every YOLO training run, including parameters, metrics, and outputs. Explore the Ultralytics ClearML integration guide for step-by-step instructions.
- Data Versioning: Manage and access your custom training data with ClearML's Data Versioning Tool, similar to DVC integration.
- Remote Execution: Remotely train and monitor models using ClearML Agent for seamless scaling.
- Hyperparameter Optimization: Boost your mean average precision (mAP) with ClearML's hyperparameter tuning capabilities.
- Model Deployment: Deploy your trained YOLO model as an API with ClearML Serving, complementing Ultralytics model deployment options.
You can use ClearML's experiment manager alone or combine these features into a comprehensive MLOps pipeline.
๐ฆพ Setting Up ClearML
ClearML requires a server to track experiments and data. You have two main options:
- ClearML Hosted Service: Sign up for a free account at app.clear.ml.
- Self-Hosted Server: Deploy your own ClearML server using the official setup guide. The server is open-source, ensuring data privacy and control.
To get started:
Install the ClearML Python package:
bashpip install clearmlNote: The
clearmlpackage is listed (commented out) inrequirements.txtand is not installed by default โ install it with the command above.Connect the ClearML SDK to your server:
Create credentials (Settings โ Workspace โ Create new credentials), then run:bashclearml-initFollow the prompts to complete setup.
For a general Ultralytics setup, see the Quickstart Guide.
๐ Training YOLO with ClearML
When the clearml package is installed, experiment tracking is automatically enabled for every YOLO training run. All experiment details are captured and stored in the ClearML experiment manager.
To customize your project or task name in ClearML, use the --project and --name arguments. By default, the project is YOLOv5 and the task is Training. ClearML uses / as a delimiter for subprojects.
Example Training Command:
# Train YOLO on COCO128 dataset for 3 epochs
python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --cacheExample with Custom Project and Task Names:
# Train with custom project and experiment names
python train.py --project my_yolo_project --name experiment_001 --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --cacheClearML automatically logs:
- Source code and uncommitted changes
- Installed Python packages
- Hyperparameters and configuration settings
- Model checkpoints (use
--save-period nto save everynepochs) - Console output logs
- Performance metrics (precision, recall, losses, learning rates, mAP0.5, mAP0.5:0.95)
- System details (hardware specs, runtime, creation date)
- Generated plots (label correlogram, confusion matrix)
- Images with bounding boxes per epoch
- Mosaic augmentation previews per epoch
- Validation images per epoch
All this information can be visualized in the ClearML UI. You can customize table views, sort experiments by metrics, and compare multiple runs. This enables advanced features like hyperparameter optimization and remote execution.
๐ Dataset Version Management
Versioning your datasets independently from code is essential for reproducibility and collaboration. ClearML's Data Versioning Tool streamlines this process. YOLO supports ClearML dataset version IDs, automatically downloading data as needed. The dataset ID is saved as a task parameter, ensuring traceability for every experiment.
Prepare Your Dataset
YOLO uses YAML files to define dataset configurations. By default, datasets are expected in the ../datasets directory relative to the repository root. For example, the COCO128 dataset structure:
../
โโโ yolov5/ # Your YOLO repository clone
โโโ datasets/
โโโ coco128/
โโโ images/
โโโ labels/
โโโ LICENSE
โโโ README.txtEnsure your custom dataset follows a similar structure.
Next, โ ๏ธ copy the corresponding dataset .yaml file into the root of your dataset folder. This file contains essential information (path, train, test, val, nc, names) required by ClearML.
../
โโโ datasets/
โโโ coco128/
โโโ images/
โโโ labels/
โโโ coco128.yaml # <---- Place the YAML file here!
โโโ LICENSE
โโโ README.txtUpload Your Dataset
Navigate to your dataset's root directory and use the clearml-data CLI tool:
cd ../datasets/coco128
clearml-data sync --project YOLO_Datasets --name coco128 --folder .Alternatively, use the following commands:
# Create a new dataset entry in ClearML
clearml-data create --project YOLO_Datasets --name coco128
# Add the dataset files (use '.' for the current directory)
clearml-data add --files .
# Finalize and upload the dataset version
clearml-data closeTip: Use --parent with clearml-data create to link versions and avoid re-uploading unchanged files.
Run Training Using a ClearML Dataset
Once your dataset is versioned in ClearML, you can use it for training by providing the dataset ID via the --data argument with the clearml:// prefix:
# Replace YOUR_DATASET_ID with the actual ID from ClearML
python train.py --img 640 --batch 16 --epochs 3 --data clearml://YOUR_DATASET_ID --weights yolov5s.pt --cache๐ Hyperparameter Optimization
With experiments and data versioned, you can leverage ClearML for hyperparameter optimization. ClearML captures all necessary information (code, packages, environment), making experiments fully reproducible. Its HPO tools clone an existing experiment, modify hyperparameters, and rerun it automatically.
To run HPO locally, use the provided script utils/loggers/clearml/hpo.py. You'll need the ID of a previously run training task (the "template task") to clone. Update the script with this ID and run:
# Install Optuna, required by the optimizer used in the script
pip install optuna
# Run the HPO script
python utils/loggers/clearml/hpo.pyThe script uses Optuna (via OptimizerOptuna) to search the hyperparameter space, so the optuna package must be installed. To enqueue HPO tasks for a remote ClearML agent instead of running locally, replace optimizer.start_locally() with optimizer.start() in the script and provide an execution queue.
๐คฏ Remote Execution (Advanced)
ClearML Agent enables you to execute experiments on remote machines, including on-premise servers or cloud GPUs such as AWS, Google Cloud, or Azure. The agent listens to task queues, reproduces the experiment environment, runs the task, and reports results back to the ClearML server.
Learn more about ClearML Agent:
Turn any machine into a ClearML agent by running:
# Replace QUEUES_TO_LISTEN_TO with your queue name(s)
clearml-agent daemon --queue QUEUES_TO_LISTEN_TO [--docker] # Use --docker to run in a Docker containerCloning, Editing, and Enqueuing Tasks
You can manage remote execution directly from the ClearML web UI:
- Clone: Right-click an existing experiment to clone it.
- Edit: Modify hyperparameters or other settings in the cloned task.
- Enqueue: Right-click the modified task and select "Enqueue" to assign it to a specific queue for an agent to pick up.
Executing a Task Remotely via Code
You can also modify your training script to automatically enqueue tasks for remote execution. Add task.execute_remotely() after the ClearML logger is initialized in train.py:
# Inside train.py, after logger initialization...
if RANK in {-1, 0}:
# Initialize loggers
loggers = Loggers(save_dir, weights, opt, hyp, LOGGER)
# Check if ClearML logger is active and enqueue the task
if loggers.clearml:
# Specify the queue name for the remote agent
loggers.clearml.task.execute_remotely(queue_name="my_remote_queue") # <------ ADD THIS LINE
# data_dict might be populated by ClearML if using a ClearML dataset
data_dict = loggers.clearml.data_dictRunning the script with this modification will package the code and its environment and send it to the specified queue, rather than executing locally.
Autoscaling Workers
ClearML provides Autoscalers that automatically manage cloud resources (AWS, GCP, Azure). They spin up new virtual machines as ClearML agents when tasks appear in a queue, and shut them down when the queue is empty, optimizing cost.
Watch the Autoscalers getting started video:
๐ค Contributing
Contributions to enhance the ClearML integration are welcome! Please see the Ultralytics Contributing Guide for details on how to get involved.
File: utils/loggers/comet/README.md
Using Ultralytics YOLO With Comet
This guide explains how to integrate Ultralytics YOLO with Comet for monitoring training, logging results, managing datasets, and optimizing hyperparameters.
๐งช About Comet
Comet provides tools for data scientists, engineers, and teams to accelerate and optimize deep learning and machine learning models.
With Comet, you can track and visualize model metrics in real time, save hyperparameters, datasets, and model checkpoints, and visualize predictions using Custom Panels. For more details, see the Comet Documentation.
๐ Getting Started
Follow these steps to set up Comet for your YOLO projects.
Install Comet
Install the comet_ml Python package using pip:
pip install comet_mlConfigure Comet Credentials
You can configure Comet in two ways:
Environment Variables:
Set your credentials directly in your environment.shellexport COMET_API_KEY=YOUR_COMET_API_KEY export COMET_PROJECT_NAME=YOUR_COMET_PROJECT_NAME # Defaults to 'yolov5' if not setFind your API key in your Comet Account Settings.
Configuration File:
Create a.comet.configfile in your working directory:ini[comet] api_key=YOUR_COMET_API_KEY project_name=YOUR_COMET_PROJECT_NAME # Defaults to 'yolov5' if not set
Run the Training Script
Run the YOLO training script. Comet will automatically log your run.
# Train YOLO on COCO128 for 5 epochs
python train.py --img 640 --batch 16 --epochs 5 --data coco128.yaml --weights yolov5s.ptComet automatically logs hyperparameters, command-line arguments, and training/validation metrics. Visualize and analyze your runs in the Comet UI. For more details, see the Ultralytics training documentation.
โจ Try an Example!
Explore a completed YOLO training run tracked with Comet:
Run the example yourself using this Google Colab notebook:
๐ Automatic Logging
Comet automatically logs the following information by default:
Metrics
- Losses: Box Loss, Object Loss, Classification Loss (Training and Validation)
- Performance: [email protected], [email protected]:0.95 (Validation). Learn more in the YOLO Performance Metrics guide.
- Precision and Recall: Validation data metrics
Parameters
- Model Hyperparameters: Configuration used for the model
- Command Line Arguments: All arguments passed via the CLI
Visualizations
- Confusion Matrix: Model predictions on validation data (Wikipedia)
- Curves: PR and F1 curves across all classes
- Label Correlogram: Correlation visualization of class labels
โ๏ธ Advanced Configuration
Customize Comet's logging behavior using command-line flags or environment variables.
# Environment Variables for Comet Configuration
export COMET_MODE=online # 'online' or 'offline'. Default: online
export COMET_MODEL_NAME=YOUR_MODEL_NAME # Name for the saved model. Default: yolov5
export COMET_LOG_CONFUSION_MATRIX=false # Disable confusion matrix logging. Default: true
export COMET_MAX_IMAGE_UPLOADS=NUMBER # Max prediction images to log. Default: 100
export COMET_LOG_PER_CLASS_METRICS=true # Log metrics per class. Default: false
export COMET_DEFAULT_CHECKPOINT_FILENAME=checkpoint_file.pt # Checkpoint for resuming. Default: 'last.pt'
export COMET_LOG_BATCH_METRICS=true # Log training metrics per batch. Default: false
export COMET_LOG_PREDICTIONS=true # Disable prediction logging if set to false. Default: trueFor more configuration options, see the Comet documentation.
Logging Checkpoints With Comet
Model checkpoint logging to Comet is disabled by default. Enable it using the --save-period argument during training to save checkpoints at the specified epoch interval.
python train.py \
--img 640 \
--batch 16 \
--epochs 5 \
--data coco128.yaml \
--weights yolov5s.pt \
--save-period 1 # Save checkpoint every epochCheckpoints will appear in the "Assets & Artifacts" tab of your Comet experiment. Learn more about model management in the Comet Model Registry documentation.
Logging Model Predictions
By default, model predictions (images, ground truth labels, bounding boxes) for the validation set are logged. Control the logging frequency using the --bbox_interval argument, which specifies logging every Nth batch per epoch.
Note: The YOLO validation dataloader defaults to a batch size of 32. Adjust --bbox_interval as needed.
Visualize predictions using Comet's Object Detection Custom Panel. See an example project using the Panel.
python train.py \
--img 640 \
--batch 16 \
--epochs 5 \
--data coco128.yaml \
--weights yolov5s.pt \
--bbox_interval 2 # Log predictions every 2nd validation batch per epochControlling the Number of Prediction Images
Adjust the maximum number of validation images logged using the COMET_MAX_IMAGE_UPLOADS environment variable.
env COMET_MAX_IMAGE_UPLOADS=200 python train.py \
--img 640 \
--batch 16 \
--epochs 5 \
--data coco128.yaml \
--weights yolov5s.pt \
--bbox_interval 1 # Log every batchLogging Class Level Metrics
Enable logging of mAP, precision, recall, and F1-score for each class using the COMET_LOG_PER_CLASS_METRICS environment variable.
env COMET_LOG_PER_CLASS_METRICS=true python train.py \
--img 640 \
--batch 16 \
--epochs 5 \
--data coco128.yaml \
--weights yolov5s.pt๐พ Dataset Management With Comet Artifacts
Use Comet Artifacts to version, store, and manage your datasets.
Uploading a Dataset
Upload your dataset using the --upload_dataset flag. Ensure your dataset follows the structure described in the Ultralytics Datasets documentation and that your dataset config YAML file matches the format of coco128.yaml (see the COCO128 dataset docs).
python train.py \
--img 640 \
--batch 16 \
--epochs 5 \
--data coco128.yaml \
--weights yolov5s.pt \
--upload_dataset # Upload the dataset specified in coco128.yamlView the uploaded dataset in the Artifacts tab of your Comet Workspace.
Preview data directly in the Comet UI.
Artifacts are versioned and support metadata. Comet automatically logs metadata from your dataset YAML file.
Using a Saved Artifact
To use a dataset stored in Comet Artifacts, update the path in your dataset YAML file to the Artifact resource URL:
# contents of artifact.yaml
path: "comet://WORKSPACE_NAME/ARTIFACT_NAME:ARTIFACT_VERSION_OR_ALIAS"
train: images/train # Adjust subdirectory if needed
val: images/val # Adjust subdirectory if needed
# Other dataset configurations...Then, pass this configuration file to your training script:
python train.py \
--img 640 \
--batch 16 \
--epochs 5 \
--data artifact.yaml \
--weights yolov5s.ptArtifacts track data lineage, showing which experiments used specific dataset versions.
๐ Resuming Training Runs
If a training run is interrupted (for example, due to connection issues), you can resume it using the --resume flag with the Comet Run Path (comet://YOUR_WORKSPACE/YOUR_PROJECT/EXPERIMENT_ID).
This restores the model state, hyperparameters, arguments, and downloads necessary Artifacts, continuing logging to the existing Comet Experiment. Learn more about resuming runs in the Comet documentation.
python train.py \
--resume "comet://YOUR_WORKSPACE/YOUR_PROJECT/EXPERIMENT_ID"๐ Hyperparameter Optimization (HPO)
YOLO integrates with the Comet Optimizer for easy hyperparameter sweeps and visualization. This helps you find the best set of parameters for your model, a process often referred to as Hyperparameter Tuning.
Configuring an Optimizer Sweep
Create a JSON configuration file defining the sweep parameters, search strategy, and objective metric. An example is provided at utils/loggers/comet/optimizer_config.json.
Run the sweep using the hpo.py script:
python utils/loggers/comet/hpo.py \
--comet_optimizer_config "utils/loggers/comet/optimizer_config.json"The hpo.py script accepts the same arguments as train.py. Pass additional fixed arguments for the sweep:
python utils/loggers/comet/hpo.py \
--comet_optimizer_config "utils/loggers/comet/optimizer_config.json" \
--save-period 1 \
--bbox_interval 1Running a Sweep in Parallel
Execute multiple sweep trials concurrently using the comet optimize command:
comet optimize -j NUM_WORKERS \
utils/loggers/comet/hpo.py utils/loggers/comet/optimizer_config.jsonReplace NUM_WORKERS with the desired number of parallel processes.
Visualizing HPO Results
Comet offers various visualizations for analyzing sweep results, such as parallel coordinate plots and parameter importance plots. Explore a project with a completed sweep.
๐ค Contributing
Contributions to enhance the YOLO-Comet integration are welcome! Please see the Ultralytics Contributing Guide for more information on how to get involved. Thank you for helping improve this integration!
File: README.zh-CN.md
Ultralytics YOLOv5 ๐ ๆฏ็ฑ Ultralytics ๅผๅ็ไธๆฌพๅฟซ้ใๅ็กฎไธๆไบไฝฟ็จ็่ฎก็ฎๆบ่ง่งๆจกๅใๅบไบ PyTorch ๆกๆถ๏ผYOLOv5 ไปฅๅ ถ้ๅบฆใๅ็กฎๆงๅ็ฎๆดๆง่้ปๅใๅฎ่ๅไบๅนฟๆณ็ ็ฉถๅๅผๅ็่ง่งฃไธๆไฝณๅฎ่ทต๏ผไฝฟๅ ถๆไธบๅ็ง่ง่ง AI ไปปๅกไธญ็ญ้จ่ๅฏ้ ็้ๆฉ๏ผๅ ๆฌ็ฎๆ ๆฃๆตใๅพๅๅๅฒๅๅพๅๅ็ฑปใ
ๆไปฌๅธๆ่ฟ้็่ตๆบ่ฝๅธฎๅฉๆจๅ ๅๅฉ็จ YOLOv5ใ่ฏทๆต่ง YOLOv5 ๆๆกฃ่ทๅ่ฏฆ็ปไฟกๆฏ๏ผๅจ GitHub ไธๆๅบ issue ไปฅ่ทๅพๆฏๆ๏ผๅนถๅ ๅ ฅๆไปฌ็ Discord ็คพๅบ่ฟ่กๆ้ฎๅ่ฎจ่ฎบ๏ผ
ๅฆ้็ณ่ฏทไผไธ่ฎธๅฏ่ฏ๏ผ่ฏทๅกซๅ Ultralytics ๆๆ่ฎธๅฏ ่กจๆ ผใ
๐ ๆข็ดข Ultralytics YOLO ็ๆ็ณป็ป
YOLOv5 ๆฏไธไธชๆ็ใ็ป่ฟ็ไบง้ช่ฏ็ๆจกๅ๏ผไป็ถๆฏๅฟซ้ๅฏ้ ็็ฎๆ ๆฃๆตใๅฎไพๅๅฒๅๅพๅๅ็ฑป็็ปไฝณ้ๆฉใๅฆๆๆจ็้กน็ฎ้่ฆๆๆฐ็ๆถๆใๅงฟๆไผฐ่ฎกๅๆ่ฝฌ็ฎๆ ๆฃๆต (OBB)็ญ้ขๅคไปปๅก๏ผๆ็ปไธ็ Python ไธ CLI ๆฅๅฃ๏ผ้ฃไนๆ็ปญ็ปดๆค็ ultralytics ๅ
ๅฐๆๆฐ็ Ultralytics YOLO ๆจกๅๆฑ้ไบไธๅคใๆต่ง Ultralytics ๆๆกฃไปฅๆพๅฐๆ้ๅๆจ็จไพ็ๆนๆกใ
# ๅฎ่ฃ
ultralytics ๅ
ไปฅ่ทๅๆๆฐ็ Ultralytics YOLO ๆจกๅ
pip install ultralytics๐ ๆๆกฃ
่ฏทๅ้ YOLOv5 ๆๆกฃ๏ผไบ่งฃๆๅ ณ่ฎญ็ปใๆต่ฏๅ้จ็ฝฒ็ๅฎๆดๆๆกฃใ่ฏทๅ้ ไธๆน็ๅฟซ้ๅ ฅ้จ็คบไพใ
ๅฎ่ฃ
ๅ ้ไปๅบๅนถๅจ Python>=3.8.0 ็ฏๅขไธญๅฎ่ฃ ไพ่ต้กนใ็กฎไฟๆจๅทฒๅฎ่ฃ PyTorch>=1.8ใ
# ๅ
้ YOLOv5 ไปๅบ
git clone https://github.com/ultralytics/yolov5
# ๅฏผ่ชๅฐๅ
้็็ฎๅฝ
cd yolov5
# ๅฎ่ฃ
ๆ้็ๅ
pip install -r requirements.txtไฝฟ็จ PyTorch Hub ่ฟ่กๆจ็
้่ฟ PyTorch Hub ไฝฟ็จ YOLOv5 ่ฟ่กๆจ็ใๆจกๅ ไผ่ชๅจไปๆๆฐ็ YOLOv5 ๅๅธ็ๆฌไธ่ฝฝใ
import torch
# ๅ ่ฝฝ YOLOv5 ๆจกๅ (้้กน: yolov5n, yolov5s, yolov5m, yolov5l, yolov5x)
model = torch.hub.load("ultralytics/yolov5", "yolov5s") # ้ป่ฎค: yolov5s
# ๅฎไน่พๅ
ฅๅพๅๆบ (URLใๆฌๅฐๆไปถใPIL ๅพๅใOpenCV ๅธงใnumpy ๆฐ็ปๆๅ่กจ)
img = "https://ultralytics.com/images/zidane.jpg" # ็คบไพๅพๅ
# ๆง่กๆจ็ (่ชๅจๅค็ๆนๅค็ใ่ฐๆดๅคงๅฐใๅฝไธๅ)
results = model(img)
# ๅค็็ปๆ (้้กน: .print(), .show(), .save(), .crop(), .pandas())
results.print() # ๅฐ็ปๆๆๅฐๅฐๆงๅถๅฐ
results.show() # ๅจ็ชๅฃไธญๆพ็คบ็ปๆ
results.save() # ๅฐ็ปๆไฟๅญๅฐ runs/detect/expไฝฟ็จ detect.py ่ฟ่กๆจ็
detect.py ่ๆฌๅจๅ็งๆฅๆบไธ่ฟ่กๆจ็ใๅฎไผ่ชๅจไปๆๆฐ็ YOLOv5 ๅๅธ็ๆฌไธ่ฝฝๆจกๅ๏ผๅนถๅฐ็ปๆไฟๅญๅฐ runs/detect ็ฎๅฝใ
# ไฝฟ็จ็ฝ็ปๆๅๅคด่ฟ่กๆจ็
python detect.py --weights yolov5s.pt --source 0
# ๅฏนๆฌๅฐๅพๅๆไปถ่ฟ่กๆจ็
python detect.py --weights yolov5s.pt --source img.jpg
# ๅฏนๆฌๅฐ่ง้ขๆไปถ่ฟ่กๆจ็
python detect.py --weights yolov5s.pt --source vid.mp4
# ๅฏนๅฑๅนๆชๅพ่ฟ่กๆจ็
python detect.py --weights yolov5s.pt --source screen
# ๅฏนๅพๅ็ฎๅฝ่ฟ่กๆจ็
python detect.py --weights yolov5s.pt --source path/to/images/
# ๅฏนๅๅบๅพๅ่ทฏๅพ็ๆๆฌๆไปถ่ฟ่กๆจ็
python detect.py --weights yolov5s.pt --source list.txt
# ๅฏนๅๅบๆต URL ็ๆๆฌๆไปถ่ฟ่กๆจ็
python detect.py --weights yolov5s.pt --source list.streams
# ไฝฟ็จ glob ๆจกๅผๅฏนๅพๅ่ฟ่กๆจ็
python detect.py --weights yolov5s.pt --source 'path/to/*.jpg'
# ๅฏน YouTube ่ง้ข URL ่ฟ่กๆจ็
python detect.py --weights yolov5s.pt --source 'https://youtu.be/LNwODJXcvt4'
# ๅฏน RTSPใRTMP ๆ HTTP ๆต่ฟ่กๆจ็
python detect.py --weights yolov5s.pt --source 'rtsp://example.com/media.mp4'่ฎญ็ป
ไปฅไธๅฝไปคๆผ็คบไบๅฆไฝๅค็ฐ YOLOv5 ๅจ COCO ๆฐๆฎ้ไธ็็ปๆใๆจกๅๅๆฐๆฎ้้ฝไผ่ชๅจไปๆๆฐ็ YOLOv5 ๅๅธ็ๆฌไธ่ฝฝใYOLOv5n/s/m/l/x ็่ฎญ็ปๆถ้ดๅจๅไธช NVIDIA V100 GPU ไธๅคง็บฆ้่ฆ 1/2/4/6/8 ๅคฉใไฝฟ็จๅค GPU ่ฎญ็ปๅฏไปฅๆพ่ๅๅฐ่ฎญ็ปๆถ้ดใ่ฏทไฝฟ็จ็กฌไปถๅ
่ฎธ็ๆๅคง --batch-size๏ผๆไฝฟ็จ --batch-size -1 ไปฅๅฏ็จ YOLOv5 AutoBatchใไธ้ขๆพ็คบ็ๆนๅค็ๅคงๅฐ้็จไบ V100-16GB GPUใ
# ๅจ COCO ไธ่ฎญ็ป YOLOv5n 300 ไธชๅจๆ
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5n.yaml --batch-size 128
# ๅจ COCO ไธ่ฎญ็ป YOLOv5s 300 ไธชๅจๆ
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5s.yaml --batch-size 64
# ๅจ COCO ไธ่ฎญ็ป YOLOv5m 300 ไธชๅจๆ
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5m.yaml --batch-size 40
# ๅจ COCO ไธ่ฎญ็ป YOLOv5l 300 ไธชๅจๆ
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5l.yaml --batch-size 24
# ๅจ COCO ไธ่ฎญ็ป YOLOv5x 300 ไธชๅจๆ
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5x.yaml --batch-size 16ๆ็จ
- ่ฎญ็ป่ชๅฎไนๆฐๆฎ ๐ ๆจ่๏ผๅญฆไน ๅฆไฝๅจๆจ่ชๅทฑ็ๆฐๆฎ้ไธ่ฎญ็ป YOLOv5ใ
- ่ทๅพๆไฝณ่ฎญ็ป็ปๆ็ๆๅทง โ๏ธ๏ผๅฉ็จไธๅฎถๆๅทงๆๅๆจกๅๆง่ฝใ
- ๅค GPU ่ฎญ็ป๏ผไฝฟ็จๅคไธช GPU ๅ ้่ฎญ็ปใ
- PyTorch Hub ้ๆ๏ผไฝฟ็จ PyTorch Hub ่ฝปๆพๅ ่ฝฝๆจกๅใ
- ๆจกๅๅฏผๅบ (TFLite, ONNX, CoreML, TensorRT) ๐๏ผๅฐๆจ็ๆจกๅ่ฝฌๆขไธบๅ็ง้จ็ฝฒๆ ผๅผ๏ผๅฆ ONNX ๆ TensorRTใ
- NVIDIA Jetson ้จ็ฝฒ๏ผๅจ NVIDIA Jetson ่ฎพๅคไธ้จ็ฝฒ YOLOv5ใ
- ๆต่ฏๆถๅขๅผบ (TTA)๏ผไฝฟ็จ TTA ๆ้ซ้ขๆตๅ็กฎๆงใ
- ๆจกๅ้ๆ๏ผ็ปๅๅคไธชๆจกๅไปฅ่ทๅพๆดๅฅฝ็ๆง่ฝใ
- ๆจกๅๅชๆ/็จ็ๅ๏ผไผๅๆจกๅ็ๅคงๅฐๅ้ๅบฆใ
- ่ถ ๅๆฐ่ฟๅ๏ผ่ชๅจๆพๅฐๆไฝณ่ฎญ็ป่ถ ๅๆฐใ
- ไฝฟ็จๅป็ปๅฑ็่ฟ็งปๅญฆไน ๏ผไฝฟ็จ่ฟ็งปๅญฆไน ้ซๆๅฐๅฐ้ข่ฎญ็ปๆจกๅๅบ็จไบๆฐไปปๅกใ
- ๆถๆๆ่ฆ๏ผไบ่งฃ YOLOv5 ๆจกๅๆถๆใ
- Ultralytics Platform ่ฎญ็ป ๐ ๆจ่๏ผไฝฟ็จ Ultralytics Platform ่ฎญ็ปๅ้จ็ฝฒ YOLO ๆจกๅใ
- ClearML ๆฅๅฟ่ฎฐๅฝ๏ผไธ ClearML ้ๆไปฅ่ฟ่กๅฎ้ช่ท่ธชใ
- Neural Magic DeepSparse ้ๆ๏ผไฝฟ็จ DeepSparse ๅ ้ๆจ็ใ
- Comet ๆฅๅฟ่ฎฐๅฝ๏ผไฝฟ็จ Comet ML ่ฎฐๅฝๅฎ้ชใ
๐งฉ ้ๆ
ๆไปฌไธ้ขๅ AI ๅนณๅฐ็ๅ ณ้ฎ้ๆๆฉๅฑไบ Ultralytics ไบงๅ็ๅ่ฝ๏ผๅขๅผบไบ่ฏธๅฆๆฐๆฎ้ๆ ๆณจใ่ฎญ็ปใๅฏ่งๅๅๆจกๅ็ฎก็็ญไปปๅกใไบ่งฃ Ultralytics ๅฆไฝไธ Weights & BiasesใComet MLใRoboflow ๅ Intel OpenVINO ็ญๅไฝไผไผดๅไฝ๏ผไผๅๆจ็ AI ๅทฅไฝๆต็จใๅจ Ultralytics ้ๆ ๆข็ดขๆดๅคไฟกๆฏใ
๐ค ไธบไฝ้ๆฉ YOLOv5๏ผ
YOLOv5 ็่ฎพ่ฎกๆจๅจ็ฎๅๆ็จใๆไปฌไผๅ ่่ๅฎ้ ๆง่ฝๅๅฏ่ฎฟ้ฎๆงใ
YOLOv5-P5 640 ๅพ่กจ
ๅพ่กจ่ฏดๆ
- COCO AP val ่กจ็คบๅจ ไบคๅนถๆฏ (IoU) ้ๅผไป 0.5 ๅฐ 0.95 ่ๅดๅ ็ๅนณๅ็ฒพๅบฆๅๅผ (mAP)๏ผๅจๅ ๅซ 5000 ๅผ ๅพๅ็ COCO val2017 ๆฐๆฎ้ไธ๏ผไฝฟ็จๅ็งๆจ็ๅฐบๅฏธ๏ผ256 ๅฐ 1536 ๅ็ด ๏ผๆต้ๅพๅบใ
- GPU Speed ไฝฟ็จๆนๅค็ๅคงๅฐไธบ 32 ็ AWS p3.2xlarge V100 ๅฎไพ๏ผๆต้ๅจ COCO val2017 ๆฐๆฎ้ไธๆฏๅผ ๅพๅ็ๅนณๅๆจ็ๆถ้ดใ
- EfficientDet ๆฐๆฎๆฅๆบไบ google/automl ไปๅบ๏ผๆนๅค็ๅคงๅฐไธบ 8ใ
- ๅค็ฐ่ฟไบ็ปๆ่ฏทไฝฟ็จๅฝไปค๏ผ
python val.py --task study --data coco.yaml --iou 0.7 --weights yolov5n6.pt yolov5s6.pt yolov5m6.pt yolov5l6.pt yolov5x6.pt
้ข่ฎญ็ปๆ้
ๆญค่กจๆพ็คบไบๅจ COCO ๆฐๆฎ้ไธ่ฎญ็ป็ๅ็ง YOLOv5 ๆจกๅ็ๆง่ฝๆๆ ใ
| ๆจกๅ | ๅฐบๅฏธ(ๅ็ด ) | mAPval50-95 | mAPval50 | ้ๅบฆCPU b1(ๆฏซ็ง) | ้ๅบฆV100 b1(ๆฏซ็ง) | ้ๅบฆV100 b32(ๆฏซ็ง) | ๅๆฐ(M) | FLOPs@640 (B) |
|---|---|---|---|---|---|---|---|---|
| YOLOv5n | 640 | 28.0 | 45.7 | 45 | 6.3 | 0.6 | 1.9 | 4.5 |
| YOLOv5s | 640 | 37.4 | 56.8 | 98 | 6.4 | 0.9 | 7.2 | 16.5 |
| YOLOv5m | 640 | 45.4 | 64.1 | 224 | 8.2 | 1.7 | 21.2 | 49.0 |
| YOLOv5l | 640 | 49.0 | 67.3 | 430 | 10.1 | 2.7 | 46.5 | 109.1 |
| YOLOv5x | 640 | 50.7 | 68.9 | 766 | 12.1 | 4.8 | 86.7 | 205.7 |
| YOLOv5n6 | 1280 | 36.0 | 54.4 | 153 | 8.1 | 2.1 | 3.2 | 4.6 |
| YOLOv5s6 | 1280 | 44.8 | 63.7 | 385 | 8.2 | 3.6 | 12.6 | 16.8 |
| YOLOv5m6 | 1280 | 51.3 | 69.3 | 887 | 11.1 | 6.8 | 35.7 | 50.0 |
| YOLOv5l6 | 1280 | 53.7 | 71.3 | 1784 | 15.8 | 10.5 | 76.8 | 111.4 |
| YOLOv5x6+ [TTA] | 12801536 | 55.055.8 | 72.772.7 | 3136- | 26.2- | 19.4- | 140.7- | 209.8- |
่กจๆ ผ่ฏดๆ
- 640 ๅ็ด ่กๅฑ็คบ็ๆฏๆง็ๅบไบ้ๆก็ YOLOv5 ๆ้ๅๅ ถๆๆ ๏ผไฝ้พๆฅไผๆๅผ Ultralytics Platform ไธๅฏนๅบ็ๆ ้ YOLOv5u ๅ็ปงๆจกๅใP6 ้พๆฅไป็ดๆฅไธ่ฝฝๆง็ 1280 ๅ็ด ๆ้ใ
- ๆๆ้ข่ฎญ็ปๆ้ๅไฝฟ็จ้ป่ฎค่ฎพ็ฝฎ่ฎญ็ปไบ 300 ไธชๅจๆใNano (n) ๅ Small (s) ๆจกๅไฝฟ็จ hyp.scratch-low.yaml ่ถ ๅๆฐ๏ผ่ Medium (m)ใLarge (l) ๅ Extra-Large (x) ๆจกๅไฝฟ็จ hyp.scratch-high.yamlใ
- mAPval ๅผ่กจ็คบๅจ COCO val2017 ๆฐๆฎ้ไธ็ๅๆจกๅใๅๅฐบๅบฆๆง่ฝใๅค็ฐ่ฏทไฝฟ็จ๏ผ
python val.py --data coco.yaml --img 640 --conf 0.001 --iou 0.65 - ้ๅบฆๆๆ ๆฏๅจ AWS p3.2xlarge V100 ๅฎไพไธๅฏน COCO val ๅพๅ่ฟ่กๅนณๅๆต้็ใไธๅ
ๆฌ้ๆๅคงๅผๆๅถ (NMS) ๆถ้ด๏ผ็บฆ 1 ๆฏซ็ง/ๅพๅ๏ผใๅค็ฐ่ฏทไฝฟ็จ๏ผ
python val.py --data coco.yaml --img 640 --task speed --batch 1 - TTA (ๆต่ฏๆถๅขๅผบ) ๅ
ๆฌๅๅฐๅๅฐบๅบฆๅขๅผบไปฅๆ้ซๅ็กฎๆงใๅค็ฐ่ฏทไฝฟ็จ๏ผ
python val.py --data coco.yaml --img 1536 --iou 0.7 --augment
๐ผ๏ธ ๅๅฒ
YOLOv5 v7.0 ็ๆฌ ๅผๅ ฅไบๅฎไพๅๅฒๆจกๅ๏ผ่ฎพ่ฎก็จไบ่ฝปๆพ่ฎญ็ปใ้ช่ฏๅ้จ็ฝฒใๆๅ ณๅฎๆด่ฏฆ็ปไฟกๆฏ๏ผ่ฏทๅ้ ๅๅธ่ฏดๆ๏ผๅนถๆข็ดข YOLOv5 ๅๅฒ Colab ็ฌ่ฎฐๆฌไปฅ่ทๅๅฟซ้ๅ ฅ้จ็คบไพใ
ๅๅฒ้ข่ฎญ็ปๆ้
YOLOv5 ๅๅฒๆจกๅๅจ COCO ๆฐๆฎ้ไธไฝฟ็จ A100 GPU ไปฅ 640 ๅ็ด ็ๅพๅๅคงๅฐ่ฎญ็ปไบ 300 ไธชๅจๆใๆจกๅๅฏผๅบไธบ ONNX FP32 ็จไบ CPU ้ๅบฆๆต่ฏ๏ผๅฏผๅบไธบ TensorRT FP16 ็จไบ GPU ้ๅบฆๆต่ฏใๆๆ้ๅบฆๆต่ฏๅๅจ Google Colab Pro ็ฌ่ฎฐๆฌไธ่ฟ่ก๏ผไปฅ็กฎไฟๅฏๅค็ฐๆงใ
| ๆจกๅ | ๅฐบๅฏธ(ๅ็ด ) | mAPbox50-95 | mAPmask50-95 | ่ฎญ็ปๆถ้ด300 ๅจๆA100 (ๅฐๆถ) | ้ๅบฆONNX CPU(ๆฏซ็ง) | ้ๅบฆTRT A100(ๆฏซ็ง) | ๅๆฐ(M) | FLOPs@640 (B) |
|---|---|---|---|---|---|---|---|---|
| YOLOv5n-seg | 640 | 27.6 | 23.4 | 80:17 | 62.7 | 1.2 | 2.0 | 7.1 |
| YOLOv5s-seg | 640 | 37.6 | 31.7 | 88:16 | 173.3 | 1.4 | 7.6 | 26.4 |
| YOLOv5m-seg | 640 | 45.0 | 37.1 | 108:36 | 427.0 | 2.2 | 22.0 | 70.8 |
| YOLOv5l-seg | 640 | 49.0 | 39.9 | 66:43 (2x) | 857.4 | 2.9 | 47.9 | 147.7 |
| YOLOv5x-seg | 640 | 50.7 | 41.4 | 62:56 (3x) | 1579.2 | 4.5 | 88.8 | 265.7 |
ๆๆ้ข่ฎญ็ปๆ้ๅไฝฟ็จ SGD ไผๅๅจ๏ผ
lr0=0.01ๅweight_decay=5e-5๏ผๅจ 640 ๅ็ด ็ๅพๅๅคงๅฐไธ๏ผไฝฟ็จ้ป่ฎค่ฎพ็ฝฎ่ฎญ็ปไบ 300 ไธชๅจๆใ่ฎญ็ป่ฟ่ก่ฎฐๅฝๅจ https://wandb.ai/glenn-jocher/YOLOv5_v70_officialใๅ็กฎๅบฆๅผ่กจ็คบๅจ COCO ๆฐๆฎ้ไธ็ๅๆจกๅใๅๅฐบๅบฆๆง่ฝใๅค็ฐ่ฏทไฝฟ็จ๏ผ
python segment/val.py --data coco.yaml --weights yolov5s-seg.pt้ๅบฆๆๆ ๆฏๅจ Colab Pro A100 High-RAM ๅฎไพไธๅฏน 100 ๅผ ๆจ็ๅพๅ่ฟ่กๅนณๅๆต้็ใๅผไป ่กจ็คบๆจ็้ๅบฆ๏ผNMS ็บฆๅขๅ 1 ๆฏซ็ง/ๅพๅ๏ผใๅค็ฐ่ฏทไฝฟ็จ๏ผ
python segment/val.py --data coco.yaml --weights yolov5s-seg.pt --batch 1ๅฏผๅบๅฐ ONNX (FP32) ๅ TensorRT (FP16) ๆฏไฝฟ็จ
export.pyๅฎๆ็ใๅค็ฐ่ฏทไฝฟ็จ๏ผpython export.py --weights yolov5s-seg.pt --include engine --device 0 --half
่ฎญ็ป
YOLOv5 ๅๅฒ่ฎญ็ปๆฏๆ้่ฟ --data coco128-seg.yaml ๅๆฐ่ชๅจไธ่ฝฝ COCO128-seg ๆฐๆฎ้ใๅฏนไบๅฎๆด็ COCO-segments ๆฐๆฎ้๏ผ่ฏทไฝฟ็จ bash data/scripts/get_coco.sh --train --val --segments ๆๅจไธ่ฝฝ๏ผ็ถๅไฝฟ็จ python segment/train.py --data coco.yaml ่ฟ่ก่ฎญ็ปใ
# ๅจๅไธช GPU ไธ่ฎญ็ป
python segment/train.py --data coco128-seg.yaml --weights yolov5s-seg.pt --img 640
# ไฝฟ็จๅค GPU ๅๅธๅผๆฐๆฎๅนถ่ก (DDP) ่ฟ่ก่ฎญ็ป
python -m torch.distributed.run --nproc_per_node 4 --master_port 1 segment/train.py --data coco128-seg.yaml --weights yolov5s-seg.pt --img 640 --device 0,1,2,3้ช่ฏ
ๅจ COCO ๆฐๆฎ้ไธ้ช่ฏ YOLOv5s-seg ็ๆฉ็ ๅนณๅ็ฒพๅบฆๅๅผ (mAP)๏ผ
# ไธ่ฝฝ COCO ้ช่ฏๅๅฒ้ (780MB, 5000 ๅผ ๅพๅ)
bash data/scripts/get_coco.sh --val --segments
# ้ช่ฏๆจกๅ
python segment/val.py --weights yolov5s-seg.pt --data coco.yaml --img 640้ขๆต
ไฝฟ็จ้ข่ฎญ็ป็ YOLOv5m-seg.pt ๆจกๅๅฏน bus.jpg ๆง่กๅๅฒ๏ผ
# ่ฟ่ก้ขๆต
python segment/predict.py --weights yolov5m-seg.pt --source data/images/bus.jpg# ไป PyTorch Hub ๅ ่ฝฝๆจกๅ (ๆณจๆ: ๆจ็ๆฏๆๅฏ่ฝๆๆไธๅ)
model = torch.hub.load("ultralytics/yolov5", "custom", "yolov5m-seg.pt")ๅฏผๅบ
ๅฐ YOLOv5s-seg ๆจกๅๅฏผๅบไธบ ONNX ๅ TensorRT ๆ ผๅผ๏ผ
# ๅฏผๅบๆจกๅ
python export.py --weights yolov5s-seg.pt --include onnx engine --img 640 --device 0๐ท๏ธ ๅ็ฑป
YOLOv5 v6.2 ็ๆฌ ๅผๅ ฅไบๅฏนๅพๅๅ็ฑปๆจกๅ่ฎญ็ปใ้ช่ฏๅ้จ็ฝฒ็ๆฏๆใ่ฏทๆฅ็ๅๅธ่ฏดๆไบ่งฃ่ฏฆ็ปไฟกๆฏ๏ผๅนถๅ้ YOLOv5 ๅ็ฑป Colab ็ฌ่ฎฐๆฌ่ทๅๅฟซ้ๅ ฅ้จๆๅใ
ๅ็ฑป้ข่ฎญ็ปๆ้
YOLOv5-cls ๅ็ฑปๆจกๅๅจ ImageNet ไธไฝฟ็จ 4xA100 ๅฎไพ่ฎญ็ปไบ 90 ไธชๅจๆใResNet ๅ EfficientNet ๆจกๅๅจ็ธๅ่ฎพ็ฝฎไธไธ่ตท่ฎญ็ปไปฅ่ฟ่กๆฏ่พใๆจกๅๅฏผๅบไธบ ONNX FP32๏ผ็จไบ CPU ้ๅบฆๆต่ฏ๏ผๅ TensorRT FP16๏ผ็จไบ GPU ้ๅบฆๆต่ฏ๏ผใๆๆ้ๅบฆๆต่ฏๅๅจ Google Colab Pro ไธ่ฟ่ก๏ผไปฅ็กฎไฟๅฏๅค็ฐๆงใ
| ๆจกๅ | ๅฐบๅฏธ(ๅ็ด ) | ๅ็กฎ็top1 | ๅ็กฎ็top5 | ่ฎญ็ป90 ๅจๆ4xA100 (ๅฐๆถ) | ้ๅบฆONNX CPU(ๆฏซ็ง) | ้ๅบฆTensorRT V100(ๆฏซ็ง) | ๅๆฐ(M) | FLOPs@224 (B) |
|---|---|---|---|---|---|---|---|---|
| YOLOv5n-cls | 224 | 64.6 | 85.4 | 7:59 | 3.3 | 0.5 | 2.5 | 0.5 |
| YOLOv5s-cls | 224 | 71.5 | 90.2 | 8:09 | 6.6 | 0.6 | 5.4 | 1.4 |
| YOLOv5m-cls | 224 | 75.9 | 92.9 | 10:06 | 15.5 | 0.9 | 12.9 | 3.9 |
| YOLOv5l-cls | 224 | 78.0 | 94.0 | 11:56 | 26.9 | 1.4 | 26.5 | 8.5 |
| YOLOv5x-cls | 224 | 79.0 | 94.4 | 15:04 | 54.3 | 1.8 | 48.1 | 15.9 |
| ResNet18 | 224 | 70.3 | 89.5 | 6:47 | 11.2 | 0.5 | 11.7 | 3.7 |
| ResNet34 | 224 | 73.9 | 91.8 | 8:33 | 20.6 | 0.9 | 21.8 | 7.4 |
| ResNet50 | 224 | 76.8 | 93.4 | 11:10 | 23.4 | 1.0 | 25.6 | 8.5 |
| ResNet101 | 224 | 78.5 | 94.3 | 17:10 | 42.1 | 1.9 | 44.5 | 15.9 |
| EfficientNet_b0 | 224 | 75.1 | 92.4 | 13:03 | 12.5 | 1.3 | 5.3 | 1.0 |
| EfficientNet_b1 | 224 | 76.4 | 93.2 | 17:04 | 14.9 | 1.6 | 7.8 | 1.5 |
| EfficientNet_b2 | 224 | 76.6 | 93.4 | 17:10 | 15.9 | 1.6 | 9.1 | 1.7 |
| EfficientNet_b3 | 224 | 77.7 | 94.0 | 19:19 | 18.9 | 1.9 | 12.2 | 2.4 |
่กจๆ ผ่ฏดๆ๏ผ็นๅปๅฑๅผ๏ผ
ๆๆ้ข่ฎญ็ปๆ้ๅไฝฟ็จ SGD ไผๅๅจ๏ผ
lr0=0.001ๅweight_decay=5e-5๏ผๅจ 224 ๅ็ด ็ๅพๅๅคงๅฐไธ๏ผไฝฟ็จ้ป่ฎค่ฎพ็ฝฎ่ฎญ็ปไบ 90 ไธชๅจๆใ่ฎญ็ป่ฟ่ก่ฎฐๅฝๅจ https://wandb.ai/glenn-jocher/YOLOv5-Classifier-v6-2ใๅ็กฎๅบฆๅผ๏ผtop-1 ๅ top-5๏ผ่กจ็คบๅจ ImageNet-1k ๆฐๆฎ้ไธ็ๅๆจกๅใๅๅฐบๅบฆๆง่ฝใๅค็ฐ่ฏทไฝฟ็จ๏ผ
python classify/val.py --data ../datasets/imagenet --img 224้ๅบฆๆๆ ๆฏๅจ Google Colab Pro V100 High-RAM ๅฎไพไธๅฏน 100 ๅผ ๆจ็ๅพๅ่ฟ่กๅนณๅๆต้็ใๅค็ฐ่ฏทไฝฟ็จ๏ผ
python classify/val.py --data ../datasets/imagenet --img 224 --batch 1ๅฏผๅบๅฐ ONNX (FP32) ๅ TensorRT (FP16) ๆฏไฝฟ็จ
export.pyๅฎๆ็ใๅค็ฐ่ฏทไฝฟ็จ๏ผpython export.py --weights yolov5s-cls.pt --include engine onnx --imgsz 224
่ฎญ็ป
YOLOv5 ๅ็ฑป่ฎญ็ปๆฏๆไฝฟ็จ --data ๅๆฐ่ชๅจไธ่ฝฝ่ฏธๅฆ MNISTใFashion-MNISTใCIFAR10ใCIFAR100ใImagenetteใImagewoof ๅ ImageNet ็ญๆฐๆฎ้ใไพๅฆ๏ผไฝฟ็จ --data mnist ๅผๅงๅจ MNIST ไธ่ฎญ็ปใ
# ไฝฟ็จ CIFAR-100 ๆฐๆฎ้ๅจๅไธช GPU ไธ่ฎญ็ป
python classify/train.py --model yolov5s-cls.pt --data cifar100 --epochs 5 --img 224 --batch 128
# ๅจ ImageNet ๆฐๆฎ้ไธไฝฟ็จๅค GPU DDP ่ฟ่ก่ฎญ็ป
python -m torch.distributed.run --nproc_per_node 4 --master_port 1 classify/train.py --model yolov5s-cls.pt --data imagenet --epochs 5 --img 224 --device 0,1,2,3้ช่ฏ
ๅจ ImageNet-1k ้ช่ฏๆฐๆฎ้ไธ้ช่ฏ YOLOv5m-cls ๆจกๅ็ๅ็กฎๆง๏ผ
# ไธ่ฝฝ ImageNet ้ช่ฏ้ (6.3GB, 50,000 ๅผ ๅพๅ)
bash data/scripts/get_imagenet.sh --val
# ้ช่ฏๆจกๅ
python classify/val.py --weights yolov5m-cls.pt --data ../datasets/imagenet --img 224้ขๆต
ไฝฟ็จ้ข่ฎญ็ป็ YOLOv5s-cls.pt ๆจกๅๅฏนๅพๅ bus.jpg ่ฟ่กๅ็ฑป๏ผ
# ่ฟ่ก้ขๆต
python classify/predict.py --weights yolov5s-cls.pt --source data/images/bus.jpg# ไป PyTorch Hub ๅ ่ฝฝๆจกๅ
model = torch.hub.load("ultralytics/yolov5", "custom", "yolov5s-cls.pt")ๅฏผๅบ
ๅฐ่ฎญ็ปๅฅฝ็ YOLOv5s-clsใResNet50 ๅ EfficientNet_b0 ๆจกๅๅฏผๅบไธบ ONNX ๅ TensorRT ๆ ผๅผ๏ผ
# ๅฏผๅบๆจกๅ
python export.py --weights yolov5s-cls.pt resnet50.pt efficientnet_b0.pt --include onnx engine --img 224โ๏ธ ็ฏๅข
ไฝฟ็จๆไปฌ้ข้ ็ฝฎ็็ฏๅขๅฟซ้ๅผๅงใ็นๅปไธ้ข็ๅพๆ ๆฅ็่ฎพ็ฝฎ่ฏฆๆ ใ
๐ค ่ดก็ฎ
ๆไปฌๆฌข่ฟๆจ็่ดก็ฎ๏ผ่ฎฉ YOLOv5 ๅๅพๆไบ่ฎฟ้ฎๅๆๆๆฏ็คพๅบ็ๅ ฑๅๅชๅใ่ฏทๅ้ ๆไปฌ็่ดก็ฎๆๅๅผๅงใ้่ฟ YOLOv5 ่ฐๆฅๅไบซๆจ็ๅ้ฆใๆ่ฐขๆๆไธบไฝฟ YOLOv5 ๅๅพๆดๅฅฝ่ๅๅบ่ดก็ฎ็ไบบ๏ผ
๐ ่ฎธๅฏ่ฏ
Ultralytics ๆไพไธค็ง่ฎธๅฏ้้กนไปฅๆปก่ถณไธๅ้ๆฑ๏ผ
- AGPL-3.0 ่ฎธๅฏ่ฏ๏ผไธ็ง OSI ๆนๅ็ๅผๆบ่ฎธๅฏ่ฏ๏ผ้ๅธธ้ๅๅญฆๆฏ็ ็ฉถใไธชไบบ้กน็ฎๅๆต่ฏใๅฎไฟ่ฟๅผๆพๅไฝๅ็ฅ่ฏๅ ฑไบซใ่ฏฆๆ ่ฏทๅ้ LICENSE ๆไปถใ
- ไผไธ่ฎธๅฏ่ฏ๏ผไธไธบๅไธๅบ็จ้่บซๅฎๅถ๏ผๆญค่ฎธๅฏ่ฏๅ ่ฎธๅฐ Ultralytics ่ฝฏไปถๅ AI ๆจกๅๆ ็ผ้ๆๅฐๅไธไบงๅๅๆๅกไธญ๏ผ็ป่ฟ AGPL-3.0 ็ๅผๆบ่ฆๆฑใๅฏนไบๅไธ็จไพ๏ผ่ฏท้่ฟ Ultralytics ๆๆ่ฎธๅฏ่็ณปๆไปฌใ
๐ง ่็ณป
ๅฏนไบไธ YOLOv5 ็ธๅ ณ็้่ฏฏๆฅๅๅๅ่ฝ่ฏทๆฑ๏ผ่ฏท่ฎฟ้ฎ GitHub Issuesใๅฏนไบไธ่ฌ้ฎ้ขใ่ฎจ่ฎบๅ็คพๅบๆฏๆ๏ผ่ฏทๅ ๅ ฅๆไปฌ็ Discord ๆๅกๅจ๏ผ
2. Official Technical Reference & Guides (ultralytics/docs)
๐ Ultralytics Docs
Welcome to Ultralytics Docs, your comprehensive resource for understanding and utilizing our state-of-the-art machine learning tools and models, including Ultralytics YOLO. These documents are actively maintained and deployed to https://docs.ultralytics.com for easy access.
๐ ๏ธ Ultralytics Package
The badges above track the core ultralytics Python package documented by this site. To install that package in developer mode, which allows you to modify the source code directly, ensure you have Git and Python 3.8 or later installed on your system. Then, follow these steps:
Clone the
ultralyticsrepository to your local machine using Git:bashgit clone https://github.com/ultralytics/ultralytics.gitNavigate to the cloned repository's root directory:
bashcd ultralyticsInstall the package in editable mode (
-e) along with its development dependencies ([dev]) using pip:bashpip install -e '.[dev]'This command installs the
ultralyticspackage such that changes to the source code are immediately reflected in your environment, ideal for development and contributing.
๐งฐ Technology Stack
- Next.js - Framework that renders the published documentation site
- Ultralytics Chat - Realtime conversational AI with open-source chat.js implementation
- Vercel - Hosting and deployment
- GitHub Actions - CI/CD automation
๐ง Repository Tooling
This repository contains documentation source plus maintenance workflows for published-site checks. Install the lightweight Python dependencies before running repository utilities locally:
uv pip install -r requirements.txtFor example, utils/check_image_sizes.py is used by the website link-check workflow to flag oversized images in downloaded pages.
๐ Website Checks
The live documentation at docs.ultralytics.com is maintained with scheduled and manual workflows in .github/workflows/:
links.ymldownloads rendered pages forwww.ultralytics.com,docs.ultralytics.com,academy.ultralytics.com, andhandbook.ultralytics.com, then checks links, spelling, and large images.links_local.ymlchecks repository Markdown and HTML links, with an optional broader link scan on manual runs.download_websites.ymlcan download public website pages for inspection.
Production combines this repository's content with the other documentation sources, validates the complete tree with zensical build --strict, and renders it through Ultralytics' centralized publishing service. This repository therefore has no standalone site build; use the workflows above to check published pages.
๐ก Contribute
We deeply value contributions from the open-source community to enhance Ultralytics projects. Your input helps drive innovation in computer vision and AI! Please review our Contributing Guide for detailed information on how to get involved. You can also share your feedback and ideas through our quick Survey. A heartfelt thank you ๐ to all our contributors for their dedication and support!
We look forward to your contributions!
๐ License
Ultralytics Docs are available under two licensing options to accommodate different usage scenarios:
- AGPL-3.0 License: Ideal for students, researchers, and enthusiasts involved in academic pursuits and open collaboration. See the LICENSE file for full details. This license promotes sharing improvements back with the community, fostering an open and collaborative environment.
- Enterprise License: Designed for commercial applications, this license allows seamless integration of Ultralytics software and AI models into commercial products and services without the open-source requirements of AGPL-3.0. Visit Ultralytics Licensing for more information on obtaining an Enterprise License.
โ๏ธ Contact
For bug reports, feature requests, and other issues related to the documentation, please use GitHub Issues. For discussions, questions, and community support regarding Ultralytics software, the Ultralytics Platform, and more, join the conversation with peers and the Ultralytics team on our Discord server!