Update YOLO11 Actions and Docs (#16596)

Signed-off-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Ultralytics Assistant 2024-10-01 16:58:12 +02:00 committed by GitHub
parent 51e93d6111
commit 97f38409fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
124 changed files with 1948 additions and 1948 deletions

View file

@ -1,10 +1,10 @@
---
comments: true
description: Learn how to convert YOLOv8 models to TFLite for edge device deployment. Optimize performance and ensure seamless execution on various platforms.
keywords: YOLOv8, TFLite, model export, TensorFlow Lite, edge devices, deployment, Ultralytics, machine learning, on-device inference, model optimization
description: Learn how to convert YOLO11 models to TFLite for edge device deployment. Optimize performance and ensure seamless execution on various platforms.
keywords: YOLO11, TFLite, model export, TensorFlow Lite, edge devices, deployment, Ultralytics, machine learning, on-device inference, model optimization
---
# A Guide on YOLOv8 Model Export to TFLite for Deployment
# A Guide on YOLO11 Model Export to TFLite for Deployment
<p align="center">
<img width="75%" src="https://github.com/ultralytics/docs/releases/download/0/tflite-logo.avif" alt="TFLite Logo">
@ -12,7 +12,7 @@ keywords: YOLOv8, TFLite, model export, TensorFlow Lite, edge devices, deploymen
Deploying [computer vision](https://www.ultralytics.com/glossary/computer-vision-cv) models on edge devices or embedded devices requires a format that can ensure seamless performance.
The TensorFlow Lite or TFLite export format allows you to optimize your [Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics) models for tasks like [object detection](https://www.ultralytics.com/glossary/object-detection) and [image classification](https://www.ultralytics.com/glossary/image-classification) in edge device-based applications. In this guide, we'll walk through the steps for converting your models to the TFLite format, making it easier for your models to perform well on various edge devices.
The TensorFlow Lite or TFLite export format allows you to optimize your [Ultralytics YOLO11](https://github.com/ultralytics/ultralytics) models for tasks like [object detection](https://www.ultralytics.com/glossary/object-detection) and [image classification](https://www.ultralytics.com/glossary/image-classification) in edge device-based applications. In this guide, we'll walk through the steps for converting your models to the TFLite format, making it easier for your models to perform well on various edge devices.
## Why should you export to TFLite?
@ -34,7 +34,7 @@ TFLite models offer a wide range of key features that enable on-device machine l
## Deployment Options in TFLite
Before we look at the code for exporting YOLOv8 models to the TFLite format, let's understand how TFLite models are normally used.
Before we look at the code for exporting YOLO11 models to the TFLite format, let's understand how TFLite models are normally used.
TFLite offers various on-device deployment options for machine learning models, including:
@ -48,7 +48,7 @@ TFLite offers various on-device deployment options for machine learning models,
- **Deploying with Microcontrollers**: TFLite models can also be deployed on microcontrollers and other devices with only a few kilobytes of memory. The core runtime just fits in 16 KB on an Arm Cortex M3 and can run many basic models. It doesn't require operating system support, any standard C or C++ libraries, or dynamic memory allocation.
## Export to TFLite: Converting Your YOLOv8 Model
## Export to TFLite: Converting Your YOLO11 Model
You can improve on-device model execution efficiency and optimize performance by converting them to TFLite format.
@ -61,15 +61,15 @@ To install the required packages, run:
=== "CLI"
```bash
# Install the required package for YOLOv8
# Install the required package for YOLO11
pip install ultralytics
```
For detailed instructions and best practices related to the installation process, check our [Ultralytics Installation guide](../quickstart.md). While installing the required packages for YOLOv8, if you encounter any difficulties, consult our [Common Issues guide](../guides/yolo-common-issues.md) for solutions and tips.
For detailed instructions and best practices related to the installation process, check our [Ultralytics Installation guide](../quickstart.md). While installing the required packages for YOLO11, if you encounter any difficulties, consult our [Common Issues guide](../guides/yolo-common-issues.md) for solutions and tips.
### Usage
Before diving into the usage instructions, it's important to note that while all [Ultralytics YOLOv8 models](../models/index.md) are available for exporting, you can ensure that the model you select supports export functionality [here](../modes/export.md).
Before diving into the usage instructions, it's important to note that while all [Ultralytics YOLO11 models](../models/index.md) are available for exporting, you can ensure that the model you select supports export functionality [here](../modes/export.md).
!!! example "Usage"
@ -78,14 +78,14 @@ Before diving into the usage instructions, it's important to note that while all
```python
from ultralytics import YOLO
# Load the YOLOv8 model
model = YOLO("yolov8n.pt")
# Load the YOLO11 model
model = YOLO("yolo11n.pt")
# Export the model to TFLite format
model.export(format="tflite") # creates 'yolov8n_float32.tflite'
model.export(format="tflite") # creates 'yolo11n_float32.tflite'
# Load the exported TFLite model
tflite_model = YOLO("yolov8n_float32.tflite")
tflite_model = YOLO("yolo11n_float32.tflite")
# Run inference
results = tflite_model("https://ultralytics.com/images/bus.jpg")
@ -94,18 +94,18 @@ Before diving into the usage instructions, it's important to note that while all
=== "CLI"
```bash
# Export a YOLOv8n PyTorch model to TFLite format
yolo export model=yolov8n.pt format=tflite # creates 'yolov8n_float32.tflite'
# Export a YOLO11n PyTorch model to TFLite format
yolo export model=yolo11n.pt format=tflite # creates 'yolo11n_float32.tflite'
# Run inference with the exported model
yolo predict model='yolov8n_float32.tflite' source='https://ultralytics.com/images/bus.jpg'
yolo predict model='yolo11n_float32.tflite' source='https://ultralytics.com/images/bus.jpg'
```
For more details about the export process, visit the [Ultralytics documentation page on exporting](../modes/export.md).
## Deploying Exported YOLOv8 TFLite Models
## Deploying Exported YOLO11 TFLite Models
After successfully exporting your Ultralytics YOLOv8 models to TFLite format, you can now deploy them. The primary and recommended first step for running a TFLite model is to utilize the YOLO("model.tflite") method, as outlined in the previous usage code snippet. However, for in-depth instructions on deploying your TFLite models in various other settings, take a look at the following resources:
After successfully exporting your Ultralytics YOLO11 models to TFLite format, you can now deploy them. The primary and recommended first step for running a TFLite model is to utilize the YOLO("model.tflite") method, as outlined in the previous usage code snippet. However, for in-depth instructions on deploying your TFLite models in various other settings, take a look at the following resources:
- **[Android](https://ai.google.dev/edge/litert/android)**: A quick start guide for integrating [TensorFlow](https://www.ultralytics.com/glossary/tensorflow) Lite into Android applications, providing easy-to-follow steps for setting up and running [machine learning](https://www.ultralytics.com/glossary/machine-learning-ml) models.
@ -115,17 +115,17 @@ After successfully exporting your Ultralytics YOLOv8 models to TFLite format, yo
## Summary
In this guide, we focused on how to export to TFLite format. By converting your Ultralytics YOLOv8 models to TFLite model format, you can improve the efficiency and speed of YOLOv8 models, making them more effective and suitable for [edge computing](https://www.ultralytics.com/glossary/edge-computing) environments.
In this guide, we focused on how to export to TFLite format. By converting your Ultralytics YOLO11 models to TFLite model format, you can improve the efficiency and speed of YOLO11 models, making them more effective and suitable for [edge computing](https://www.ultralytics.com/glossary/edge-computing) environments.
For further details on usage, visit the [TFLite official documentation](https://ai.google.dev/edge/litert).
Also, if you're curious about other Ultralytics YOLOv8 integrations, make sure to check out our [integration guide page](../integrations/index.md). You'll find tons of helpful info and insights waiting for you there.
Also, if you're curious about other Ultralytics YOLO11 integrations, make sure to check out our [integration guide page](../integrations/index.md). You'll find tons of helpful info and insights waiting for you there.
## FAQ
### How do I export a YOLOv8 model to TFLite format?
### How do I export a YOLO11 model to TFLite format?
To export a YOLOv8 model to TFLite format, you can use the Ultralytics library. First, install the required package using:
To export a YOLO11 model to TFLite format, you can use the Ultralytics library. First, install the required package using:
```bash
pip install ultralytics
@ -136,24 +136,24 @@ Then, use the following code snippet to export your model:
```python
from ultralytics import YOLO
# Load the YOLOv8 model
model = YOLO("yolov8n.pt")
# Load the YOLO11 model
model = YOLO("yolo11n.pt")
# Export the model to TFLite format
model.export(format="tflite") # creates 'yolov8n_float32.tflite'
model.export(format="tflite") # creates 'yolo11n_float32.tflite'
```
For CLI users, you can achieve this with:
```bash
yolo export model=yolov8n.pt format=tflite # creates 'yolov8n_float32.tflite'
yolo export model=yolo11n.pt format=tflite # creates 'yolo11n_float32.tflite'
```
For more details, visit the [Ultralytics export guide](../modes/export.md).
### What are the benefits of using TensorFlow Lite for YOLOv8 [model deployment](https://www.ultralytics.com/glossary/model-deployment)?
### What are the benefits of using TensorFlow Lite for YOLO11 [model deployment](https://www.ultralytics.com/glossary/model-deployment)?
TensorFlow Lite (TFLite) is an open-source [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) framework designed for on-device inference, making it ideal for deploying YOLOv8 models on mobile, embedded, and IoT devices. Key benefits include:
TensorFlow Lite (TFLite) is an open-source [deep learning](https://www.ultralytics.com/glossary/deep-learning-dl) framework designed for on-device inference, making it ideal for deploying YOLO11 models on mobile, embedded, and IoT devices. Key benefits include:
- **On-device optimization**: Minimize latency and enhance privacy by processing data locally.
- **Platform compatibility**: Supports Android, iOS, embedded Linux, and MCU.
@ -161,33 +161,33 @@ TensorFlow Lite (TFLite) is an open-source [deep learning](https://www.ultralyti
To learn more, check out the [TFLite guide](https://ai.google.dev/edge/litert).
### Is it possible to run YOLOv8 TFLite models on Raspberry Pi?
### Is it possible to run YOLO11 TFLite models on Raspberry Pi?
Yes, you can run YOLOv8 TFLite models on Raspberry Pi to improve inference speeds. First, export your model to TFLite format as explained [here](#how-do-i-export-a-yolov8-model-to-tflite-format). Then, use a tool like TensorFlow Lite Interpreter to execute the model on your Raspberry Pi.
Yes, you can run YOLO11 TFLite models on Raspberry Pi to improve inference speeds. First, export your model to TFLite format as explained [here](#how-do-i-export-a-yolo11-model-to-tflite-format). Then, use a tool like TensorFlow Lite Interpreter to execute the model on your Raspberry Pi.
For further optimizations, you might consider using [Coral Edge TPU](https://coral.withgoogle.com/). For detailed steps, refer to our [Raspberry Pi deployment guide](../guides/raspberry-pi.md).
### Can I use TFLite models on microcontrollers for YOLOv8 predictions?
### Can I use TFLite models on microcontrollers for YOLO11 predictions?
Yes, TFLite supports deployment on microcontrollers with limited resources. TFLite's core runtime requires only 16 KB of memory on an Arm Cortex M3 and can run basic YOLOv8 models. This makes it suitable for deployment on devices with minimal computational power and memory.
Yes, TFLite supports deployment on microcontrollers with limited resources. TFLite's core runtime requires only 16 KB of memory on an Arm Cortex M3 and can run basic YOLO11 models. This makes it suitable for deployment on devices with minimal computational power and memory.
To get started, visit the [TFLite Micro for Microcontrollers guide](https://ai.google.dev/edge/litert/microcontrollers/overview).
### What platforms are compatible with TFLite exported YOLOv8 models?
### What platforms are compatible with TFLite exported YOLO11 models?
TensorFlow Lite provides extensive platform compatibility, allowing you to deploy YOLOv8 models on a wide range of devices, including:
TensorFlow Lite provides extensive platform compatibility, allowing you to deploy YOLO11 models on a wide range of devices, including:
- **Android and iOS**: Native support through TFLite Android and iOS libraries.
- **Embedded Linux**: Ideal for single-board computers such as Raspberry Pi.
- **Microcontrollers**: Suitable for MCUs with constrained resources.
For more information on deployment options, see our detailed [deployment guide](#deploying-exported-yolov8-tflite-models).
For more information on deployment options, see our detailed [deployment guide](#deploying-exported-yolo11-tflite-models).
### How do I troubleshoot common issues during YOLOv8 model export to TFLite?
### How do I troubleshoot common issues during YOLO11 model export to TFLite?
If you encounter errors while exporting YOLOv8 models to TFLite, common solutions include:
If you encounter errors while exporting YOLO11 models to TFLite, common solutions include:
- **Check package compatibility**: Ensure you're using compatible versions of Ultralytics and TensorFlow. Refer to our [installation guide](../quickstart.md).
- **Model support**: Verify that the specific YOLOv8 model supports TFLite export by checking [here](../modes/export.md).
- **Model support**: Verify that the specific YOLO11 model supports TFLite export by checking [here](../modes/export.md).
For additional troubleshooting tips, visit our [Common Issues guide](../guides/yolo-common-issues.md).