majianjia / nnom

A higher-level Neural Network library for microcontrollers.
Apache License 2.0
820 stars 235 forks source link

Output of the neural network on MCU #145

Open siddhant0718 opened 2 years ago

siddhant0718 commented 2 years ago

I implemented a neural network on a small size dataset using the reference of the auto-test sample. After loading the library on CCS and into the MCU, I am trying to check if the model is successfully able to predict the outputs based on the given inputs. However, after building the code and debugging it for the MCU, the MCU creates a 'result.csv' file as per the sample code but does not fill any data into it. I was wondering what the output would look like in case of the modified sample project where I am predicting the probability of different labels just like we do in the mnist dataset. Specifically, I am confused with this snippet of code in the 'main.c' file:

model = nnom_model_create(); // create NNoM model pre = prediction_create(model, nnom_output_data, sizeof(nnom_output_data), 4); // 10 classes, get top-4 ...... //nnom_predict(model, &label, &prob); // this will work independently prediction_run(pre, true_label[i], &label, &prob); // this provide more info but requires prediction API // save results printf(fp, "%d,%f\n", label, prob);


Here, I am not sure if the prediction_run() function will indeed write the predictions into the pre structure - as I am uncertain about what 'requires prediction API' means. Also, instead if I use the nnom_predict() function - what exactly should the output look like if I check the value of the variable or print it out.
Please let me know if any additional information is needed. Thanks!!