save
This commit is contained in:
@@ -14,7 +14,7 @@ Model fc2_bias;
|
||||
Model fc2_weight;
|
||||
Model data;
|
||||
|
||||
|
||||
float data_array[DATA_ARRSIZE] __attribute__((at(0XC0009C40)));
|
||||
|
||||
float* modelmym_init(char* model_name){
|
||||
if(conv1_bias.array == NULL && strcmp(model_name, "conv1_bias") == 0)
|
||||
@@ -37,8 +37,8 @@ float* modelmym_init(char* model_name){
|
||||
return fc2_bias.array = (float*)mymalloc(SRAMEX, FC2_BIAS_ARRSIZE * sizeof(float));
|
||||
else if(fc2_weight.array == NULL && strcmp(model_name, "fc2_weight") == 0)
|
||||
return fc2_weight.array = (float*)mymalloc(SRAMEX, FC2_WEIGHT_ARRSIZE * sizeof(float));
|
||||
else if(data.array == NULL && strcmp(model_name, "data") == 0)
|
||||
return data.array = (float*)mymalloc(SRAMEX, DATA_ARRSIZE * sizeof(float));
|
||||
// else if(data.array == NULL && strcmp(model_name, "data") == 0)
|
||||
// return data.array = (float*)mymalloc(SRAMEX, DATA_ARRSIZE * sizeof(float));
|
||||
else if(strcmp(model_name, "all") == 0){
|
||||
if(conv1_bias.array == NULL)conv1_bias.array = (float*)mymalloc(SRAMEX, CONV1_BIAS_ARRSIZE * sizeof(float));
|
||||
if(conv1_weight.array == NULL)conv1_weight.array = (float*)mymalloc(SRAMEX, CONV1_WEIGHT_ARRSIZE * sizeof(float));
|
||||
@@ -50,7 +50,7 @@ float* modelmym_init(char* model_name){
|
||||
if(fc1_weight.array == NULL)fc1_weight.array = (float*)mymalloc(SRAMEX, FC1_WEIGHT_ARRSIZE * sizeof(float));
|
||||
if(fc2_bias.array == NULL)fc2_bias.array = (float*)mymalloc(SRAMEX, FC2_BIAS_ARRSIZE * sizeof(float));
|
||||
if(fc2_weight.array == NULL)fc2_weight.array = (float*)mymalloc(SRAMEX, FC2_WEIGHT_ARRSIZE * sizeof(float));
|
||||
if(data.array == NULL)data.array = (float*)mymalloc(SRAMEX, DATA_ARRSIZE * sizeof(float));
|
||||
// if(data.array == NULL)data.array = (float*)mymalloc(SRAMEX, DATA_ARRSIZE * sizeof(float));
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -119,9 +119,9 @@ u8 modelmym_free(char* model_name){
|
||||
return 1;
|
||||
}
|
||||
else if(data.array != NULL && strcmp(model_name, "data") == 0){
|
||||
myfree(SRAMEX,data.array);
|
||||
data.array = NULL;
|
||||
data.realength = 0;
|
||||
// myfree(SRAMEX,data.array);
|
||||
memset(data.array, 0 ,data.maxlength);
|
||||
// data.realength = 0;
|
||||
return 1;
|
||||
}
|
||||
else if(strcmp(model_name, "all") == 0){
|
||||
@@ -173,7 +173,7 @@ u8 model_write(char* model_name)
|
||||
Model *_model = model(model_name);
|
||||
|
||||
if(_model == NULL || strcmp(model_name, "data") == 0){
|
||||
sprintf(_path, "0:/dataset/_data/%s.txt", model_name);
|
||||
sprintf(_path, "dataset/_data/%s.txt", model_name);
|
||||
if(f_open(file, (const TCHAR *)_path, 1)){
|
||||
DEBUG_PRINTF("\r\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>ģ<EFBFBD>ͻ<EFBFBD>Data<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\n");
|
||||
return 199;
|
||||
@@ -184,7 +184,7 @@ u8 model_write(char* model_name)
|
||||
}
|
||||
|
||||
if(_model -> dname == NULL){
|
||||
sprintf(_path, "0:/dataset/%s.txt", _model -> name);
|
||||
sprintf(_path, "dataset/%s.txt", _model -> name);
|
||||
if(f_open(file, (const TCHAR *)_path, 1)){
|
||||
DEBUG_PRINTF("Ԥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>ͣ<EFBFBD>[%s]\r\n", _path);
|
||||
return 4;
|
||||
@@ -197,7 +197,7 @@ u8 model_write(char* model_name)
|
||||
}
|
||||
|
||||
if(_model -> dname)sprintf(_datapath, "_data/%s", _model -> dname);
|
||||
sprintf(_path, "0:/dataset/%s.txt", _model -> dname ? _datapath : _model -> name);
|
||||
sprintf(_path, "dataset/%s.txt", _model -> dname ? _datapath : _model -> name);
|
||||
if(f_open(file, (const TCHAR *)_path, 1)){
|
||||
DEBUG_PRINTF("<EFBFBD>ļ<EFBFBD>[%s]<5D><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>\r\n", _model -> dname ? _model -> dname : _model -> name);
|
||||
return 199;
|
||||
@@ -286,7 +286,7 @@ u8 model_switchdata(char* data_name){
|
||||
u8 _len = strlen(data_name);
|
||||
char _path[_len+1+7+35];
|
||||
if(data.array != NULL)modelmym_free("data");
|
||||
sprintf(_path, "0:/dataset/_data/%s.txt",data_name);
|
||||
sprintf(_path, "dataset/_data/%s.txt",data_name);
|
||||
if(f_open(file,(const TCHAR*)_path,1)){
|
||||
DEBUG_PRINTF("\r\nData<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>[%s]<5D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\n",data_name);
|
||||
return 0;
|
||||
@@ -361,7 +361,7 @@ void model_init(){
|
||||
conv1_weight.array = modelmym_init(conv1_weight.name);
|
||||
conv1_weight.maxlength = CONV1_WEIGHT_ARRSIZE;
|
||||
conv1_weight.channel = 1;
|
||||
conv1_weight.num_kernels = 32;
|
||||
conv1_weight.num_kernels = CONV1_BIAS_ARRSIZE;
|
||||
|
||||
conv2_bias.name = "conv2_bias";
|
||||
conv2_bias.array = modelmym_init(conv2_bias.name);
|
||||
@@ -371,7 +371,7 @@ void model_init(){
|
||||
conv2_weight.array = modelmym_init(conv2_weight.name);
|
||||
conv2_weight.maxlength = CONV2_WEIGHT_ARRSIZE;
|
||||
conv2_weight.channel = 32;
|
||||
conv2_weight.num_kernels = 64;
|
||||
conv2_weight.num_kernels = CONV2_BIAS_ARRSIZE;
|
||||
|
||||
conv3_bias.name = "conv3_bias";
|
||||
conv3_bias.array = modelmym_init(conv3_bias.name);
|
||||
@@ -381,7 +381,7 @@ void model_init(){
|
||||
conv3_weight.array = modelmym_init(conv3_weight.name);
|
||||
conv3_weight.maxlength = CONV3_WEIGHT_ARRSIZE;
|
||||
conv3_weight.channel = 64;
|
||||
conv3_weight.num_kernels = 128;
|
||||
conv3_weight.num_kernels = CONV3_BIAS_ARRSIZE;
|
||||
|
||||
fc1_bias.name = "fc1_bias";
|
||||
fc1_bias.array = modelmym_init(fc1_bias.name);
|
||||
@@ -398,10 +398,14 @@ void model_init(){
|
||||
fc2_weight.name = "fc2_weight";
|
||||
fc2_weight.array = modelmym_init(fc2_weight.name);
|
||||
fc2_weight.maxlength = FC2_WEIGHT_ARRSIZE;
|
||||
fc2_weight.num_kernels = FC2_BIAS_ARRSIZE;
|
||||
|
||||
data.name = "data";
|
||||
data.array = modelmym_init(data.name);
|
||||
data.array = data_array;
|
||||
data.maxlength = DATA_ARRSIZE;
|
||||
data.realength = DATA_ARRSIZE;
|
||||
data.dname = "data";
|
||||
|
||||
memset(data.array, 0, sizeof(float)*DATA_ARRSIZE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user