-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
model.export to TFLite with int8 doesn't yield a fully int8 quantized model #16090
Comments
@nicklasb thank you for reporting this issue. The INT8 quantization process requires a representative dataset to calibrate the model properly. Please ensure you're providing this dataset during export. For more details, you can refer to our TFLite export documentation. If you have further insights or a solution, feel free to submit a PR. |
Hi, @glenn-jocher, thanks for the reply:
|
@nicklasb thank you for your feedback. We'll review the documentation to ensure clarity on the representative dataset requirement for INT8 quantization. If you encounter any specific issues or have further insights, feel free to share them. Your willingness to contribute is appreciated. |
But is this a bug or not? I am not sure I understand your answer...I have no avenues forward from this. |
I'm sorry for any confusion. This appears to be a limitation with the current export process for TFLite Micro. We're looking into it, but if immediate support is crucial, you might consider other models for now. |
Sorry If I am a bit persistent, but I need to know if Ultralytics intends or doesn't intend not persue tflite micro as a supported use case for me to consider the framework for future use. Feels a little bit like you going AI on me. :-) |
We understand your concern. Currently, full support for TFLite Micro isn't available, but we're evaluating future possibilities. For immediate needs, you might explore other options. |
I encounter same problem, exporting
but |
Thank you for sharing your experience. We're aware of the issue with INT8 export for TFLite and are investigating it. For now, using FP32 or FP16 is recommended. |
@glenn-jocher if now I have to switch to other yolo mobile solution like |
I think it is better if Ultralytics fix the int8 support. :-) |
We understand the importance of INT8 support and are looking into it. Meanwhile, using FP16 or FP32 with the yolo-flutter-app is a viable option. Thank you for your patience. |
after debugging, I found that more details here ultralytics/yolo-flutter-app#61 (comment). yeah, |
Thank you for confirming the support for FP16 and FP32 in the yolo-flutter-app. We appreciate your feedback on INT8 support and are working on improvements. |
It looks like it works for YOLO11n:
Creates a valid export. But crashes with |
Thanks for pointing that out! The issue might be related to input tensor limits in TFLite. We'll investigate further to ensure consistent INT8 export functionality. You can monitor updates in #18083. |
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help. For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed! Thank you for your contributions to YOLO 🚀 and Vision AI ⭐ |
Search before asking
Ultralytics YOLO Component
Export
Bug
In my view, this, when run on a nano model, should yield a fully quantized int8 model regardless of input.
model.export(format='tflite', int8=True)
Instead, using the exported model TFLite Micro will raise the "Hybrid models are not supported on TFLite Micro.", which is raised then the input type is different from the filter type.
Note that this was not an issue on the YoloV5 export. I am not sure how the "representative" dataset is used now, but even though the data parameter is possible to set, but is not in the docs?
Environment
Ultralytics YOLOv8.2.90 🚀 Python-3.12.6 torch-2.4.1+cpu CPU (AMD Ryzen 7 7735U with Radeon Graphics)
Setup complete ✅ (16 CPUs, 31.2 GB RAM, 397.0/952.4 GB disk)
OS Windows-11-10.0.22631-SP0
Environment Windows
Python 3.12.6
Install git
RAM 31.25 GB
CPU AMD Ryzen 7 7735U with Radeon Graphics
CUDA None
numpy ✅ 1.26.4<2.0.0,>=1.23.0
matplotlib ✅ 3.9.2>=3.3.0
opencv-python ✅ 4.10.0.84>=4.6.0
pillow ✅ 10.4.0>=7.1.2
pyyaml ✅ 6.0.2>=5.3.1
requests ✅ 2.32.3>=2.23.0
scipy ✅ 1.14.1>=1.4.1
torch ✅ 2.4.1>=1.8.0
torchvision ✅ 0.19.1>=0.9.0
tqdm ✅ 4.66.5>=4.64.0
psutil ✅ 6.0.0
py-cpuinfo ✅ 9.0.0
pandas ✅ 2.2.2>=1.1.4
seaborn ✅ 0.13.2>=0.11.0
ultralytics-thop ✅ 2.0.6>=2.0.0
torch ✅ 2.4.1!=2.4.0,>=1.8.0; sys_platform == "win32"
Minimal Reproducible Example
In my view, this, run on a nano model should yield a fully quantized model regardless of input:
model.export(format='tflite', int8=True)
Instead it seems to create a model with different types, at least according to TFLite micro.
Additional
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: