--- comments: true description: Learn how to profile speed and accuracy of YOLOv8 across various export formats; get insights on mAP50-95, accuracy_top5 metrics, and more. keywords: Ultralytics, YOLOv8, benchmarking, speed profiling, accuracy profiling, mAP50-95, accuracy_top5, ONNX, OpenVINO, TensorRT, YOLO export formats --- # Model Benchmarking with Ultralytics YOLO Ultralytics YOLO ecosystem and integrations ## Introduction 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 YOLOv8 serves this purpose by providing a robust framework for assessing the speed and accuracy of your model across a range of export formats.



Watch: Ultralytics Modes Tutorial: Benchmark

## Why Is Benchmarking Crucial? - **Informed Decisions:** Gain insights into the trade-offs between speed and accuracy. - **Resource Allocation:** Understand how different export formats perform on different hardware. - **Optimization:** Learn which export format offers the best performance for your specific use case. - **Cost Efficiency:** Make more efficient use of hardware resources based on benchmark results. ### Key Metrics in Benchmark Mode - **mAP50-95:** For object detection, segmentation, and pose estimation. - **accuracy_top5:** For image classification. - **Inference Time:** Time taken for each image in milliseconds. ### Supported Export Formats - **ONNX:** For optimal CPU performance - **TensorRT:** For maximal GPU efficiency - **OpenVINO:** For Intel hardware optimization - **CoreML, TensorFlow SavedModel, and More:** For diverse deployment needs. !!! Tip "Tip" * Export to ONNX or OpenVINO for up to 3x CPU speedup. * Export to TensorRT for up to 5x GPU speedup. ## Usage Examples Run YOLOv8n benchmarks on all supported export formats including ONNX, TensorRT etc. See Arguments section below for a full list of export arguments. !!! Example === "Python" ```python from ultralytics.utils.benchmarks import benchmark # Benchmark on GPU benchmark(model='yolov8n.pt', data='coco8.yaml', imgsz=640, half=False, device=0) ``` === "CLI" ```bash yolo benchmark model=yolov8n.pt data='coco8.yaml' imgsz=640 half=False device=0 ``` ## Arguments Arguments such as `model`, `data`, `imgsz`, `half`, `device`, and `verbose` 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., `"yolov8n.pt"` for pre-trained 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: `"coco128.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"`, `"cuda:0"`, or a list of devices like `"cuda:0,1"` for multi-GPU setups. | | `verbose` | `False` | Controls the level of detail in logging output. A boolean value; set `verbose=True` for detailed logs or a float for thresholding errors. | ## Export Formats Benchmarks will attempt to run automatically on all possible export formats below. | Format | `format` Argument | Model | Metadata | Arguments | |--------------------------------------------------------------------|-------------------|---------------------------|----------|-----------------------------------------------------| | [PyTorch](https://pytorch.org/) | - | `yolov8n.pt` | ✅ | - | | [TorchScript](https://pytorch.org/docs/stable/jit.html) | `torchscript` | `yolov8n.torchscript` | ✅ | `imgsz`, `optimize` | | [ONNX](https://onnx.ai/) | `onnx` | `yolov8n.onnx` | ✅ | `imgsz`, `half`, `dynamic`, `simplify`, `opset` | | [OpenVINO](../integrations/openvino.md) | `openvino` | `yolov8n_openvino_model/` | ✅ | `imgsz`, `half`, `int8` | | [TensorRT](https://developer.nvidia.com/tensorrt) | `engine` | `yolov8n.engine` | ✅ | `imgsz`, `half`, `dynamic`, `simplify`, `workspace` | | [CoreML](https://github.com/apple/coremltools) | `coreml` | `yolov8n.mlpackage` | ✅ | `imgsz`, `half`, `int8`, `nms` | | [TF SavedModel](https://www.tensorflow.org/guide/saved_model) | `saved_model` | `yolov8n_saved_model/` | ✅ | `imgsz`, `keras`, `int8` | | [TF GraphDef](https://www.tensorflow.org/api_docs/python/tf/Graph) | `pb` | `yolov8n.pb` | ❌ | `imgsz` | | [TF Lite](https://www.tensorflow.org/lite) | `tflite` | `yolov8n.tflite` | ✅ | `imgsz`, `half`, `int8` | | [TF Edge TPU](https://coral.ai/docs/edgetpu/models-intro/) | `edgetpu` | `yolov8n_edgetpu.tflite` | ✅ | `imgsz` | | [TF.js](https://www.tensorflow.org/js) | `tfjs` | `yolov8n_web_model/` | ✅ | `imgsz`, `half`, `int8` | | [PaddlePaddle](https://github.com/PaddlePaddle) | `paddle` | `yolov8n_paddle_model/` | ✅ | `imgsz` | | [NCNN](https://github.com/Tencent/ncnn) | `ncnn` | `yolov8n_ncnn_model/` | ✅ | `imgsz`, `half` | See full `export` details in the [Export](https://docs.ultralytics.com/modes/export/) page.