Unable to get proper output for MNIST digit recognition CNN Implementation using Keras and STM32Cube AI.
I'm trying to Implement basic MNIST Handwritten Digit recognition Model on STM32F769 DISC1 kit using STM Cube AI.
Here are the steps I followed.
- Took a standard MNIST Digit recognition model from here https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/digits_recognition_cnn/digits_recognition_cnn.ipynb
It is provided by google colab.
2. downloaded the .h5 file
3 Created the project using STM32CUBE MX, in that included the STM32 CUBE AI Software pack. Included the core and selected application as 'application template'
4 Using keeping other initializations default and selecting clock frequency 216 MHz, I generated the code.
5 kept main program untouched (where MX_X_CUBE_AI_Process(); is called in while(1) loop.
6 in app_x-cube-ai.c file made the modifications as told in 'Embedded Interface Client API' in documentation.
Here I have no device to actually record the handwritten digit, therefore I copied one of the training dataset sample manually from ipython notebook and saved it in array in app_x-cube-ai.c file. Note that my training was done for the values originally 0 to 255 normalized to 0 to 1.
as stated ,I saved the pixel values for one of the digit in an array called 'imgarray' which is equal to the size 28 x 28. the datatype of 'imgarray' i kept as ai_double.
7 on running the inference in debug mode, I found the output (which were stored in an array out_data[10].) unsatisfactory.
8 moreover, the most concerning this is that even if i changed the value of 'imgarray' with pixel values of different digit, the output result in the 'out_data' array REMAINS EXACTLY THE SAME
Is there anything that I'm doing wrong fundamentally.
Request my fellow developers on STCommunity to guide me.
