docs/en/modes/benchmark.md
!!! tip "Refresh Browser"
You may need to refresh the page to view the graphs correctly due to potential cookie issues.
<canvas id="modelComparisonChart" width="1024" height="400"></canvas>
Once your model is trained and validated, the next logical step is to evaluate its performance in various real-world scenarios. Benchmark mode in Ultralytics YOLO26 serves this purpose by providing a robust framework for assessing the speed and accuracy of your model across a range of export formats.
<p align="center"> <iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/UF7pYdLSMng" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen> </iframe><strong>Watch:</strong> Benchmark Ultralytics YOLO26 Models | How to Compare Model Performance on Different Hardware?
</p>!!! tip
* Export to ONNX or OpenVINO for up to 3x CPU speedup.
* Export to TensorRT for up to 5x GPU speedup.
Run YOLO26n benchmarks across all supported export formats (ONNX, TensorRT, etc.). See the Arguments section below for a full list of export options.
!!! example
=== "Python"
```python
from ultralytics.utils.benchmarks import benchmark
# Benchmark on GPU
benchmark(model="yolo26n.pt", data="coco8.yaml", imgsz=640, half=False, device=0)
# Benchmark specific export format
benchmark(model="yolo26n.pt", data="coco8.yaml", imgsz=640, format="onnx")
```
=== "CLI"
```bash
yolo benchmark model=yolo26n.pt data='coco8.yaml' imgsz=640 half=False device=0
# Benchmark specific export format
yolo benchmark model=yolo26n.pt data='coco8.yaml' imgsz=640 format=onnx
```
Arguments such as model, data, imgsz, half, device, verbose and format provide users with the flexibility to fine-tune the benchmarks to their specific needs and compare the performance of different export formats with ease.
| Key | Default Value | Description |
|---|---|---|
model | None | Specifies the path to the model file. Accepts both .pt and .yaml formats, e.g., "yolo26n.pt" for pretrained models or configuration files. |
data | None | Path to a YAML file defining the dataset for benchmarking, typically including paths and settings for validation data. Example: "coco8.yaml". |
imgsz | 640 | The input image size for the model. Can be a single integer for square images or a tuple (width, height) for non-square, e.g., (640, 480). |
half | False | Enables FP16 (half-precision) inference, reducing memory usage and possibly increasing speed on compatible hardware. Use half=True to enable. |
int8 | False | Activates INT8 quantization for further optimized performance on supported devices, especially useful for edge devices. Set int8=True to use. |
device | None | Defines the computation device(s) for benchmarking, such as "cpu" or "cuda:0". |
verbose | False | Controls the level of detail in logging output. Set verbose=True for detailed logs. |
format | '' | Benchmarks only the specified export format (e.g., format=onnx). Leave it blank to test every supported format automatically. |
Benchmarks will attempt to run automatically on all possible export formats listed below. Alternatively, you can run benchmarks for a specific format by using the format argument, which accepts any of the formats mentioned below.
{% include "macros/export-table.md" %}
See full export details in the Export page.
Ultralytics YOLO26 offers a Benchmark mode to assess your model's performance across different export formats. This mode provides insights into key metrics such as mean Average Precision (mAP50-95), accuracy, and inference time in milliseconds. To run benchmarks, you can use either Python or CLI commands. For example, to benchmark on a GPU:
!!! example
=== "Python"
```python
from ultralytics.utils.benchmarks import benchmark
# Benchmark on GPU
benchmark(model="yolo26n.pt", data="coco8.yaml", imgsz=640, half=False, device=0)
```
=== "CLI"
```bash
yolo benchmark model=yolo26n.pt data='coco8.yaml' imgsz=640 half=False device=0
```
For more details on benchmark arguments, visit the Arguments section.
Exporting YOLO26 models to different formats such as ONNX, TensorRT, and OpenVINO allows you to optimize performance based on your deployment environment. For instance:
These formats enhance both the speed and accuracy of your models, making them more efficient for various real-world applications. Visit the Export page for complete details.
Benchmarking your YOLO26 models is essential for several reasons:
Key metrics such as mAP50-95, Top-5 accuracy, and inference time help in making these evaluations. Refer to the Key Metrics section for more information.
YOLO26 supports a variety of export formats, each tailored for specific hardware and use cases:
For a complete list of supported formats and their respective advantages, check out the Supported Export Formats section.
When running benchmarks, several arguments can be customized to suit specific needs:
For a full list of arguments, refer to the Arguments section.