Showing results for 
Search instead for 
Did you mean: 

STM32F411RE CubeMX 5.6.1 generated simple AI project compiling OK, But gives error in MX_X_CUBE_AI_Process();

Associate II

I have a simple binary classification ANN model built with Tensorflow Keras and converted as Tensorflowlite model. This model gets imported and analyzed on the cubeMX tool without any errors. There is no IO input required for this trial model, so allowing random numbers for input features. Without any modifications to the code imported to STM32CubeIDE and build succeeds. While debugging, i can see that inside MX_X_CUBE_AI_Process() --> aiRun() method is returning error code 23 and error Type as 18.

Since the analyze function succeeded during code generation process, i expected that this code runs without any modification. Any suggestions please?

Associate II

I am using a simple dataset from following site and using tensorflow python model program as attached.

other information: X-CUBE-AI 5.1.1

Nucleo board: STM32F411RE

Associate II


Just posting the issue i found and workaround performed to get this done. There is some issue with TFlite converter program as of date. When tensorflow keras feature layer is included, it fails to properly function inside the STM32. I had to then revert to bare bone keras input layer building with numpy arrays and shapes defined. Once i included method, it imported well and also performs as expected in STM32.

note: dont forget to convert result output bytes back to float to infer the output in right way.

Attached is the revised python program.

All the best.