移植stm32代码
This commit is contained in:
72
cnn_model.h
Normal file
72
cnn_model.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#ifndef CNNMODEL_H_
|
||||
#define CNNMODEL_H_
|
||||
#include "malloc.h"
|
||||
#include "debug.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
char* name;
|
||||
char* dname;
|
||||
float* array;
|
||||
u32 maxlength;
|
||||
u32 realength;
|
||||
} Model;
|
||||
|
||||
|
||||
|
||||
#define READLENGTH (11*10)
|
||||
#define CONV1_BIAS_ARRSIZE (32)
|
||||
#define CONV1_WEIGHT_ARRSIZE (32*1*3*3) //288
|
||||
#define CONV2_BIAS_ARRSIZE (64)
|
||||
#define CONV2_WEIGHT_ARRSIZE (64*32*3*3) //18432
|
||||
#define CONV3_BIAS_ARRSIZE (128)
|
||||
#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 DATA_ARRSIZE (1250000) //1250000
|
||||
|
||||
|
||||
|
||||
extern Model conv1_bias;
|
||||
extern Model conv1_weight;
|
||||
extern Model conv2_bias;
|
||||
extern Model conv2_weight;
|
||||
extern Model conv3_bias;
|
||||
extern Model conv3_weight;
|
||||
extern Model fc1_bias;
|
||||
extern Model fc1_weight;
|
||||
extern Model fc2_bias;
|
||||
extern Model fc2_weight;
|
||||
extern Model data;
|
||||
|
||||
|
||||
|
||||
float* modelmym_init(char* model_name);
|
||||
u8 modelmym_free(char* model_name);
|
||||
u8 model_write(char* model_name);
|
||||
u8 model_read(char* model_name, u32 start, u32 end, u32 gap);
|
||||
u8 model_switchdata(char* model_name);
|
||||
void model_dataset(void);
|
||||
u8 model_info(char* model_name);
|
||||
void* model(char* model_name);
|
||||
void model_init(void);
|
||||
|
||||
|
||||
|
||||
//conv1_bias[a*1] a:0~31
|
||||
//conv1_weight[a*9+b*9+c*3+d*1] a:0~31 b:0 c:0~2 d:0~2
|
||||
//conv2_bias[a*1] a:0~63
|
||||
//conv2_weight[a*288+b*9+c*3+d*1] a:0~63 b:0~31 c:0~2 d:0~2
|
||||
//conv3_bias[a*1] a:0~127
|
||||
//conv3_weight[a*576+b*9+c*3+d*1] a:0~127 b:0~63 c:0~2 d:0~2
|
||||
//fc1_bias[a*1] a:0~127
|
||||
//fc1_weight[a*18432+b*1] a:0~127 b:0~18431
|
||||
//fc2_bias[a*1] a:0~6
|
||||
//fc2_weight[a*128+b*1] a:0~6 b:0~127
|
||||
#endif
|
||||
Reference in New Issue
Block a user