This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

No accuracy after exporting Caffe model on the microcontroller for MNIST Dataset

Hi All,

        I have trained and tested the Caffe model for the MNIST dataset which produces 85 to 90% accuracy when tested on Desktop computers. I have generated a header file after solving bugs in code_gen.py script. When exported on CMSIS-NN for testing image on the microcontroller, I only got 3% accuracy.

After changes in the parameter.h file as mentioned below.

Before changes 
#define DATA_RSHIFT 7
#define CONV1_BIAS_LSHIFT 6
#define CONV1_OUT_RSHIFT 10
After changes
 #define DATA_RSHIFT 1
#define CONV1_BIAS_LSHIFT 0
#define CONV1_OUT_RSHIFT 4
I am getting 28% accuracy. I have generated input image array data through a grayscale format which has a value range from 0 to 255. And fed input to the below code.
void mean_subtract(uint8_t* image_data) {
for(int i=0; i<DATA_OUT_CH*DATA_OUT_DIM*DATA_OUT_DIM; i++) {
    image_data[i] = (q7_t)__SSAT( ((int)(image_data[i]- mean[i]) >> DATA_RSHIFT), 8);
}
I don't where I am missing.