This commit is contained in:
Qiea
2024-11-12 14:53:30 +08:00
parent 572b24f867
commit 8c9b256242
2 changed files with 10 additions and 5 deletions

View File

@@ -321,11 +321,12 @@ void cnn_run(){
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>100 * 100 <20><><EFBFBD><EFBFBD>
float* _data = generateMatrix(data,&value[0]);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ磡<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ:%f ƽ<><C6BD>ֵ:%f <20><>׼<EFBFBD><D7BC>:%f\r\n",value[0],value[1],value[2]);
DEBUG_PRINTF("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ磡<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ:%f ƽ<><C6BD>ֵ:%f <20><>׼<EFBFBD><D7BC>:%f\r\n",value[0],value[1],value[2]);
char* _uuid = uuid();
send_blocks(_data,_uuid);
//<2F><>һ<EFBFBD><EFBFBD><E3A3BA><EFBFBD><EFBFBD>102 * 102
DEBUG_PRINTF("<EFBFBD><EFBFBD>һ<EFBFBD>ʼ\n");
float* expand_matrix_1 = expand(_data, 100, 1);
float* conv_rlst_1 = convolution(conv1_weight,conv1_bias,expand_matrix_1, 102);
float* pool_rslt_1 = pooling(conv1_weight, conv_rlst_1, 100);
@@ -338,6 +339,7 @@ void cnn_run(){
conv_rlst_1 = NULL;
//<2F>ڶ<EFBFBD><DAB6><EFBFBD><E3A3BA><EFBFBD><EFBFBD>32 * 52 * 52
DEBUG_PRINTF("<EFBFBD>ڶ<EFBFBD><EFBFBD>ʼ\n");
float* expand_matrix_2 = expand(pool_rslt_1, 50, 32);
float* conv_rlst_2 = convolution(conv2_weight,conv2_bias,expand_matrix_2, 52);
float* pool_rslt_2 = pooling(conv2_weight, conv_rlst_2, 50);
@@ -350,6 +352,7 @@ void cnn_run(){
conv_rlst_2 = NULL;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E3A3BA><EFBFBD><EFBFBD> 64 * 27 * 27
DEBUG_PRINTF("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ\n");
float* expand_matrix_3 = expand(pool_rslt_2, 25, 64);
float* conv_rlst_3 = convolution(conv3_weight,conv3_bias,expand_matrix_3, 27);
float* pool_rslt_3 = pooling(conv3_weight, conv_rlst_3, 25);
@@ -361,10 +364,12 @@ void cnn_run(){
myfree(SRAMEX,conv_rlst_3);
conv_rlst_3 = NULL;
DEBUG_PRINTF("<EFBFBD><EFBFBD><EFBFBD>IJ㿪ʼ\n");
float* affine1_rslt = hidden(pool_rslt_3);
DEBUG_PRINTF("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ\r\n");
float* affine2_rslt = output(affine1_rslt);
printf("<EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>%f\r\n",calculate_probabilities(affine2_rslt));
printf("<EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>%f\n",calculate_probabilities(affine2_rslt));
printf("Label is:%d\r\n",calculate_layer(affine2_rslt));
myfree(SRAMEX,pool_rslt_3);
@@ -375,6 +380,6 @@ void cnn_run(){
affine2_rslt = NULL;
} else{
printf("δ<EFBFBD>ŵ磡<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ:%f ƽ<><C6BD>ֵ:%f <20><>׼<EFBFBD><D7BC>:%f\r\n",value[0],value[1],value[2]);
DEBUG_PRINTF("δ<EFBFBD>ŵ磡<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ:%f ƽ<><C6BD>ֵ:%f <20><>׼<EFBFBD><D7BC>:%f\r\n",value[0],value[1],value[2]);
}
}

View File

@@ -44,7 +44,7 @@ void send_blocks(float* arr, char* uuid_str){
memset(_block, 0 ,sizeof(char)*100*100);
block_index = 0; // <20><><EFBFBD>ÿ<EFBFBD>
sprintf(_block, "{\"uuid\":\"%s\",\"Bid\":\"%d\",\"Eid\":\"%d\",\"Block\":\"%s\"}\n", uuid_str, total_len++, _total_len, block);
printf("%s", _block);
DEBUG_PRINTF("%s", _block);
myfree(SRAMEX,_block);
_block = NULL;
}
@@ -57,7 +57,7 @@ void send_blocks(float* arr, char* uuid_str){
memset(_block, 0 ,sizeof(char)*100*100);
block_index = 0;
sprintf(_block, "{\"uuid\":\"%s\",\"Bid\":\"%d\",\"Eid\":\"%d\",\"Block\":\"%s\"}\n", uuid_str, total_len, _total_len, block);
printf("%s", _block);
DEBUG_PRINTF("%s", _block);
myfree(SRAMEX,_block);
_block = NULL;
}