Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cbe00c6c95 | |||
| c453296dd4 | |||
|
|
13d21f152c |
14
.gitignore
vendored
14
.gitignore
vendored
@@ -1,14 +0,0 @@
|
|||||||
CMakeLists.txt.user
|
|
||||||
CMakeCache.txt
|
|
||||||
CMakeFiles
|
|
||||||
CMakeScripts
|
|
||||||
Testing
|
|
||||||
Makefile
|
|
||||||
cmake_install.cmake
|
|
||||||
install_manifest.txt
|
|
||||||
compile_commands.json
|
|
||||||
CTestTestfile.cmake
|
|
||||||
_deps
|
|
||||||
.gitattributes
|
|
||||||
/cmake-build-debug
|
|
||||||
/.idea
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.26)
|
|
||||||
project(c_cnn C)
|
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
|
||||||
|
|
||||||
include_directories(.)
|
|
||||||
|
|
||||||
add_executable(c_cnn
|
|
||||||
cnn.c
|
|
||||||
cnn.h
|
|
||||||
main.c
|
|
||||||
cnn_model.c
|
|
||||||
debug.c)
|
|
||||||
188
cnn.c
188
cnn.c
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void print_rslt(float* rslt, u8 input_matrix_length, u32 length){
|
void print_rslt(float* rslt, uint8_t input_matrix_length, uint32_t length){
|
||||||
int _tmp = 0;
|
int _tmp = 0;
|
||||||
printf("[0:0]");
|
printf("[0:0]");
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
@@ -14,7 +14,7 @@ void print_rslt(float* rslt, u8 input_matrix_length, u32 length){
|
|||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将原始矩阵复制到填充后的矩阵中央
|
// <EFBFBD><EFBFBD>ԭʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
float* expand(const float* old_matrix, int old_matrix_length, int layer){
|
float* expand(const float* old_matrix, int old_matrix_length, int layer){
|
||||||
float* new_matrix = (float *)malloc(sizeof(float)*layer*(old_matrix_length+2)*(old_matrix_length+2));
|
float* new_matrix = (float *)malloc(sizeof(float)*layer*(old_matrix_length+2)*(old_matrix_length+2));
|
||||||
memset(new_matrix, 0, sizeof(float)*layer*(old_matrix_length+2)*(old_matrix_length+2));
|
memset(new_matrix, 0, sizeof(float)*layer*(old_matrix_length+2)*(old_matrix_length+2));
|
||||||
@@ -31,34 +31,34 @@ float* expand(const float* old_matrix, int old_matrix_length, int layer){
|
|||||||
return new_matrix;
|
return new_matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
//model 模型名字
|
//model ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
//input_matrix 输入图像
|
//input_matrix <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>
|
||||||
//input_matrix_length 输入图像的边长:102
|
//input_matrix_length <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ı߳<EFBFBD><EFBFBD><EFBFBD>102
|
||||||
//c_rl 输出图像的边长:100
|
//c_rl <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ı߳<EFBFBD><EFBFBD><EFBFBD>100
|
||||||
//返回卷积的结果
|
//<EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD>
|
||||||
float* convolution(Model model_w, Model model_b, const float* input_matrix, int input_matrix_length){
|
float* convolution(Model model_w, Model model_b, const float* input_matrix, int input_matrix_length){
|
||||||
// 初始化卷积层参数
|
// <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
int im_l = input_matrix_length;
|
int im_l = input_matrix_length;
|
||||||
int cr_l = input_matrix_length - 2;
|
int cr_l = input_matrix_length - 2;
|
||||||
float conv_temp; // 临时变量,用于存储卷积计算的中间结果
|
float conv_temp; // <EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
//用于合并前的数组,具有32*64*50*50(第二层)的大小
|
//<EFBFBD><EFBFBD><EFBFBD>ںϲ<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>32*64*50*50(<EFBFBD>ڶ<EFBFBD><EFBFBD><EFBFBD>)<29>Ĵ<EFBFBD>С
|
||||||
float* _conv_rlst = (float *) malloc(sizeof (float) * model_w.num_kernels * (cr_l * cr_l));
|
float* _conv_rlst = (float *) malloc(sizeof (float) * model_w.num_kernels * (cr_l * cr_l));
|
||||||
memset(_conv_rlst, 0, sizeof (float) * model_w.num_kernels * (cr_l * cr_l));
|
memset(_conv_rlst, 0, sizeof (float) * model_w.num_kernels * (cr_l * cr_l));
|
||||||
//子图合并后的数组
|
//<EFBFBD><EFBFBD>ͼ<EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
float* conv_rlst = (float *) malloc(sizeof (float) * model_w.num_kernels * (cr_l * cr_l));
|
float* conv_rlst = (float *) malloc(sizeof (float) * model_w.num_kernels * (cr_l * cr_l));
|
||||||
memset(conv_rlst, 0, sizeof (float) * model_w.num_kernels * (cr_l * cr_l));
|
memset(conv_rlst, 0, sizeof (float) * model_w.num_kernels * (cr_l * cr_l));
|
||||||
|
|
||||||
// 遍历30个卷积核(假设有30个通道)
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>30<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
for(int c=0; c < model_w.channel; c++){
|
for(int c=0; c < model_w.channel; c++){
|
||||||
for(int k=0; k < model_w.num_kernels; k++){
|
for(int k=0; k < model_w.num_kernels; k++){
|
||||||
for(int row = 0; row < cr_l; row++) {
|
for(int row = 0; row < cr_l; row++) {
|
||||||
for (int col = 0; col < cr_l; col++) {
|
for (int col = 0; col < cr_l; col++) {
|
||||||
conv_temp = 0; // 每个输出像素初始化为0
|
conv_temp = 0; // ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD>ʼ<EFBFBD><EFBFBD>Ϊ0
|
||||||
// 进行3x3的卷积操作
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>3x3<EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
for (int x = 0; x < 3; x++) {
|
for (int x = 0; x < 3; x++) {
|
||||||
for (int y = 0; y < 3; y++) {
|
for (int y = 0; y < 3; y++) {
|
||||||
// 将输入图像的对应像素与卷积核权重相乘,并累加到conv_temp
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼӵ<EFBFBD>conv_temp
|
||||||
conv_temp += input_matrix[(c*im_l*im_l) + (row*(im_l)+col) + (x*(im_l)+y)]
|
conv_temp += input_matrix[(c*im_l*im_l) + (row*(im_l)+col) + (x*(im_l)+y)]
|
||||||
* model_w.array[((c+k*model_w.channel)*3*3) + (x*3+y)];
|
* model_w.array[((c+k*model_w.channel)*3*3) + (x*3+y)];
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ float* convolution(Model model_w, Model model_b, const float* input_matrix, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//合并子图
|
//<EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD>ͼ
|
||||||
for(int k=0; k < model_w.num_kernels; k++) {
|
for(int k=0; k < model_w.num_kernels; k++) {
|
||||||
for (int row = 0; row < cr_l; row++) {
|
for (int row = 0; row < cr_l; row++) {
|
||||||
for (int col = 0; col < cr_l; col++) {
|
for (int col = 0; col < cr_l; col++) {
|
||||||
@@ -80,13 +80,13 @@ float* convolution(Model model_w, Model model_b, const float* input_matrix, int
|
|||||||
for (int row = 0; row < cr_l; row++) {
|
for (int row = 0; row < cr_l; row++) {
|
||||||
for (int col = 0; col < cr_l; col++) {
|
for (int col = 0; col < cr_l; col++) {
|
||||||
conv_temp = conv_rlst[(k * cr_l * cr_l) + (row * cr_l + col)];
|
conv_temp = conv_rlst[(k * cr_l * cr_l) + (row * cr_l + col)];
|
||||||
// 加上对应卷积核的偏置
|
// <EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>ƫ<EFBFBD><EFBFBD>
|
||||||
conv_temp += model_b.array[k];
|
conv_temp += model_b.array[k];
|
||||||
// 激活函数:ReLU(将小于0的值设为0)
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ReLU<EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Ϊ0<EFBFBD><EFBFBD>
|
||||||
if (conv_temp > 0)
|
if (conv_temp > 0)
|
||||||
conv_rlst[(k * (cr_l * cr_l)) + (row * cr_l) + (col)] = conv_temp; // 如果卷积结果大于0,存入结果数组
|
conv_rlst[(k * (cr_l * cr_l)) + (row * cr_l) + (col)] = conv_temp; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
else
|
else
|
||||||
conv_rlst[(k * (cr_l * cr_l)) + (row * cr_l) + (col)] = 0; // 否则存入0
|
conv_rlst[(k * (cr_l * cr_l)) + (row * cr_l) + (col)] = 0; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,38 +95,38 @@ float* convolution(Model model_w, Model model_b, const float* input_matrix, int
|
|||||||
return conv_rlst;
|
return conv_rlst;
|
||||||
}
|
}
|
||||||
|
|
||||||
//num_kernels 卷积核的个数:32
|
//num_kernels <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵ĸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>32
|
||||||
//area 池化的面积:2*2
|
//area <EFBFBD>ػ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2*2
|
||||||
//input_matrix 输入图像
|
//input_matrix <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>
|
||||||
//input_matrix_length 输入图像的边长:100
|
//input_matrix_length <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ı߳<EFBFBD><EFBFBD><EFBFBD>100
|
||||||
//输出图像的边长:50
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ı߳<EFBFBD><EFBFBD><EFBFBD>50
|
||||||
//返回池化的结果
|
//<EFBFBD><EFBFBD><EFBFBD>سػ<EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD>
|
||||||
float* pooling(Model model_w, const float* input_matrix, u8 input_matrix_length){
|
float* pooling(Model model_w, const float* input_matrix, uint8_t input_matrix_length){
|
||||||
u8 im_l = input_matrix_length;
|
uint8_t im_l = input_matrix_length;
|
||||||
float pool_temp = 0; // 临时变量,用于存储池化操作的最大值
|
float pool_temp = 0; // <EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ洢<EFBFBD>ػ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||||
float* pool_rslt = (float *) malloc(sizeof (float)*model_w.num_kernels*im_l*im_l);
|
float* pool_rslt = (float *) malloc(sizeof (float)*model_w.num_kernels*im_l*im_l);
|
||||||
memset(pool_rslt, 0, sizeof (float)*model_w.num_kernels*im_l*im_l);
|
memset(pool_rslt, 0, sizeof (float)*model_w.num_kernels*im_l*im_l);
|
||||||
// 遍历30个通道(与卷积核数量相同)
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>30<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD>
|
||||||
for(u8 n=0; n<model_w.num_kernels; n++)
|
for(uint8_t n=0; n<model_w.num_kernels; n++)
|
||||||
{
|
{
|
||||||
// 遍历输入图像的每一行,步长为2(2x2的池化窗口)
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿһ<EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ2<EFBFBD><EFBFBD>2x2<EFBFBD>ijػ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
|
||||||
for(u8 row=0; row<im_l; row=row+2)
|
for(uint8_t row=0; row<im_l; row=row+2)
|
||||||
{
|
{
|
||||||
// 遍历输入图像的每一列,步长为2
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿһ<EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ2
|
||||||
for(u8 col=0; col<im_l; col=col+2)
|
for(uint8_t col=0; col<im_l; col=col+2)
|
||||||
{
|
{
|
||||||
pool_temp = 0; // 每个池化区域的最大值初始化为0
|
pool_temp = 0; // ÿ<EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>Ϊ0
|
||||||
// 进行2x2的最大池化操作
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>2x2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
for(u8 x=0; x<2; x++)
|
for(uint8_t x=0; x<2; x++)
|
||||||
{
|
{
|
||||||
for(u8 y=0; y<2; y++)
|
for(uint8_t y=0; y<2; y++)
|
||||||
{
|
{
|
||||||
// 更新当前池化区域的最大值
|
// <EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>ǰ<EFBFBD>ػ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||||
if(pool_temp <= input_matrix[row*im_l+col+x*im_l+y+n*(im_l*im_l)])
|
if(pool_temp <= input_matrix[row*im_l+col+x*im_l+y+n*(im_l*im_l)])
|
||||||
pool_temp = input_matrix[row*im_l+col+x*im_l+y+n*(im_l*im_l)];
|
pool_temp = input_matrix[row*im_l+col+x*im_l+y+n*(im_l*im_l)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 将最大值存入池化结果数组
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
pool_rslt[(row/2)*(im_l/2)+col/2+n*((im_l/2)*(im_l/2))] = pool_temp;
|
pool_rslt[(row/2)*(im_l/2)+col/2+n*((im_l/2)*(im_l/2))] = pool_temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,29 +135,29 @@ float* pooling(Model model_w, const float* input_matrix, u8 input_matrix_length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
float* hidden(const float* input_matrix){
|
float* hidden(const float* input_matrix){
|
||||||
float affine1_temp; // 临时变量,用于存储全连接层的中间结果
|
float affine1_temp; // <EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ洢ȫ<EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
float *affine1_rslt = (float *) malloc(sizeof(float)*128);
|
float *affine1_rslt = (float *) malloc(sizeof(float)*128);
|
||||||
memset(affine1_rslt, 0, sizeof(float)*128);
|
memset(affine1_rslt, 0, sizeof(float)*128);
|
||||||
|
|
||||||
// 遍历128个神经元(假设隐藏层有128个神经元)
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>128<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>128<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD>
|
||||||
for(u8 n=0; n<128; n++)
|
for(uint8_t n=0; n<128; n++)
|
||||||
{
|
{
|
||||||
affine1_temp = 0; // 每个神经元的输出初始化为0
|
affine1_temp = 0; // ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>Ϊ0
|
||||||
|
|
||||||
// 进行矩阵乘法,将池化层输出展平为一维向量后,与全连接层权重进行点积
|
// <EFBFBD><EFBFBD><EFBFBD>о<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չƽΪһά<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD>Ȩ<EFBFBD>ؽ<EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>
|
||||||
for(int i=0; i<(128*12*12); i++)
|
for(int i=0; i<(128*12*12); i++)
|
||||||
{
|
{
|
||||||
affine1_temp = affine1_temp + input_matrix[i] * fc1_weight.array[i+(128*12*12)*n];
|
affine1_temp = affine1_temp + input_matrix[i] * fc1_weight.array[i+(128*12*12)*n];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加上对应神经元的偏置
|
// <EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD>ƫ<EFBFBD><EFBFBD>
|
||||||
affine1_temp = affine1_temp + fc1_bias.array[n];
|
affine1_temp = affine1_temp + fc1_bias.array[n];
|
||||||
|
|
||||||
// 激活函数:ReLU(将小于0的值设为0)
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ReLU<EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Ϊ0<EFBFBD><EFBFBD>
|
||||||
if(affine1_temp > 0)
|
if(affine1_temp > 0)
|
||||||
affine1_rslt[n] = affine1_temp; // 如果结果大于0,存入结果数组
|
affine1_rslt[n] = affine1_temp; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
else
|
else
|
||||||
affine1_rslt[n] = 0; // 否则存入0
|
affine1_rslt[n] = 0; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0
|
||||||
}
|
}
|
||||||
|
|
||||||
// print_rslt(affine1_rslt,1,128);
|
// print_rslt(affine1_rslt,1,128);
|
||||||
@@ -166,25 +166,25 @@ float* hidden(const float* input_matrix){
|
|||||||
}
|
}
|
||||||
|
|
||||||
float* output(Model model_w, const float* input_matrix){
|
float* output(Model model_w, const float* input_matrix){
|
||||||
u8 num = model_w.num_kernels;
|
uint8_t num = model_w.num_kernels;
|
||||||
float affine2_temp; // 临时变量,用于存储输出层的中间结果
|
float affine2_temp; // <EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
float *affine2_rslt = (float *) malloc(sizeof(float)*num);
|
float *affine2_rslt = (float *) malloc(sizeof(float)*num);
|
||||||
memset(affine2_rslt, 0, sizeof(float)*num);
|
memset(affine2_rslt, 0, sizeof(float)*num);
|
||||||
|
|
||||||
// 遍历10个输出神经元(假设有10个类别)
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>10<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>10<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
for(int n=0; n<num; n++)
|
for(int n=0; n<num; n++)
|
||||||
{
|
{
|
||||||
affine2_temp = 0; // 当前神经元的输出初始化为0
|
affine2_temp = 0; // <EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>Ϊ0
|
||||||
|
|
||||||
// 进行矩阵乘法,将隐藏层的输出与输出层权重进行点积
|
// <EFBFBD><EFBFBD><EFBFBD>о<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>ؽ<EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>
|
||||||
for(int i=0; i<128; i++)
|
for(int i=0; i<128; i++)
|
||||||
{
|
{
|
||||||
affine2_temp = affine2_temp + fc2_weight.array[i+128*n] * input_matrix[i];
|
affine2_temp = affine2_temp + fc2_weight.array[i+128*n] * input_matrix[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加上对应神经元的偏置
|
// <EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD>ƫ<EFBFBD><EFBFBD>
|
||||||
affine2_temp = affine2_temp + fc2_weight.array[n];
|
affine2_temp = affine2_temp + fc2_weight.array[n];
|
||||||
affine2_rslt[n] = affine2_temp; // 存储输出层的结果
|
affine2_rslt[n] = affine2_temp; // <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD>
|
||||||
}
|
}
|
||||||
|
|
||||||
return affine2_rslt;
|
return affine2_rslt;
|
||||||
@@ -214,7 +214,7 @@ void calculate_statistics(Model model, float* value)
|
|||||||
value[2] = sqrtf(variance);
|
value[2] = sqrtf(variance);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 check_threshold(Model model, const float* value)
|
uint8_t check_threshold(Model model, const float* value)
|
||||||
{
|
{
|
||||||
const float threshold = 20;
|
const float threshold = 20;
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ float* generateMatrix(Model model, const float* value)
|
|||||||
float* CNN_data = (float*) malloc(sizeof(float)*100*100);
|
float* CNN_data = (float*) malloc(sizeof(float)*100*100);
|
||||||
memset(CNN_data, 0, sizeof(float)*100*100);
|
memset(CNN_data, 0, sizeof(float)*100*100);
|
||||||
|
|
||||||
u16 x = model.maxlength / 100;
|
uint16_t x = model.maxlength / 100;
|
||||||
float y = value[0] / 100;
|
float y = value[0] / 100;
|
||||||
|
|
||||||
for (int i = 0; i < model.maxlength; i++) {
|
for (int i = 0; i < model.maxlength; i++) {
|
||||||
@@ -256,7 +256,7 @@ float* generateMatrix(Model model, const float* value)
|
|||||||
float calculate_probabilities(Model model_w, float *input_array)
|
float calculate_probabilities(Model model_w, float *input_array)
|
||||||
{
|
{
|
||||||
float sum = 0;
|
float sum = 0;
|
||||||
u8 input_num = model_w.num_kernels;
|
uint8_t input_num = model_w.num_kernels;
|
||||||
float *result = (float *) malloc(sizeof(float)*input_num);
|
float *result = (float *) malloc(sizeof(float)*input_num);
|
||||||
memset(result, 0, sizeof(float)*input_num);
|
memset(result, 0, sizeof(float)*input_num);
|
||||||
|
|
||||||
@@ -294,16 +294,16 @@ float calculate_probabilities(Model model_w, float *input_array)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
u8 calculate_layer(Model model_w, float *input_array){
|
uint8_t calculate_layer(Model model_w, float *input_array){
|
||||||
u8 input_num = model_w.num_kernels;
|
uint8_t input_num = model_w.num_kernels;
|
||||||
u8 predict_num = 0;
|
uint8_t predict_num = 0;
|
||||||
float max_temp = -100;
|
float max_temp = -100;
|
||||||
for(int n=0; n<input_num; n++)
|
for(int n=0; n<input_num; n++)
|
||||||
{
|
{
|
||||||
if(max_temp <= input_array[n])
|
if(max_temp <= input_array[n])
|
||||||
{
|
{
|
||||||
max_temp = input_array[n]; // 更新最大值
|
max_temp = input_array[n]; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||||
predict_num = n; // 记录最大值对应的类别索引
|
predict_num = n; // <EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print_rslt(input_array,input_num,input_num);
|
print_rslt(input_array,input_num,input_num);
|
||||||
@@ -312,13 +312,12 @@ u8 calculate_layer(Model model_w, float *input_array){
|
|||||||
|
|
||||||
|
|
||||||
void cnn_run(){
|
void cnn_run(){
|
||||||
#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])){
|
||||||
float* _data = generateMatrix(data,&value[0]);
|
float* _data = generateMatrix(data,&value[0]);
|
||||||
|
|
||||||
//第一层:填充102 * 102
|
//<EFBFBD><EFBFBD>һ<EFBFBD>㣺<EFBFBD><EFBFBD><EFBFBD><EFBFBD>102 * 102
|
||||||
float* expand_matrix_1 = expand(_data, 100, 1);
|
float* expand_matrix_1 = expand(_data, 100, 1);
|
||||||
float* conv_rlst_1 = convolution(conv1_weight,conv1_bias,expand_matrix_1, 102);
|
float* conv_rlst_1 = convolution(conv1_weight,conv1_bias,expand_matrix_1, 102);
|
||||||
float* pool_rslt_1 = pooling(conv1_weight, conv_rlst_1, 100);
|
float* pool_rslt_1 = pooling(conv1_weight, conv_rlst_1, 100);
|
||||||
@@ -330,7 +329,7 @@ void cnn_run(){
|
|||||||
free(conv_rlst_1);
|
free(conv_rlst_1);
|
||||||
conv_rlst_1 = NULL;
|
conv_rlst_1 = NULL;
|
||||||
|
|
||||||
//第二层:填充32 * 52 * 52
|
//<EFBFBD>ڶ<EFBFBD><EFBFBD>㣺<EFBFBD><EFBFBD><EFBFBD><EFBFBD>32 * 52 * 52
|
||||||
float* expand_matrix_2 = expand(pool_rslt_1, 50, 32);
|
float* expand_matrix_2 = expand(pool_rslt_1, 50, 32);
|
||||||
float* conv_rlst_2 = convolution(conv2_weight,conv2_bias,expand_matrix_2, 52);
|
float* conv_rlst_2 = convolution(conv2_weight,conv2_bias,expand_matrix_2, 52);
|
||||||
float* pool_rslt_2 = pooling(conv2_weight, conv_rlst_2, 50);
|
float* pool_rslt_2 = pooling(conv2_weight, conv_rlst_2, 50);
|
||||||
@@ -342,7 +341,7 @@ void cnn_run(){
|
|||||||
free(conv_rlst_2);
|
free(conv_rlst_2);
|
||||||
conv_rlst_2 = NULL;
|
conv_rlst_2 = NULL;
|
||||||
|
|
||||||
//第三层:填充 64 * 27 * 27
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㣺<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 64 * 27 * 27
|
||||||
float* expand_matrix_3 = expand(pool_rslt_2, 25, 64);
|
float* expand_matrix_3 = expand(pool_rslt_2, 25, 64);
|
||||||
float* conv_rlst_3 = convolution(conv3_weight,conv3_bias,expand_matrix_3, 27);
|
float* conv_rlst_3 = convolution(conv3_weight,conv3_bias,expand_matrix_3, 27);
|
||||||
float* pool_rslt_3 = pooling(conv3_weight, conv_rlst_3, 25);
|
float* pool_rslt_3 = pooling(conv3_weight, conv_rlst_3, 25);
|
||||||
@@ -357,7 +356,7 @@ void cnn_run(){
|
|||||||
float* affine1_rslt = hidden(pool_rslt_3);
|
float* affine1_rslt = hidden(pool_rslt_3);
|
||||||
float* affine2_rslt = output(fc2_weight, affine1_rslt);
|
float* affine2_rslt = output(fc2_weight, affine1_rslt);
|
||||||
|
|
||||||
printf("概率:%f\r\n",calculate_probabilities(fc2_weight, affine2_rslt));
|
printf("<EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>%f\r\n",calculate_probabilities(fc2_weight, affine2_rslt));
|
||||||
printf("Label is:%d\r\n",calculate_layer(fc2_weight, affine2_rslt));
|
printf("Label is:%d\r\n",calculate_layer(fc2_weight, affine2_rslt));
|
||||||
|
|
||||||
free(pool_rslt_3);
|
free(pool_rslt_3);
|
||||||
@@ -368,53 +367,6 @@ void cnn_run(){
|
|||||||
affine2_rslt = NULL;
|
affine2_rslt = NULL;
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
printf("未放电!最大值:%f 平均值:%f 标准差:%f\r\n",value[0],value[1],value[2]);
|
printf("δ<EFBFBD>ŵ磡<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ:%f ƽ<><C6BD>ֵ:%f <20><><EFBFBD><D7BC>:%f\r\n",value[0],value[1],value[2]);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
float* expand_matrix_1 = expand(data.array, 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);
|
|
||||||
|
|
||||||
free(expand_matrix_1);
|
|
||||||
expand_matrix_1 = NULL;
|
|
||||||
free(conv_rlst_1);
|
|
||||||
conv_rlst_1 = NULL;
|
|
||||||
|
|
||||||
//第二层:填充32 * 52 * 52
|
|
||||||
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);
|
|
||||||
|
|
||||||
free(pool_rslt_1);
|
|
||||||
pool_rslt_1 = NULL;
|
|
||||||
free(expand_matrix_2);
|
|
||||||
expand_matrix_2 = NULL;
|
|
||||||
free(conv_rlst_2);
|
|
||||||
conv_rlst_2 = NULL;
|
|
||||||
|
|
||||||
//第三层:填充 64 * 27 * 27
|
|
||||||
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);
|
|
||||||
|
|
||||||
free(pool_rslt_2);
|
|
||||||
pool_rslt_2 = NULL;
|
|
||||||
free(expand_matrix_3);
|
|
||||||
expand_matrix_3 = NULL;
|
|
||||||
free(conv_rlst_3);
|
|
||||||
conv_rlst_3 = NULL;
|
|
||||||
|
|
||||||
float* affine1_rslt = hidden(pool_rslt_3);
|
|
||||||
float* affine2_rslt = output(fc2_weight, affine1_rslt);
|
|
||||||
|
|
||||||
printf("概率:%f\r\n",calculate_probabilities(fc2_weight, affine2_rslt));
|
|
||||||
printf("Label is:%d\r\n",calculate_layer(fc2_weight, affine2_rslt));
|
|
||||||
|
|
||||||
free(pool_rslt_3);
|
|
||||||
pool_rslt_3 = NULL;
|
|
||||||
free(affine1_rslt);
|
|
||||||
affine1_rslt = NULL;
|
|
||||||
free(affine2_rslt);
|
|
||||||
affine2_rslt = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|||||||
7
cnn.h
7
cnn.h
@@ -1,14 +1,7 @@
|
|||||||
#ifndef _CNN_H_
|
#ifndef _CNN_H_
|
||||||
#define _CNN_H_
|
#define _CNN_H_
|
||||||
#include "cnn_model.h"
|
#include "cnn_model.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cnn_run(void);
|
void cnn_run(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
77
cnn_model.c
77
cnn_model.c
@@ -57,7 +57,7 @@ float* modelmym_init(char* model_name){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
u8 modelmym_free(char* model_name){
|
uint8_t modelmym_free(char* model_name){
|
||||||
if(conv1_bias.array != NULL && strcmp(model_name, "conv1_bias") == 0){
|
if(conv1_bias.array != NULL && strcmp(model_name, "conv1_bias") == 0){
|
||||||
free(conv1_bias.array);
|
free(conv1_bias.array);
|
||||||
conv1_bias.array = NULL;
|
conv1_bias.array = NULL;
|
||||||
@@ -143,7 +143,7 @@ u8 modelmym_free(char* model_name){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
u8 model_write(char* model_name)
|
uint8_t model_write(char* model_name)
|
||||||
{
|
{
|
||||||
if(strcmp(model_name, "all") == 0){
|
if(strcmp(model_name, "all") == 0){
|
||||||
model_write("conv1_bias");
|
model_write("conv1_bias");
|
||||||
@@ -158,11 +158,10 @@ u8 model_write(char* model_name)
|
|||||||
model_write("fc2_weight");
|
model_write("fc2_weight");
|
||||||
|
|
||||||
model_info("all");
|
model_info("all");
|
||||||
SDRAM_USED();
|
|
||||||
}else{
|
}else{
|
||||||
u8 _times=0;
|
uint8_t _times=0;
|
||||||
u32 _larr = 0;
|
uint32_t _larr = 0;
|
||||||
u8 _len = strlen(model_name);
|
uint8_t _len = strlen(model_name);
|
||||||
char _path[_len+1+7+30];
|
char _path[_len+1+7+30];
|
||||||
char _datapath[_len+1+7+30];
|
char _datapath[_len+1+7+30];
|
||||||
char _fstr[READLENGTH+1] = {0};
|
char _fstr[READLENGTH+1] = {0};
|
||||||
@@ -173,7 +172,7 @@ u8 model_write(char* model_name)
|
|||||||
sprintf(_path, "./dataset/_data/%s.txt", model_name);
|
sprintf(_path, "./dataset/_data/%s.txt", model_name);
|
||||||
FILE *file = fopen(_path, "r");
|
FILE *file = fopen(_path, "r");
|
||||||
if(file == NULL){
|
if(file == NULL){
|
||||||
DEBUG_PRINTF("\r\n输入了一个无效的模型或Data数据集的名字\r\n");
|
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;
|
return 199;
|
||||||
}else{
|
}else{
|
||||||
_model = model("data");
|
_model = model("data");
|
||||||
@@ -185,13 +184,13 @@ u8 model_write(char* model_name)
|
|||||||
sprintf(_path, "./dataset/%s.txt", _model -> name);
|
sprintf(_path, "./dataset/%s.txt", _model -> name);
|
||||||
FILE *file = fopen(_path, "r");
|
FILE *file = fopen(_path, "r");
|
||||||
if(file == NULL){
|
if(file == NULL){
|
||||||
DEBUG_PRINTF("预设里没有这个模型:[%s]\r\n", _path);
|
printf("Ԥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>ͣ<EFBFBD>[%s]\r\n", _path);
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_model -> array == NULL && modelmym_init(_model -> name) == NULL){
|
if(_model -> array == NULL && modelmym_init(_model -> name) == NULL){
|
||||||
DEBUG_PRINTF("无法创建模型参数[%s]的数组到SDRAM里\r\n", _model -> name);
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>Ͳ<EFBFBD><EFBFBD><EFBFBD>[%s]<5D><><EFBFBD><EFBFBD><EFBFBD>鵽SDRAM<EFBFBD><EFBFBD>\r\n", _model -> name);
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,40 +198,40 @@ u8 model_write(char* model_name)
|
|||||||
sprintf(_path, "./dataset/%s.txt", _model -> dname ? _datapath : _model -> name);
|
sprintf(_path, "./dataset/%s.txt", _model -> dname ? _datapath : _model -> name);
|
||||||
FILE *file = fopen(_path, "r");
|
FILE *file = fopen(_path, "r");
|
||||||
if(file == NULL){
|
if(file == NULL){
|
||||||
DEBUG_PRINTF("文件[%s]无法打开\r\n", _model -> dname ? _model -> dname : _model -> name);
|
printf("<EFBFBD>ļ<EFBFBD>[%s]<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\n", _model -> dname ? _model -> dname : _model -> name);
|
||||||
return 199;
|
return 199;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PRINTF("写入的模型参数名字是:%s\r\n", _model -> name);
|
printf("д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>Ͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD>%s\r\n", _model -> name);
|
||||||
if(_model -> dname)DEBUG_PRINTF("写入的Data数据集是:%s\r\n", _model -> dname);
|
if(_model -> dname)printf("д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Data<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD>ǣ<EFBFBD>%s\r\n", _model -> dname);
|
||||||
DEBUG_PRINTF("写入模型参数数组的最大长度为:%d\r\n", _model -> maxlength);
|
printf("д<EFBFBD><EFBFBD>ģ<EFBFBD>Ͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>%d\r\n", _model -> maxlength);
|
||||||
DEBUG_PRINTF("目前数组存活的元素数量为:%d", _model -> realength);
|
printf("Ŀǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>%d", _model -> realength);
|
||||||
printf("\r\n正在写入模型参数'%s',请稍后......\r\n",_model -> dname ? _model -> dname : _model -> name);
|
printf("\r\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>ģ<EFBFBD>Ͳ<EFBFBD><EFBFBD><EFBFBD>'%s'<27><><EFBFBD><EFBFBD><EFBFBD>Ժ<EFBFBD>......\r\n",_model -> dname ? _model -> dname : _model -> name);
|
||||||
|
|
||||||
while(_larr < _model->maxlength && fgets(_fstr, sizeof(_fstr), file) != NULL){
|
while(_larr < _model->maxlength && fgets(_fstr, sizeof(_fstr), file) != NULL){
|
||||||
char *endptr;
|
char *endptr;
|
||||||
float value = strtof(_fstr, &endptr);
|
float value = strtof(_fstr, &endptr);
|
||||||
|
|
||||||
// 检查是否转换成功
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
||||||
if (endptr == _fstr) {
|
if (endptr == _fstr) {
|
||||||
fprintf(stderr, "第 %d 行不是有效的浮点数: %s", _larr + 1, _fstr);
|
fprintf(stderr, "<EFBFBD><EFBFBD> %d <EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %s", _larr + 1, _fstr);
|
||||||
continue; // 跳过无效行
|
continue; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>
|
||||||
}
|
}
|
||||||
_model->array[_larr++] = value;
|
_model->array[_larr++] = value;
|
||||||
_model->realength++;
|
_model->realength++;
|
||||||
|
|
||||||
if(_model -> maxlength >= 73728 && (_larr >= (_model -> maxlength/10)*_times)){
|
if(_model -> maxlength >= 73728 && (_larr >= (_model -> maxlength/10)*_times)){
|
||||||
progress = _larr >= _model -> maxlength ? 100 : _times++ == 0 ? 0 : progress + 10;
|
progress = _larr >= _model -> maxlength ? 100 : _times++ == 0 ? 0 : progress + 10;
|
||||||
DEBUG_PRINTF("\r\n[");
|
printf("\r\n[");
|
||||||
for(u16 j=0; j<50;j++){
|
for(uint16_t j=0; j<50;j++){
|
||||||
if(j < progress/2) DEBUG_PRINTF("=");
|
if(j < progress/2) printf("=");
|
||||||
else DEBUG_PRINTF(" ");
|
else printf(" ");
|
||||||
}
|
}
|
||||||
DEBUG_PRINTF("] %d%%", progress);
|
printf("] %d%%", progress);
|
||||||
}
|
}
|
||||||
if(_larr >= _model -> maxlength)break;
|
if(_larr >= _model -> maxlength)break;
|
||||||
}
|
}
|
||||||
DEBUG_PRINTF("\r\n模型参数[%s]已写入到内存中! 模型长度为 %d\r\n",_model -> dname ? _model -> dname : _model -> name,_model -> realength);
|
printf("\r\nģ<EFBFBD>Ͳ<EFBFBD><EFBFBD><EFBFBD>[%s]<5D><>д<EFBFBD>뵽<EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>! ģ<>ͳ<EFBFBD><CDB3><EFBFBD>Ϊ %d\r\n",_model -> dname ? _model -> dname : _model -> name,_model -> realength);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@@ -240,7 +239,7 @@ u8 model_write(char* model_name)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
u8 model_read(char* model_name, u32 start, u32 end, u32 gap){
|
uint8_t model_read(char* model_name, uint32_t start, uint32_t end, uint32_t gap){
|
||||||
if(strcmp(model_name, "all") == 0){
|
if(strcmp(model_name, "all") == 0){
|
||||||
model_read("conv1_bias", start, end, gap);
|
model_read("conv1_bias", start, end, gap);
|
||||||
model_read("conv1_weight", start, end, gap);
|
model_read("conv1_weight", start, end, gap);
|
||||||
@@ -257,7 +256,7 @@ u8 model_read(char* model_name, u32 start, u32 end, u32 gap){
|
|||||||
Model *_model = model(model_name);
|
Model *_model = model(model_name);
|
||||||
if(_model == NULL || end == 0 || start > _model -> realength || end > _model -> realength)return 0;
|
if(_model == NULL || end == 0 || start > _model -> realength || end > _model -> realength)return 0;
|
||||||
if(_model -> realength){
|
if(_model -> realength){
|
||||||
for (u32 i=0;i<((end > (_model -> realength) ? _model -> realength : (end-start))+(end > (_model -> realength) ? _model -> realength : (end-start)%gap ? 2 : 1));i+=gap)
|
for (uint32_t i=0;i<((end > (_model -> realength) ? _model -> realength : (end-start))+(end > (_model -> realength) ? _model -> realength : (end-start)%gap ? 2 : 1));i+=gap)
|
||||||
printf("\r\n%s_floatArray[%d]: %f",_model->name,(i+start)<_model->realength ? i+start : _model->realength-1,(i+start)<_model->realength ? _model->array[i+start] : _model->array[_model -> realength-1]);
|
printf("\r\n%s_floatArray[%d]: %f",_model->name,(i+start)<_model->realength ? i+start : _model->realength-1,(i+start)<_model->realength ? _model->array[i+start] : _model->array[_model -> realength-1]);
|
||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -268,30 +267,30 @@ u8 model_read(char* model_name, u32 start, u32 end, u32 gap){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
u8 model_switchdata(char* data_name){
|
uint8_t model_switchdata(char* data_name){
|
||||||
u8 _len = strlen(data_name);
|
uint8_t _len = strlen(data_name);
|
||||||
char _path[_len+1+7];
|
char _path[_len+1+7];
|
||||||
if(data.array != NULL)modelmym_free("data");
|
if(data.array != NULL)modelmym_free("data");
|
||||||
sprintf(_path, "./dataset/_data/%s.txt", data_name);
|
sprintf(_path, "./dataset/_data/%s.txt", data_name);
|
||||||
FILE *file = fopen(_path, "r");
|
FILE *file = fopen(_path, "r");
|
||||||
if(file == NULL){
|
if(file == NULL){
|
||||||
DEBUG_PRINTF("\r\nData数据集[%s]不存在\r\n",data_name);
|
printf("\r\nData<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>[%s]<5D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\n",data_name);
|
||||||
return 0;
|
return 0;
|
||||||
}else{
|
}else{
|
||||||
u8 _res = model_write(data_name);
|
uint8_t _res = model_write(data_name);
|
||||||
if (_res) {
|
if (_res) {
|
||||||
DEBUG_PRINTF("Data数据集[%s]切换失败!!\r\n",data_name);
|
printf("Data<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>[%s]<5D>л<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>\r\n",data_name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else DEBUG_PRINTF("Data数据集[%s]切换成功!\r\n",data_name);
|
else printf("Data<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>[%s]<5D>л<EFBFBD><D0BB>ɹ<EFBFBD><C9B9><EFBFBD>\r\n",data_name);
|
||||||
DEBUG_PRINTF("data_name的长度为:%d\r\n_path的长度为:%d\r\n_path为:%s\r\n",_len,sizeof(_path),_path);
|
printf("data_name<EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>%d\r\n_path<EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>%d\r\n_pathΪ<EFBFBD><EFBFBD>%s\r\n",_len,sizeof(_path),_path);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
u8 model_info(char* model_name){
|
uint8_t model_info(char* model_name){
|
||||||
if(strcmp(model_name, "all") == 0){
|
if(strcmp(model_name, "all") == 0){
|
||||||
model_info("conv1_bias");
|
model_info("conv1_bias");
|
||||||
model_info("conv1_weight");
|
model_info("conv1_weight");
|
||||||
@@ -311,7 +310,7 @@ u8 model_info(char* model_name){
|
|||||||
printf("model.array.address is: 0X%X\r\n",_model -> array);
|
printf("model.array.address is: 0X%X\r\n",_model -> array);
|
||||||
printf("model.maxlength is: %d\r\n",_model -> maxlength);
|
printf("model.maxlength is: %d\r\n",_model -> maxlength);
|
||||||
printf("model.realength is: %d\r\n",_model -> realength);
|
printf("model.realength is: %d\r\n",_model -> realength);
|
||||||
//if(strcmp(_model -> name, "data") == 0)printf("dataset is: %s\r\n",_model -> dname); 这函数有BUG,用model_dataset函数
|
//if(strcmp(_model -> name, "data") == 0)printf("dataset is: %s\r\n",_model -> dname); <EFBFBD>⺯<EFBFBD><EFBFBD><EFBFBD><EFBFBD>BUG<EFBFBD><EFBFBD><EFBFBD><EFBFBD>model_dataset<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -346,7 +345,7 @@ void model_init(){
|
|||||||
conv1_weight.array = modelmym_init(conv1_weight.name);
|
conv1_weight.array = modelmym_init(conv1_weight.name);
|
||||||
conv1_weight.maxlength = CONV1_WEIGHT_ARRSIZE;
|
conv1_weight.maxlength = CONV1_WEIGHT_ARRSIZE;
|
||||||
conv1_weight.channel = 1;
|
conv1_weight.channel = 1;
|
||||||
conv1_weight.num_kernels = 32;
|
conv1_weight.num_kernels = CONV1_BIAS_ARRSIZE;
|
||||||
|
|
||||||
conv2_bias.name = "conv2_bias";
|
conv2_bias.name = "conv2_bias";
|
||||||
conv2_bias.array = modelmym_init(conv2_bias.name);
|
conv2_bias.array = modelmym_init(conv2_bias.name);
|
||||||
@@ -356,7 +355,7 @@ void model_init(){
|
|||||||
conv2_weight.array = modelmym_init(conv2_weight.name);
|
conv2_weight.array = modelmym_init(conv2_weight.name);
|
||||||
conv2_weight.maxlength = CONV2_WEIGHT_ARRSIZE;
|
conv2_weight.maxlength = CONV2_WEIGHT_ARRSIZE;
|
||||||
conv2_weight.channel = 32;
|
conv2_weight.channel = 32;
|
||||||
conv2_weight.num_kernels = 64;
|
conv2_weight.num_kernels = CONV2_BIAS_ARRSIZE;
|
||||||
|
|
||||||
conv3_bias.name = "conv3_bias";
|
conv3_bias.name = "conv3_bias";
|
||||||
conv3_bias.array = modelmym_init(conv3_bias.name);
|
conv3_bias.array = modelmym_init(conv3_bias.name);
|
||||||
@@ -366,7 +365,7 @@ void model_init(){
|
|||||||
conv3_weight.array = modelmym_init(conv3_weight.name);
|
conv3_weight.array = modelmym_init(conv3_weight.name);
|
||||||
conv3_weight.maxlength = CONV3_WEIGHT_ARRSIZE;
|
conv3_weight.maxlength = CONV3_WEIGHT_ARRSIZE;
|
||||||
conv3_weight.channel = 64;
|
conv3_weight.channel = 64;
|
||||||
conv3_weight.num_kernels = 128;
|
conv3_weight.num_kernels = CONV3_BIAS_ARRSIZE;
|
||||||
|
|
||||||
fc1_bias.name = "fc1_bias";
|
fc1_bias.name = "fc1_bias";
|
||||||
fc1_bias.array = modelmym_init(fc1_bias.name);
|
fc1_bias.array = modelmym_init(fc1_bias.name);
|
||||||
@@ -383,7 +382,7 @@ void model_init(){
|
|||||||
fc2_weight.name = "fc2_weight";
|
fc2_weight.name = "fc2_weight";
|
||||||
fc2_weight.array = modelmym_init(fc2_weight.name);
|
fc2_weight.array = modelmym_init(fc2_weight.name);
|
||||||
fc2_weight.maxlength = FC2_WEIGHT_ARRSIZE;
|
fc2_weight.maxlength = FC2_WEIGHT_ARRSIZE;
|
||||||
fc2_weight.num_kernels = FC2_WEIGHT_KERNELS;
|
fc2_weight.num_kernels = FC2_BIAS_ARRSIZE;
|
||||||
|
|
||||||
data.name = "data";
|
data.name = "data";
|
||||||
data.array = modelmym_init(data.name);
|
data.array = modelmym_init(data.name);
|
||||||
|
|||||||
32
cnn_model.h
32
cnn_model.h
@@ -1,8 +1,9 @@
|
|||||||
#ifndef CNNMODEL_H_
|
#ifndef CNNMODEL_H_
|
||||||
#define CNNMODEL_H_
|
#define CNNMODEL_H_
|
||||||
#include "malloc.h"
|
#include "malloc.h"
|
||||||
#include "debug.h"
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -13,11 +14,11 @@ typedef struct {
|
|||||||
char* name;
|
char* name;
|
||||||
char* dname;
|
char* dname;
|
||||||
float* array;
|
float* array;
|
||||||
u32 maxlength;
|
uint32_t maxlength;
|
||||||
u32 realength;
|
uint32_t realength;
|
||||||
|
|
||||||
u8 channel;
|
uint8_t channel;
|
||||||
u8 num_kernels;
|
uint8_t num_kernels;
|
||||||
|
|
||||||
} Model;
|
} Model;
|
||||||
|
|
||||||
@@ -36,16 +37,7 @@ typedef struct {
|
|||||||
#define FC2_BIAS_ARRSIZE (4)
|
#define FC2_BIAS_ARRSIZE (4)
|
||||||
#define FC2_WEIGHT_ARRSIZE (4*128) //896
|
#define FC2_WEIGHT_ARRSIZE (4*128) //896
|
||||||
|
|
||||||
#define FC2_WEIGHT_KERNELS 4 //4个卷积核
|
#define DATA_ARRSIZE (1300000)
|
||||||
|
|
||||||
|
|
||||||
//1为跑原始数据 0为跑100矩阵
|
|
||||||
#define is1300000 1
|
|
||||||
#if is1300000
|
|
||||||
#define DATA_ARRSIZE (1300000)
|
|
||||||
#else
|
|
||||||
#define DATA_ARRSIZE (100 * 100)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -64,11 +56,11 @@ extern Model data;
|
|||||||
|
|
||||||
|
|
||||||
float* modelmym_init(char* model_name);
|
float* modelmym_init(char* model_name);
|
||||||
u8 modelmym_free(char* model_name);
|
uint8_t modelmym_free(char* model_name);
|
||||||
u8 model_write(char* model_name);
|
uint8_t model_write(char* model_name);
|
||||||
u8 model_read(char* model_name, u32 start, u32 end, u32 gap);
|
uint8_t model_read(char* model_name, uint32_t start, uint32_t end, uint32_t gap);
|
||||||
u8 model_switchdata(char* model_name);
|
uint8_t model_switchdata(char* model_name);
|
||||||
u8 model_info(char* model_name);
|
uint8_t model_info(char* model_name);
|
||||||
void* model(char* model_name);
|
void* model(char* model_name);
|
||||||
void model_init(void);
|
void model_init(void);
|
||||||
|
|
||||||
|
|||||||
1300000
dataset/_data/split_3.txt
Normal file
1300000
dataset/_data/split_3.txt
Normal file
File diff suppressed because it is too large
Load Diff
1300000
dataset/_data/split_9.txt
Normal file
1300000
dataset/_data/split_9.txt
Normal file
File diff suppressed because it is too large
Load Diff
32
dataset/conv1_bias.txt
Normal file
32
dataset/conv1_bias.txt
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
-0.004631
|
||||||
|
-0.072553
|
||||||
|
-0.001263
|
||||||
|
-0.222981
|
||||||
|
0.005574
|
||||||
|
-0.430715
|
||||||
|
-0.312284
|
||||||
|
-0.161185
|
||||||
|
-0.151565
|
||||||
|
-0.060493
|
||||||
|
0.231827
|
||||||
|
-0.357113
|
||||||
|
-0.438887
|
||||||
|
0.198280
|
||||||
|
0.193470
|
||||||
|
-0.002525
|
||||||
|
0.179678
|
||||||
|
-0.308586
|
||||||
|
-0.112759
|
||||||
|
0.013523
|
||||||
|
-0.020758
|
||||||
|
-0.320550
|
||||||
|
0.258272
|
||||||
|
0.125773
|
||||||
|
-0.437729
|
||||||
|
0.151137
|
||||||
|
-0.316827
|
||||||
|
0.176797
|
||||||
|
-0.178724
|
||||||
|
0.223349
|
||||||
|
-0.279238
|
||||||
|
0.006178
|
||||||
288
dataset/conv1_weight.txt
Normal file
288
dataset/conv1_weight.txt
Normal file
@@ -0,0 +1,288 @@
|
|||||||
|
0.264396
|
||||||
|
0.012110
|
||||||
|
0.255190
|
||||||
|
-0.113358
|
||||||
|
0.184589
|
||||||
|
0.057568
|
||||||
|
0.191846
|
||||||
|
0.117760
|
||||||
|
-0.245086
|
||||||
|
-0.005652
|
||||||
|
0.013235
|
||||||
|
0.293202
|
||||||
|
-0.188579
|
||||||
|
0.014698
|
||||||
|
0.025587
|
||||||
|
-0.051998
|
||||||
|
0.127640
|
||||||
|
0.287372
|
||||||
|
-0.119986
|
||||||
|
-0.208348
|
||||||
|
0.278841
|
||||||
|
-0.066475
|
||||||
|
-0.081250
|
||||||
|
0.092410
|
||||||
|
-0.147814
|
||||||
|
0.047256
|
||||||
|
0.173974
|
||||||
|
-0.329876
|
||||||
|
-0.423296
|
||||||
|
-0.584921
|
||||||
|
-0.356580
|
||||||
|
-0.229025
|
||||||
|
-0.270002
|
||||||
|
-0.255455
|
||||||
|
0.316085
|
||||||
|
0.004567
|
||||||
|
0.028426
|
||||||
|
-0.334845
|
||||||
|
-0.003385
|
||||||
|
0.140219
|
||||||
|
0.062490
|
||||||
|
-0.118646
|
||||||
|
0.094126
|
||||||
|
0.255222
|
||||||
|
-0.107712
|
||||||
|
0.002896
|
||||||
|
-0.081413
|
||||||
|
-0.043819
|
||||||
|
0.240522
|
||||||
|
0.022667
|
||||||
|
0.231820
|
||||||
|
-0.123995
|
||||||
|
-0.079158
|
||||||
|
-0.108327
|
||||||
|
-0.027508
|
||||||
|
-0.109963
|
||||||
|
0.288606
|
||||||
|
-0.335862
|
||||||
|
-0.232113
|
||||||
|
0.018983
|
||||||
|
-0.193671
|
||||||
|
-0.184815
|
||||||
|
-0.126731
|
||||||
|
-0.178352
|
||||||
|
0.144650
|
||||||
|
0.175241
|
||||||
|
-0.073164
|
||||||
|
0.199136
|
||||||
|
-0.253890
|
||||||
|
0.004484
|
||||||
|
0.067553
|
||||||
|
0.093465
|
||||||
|
-0.234934
|
||||||
|
-0.018499
|
||||||
|
0.011184
|
||||||
|
0.112343
|
||||||
|
-0.244534
|
||||||
|
0.285953
|
||||||
|
0.256141
|
||||||
|
0.238208
|
||||||
|
-0.024591
|
||||||
|
-0.110319
|
||||||
|
-0.337829
|
||||||
|
-0.268405
|
||||||
|
-0.332071
|
||||||
|
-0.051145
|
||||||
|
0.120763
|
||||||
|
-0.024749
|
||||||
|
0.248383
|
||||||
|
-0.101862
|
||||||
|
-0.352574
|
||||||
|
-0.188207
|
||||||
|
-0.154518
|
||||||
|
-0.308905
|
||||||
|
-0.424403
|
||||||
|
-0.342620
|
||||||
|
0.047083
|
||||||
|
-0.204670
|
||||||
|
0.273949
|
||||||
|
0.185371
|
||||||
|
-0.183867
|
||||||
|
0.222050
|
||||||
|
-0.289864
|
||||||
|
-0.377326
|
||||||
|
-0.207679
|
||||||
|
-0.126656
|
||||||
|
0.228524
|
||||||
|
-0.135648
|
||||||
|
0.092356
|
||||||
|
-0.157213
|
||||||
|
0.134332
|
||||||
|
0.084983
|
||||||
|
-0.017297
|
||||||
|
-0.296890
|
||||||
|
-0.262142
|
||||||
|
-0.014616
|
||||||
|
0.111652
|
||||||
|
-0.087568
|
||||||
|
0.171141
|
||||||
|
-0.299918
|
||||||
|
0.290131
|
||||||
|
-0.128769
|
||||||
|
-0.010415
|
||||||
|
0.076719
|
||||||
|
0.221479
|
||||||
|
-0.157894
|
||||||
|
0.068890
|
||||||
|
0.009761
|
||||||
|
-0.258660
|
||||||
|
-0.186225
|
||||||
|
0.254293
|
||||||
|
0.106144
|
||||||
|
-0.124818
|
||||||
|
-0.352556
|
||||||
|
0.231044
|
||||||
|
0.277191
|
||||||
|
-0.140471
|
||||||
|
-0.176610
|
||||||
|
0.164834
|
||||||
|
-0.223433
|
||||||
|
0.117251
|
||||||
|
-0.090913
|
||||||
|
-0.154972
|
||||||
|
-0.073200
|
||||||
|
0.225833
|
||||||
|
-0.121053
|
||||||
|
-0.519649
|
||||||
|
-0.030060
|
||||||
|
0.188377
|
||||||
|
-0.082648
|
||||||
|
0.023897
|
||||||
|
-0.181276
|
||||||
|
-0.320161
|
||||||
|
-0.050713
|
||||||
|
-0.041318
|
||||||
|
0.074467
|
||||||
|
0.171705
|
||||||
|
-0.126269
|
||||||
|
0.033716
|
||||||
|
-0.183754
|
||||||
|
-0.362817
|
||||||
|
-0.192327
|
||||||
|
-0.358436
|
||||||
|
0.258644
|
||||||
|
0.221722
|
||||||
|
0.208344
|
||||||
|
-0.113581
|
||||||
|
-0.216356
|
||||||
|
-0.303875
|
||||||
|
0.022764
|
||||||
|
0.062494
|
||||||
|
-0.168767
|
||||||
|
-0.236584
|
||||||
|
0.388117
|
||||||
|
-0.067814
|
||||||
|
0.008403
|
||||||
|
0.050595
|
||||||
|
-0.108519
|
||||||
|
-0.262208
|
||||||
|
0.319813
|
||||||
|
-0.006849
|
||||||
|
-0.024721
|
||||||
|
0.007692
|
||||||
|
0.137184
|
||||||
|
0.061543
|
||||||
|
-0.048481
|
||||||
|
-0.166637
|
||||||
|
-0.211058
|
||||||
|
-0.306806
|
||||||
|
-0.057978
|
||||||
|
-0.096503
|
||||||
|
0.288373
|
||||||
|
0.151038
|
||||||
|
-0.333258
|
||||||
|
-0.186567
|
||||||
|
0.161674
|
||||||
|
0.262806
|
||||||
|
0.237353
|
||||||
|
-0.361782
|
||||||
|
-0.131101
|
||||||
|
-0.373160
|
||||||
|
-0.334982
|
||||||
|
-0.396515
|
||||||
|
-0.323307
|
||||||
|
-0.202191
|
||||||
|
-0.373635
|
||||||
|
0.046574
|
||||||
|
0.177337
|
||||||
|
-0.233079
|
||||||
|
0.197044
|
||||||
|
-0.324467
|
||||||
|
0.273250
|
||||||
|
-0.320781
|
||||||
|
0.233871
|
||||||
|
0.165834
|
||||||
|
-0.151728
|
||||||
|
-0.184531
|
||||||
|
0.166097
|
||||||
|
-0.040754
|
||||||
|
0.147207
|
||||||
|
0.131238
|
||||||
|
0.264796
|
||||||
|
0.291155
|
||||||
|
-0.200281
|
||||||
|
0.195431
|
||||||
|
0.128389
|
||||||
|
0.181558
|
||||||
|
-0.252029
|
||||||
|
0.181836
|
||||||
|
0.083001
|
||||||
|
-0.180665
|
||||||
|
-0.252472
|
||||||
|
-0.259574
|
||||||
|
-0.150548
|
||||||
|
-0.247819
|
||||||
|
-0.253767
|
||||||
|
-0.109555
|
||||||
|
0.158506
|
||||||
|
-0.197960
|
||||||
|
0.196803
|
||||||
|
0.252319
|
||||||
|
-0.030197
|
||||||
|
-0.055893
|
||||||
|
0.254212
|
||||||
|
0.229382
|
||||||
|
-0.207656
|
||||||
|
0.037787
|
||||||
|
0.028231
|
||||||
|
-0.347745
|
||||||
|
-0.275953
|
||||||
|
-0.166275
|
||||||
|
-0.229568
|
||||||
|
0.267331
|
||||||
|
-0.257930
|
||||||
|
0.010068
|
||||||
|
0.209660
|
||||||
|
0.150940
|
||||||
|
-0.060589
|
||||||
|
-0.319203
|
||||||
|
0.035770
|
||||||
|
0.092334
|
||||||
|
-0.230210
|
||||||
|
0.245727
|
||||||
|
-0.068963
|
||||||
|
0.086573
|
||||||
|
-0.061331
|
||||||
|
0.122903
|
||||||
|
0.080436
|
||||||
|
0.119416
|
||||||
|
-0.024226
|
||||||
|
-0.188355
|
||||||
|
-0.234652
|
||||||
|
0.152925
|
||||||
|
0.201060
|
||||||
|
0.063903
|
||||||
|
0.123116
|
||||||
|
0.042292
|
||||||
|
-0.172743
|
||||||
|
0.206093
|
||||||
|
0.406446
|
||||||
|
-0.190303
|
||||||
|
-0.234680
|
||||||
|
-0.100517
|
||||||
|
-0.102583
|
||||||
|
0.154145
|
||||||
|
-0.134558
|
||||||
|
0.108717
|
||||||
|
0.010376
|
||||||
64
dataset/conv2_bias.txt
Normal file
64
dataset/conv2_bias.txt
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
-0.005641
|
||||||
|
0.045337
|
||||||
|
0.022688
|
||||||
|
0.022603
|
||||||
|
-0.003216
|
||||||
|
-0.030439
|
||||||
|
-0.141888
|
||||||
|
0.079657
|
||||||
|
-0.013354
|
||||||
|
-0.038644
|
||||||
|
-0.059302
|
||||||
|
-0.031407
|
||||||
|
-0.038632
|
||||||
|
0.039465
|
||||||
|
0.048158
|
||||||
|
-0.046950
|
||||||
|
-0.032638
|
||||||
|
-0.062939
|
||||||
|
-0.034895
|
||||||
|
0.013741
|
||||||
|
-0.037496
|
||||||
|
-0.019306
|
||||||
|
-0.007166
|
||||||
|
-0.045438
|
||||||
|
-0.017623
|
||||||
|
-0.029193
|
||||||
|
0.109553
|
||||||
|
-0.093409
|
||||||
|
0.000137
|
||||||
|
-0.009409
|
||||||
|
0.028830
|
||||||
|
0.002159
|
||||||
|
0.052856
|
||||||
|
-0.064427
|
||||||
|
-0.015227
|
||||||
|
0.012225
|
||||||
|
0.000874
|
||||||
|
-0.005634
|
||||||
|
0.036257
|
||||||
|
-0.054466
|
||||||
|
-0.003907
|
||||||
|
-0.143422
|
||||||
|
0.013692
|
||||||
|
-0.030289
|
||||||
|
-0.038533
|
||||||
|
-0.112211
|
||||||
|
0.034781
|
||||||
|
-0.008203
|
||||||
|
-0.054083
|
||||||
|
-0.016784
|
||||||
|
0.033634
|
||||||
|
-0.088775
|
||||||
|
0.017148
|
||||||
|
0.021540
|
||||||
|
0.015659
|
||||||
|
0.011183
|
||||||
|
-0.001851
|
||||||
|
-0.031995
|
||||||
|
-0.080671
|
||||||
|
0.051828
|
||||||
|
0.059321
|
||||||
|
-0.025378
|
||||||
|
-0.054386
|
||||||
|
-0.016398
|
||||||
18432
dataset/conv2_weight.txt
Normal file
18432
dataset/conv2_weight.txt
Normal file
File diff suppressed because it is too large
Load Diff
128
dataset/conv3_bias.txt
Normal file
128
dataset/conv3_bias.txt
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
0.080931
|
||||||
|
-0.005371
|
||||||
|
-0.036383
|
||||||
|
-0.045386
|
||||||
|
-0.054329
|
||||||
|
0.108908
|
||||||
|
-0.031541
|
||||||
|
0.028897
|
||||||
|
-0.060491
|
||||||
|
-0.020571
|
||||||
|
-0.018694
|
||||||
|
-0.025861
|
||||||
|
-0.030109
|
||||||
|
-0.052287
|
||||||
|
-0.096520
|
||||||
|
-0.006112
|
||||||
|
0.012281
|
||||||
|
-0.040138
|
||||||
|
-0.026996
|
||||||
|
-0.028355
|
||||||
|
0.023113
|
||||||
|
-0.018347
|
||||||
|
0.021012
|
||||||
|
-0.024404
|
||||||
|
-0.020810
|
||||||
|
-0.033943
|
||||||
|
-0.031695
|
||||||
|
-0.002791
|
||||||
|
-0.005490
|
||||||
|
0.052321
|
||||||
|
-0.037635
|
||||||
|
-0.028975
|
||||||
|
-0.072508
|
||||||
|
-0.010565
|
||||||
|
0.089627
|
||||||
|
0.051853
|
||||||
|
-0.049895
|
||||||
|
-0.028532
|
||||||
|
0.120244
|
||||||
|
-0.065720
|
||||||
|
-0.033159
|
||||||
|
0.008072
|
||||||
|
-0.022876
|
||||||
|
0.002690
|
||||||
|
0.028910
|
||||||
|
0.019758
|
||||||
|
-0.027900
|
||||||
|
-0.018999
|
||||||
|
-0.040230
|
||||||
|
0.012506
|
||||||
|
-0.044383
|
||||||
|
-0.028107
|
||||||
|
-0.035639
|
||||||
|
-0.008712
|
||||||
|
-0.042572
|
||||||
|
-0.007128
|
||||||
|
-0.026243
|
||||||
|
-0.047105
|
||||||
|
-0.071900
|
||||||
|
0.004547
|
||||||
|
-0.037700
|
||||||
|
-0.033511
|
||||||
|
-0.045946
|
||||||
|
-0.062072
|
||||||
|
-0.063012
|
||||||
|
0.037648
|
||||||
|
0.014312
|
||||||
|
0.006599
|
||||||
|
-0.023144
|
||||||
|
-0.023018
|
||||||
|
0.013904
|
||||||
|
-0.052499
|
||||||
|
0.017902
|
||||||
|
-0.040357
|
||||||
|
-0.098850
|
||||||
|
0.011475
|
||||||
|
0.070717
|
||||||
|
-0.013301
|
||||||
|
0.003174
|
||||||
|
-0.030168
|
||||||
|
-0.034066
|
||||||
|
-0.013226
|
||||||
|
-0.023046
|
||||||
|
-0.030439
|
||||||
|
-0.026275
|
||||||
|
0.031229
|
||||||
|
-0.053149
|
||||||
|
-0.067014
|
||||||
|
0.003809
|
||||||
|
0.001963
|
||||||
|
0.023235
|
||||||
|
-0.000045
|
||||||
|
-0.027270
|
||||||
|
-0.007391
|
||||||
|
-0.012155
|
||||||
|
-0.003669
|
||||||
|
-0.041546
|
||||||
|
0.016943
|
||||||
|
0.022902
|
||||||
|
-0.045985
|
||||||
|
-0.053092
|
||||||
|
0.021105
|
||||||
|
-0.032606
|
||||||
|
-0.028661
|
||||||
|
-0.048068
|
||||||
|
-0.042106
|
||||||
|
-0.017811
|
||||||
|
-0.019530
|
||||||
|
-0.028386
|
||||||
|
-0.047340
|
||||||
|
0.015859
|
||||||
|
-0.040411
|
||||||
|
-0.006513
|
||||||
|
0.007619
|
||||||
|
0.012492
|
||||||
|
0.011398
|
||||||
|
0.030425
|
||||||
|
-0.049798
|
||||||
|
-0.052375
|
||||||
|
-0.017007
|
||||||
|
-0.002935
|
||||||
|
0.080796
|
||||||
|
-0.064879
|
||||||
|
0.012029
|
||||||
|
0.002495
|
||||||
|
-0.053315
|
||||||
|
0.021447
|
||||||
|
-0.037960
|
||||||
73728
dataset/conv3_weight.txt
Normal file
73728
dataset/conv3_weight.txt
Normal file
File diff suppressed because it is too large
Load Diff
128
dataset/fc1_bias.txt
Normal file
128
dataset/fc1_bias.txt
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
-0.003303
|
||||||
|
-0.017162
|
||||||
|
-0.012434
|
||||||
|
-0.042197
|
||||||
|
-0.033317
|
||||||
|
-0.043120
|
||||||
|
0.000561
|
||||||
|
-0.011677
|
||||||
|
-0.000354
|
||||||
|
-0.008174
|
||||||
|
-0.032653
|
||||||
|
-0.000064
|
||||||
|
-0.007428
|
||||||
|
0.006177
|
||||||
|
-0.005123
|
||||||
|
-0.042697
|
||||||
|
-0.007818
|
||||||
|
-0.025033
|
||||||
|
0.017732
|
||||||
|
-0.065127
|
||||||
|
-0.036435
|
||||||
|
-0.038140
|
||||||
|
0.016812
|
||||||
|
-0.012877
|
||||||
|
-0.035449
|
||||||
|
-0.035985
|
||||||
|
0.000884
|
||||||
|
-0.026337
|
||||||
|
-0.003007
|
||||||
|
0.001144
|
||||||
|
-0.022054
|
||||||
|
0.032519
|
||||||
|
-0.008320
|
||||||
|
-0.004585
|
||||||
|
0.015589
|
||||||
|
-0.028719
|
||||||
|
-0.021946
|
||||||
|
-0.029944
|
||||||
|
-0.026863
|
||||||
|
-0.012840
|
||||||
|
-0.002333
|
||||||
|
-0.078329
|
||||||
|
-0.016042
|
||||||
|
-0.001515
|
||||||
|
-0.007396
|
||||||
|
0.017858
|
||||||
|
-0.014112
|
||||||
|
-0.040561
|
||||||
|
0.000165
|
||||||
|
-0.032233
|
||||||
|
0.014843
|
||||||
|
-0.055889
|
||||||
|
-0.032679
|
||||||
|
-0.002448
|
||||||
|
-0.023142
|
||||||
|
-0.031932
|
||||||
|
-0.061502
|
||||||
|
-0.011828
|
||||||
|
0.054338
|
||||||
|
0.025108
|
||||||
|
-0.036360
|
||||||
|
-0.014974
|
||||||
|
-0.005564
|
||||||
|
0.006727
|
||||||
|
-0.001447
|
||||||
|
-0.011361
|
||||||
|
-0.032685
|
||||||
|
-0.042424
|
||||||
|
0.028065
|
||||||
|
-0.010904
|
||||||
|
-0.018815
|
||||||
|
0.019042
|
||||||
|
-0.014854
|
||||||
|
-0.016071
|
||||||
|
-0.028355
|
||||||
|
-0.010906
|
||||||
|
-0.002750
|
||||||
|
-0.004453
|
||||||
|
-0.036549
|
||||||
|
0.008669
|
||||||
|
-0.031032
|
||||||
|
-0.004035
|
||||||
|
-0.004741
|
||||||
|
0.009571
|
||||||
|
-0.013948
|
||||||
|
-0.024394
|
||||||
|
-0.014121
|
||||||
|
-0.000113
|
||||||
|
0.030506
|
||||||
|
-0.020288
|
||||||
|
0.024610
|
||||||
|
-0.008582
|
||||||
|
0.029013
|
||||||
|
-0.003862
|
||||||
|
0.005664
|
||||||
|
-0.034357
|
||||||
|
0.015551
|
||||||
|
-0.007669
|
||||||
|
0.004395
|
||||||
|
-0.022629
|
||||||
|
-0.005918
|
||||||
|
-0.037288
|
||||||
|
0.000774
|
||||||
|
-0.049784
|
||||||
|
-0.010008
|
||||||
|
0.006821
|
||||||
|
-0.006700
|
||||||
|
0.000237
|
||||||
|
-0.005140
|
||||||
|
-0.010332
|
||||||
|
0.035143
|
||||||
|
-0.009957
|
||||||
|
-0.010226
|
||||||
|
-0.004023
|
||||||
|
-0.021022
|
||||||
|
0.009519
|
||||||
|
0.002547
|
||||||
|
-0.019027
|
||||||
|
-0.007719
|
||||||
|
-0.005774
|
||||||
|
-0.012114
|
||||||
|
0.008235
|
||||||
|
-0.014013
|
||||||
|
-0.001604
|
||||||
|
0.003618
|
||||||
|
-0.007368
|
||||||
|
0.010152
|
||||||
|
-0.027849
|
||||||
2359296
dataset/fc1_weight.txt
Normal file
2359296
dataset/fc1_weight.txt
Normal file
File diff suppressed because it is too large
Load Diff
4
dataset/fc2_bias.txt
Normal file
4
dataset/fc2_bias.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
-0.039707
|
||||||
|
-0.097658
|
||||||
|
0.063971
|
||||||
|
0.022999
|
||||||
512
dataset/fc2_weight.txt
Normal file
512
dataset/fc2_weight.txt
Normal file
@@ -0,0 +1,512 @@
|
|||||||
|
-0.058931
|
||||||
|
0.082741
|
||||||
|
0.021586
|
||||||
|
-0.026039
|
||||||
|
-0.056528
|
||||||
|
0.057236
|
||||||
|
-0.030001
|
||||||
|
-0.048260
|
||||||
|
-0.062991
|
||||||
|
-0.012605
|
||||||
|
-0.008995
|
||||||
|
0.075796
|
||||||
|
0.001260
|
||||||
|
0.070238
|
||||||
|
-0.038573
|
||||||
|
-0.010643
|
||||||
|
-0.061193
|
||||||
|
-0.055042
|
||||||
|
0.076177
|
||||||
|
-0.079882
|
||||||
|
0.052359
|
||||||
|
0.034187
|
||||||
|
0.046499
|
||||||
|
0.045794
|
||||||
|
-0.020017
|
||||||
|
0.001001
|
||||||
|
-0.040188
|
||||||
|
-0.079907
|
||||||
|
-0.022438
|
||||||
|
0.077808
|
||||||
|
-0.026346
|
||||||
|
0.016867
|
||||||
|
-0.062112
|
||||||
|
0.064634
|
||||||
|
-0.019558
|
||||||
|
-0.020223
|
||||||
|
0.074465
|
||||||
|
-0.026598
|
||||||
|
0.011714
|
||||||
|
-0.064458
|
||||||
|
-0.059716
|
||||||
|
-0.069215
|
||||||
|
-0.052678
|
||||||
|
0.051622
|
||||||
|
0.010130
|
||||||
|
0.075898
|
||||||
|
-0.060538
|
||||||
|
-0.024788
|
||||||
|
-0.023184
|
||||||
|
-0.051868
|
||||||
|
0.158896
|
||||||
|
0.028924
|
||||||
|
-0.009646
|
||||||
|
-0.042931
|
||||||
|
-0.054899
|
||||||
|
-0.068251
|
||||||
|
-0.013731
|
||||||
|
-0.074485
|
||||||
|
0.034882
|
||||||
|
0.048279
|
||||||
|
-0.028229
|
||||||
|
-0.033060
|
||||||
|
-0.042540
|
||||||
|
0.069897
|
||||||
|
-0.015747
|
||||||
|
-0.062755
|
||||||
|
0.050984
|
||||||
|
-0.058438
|
||||||
|
-0.000549
|
||||||
|
0.037112
|
||||||
|
-0.008702
|
||||||
|
0.052537
|
||||||
|
-0.032729
|
||||||
|
0.085430
|
||||||
|
0.005522
|
||||||
|
0.036936
|
||||||
|
-0.035021
|
||||||
|
-0.047576
|
||||||
|
0.021966
|
||||||
|
0.049943
|
||||||
|
0.004276
|
||||||
|
-0.002239
|
||||||
|
-0.025785
|
||||||
|
0.082176
|
||||||
|
0.004891
|
||||||
|
-0.070603
|
||||||
|
-0.061674
|
||||||
|
0.076097
|
||||||
|
0.054244
|
||||||
|
-0.121986
|
||||||
|
-0.098606
|
||||||
|
0.020275
|
||||||
|
0.089327
|
||||||
|
-0.065931
|
||||||
|
0.035219
|
||||||
|
-0.030433
|
||||||
|
0.016048
|
||||||
|
-0.082111
|
||||||
|
-0.005972
|
||||||
|
-0.033918
|
||||||
|
-0.045327
|
||||||
|
-0.055175
|
||||||
|
-0.021159
|
||||||
|
-0.045618
|
||||||
|
-0.045335
|
||||||
|
0.080924
|
||||||
|
-0.043546
|
||||||
|
-0.011036
|
||||||
|
0.033512
|
||||||
|
0.030838
|
||||||
|
-0.125617
|
||||||
|
0.027708
|
||||||
|
-0.081700
|
||||||
|
0.065922
|
||||||
|
0.051387
|
||||||
|
0.084328
|
||||||
|
0.047665
|
||||||
|
-0.026571
|
||||||
|
-0.035575
|
||||||
|
-0.024575
|
||||||
|
0.046240
|
||||||
|
0.077493
|
||||||
|
0.061416
|
||||||
|
-0.060857
|
||||||
|
0.001534
|
||||||
|
-0.071932
|
||||||
|
0.028963
|
||||||
|
-0.075439
|
||||||
|
-0.017644
|
||||||
|
0.054737
|
||||||
|
-0.003758
|
||||||
|
0.052111
|
||||||
|
0.011470
|
||||||
|
0.055459
|
||||||
|
-0.081584
|
||||||
|
-0.002910
|
||||||
|
-0.001614
|
||||||
|
0.000437
|
||||||
|
-0.010231
|
||||||
|
-0.080488
|
||||||
|
-0.063019
|
||||||
|
0.034179
|
||||||
|
-0.069775
|
||||||
|
0.043572
|
||||||
|
-0.049781
|
||||||
|
0.072616
|
||||||
|
0.047185
|
||||||
|
0.030650
|
||||||
|
0.082894
|
||||||
|
0.046069
|
||||||
|
-0.027637
|
||||||
|
0.023121
|
||||||
|
0.038936
|
||||||
|
0.052421
|
||||||
|
-0.069802
|
||||||
|
0.077418
|
||||||
|
-0.046277
|
||||||
|
-0.008017
|
||||||
|
0.001110
|
||||||
|
0.032984
|
||||||
|
-0.056455
|
||||||
|
-0.036477
|
||||||
|
-0.012413
|
||||||
|
-0.005958
|
||||||
|
-0.032892
|
||||||
|
-0.021581
|
||||||
|
0.007284
|
||||||
|
0.061327
|
||||||
|
-0.051783
|
||||||
|
-0.007153
|
||||||
|
-0.034280
|
||||||
|
0.085166
|
||||||
|
0.074945
|
||||||
|
0.028743
|
||||||
|
0.059292
|
||||||
|
0.034775
|
||||||
|
-0.081315
|
||||||
|
0.087160
|
||||||
|
-0.116786
|
||||||
|
0.049679
|
||||||
|
0.054562
|
||||||
|
-0.052033
|
||||||
|
0.037010
|
||||||
|
0.039532
|
||||||
|
0.042317
|
||||||
|
-0.055750
|
||||||
|
0.060417
|
||||||
|
-0.009291
|
||||||
|
0.044491
|
||||||
|
0.046893
|
||||||
|
-0.034242
|
||||||
|
-0.014553
|
||||||
|
-0.054940
|
||||||
|
-0.081220
|
||||||
|
0.085371
|
||||||
|
-0.014649
|
||||||
|
0.024209
|
||||||
|
0.089537
|
||||||
|
0.016395
|
||||||
|
-0.023147
|
||||||
|
0.058076
|
||||||
|
0.070385
|
||||||
|
0.006581
|
||||||
|
-0.001097
|
||||||
|
0.004920
|
||||||
|
0.048413
|
||||||
|
0.068944
|
||||||
|
-0.047064
|
||||||
|
-0.022705
|
||||||
|
-0.037674
|
||||||
|
-0.048809
|
||||||
|
0.040081
|
||||||
|
0.065193
|
||||||
|
0.043707
|
||||||
|
0.022925
|
||||||
|
0.066769
|
||||||
|
-0.012898
|
||||||
|
-0.077912
|
||||||
|
-0.052976
|
||||||
|
-0.081205
|
||||||
|
-0.023203
|
||||||
|
-0.015376
|
||||||
|
-0.003481
|
||||||
|
-0.002040
|
||||||
|
-0.040693
|
||||||
|
-0.030009
|
||||||
|
-0.038227
|
||||||
|
0.033057
|
||||||
|
-0.044845
|
||||||
|
0.066074
|
||||||
|
-0.025737
|
||||||
|
0.093399
|
||||||
|
0.059980
|
||||||
|
-0.061411
|
||||||
|
0.068019
|
||||||
|
0.067066
|
||||||
|
-0.037720
|
||||||
|
0.035344
|
||||||
|
-0.099108
|
||||||
|
0.057824
|
||||||
|
0.010723
|
||||||
|
0.073095
|
||||||
|
0.064890
|
||||||
|
-0.069253
|
||||||
|
-0.035479
|
||||||
|
0.014207
|
||||||
|
0.033675
|
||||||
|
0.036457
|
||||||
|
0.037335
|
||||||
|
-0.056124
|
||||||
|
0.070666
|
||||||
|
-0.016997
|
||||||
|
-0.042993
|
||||||
|
0.019509
|
||||||
|
0.010573
|
||||||
|
-0.073225
|
||||||
|
0.010903
|
||||||
|
0.021510
|
||||||
|
0.046624
|
||||||
|
0.016918
|
||||||
|
-0.034955
|
||||||
|
-0.004001
|
||||||
|
-0.071385
|
||||||
|
0.052190
|
||||||
|
0.054234
|
||||||
|
0.028797
|
||||||
|
-0.016552
|
||||||
|
-0.049426
|
||||||
|
-0.008711
|
||||||
|
-0.003803
|
||||||
|
0.060791
|
||||||
|
-0.065849
|
||||||
|
0.068911
|
||||||
|
0.072407
|
||||||
|
0.052717
|
||||||
|
-0.037600
|
||||||
|
-0.029691
|
||||||
|
0.041340
|
||||||
|
-0.003574
|
||||||
|
0.028065
|
||||||
|
-0.056100
|
||||||
|
-0.039326
|
||||||
|
0.015791
|
||||||
|
0.011882
|
||||||
|
0.045606
|
||||||
|
-0.016313
|
||||||
|
-0.063804
|
||||||
|
-0.023912
|
||||||
|
-0.007011
|
||||||
|
0.080493
|
||||||
|
-0.011968
|
||||||
|
-0.048865
|
||||||
|
0.068336
|
||||||
|
0.063640
|
||||||
|
-0.018984
|
||||||
|
0.016588
|
||||||
|
-0.080367
|
||||||
|
-0.076863
|
||||||
|
0.069094
|
||||||
|
0.075082
|
||||||
|
0.072882
|
||||||
|
-0.018639
|
||||||
|
-0.034967
|
||||||
|
-0.034542
|
||||||
|
-0.057999
|
||||||
|
0.033039
|
||||||
|
-0.045209
|
||||||
|
0.023652
|
||||||
|
-0.051687
|
||||||
|
-0.077231
|
||||||
|
0.046792
|
||||||
|
0.048312
|
||||||
|
0.084837
|
||||||
|
0.036035
|
||||||
|
0.003179
|
||||||
|
-0.019603
|
||||||
|
-0.036890
|
||||||
|
-0.063492
|
||||||
|
-0.045074
|
||||||
|
-0.083299
|
||||||
|
0.024020
|
||||||
|
0.047446
|
||||||
|
-0.078694
|
||||||
|
-0.071320
|
||||||
|
0.062962
|
||||||
|
0.072505
|
||||||
|
-0.048483
|
||||||
|
0.005049
|
||||||
|
0.013660
|
||||||
|
-0.064950
|
||||||
|
-0.032050
|
||||||
|
-0.026682
|
||||||
|
0.072182
|
||||||
|
0.080960
|
||||||
|
-0.044191
|
||||||
|
-0.041733
|
||||||
|
0.073146
|
||||||
|
-0.064979
|
||||||
|
0.078111
|
||||||
|
-0.039892
|
||||||
|
-0.002631
|
||||||
|
0.024524
|
||||||
|
0.063003
|
||||||
|
0.063028
|
||||||
|
0.022161
|
||||||
|
0.036528
|
||||||
|
0.005402
|
||||||
|
0.017228
|
||||||
|
0.012027
|
||||||
|
-0.017038
|
||||||
|
0.072777
|
||||||
|
0.000782
|
||||||
|
-0.042552
|
||||||
|
0.014487
|
||||||
|
0.000573
|
||||||
|
0.032583
|
||||||
|
0.048010
|
||||||
|
0.043475
|
||||||
|
-0.041002
|
||||||
|
0.024025
|
||||||
|
0.073455
|
||||||
|
0.013298
|
||||||
|
0.074902
|
||||||
|
0.064317
|
||||||
|
0.045918
|
||||||
|
-0.005138
|
||||||
|
0.003448
|
||||||
|
0.078688
|
||||||
|
0.048412
|
||||||
|
0.047301
|
||||||
|
0.061309
|
||||||
|
-0.015053
|
||||||
|
0.003955
|
||||||
|
-0.067288
|
||||||
|
0.076958
|
||||||
|
0.033469
|
||||||
|
-0.058862
|
||||||
|
0.018029
|
||||||
|
0.078768
|
||||||
|
0.039408
|
||||||
|
-0.033360
|
||||||
|
-0.022925
|
||||||
|
-0.119977
|
||||||
|
-0.025087
|
||||||
|
-0.068750
|
||||||
|
0.035327
|
||||||
|
0.073855
|
||||||
|
0.047400
|
||||||
|
-0.075196
|
||||||
|
0.010550
|
||||||
|
-0.046624
|
||||||
|
0.029754
|
||||||
|
-0.057842
|
||||||
|
-0.052033
|
||||||
|
0.017090
|
||||||
|
0.019803
|
||||||
|
0.015316
|
||||||
|
-0.043967
|
||||||
|
0.015191
|
||||||
|
-0.061190
|
||||||
|
-0.021009
|
||||||
|
0.074461
|
||||||
|
0.034960
|
||||||
|
-0.051407
|
||||||
|
-0.044240
|
||||||
|
0.029745
|
||||||
|
-0.033547
|
||||||
|
-0.027608
|
||||||
|
-0.006036
|
||||||
|
0.030190
|
||||||
|
-0.007352
|
||||||
|
-0.065457
|
||||||
|
0.040382
|
||||||
|
0.001965
|
||||||
|
-0.033753
|
||||||
|
0.075904
|
||||||
|
0.003190
|
||||||
|
0.088717
|
||||||
|
0.082109
|
||||||
|
-0.039526
|
||||||
|
-0.002976
|
||||||
|
-0.028223
|
||||||
|
-0.028789
|
||||||
|
-0.069433
|
||||||
|
0.030751
|
||||||
|
-0.041434
|
||||||
|
0.007254
|
||||||
|
0.040745
|
||||||
|
0.063343
|
||||||
|
-0.102280
|
||||||
|
-0.021423
|
||||||
|
-0.042879
|
||||||
|
0.065601
|
||||||
|
0.064359
|
||||||
|
-0.098568
|
||||||
|
-0.014232
|
||||||
|
-0.023211
|
||||||
|
-0.014910
|
||||||
|
0.090127
|
||||||
|
-0.109398
|
||||||
|
-0.166171
|
||||||
|
-0.019305
|
||||||
|
0.074800
|
||||||
|
-0.038058
|
||||||
|
0.012383
|
||||||
|
0.078751
|
||||||
|
0.045327
|
||||||
|
-0.020477
|
||||||
|
-0.010302
|
||||||
|
-0.045507
|
||||||
|
0.033407
|
||||||
|
-0.035723
|
||||||
|
0.075363
|
||||||
|
-0.055598
|
||||||
|
0.062439
|
||||||
|
0.006332
|
||||||
|
-0.011081
|
||||||
|
-0.023165
|
||||||
|
-0.097509
|
||||||
|
0.051888
|
||||||
|
0.005613
|
||||||
|
0.042150
|
||||||
|
0.026668
|
||||||
|
-0.085304
|
||||||
|
0.069341
|
||||||
|
-0.081594
|
||||||
|
-0.054077
|
||||||
|
0.075259
|
||||||
|
-0.074176
|
||||||
|
-0.072364
|
||||||
|
-0.071474
|
||||||
|
-0.015352
|
||||||
|
-0.084154
|
||||||
|
0.034522
|
||||||
|
0.073654
|
||||||
|
-0.020917
|
||||||
|
-0.002134
|
||||||
|
-0.049188
|
||||||
|
-0.054401
|
||||||
|
-0.064645
|
||||||
|
-0.093849
|
||||||
|
0.072262
|
||||||
|
0.071346
|
||||||
|
-0.067045
|
||||||
|
-0.009426
|
||||||
|
-0.000583
|
||||||
|
0.070907
|
||||||
|
-0.070580
|
||||||
|
0.029851
|
||||||
|
0.061377
|
||||||
|
-0.040588
|
||||||
|
0.056680
|
||||||
|
-0.075749
|
||||||
|
0.076125
|
||||||
|
0.009514
|
||||||
|
0.015952
|
||||||
|
0.092470
|
||||||
|
-0.072424
|
||||||
|
0.045863
|
||||||
|
0.036735
|
||||||
|
-0.078604
|
||||||
|
0.061958
|
||||||
|
-0.081167
|
||||||
|
0.005184
|
||||||
|
0.022731
|
||||||
|
-0.023145
|
||||||
|
-0.013089
|
||||||
|
-0.000382
|
||||||
|
-0.053056
|
||||||
|
-0.019507
|
||||||
|
0.018815
|
||||||
|
-0.035313
|
||||||
27
debug.c
27
debug.c
@@ -1,27 +0,0 @@
|
|||||||
#include "debug.h"
|
|
||||||
|
|
||||||
|
|
||||||
u8 _DEBUG = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DEBUG(){
|
|
||||||
_DEBUG = !_DEBUG;
|
|
||||||
printf("DEBUG IS: %s",(_DEBUG ? "ON" : "OFF"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DEBUG_PRINTF(const char *fmt, ...) {
|
|
||||||
if(_DEBUG){
|
|
||||||
va_list args;
|
|
||||||
va_start(args, fmt);
|
|
||||||
vprintf(fmt, args);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SDRAM_USED(){
|
|
||||||
}
|
|
||||||
19
debug.h
19
debug.h
@@ -1,19 +0,0 @@
|
|||||||
#ifndef DEBUG_H_
|
|
||||||
#define DEBUG_H_
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "malloc.h"
|
|
||||||
|
|
||||||
typedef uint32_t u32;
|
|
||||||
typedef uint16_t u16;
|
|
||||||
typedef uint8_t u8;
|
|
||||||
|
|
||||||
void DEBUG(void);
|
|
||||||
void DEBUG_PRINTF(const char *fmt, ...);
|
|
||||||
void SDRAM_USED(void);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
102
main.c
102
main.c
@@ -5,108 +5,10 @@
|
|||||||
#include "cnn_model.h"
|
#include "cnn_model.h"
|
||||||
#include "cnn.h"
|
#include "cnn.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void run_dataset(){
|
|
||||||
char* modelusearr_origin[] = {
|
|
||||||
"C1autosave00095_right_new_2",
|
|
||||||
"C1autosave00096_right_new_2",
|
|
||||||
"C1autosave00097_right_new_2",
|
|
||||||
"C1autosave00098_right_new_2",
|
|
||||||
"C1autosave00099_right_new_2",
|
|
||||||
"C1autosave00100_right_new_2",
|
|
||||||
"C1autosave00101_right_new_2",
|
|
||||||
"C1autosave00102_right_new_2",
|
|
||||||
"C1autosave00103_right_new_2",
|
|
||||||
"C1autosave00104_right_new_2",
|
|
||||||
"C1autosave00105_right_new_2",
|
|
||||||
"C1autosave00106_right_new_2",
|
|
||||||
"C1autosave00107_right_new_2",
|
|
||||||
"C1autosave00108_right_new_2",
|
|
||||||
"C1autosave00109_right_new_2",
|
|
||||||
"C1autosave00110_right_new_2",
|
|
||||||
"C1autosave00111_right_new_2",
|
|
||||||
"C1autosave00112_right_new_2",
|
|
||||||
"C1autosave00113_right_new_2",
|
|
||||||
"C1autosave00114_right_new_2",
|
|
||||||
"C1autosave00115_right_new_2",
|
|
||||||
"C1autosave00116_right_new_2",
|
|
||||||
"C1autosave00117_right_new_2",
|
|
||||||
"C1autosave00118_right_new_2",
|
|
||||||
"C1autosave00119_right_new_2",
|
|
||||||
"C1autosave00120_right_new_2",
|
|
||||||
"C1autosave00121_right_new_2",
|
|
||||||
"C1autosave00122_right_new_2",
|
|
||||||
"C1autosave00123_right_new_2",
|
|
||||||
"C1autosave00124_right_new_2",
|
|
||||||
|
|
||||||
"filtered_C1autosave00011_right_new",
|
|
||||||
"filtered_C1autosave00015_right_new",
|
|
||||||
"filtered_C1autosave00043_right_new",
|
|
||||||
"filtered_C1autosave00067_right_new",
|
|
||||||
"filtered_C1autosave00090_right_new",
|
|
||||||
"filtered_C1autosave00106_right_new",
|
|
||||||
"filtered_C1autosave00118_right_new",
|
|
||||||
|
|
||||||
"filtered_C1autosave00007_right_new",
|
|
||||||
"filtered_C1autosave00035_right_new",
|
|
||||||
"filtered_C1autosave00036_right_new",
|
|
||||||
"filtered_C1autosave00040_right_new",
|
|
||||||
"filtered_C1autosave00053_right_new",
|
|
||||||
"filtered_C1autosave00061_right_new",
|
|
||||||
"filtered_C1autosave00074_right_new",
|
|
||||||
"filtered_C1autosave00077_right_new",
|
|
||||||
"filtered_C1autosave00080_right_new",
|
|
||||||
"filtered_C1autosave00085_right_new",
|
|
||||||
"filtered_C1autosave00098_right_new",
|
|
||||||
"filtered_C1autosave00100_right_new",
|
|
||||||
"filtered_C1autosave00104_right_new",
|
|
||||||
"filtered_C1autosave00122_right_new",
|
|
||||||
"filtered_C1autosave00124_right_new",
|
|
||||||
|
|
||||||
"filtered_C1autosave00108_right_new",
|
|
||||||
|
|
||||||
"filtered_C1autosave00004_right_new",
|
|
||||||
"filtered_C1autosave00039_right_new",
|
|
||||||
"filtered_C1autosave00062_right_new",
|
|
||||||
};
|
|
||||||
char* modelusearr_output[] = {
|
|
||||||
"split_1",
|
|
||||||
"split_2",
|
|
||||||
"split_3",
|
|
||||||
"split_4",
|
|
||||||
"split_5",
|
|
||||||
"split_6",
|
|
||||||
"split_7",
|
|
||||||
"split_8",
|
|
||||||
"split_9",
|
|
||||||
"split_10",
|
|
||||||
};
|
|
||||||
/* 可用数据集如下
|
|
||||||
* modelusearr_origin
|
|
||||||
* modelusearr_output
|
|
||||||
*/
|
|
||||||
#define modelusearr modelusearr_output
|
|
||||||
for(int a=0;a<(sizeof(modelusearr) / sizeof(modelusearr[0]));a++){
|
|
||||||
SDRAM_USED();
|
|
||||||
model_switchdata(modelusearr[a]);
|
|
||||||
cnn_run();
|
|
||||||
}
|
|
||||||
printf("\r\n运行完成\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
model_init();
|
model_init();
|
||||||
model_write("all");
|
model_write("all");
|
||||||
|
model_switchdata("split_3");
|
||||||
#if is1300000
|
|
||||||
run_dataset();
|
|
||||||
#else
|
|
||||||
model_switchdata("EEC30B3F 2024-11-13 11-49-24");
|
|
||||||
cnn_run();
|
cnn_run();
|
||||||
#endif
|
printf("\r\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\n");
|
||||||
|
|
||||||
DEBUG_PRINTF("\r\nEnd结束");
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user