cancel
Showing results for 
Search instead for 
Did you mean: 

How to use custom AI model for Stm32n6570?

Anhem
Associate III

My question is same the title. I know that you have zoo model with custom training script to training or fine tuning based on provided model. But I have a new model, that is trained in other environment, I exported it to ONNX. How can I deploy this model to this board? Thank you.

13 REPLIES 13
Anhem
Associate III

Hi @Julian E. 

Have a nice day.

Maybe you missed my above question. Please take a look.

Thank you.

Hello @Anhem,

 

Indeed, I forgot to answer sorry.

In my opinion, we still lack easy tutorial, starting from zero, integrating simple CNN and creating a small demo as you mentioned. We are working on it.

 

In the meantime, we already have some materials:

 

STM32N6 (DK board) getting started:

STM32N6-AI - AI software ecosystem for STM32N6 with Neural-ART accelerator - STMicroelectronics

Standalone or used with model zoo, you can find application example and source code for multiple use cases (image classification, object detection, segmentation etc).

In the docs, you can find how to integrate your own model manually, or you can find how to do it with model zoo here (image classification example): 

https://github.com/STMicroelectronics/stm32ai-modelzoo-services/blob/main/object_detection/deployment/README_STM32N6.md 

 

N6, NPU and ST Edge AI Core documentation:

You can find most information here: https://stedgeai-dc.st.com/assets/embedded-docs/index.html 

I would look in particular to these:

 

Then you also have X Cube AI for cube MX to generate a project for any MCU and integrate your model:

https://www.st.com/en/embedded-software/x-cube-ai.html#documentation 

This document in particular: https://www.st.com/resource/en/user_manual/um2526-getting-started-with-xcubeai-expansion-package-for-artificial-intelligence-ai-stmicroelectronics.pdf 

 

Have a good day,

Julian

 


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @Julian E. 

Good morning.

In my opinion, we still lack easy tutorial, starting from zero, integrating simple CNN and creating a small demo as you mentioned. We are working on it.

Yes. That's good news. I am looking forward to see it. Please notify me when we have completed. I think that it is worth to build custom model from scratch, especially for beginnners.

Thanks for sharing other materials, I known these materials.

 

 

I deployed the model following this tutorial https://stm32ai-cs.st.com/assets/embedded-docs/stneuralart_getting_started.html , and the command executed successfully afterward.

python D:\stm32edgeai\stedgeai\2.1\scripts\N6_scripts\n6_loader.py

05/26/2025 03:09:42 PM  __main__ -- Preparing compiler GCC
05/26/2025 03:09:42 PM  __main__ -- Setting a breakpoint in main.c at line 125 (before the infinite loop)
05/26/2025 03:09:42 PM  __main__ -- Copying network.c to project: -> D:\stm32edgeai\stedgeai\2.1\Projects\STM32N6570-DK\Applications\NPU_Validation\X-CUBE-AI\App\network.c
05/26/2025 03:09:42 PM  __main__ -- Extracting information from the c-file
05/26/2025 03:09:42 PM  __main__ -- Converting memory files in results/<model>/generation/ to Intel-hex with proper offsets
05/26/2025 03:09:42 PM  __main__ -- arm-none-eabi-objcopy.exe --change-addresses 0x71000000 -Ibinary -Oihex network_atonbuf.xSPI2.raw network_atonbuf.xSPI2.hex
05/26/2025 03:09:43 PM  __main__ -- Resetting the board...
05/26/2025 03:09:44 PM  __main__ -- Flashing memory xSPI2 -- 14.625 kB
05/26/2025 03:09:46 PM  __main__ -- Building project (conf= N6-DK)
05/26/2025 03:09:47 PM  __main__ -- Loading internal memories & Running the program
05/26/2025 03:09:50 PM  __main__ -- Start operation achieved successfully

However, when I run the following command, it keeps throwing an error.

python D:/stm32edgeai/stedgeai/2.1/scripts/ai_runner/examples/checker.py ^
More?   -d serial:COM9:921600 ^
More?   --input-file D:/stm32aibushu/input_data.npy ^
More?   --perf-only -b 32

Creating AiRunner session with `Namespace(desc='serial:COM9:921600', batch=32, name=None, input_file='D:/stm32aibushu/input_data.npy', perf_only=True, io_only=False, with_data=False, show_tensors=False, verbosity=0, debug=False)`
ERR: No c-model available, use the --desc/-d option to specifiy a valid path/descriptor
 E801(HwIOError): Invalid firmware - COM9:921600

 Would you happen to know how to fix this issue? Thanks!