实现功能:切换

is1300000 //1为跑原始数据   0为跑100矩阵
This commit is contained in:
Qiea
2024-11-13 12:19:44 +08:00
parent c57a8cb786
commit 962756bbdb
3 changed files with 20 additions and 13 deletions

4
cnn.c
View File

@@ -306,13 +306,13 @@ u8 calculate_layer(Model model_w, float *input_array){
predict_num = n; // 记录最大值对应的类别索引 predict_num = n; // 记录最大值对应的类别索引
} }
} }
print_rslt(input_array,7,7); print_rslt(input_array,input_num,input_num);
return predict_num+0; return predict_num+0;
} }
void cnn_run(){ void cnn_run(){
#if is1250000 #if is1300000
float value[3] = {0}; float value[3] = {0};
calculate_statistics(data,&value[0]); calculate_statistics(data,&value[0]);
if (check_threshold(data,&value[0])){ if (check_threshold(data,&value[0])){

View File

@@ -32,14 +32,17 @@ typedef struct {
#define CONV3_WEIGHT_ARRSIZE (128*64*3*3) //73728 #define CONV3_WEIGHT_ARRSIZE (128*64*3*3) //73728
#define FC1_BIAS_ARRSIZE (128) #define FC1_BIAS_ARRSIZE (128)
#define FC1_WEIGHT_ARRSIZE (128*18432) //2359296 #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 FC2_WEIGHT_KERNELS 4 //4个卷积核
#define is1250000 1
#if is1250000 //1为跑原始数据 0为跑100矩阵
#define DATA_ARRSIZE (1250000) #define is1300000 0
#if is1300000
#define DATA_ARRSIZE (1300000)
#else #else
#define DATA_ARRSIZE (100 * 100) #define DATA_ARRSIZE (100 * 100)
#endif #endif

16
main.c
View File

@@ -70,7 +70,7 @@ void run_dataset(){
"filtered_C1autosave00039_right_new", "filtered_C1autosave00039_right_new",
"filtered_C1autosave00062_right_new", "filtered_C1autosave00062_right_new",
}; };
char* modelusearr_out[] = { char* modelusearr_output[] = {
"split_1", "split_1",
"split_2", "split_2",
"split_3", "split_3",
@@ -84,9 +84,9 @@ void run_dataset(){
}; };
/* 可用数据集如下 /* 可用数据集如下
* modelusearr_origin * 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++){ for(int a=0;a<(sizeof(modelusearr) / sizeof(modelusearr[0]));a++){
SDRAM_USED(); SDRAM_USED();
model_switchdata(modelusearr[a]); model_switchdata(modelusearr[a]);
@@ -96,13 +96,17 @@ void run_dataset(){
} }
int main(){ int main(){
model_init(); model_init();
model_write("all"); model_write("all");
run_dataset();
// model_switchdata("7E29181C 2024-11-12 19-13-55"); #if is1300000
// cnn_run(); run_dataset();
#else
model_switchdata("EEC30B3F 2024-11-13 11-49-24");
cnn_run();
#endif
DEBUG_PRINTF("\r\nEnd结束"); DEBUG_PRINTF("\r\nEnd结束");
} }