cancel
Showing results for 
Search instead for 
Did you mean: 

STM32N6 neural network inference gives random results.

devjalx
Associate

Hi all,

I attached my project (CMake using STM32Cube for VSCode) that generates this behavior. 

I am trying to make a neural network run on the NPU of the STM32N6. I was following this tutorial: https://community.st.com/t5/stm32-mcus/how-to-build-an-ai-application-from-scratch-on-the-nucleo-n657x0/ta-p/828502 , except that I use XIP instead of loading the program to the RAM and use a custom small NN from an .onnx file (also included in the attatched .zip). However, the neural network returns wrong values independent of the inputs and when resetting, the values change.

My suspicion is that it has something to do with the cache. However, I am cleaning and invalidating the cache as recommended here: https://community.st.com/t5/edge-ai/the-output-of-a-relative-big-model-is-different-even-if-giving/td-p/811283 (except that I use the function mcu_cache_clean_invalidate_range, which the tutorial recommends)

I also save the weights to the flash and not the RAM, which was the problem here: https://community.st.com/t5/edge-ai/problems-with-inference-using-nucleo-n657x0-q/td-p/792235 . program.sh shows how I load the program + weights to the flash.

Do you have an idea what could be the problem?

Best,

devjalx

 

 

0 REPLIES 0