2025-09-10 2:39 AM - edited 2025-09-10 2:52 AM
Hi everyone,
I’m currently working on deploying a YOLOv8 model on the STM32MP25 using ST Edge AI. Here’s what I’ve done so far and where I’m stuck.
Training & Export:
ONNX model details:
Input: [1, 3, 256, 256], float32
Output: [1, 5, 1344], float32
I successfully converted it to .nb using:
This produces a model in float16 (I tried to run this but it did not work).
Problem:
STM32MP2 works with uint8 models, so I tried converting input/output to uint8:
This fails during compilation with:
Observation:
The normally .nb file is generating, without conversion.
Explicitly trying uint8 fails.
The error suggests the ST Edge AI compiler doesn’t support direct uint8 conversion for this ONNX model.
My Question:
Has anyone successfully converted a YOLOv8 ONNX model to uint8 for STM32MP25? Are there recommended steps for preparing the model for uint8 quantization?
Any advice on preprocessing, exporting, or using ST tools to get a uint8-ready model would be highly appreciated.
Thanks!
Aman
2025-09-15 11:37 PM
Hello @20DeViL00,
You need to use an int8 model.
In your command:
model.export( format="onnx", imgsz=256, opset=10, dynamic=False, simplify=True, half=False, int8=True )
The AI MP2 team also recommend to use Tflite if you can, as it seems to work better in most case:
model.export( format="tflite", ... , int8=True )
Then you can do your generate.
The --input-data-type uint8 --output-data-type uint8 only add layers to fit the type you want in input and output. It does not change the model.
Have a good day,
Julian
2025-09-17 5:15 AM - edited 2025-09-17 5:18 AM
Hi @Julian E.,
Thanks for the clarification regarding the int8 export. I tried following your suggestion. Here’s what I did:
Then I ran the ST Edge AI generate command:
But I’m hitting this error:
It seems the model isn’t compiling for STM32MP2.
Thanks again for the guidance!
Aman Sharma
2025-09-17 6:39 AM - edited 2025-09-17 7:52 AM
Hello @20DeViL00,
It seems that in ONNX the arg int8 do not work ( https://docs.ultralytics.com/modes/export/#export-formats).
So you can try to use TFLITE instead or get your non quantized model, then quantize it manually before doing the generate.
Have a good day,
Julian
2025-09-17 6:54 AM