From 962756bbdb86161dfbaf2e7b418f85dbce0b830d Mon Sep 17 00:00:00 2001 From: Qiea <1310371422@qq.com> Date: Wed, 13 Nov 2024 12:19:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=8A=9F=E8=83=BD=EF=BC=9A?= =?UTF-8?q?=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit is1300000 //1为跑原始数据 0为跑100矩阵 --- cnn.c | 4 ++-- cnn_model.h | 13 ++++++++----- main.c | 16 ++++++++++------ 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/cnn.c b/cnn.c index 1833785..ae26b6c 100644 --- a/cnn.c +++ b/cnn.c @@ -306,13 +306,13 @@ u8 calculate_layer(Model model_w, float *input_array){ predict_num = n; // 记录最大值对应的类别索引 } } - print_rslt(input_array,7,7); + print_rslt(input_array,input_num,input_num); return predict_num+0; } void cnn_run(){ -#if is1250000 +#if is1300000 float value[3] = {0}; calculate_statistics(data,&value[0]); if (check_threshold(data,&value[0])){ diff --git a/cnn_model.h b/cnn_model.h index 233e1e3..35332c5 100644 --- a/cnn_model.h +++ b/cnn_model.h @@ -32,14 +32,17 @@ typedef struct { #define CONV3_WEIGHT_ARRSIZE (128*64*3*3) //73728 #define FC1_BIAS_ARRSIZE (128) #define FC1_WEIGHT_ARRSIZE (128*18432) //2359296 -#define FC2_BIAS_ARRSIZE (7) -#define FC2_WEIGHT_ARRSIZE (7*128) //896 + +#define FC2_BIAS_ARRSIZE (4) +#define FC2_WEIGHT_ARRSIZE (4*128) //896 #define FC2_WEIGHT_KERNELS 4 //4个卷积核 -#define is1250000 1 -#if is1250000 - #define DATA_ARRSIZE (1250000) + +//1为跑原始数据 0为跑100矩阵 +#define is1300000 0 +#if is1300000 + #define DATA_ARRSIZE (1300000) #else #define DATA_ARRSIZE (100 * 100) #endif diff --git a/main.c b/main.c index b65481d..8f9cdd9 100644 --- a/main.c +++ b/main.c @@ -70,7 +70,7 @@ void run_dataset(){ "filtered_C1autosave00039_right_new", "filtered_C1autosave00062_right_new", }; - char* modelusearr_out[] = { + char* modelusearr_output[] = { "split_1", "split_2", "split_3", @@ -84,9 +84,9 @@ void run_dataset(){ }; /* 可用数据集如下 * modelusearr_origin - * modelusearr_out + * modelusearr_output */ - #define modelusearr modelusearr_origin + #define modelusearr modelusearr_output for(int a=0;a<(sizeof(modelusearr) / sizeof(modelusearr[0]));a++){ SDRAM_USED(); model_switchdata(modelusearr[a]); @@ -96,13 +96,17 @@ void run_dataset(){ } + int main(){ model_init(); model_write("all"); - run_dataset(); -// model_switchdata("7E29181C 2024-11-12 19-13-55"); -// cnn_run(); +#if is1300000 + run_dataset(); +#else + model_switchdata("EEC30B3F 2024-11-13 11-49-24"); + cnn_run(); +#endif DEBUG_PRINTF("\r\nEnd结束"); }