From 0901bbae87e8845294272b93307ec33f9c34658d Mon Sep 17 00:00:00 2001 From: majianjia Date: Sat, 30 Mar 2019 23:06:39 +0000 Subject: [PATCH] change according to new APIs --- examples/mnist-simple/mcu/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/mnist-simple/mcu/main.c b/examples/mnist-simple/mcu/main.c index 48ed5c9..24b55f9 100644 --- a/examples/mnist-simple/mcu/main.c +++ b/examples/mnist-simple/mcu/main.c @@ -54,7 +54,7 @@ void mnist(int argc, char** argv) { uint32_t tick, time; uint32_t predic_label; - uint32_t prob; + float prob; int32_t index = atoi(argv[1]); if(index >= TOTAL_IMAGE || argc != 2) @@ -68,7 +68,7 @@ void mnist(int argc, char** argv) // copy data and do prediction memcpy(nnom_input_data, (int8_t*)&img[index][0], 784); - nnom_predic_one(model, predic_label, prob); + nnom_predic(model, &predic_label, &prob); time = rt_tick_get() - tick; //print original image to console @@ -76,7 +76,8 @@ void mnist(int argc, char** argv) printf("Time: %d tick\n", time); printf("Truth label: %d\n", label[index]); - printf("Predicted label: %d\n", result); + printf("Predicted label: %d\n", predic_label); + printf("Probability: %d%%\n", (int)(prob*100)); } FINSH_FUNCTION_EXPORT(mnist, mnist(4) );