From b5b3f7089e46aa4229a8190e2e6485adbd8a9054 Mon Sep 17 00:00:00 2001 From: julienChemillier Date: Tue, 8 Nov 2022 18:03:59 +0100 Subject: [PATCH 1/2] Add a resource --- doc/resources.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/resources.md b/doc/resources.md index 09c2a1c..41d5253 100644 --- a/doc/resources.md +++ b/doc/resources.md @@ -5,11 +5,12 @@ - [Medium](https://medium.com/@14prakash/back-propagation-is-very-simple-who-made-it-complicated-97b794c97e5c) - [Simeon Kostadinov: Understanding Backpropagation](https://towardsdatascience.com/understanding-backpropagation-algorithm-7bb3aa2f95fd) - [Tobias Hill: Gradient Descent](https://towardsdatascience.com/part-2-gradient-descent-and-backpropagation-bf90932c066a) +- [Adam Optimizer](https://arxiv.org/pdf/1412.6980.pdf) ## Convolutional Neural Network - - [The Independent Code](https://www.youtube.com/watch?v=Lakz2MoHy6o) + ## Jeux de données - [MNIST](http://yann.lecun.com/exdb/mnist/) - [ImageNet](https://www.image-net.org/index.php) From 72919406a0295d781cc3179d6ed3157946078208 Mon Sep 17 00:00:00 2001 From: julienChemillier Date: Tue, 8 Nov 2022 18:04:58 +0100 Subject: [PATCH 2/2] Fix issues --- src/cnn/include/update.h | 2 ++ src/cnn/print.c | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/cnn/include/update.h b/src/cnn/include/update.h index 345060f..9c16886 100644 --- a/src/cnn/include/update.h +++ b/src/cnn/include/update.h @@ -1,3 +1,5 @@ +#include "struct.h" + #ifndef DEF_UPDATE_H #define DEF_UPDATE_H diff --git a/src/cnn/print.c b/src/cnn/print.c index 8048e6b..42e0058 100644 --- a/src/cnn/print.c +++ b/src/cnn/print.c @@ -11,14 +11,14 @@ #define purple printf("\033[0;35m") #define reset_color printf("\033[0m") -void print_kernel_cnn(Kernel_cnn* k, int depth_input, int dim_input, int depth_output, int dim_output) { +void print_kernel_cnn(Kernel_cnn* ker, int depth_input, int dim_input, int depth_output, int dim_output) { int k_size = dim_input - dim_output + 1; // print bias green; for (int i=0; ibias[i][j][k]); + printf("%.2f", ker->bias[i][j][k]); } print_space; } @@ -29,12 +29,12 @@ void print_kernel_cnn(Kernel_cnn* k, int depth_input, int dim_input, int depth_o //print weights red; - for (int i=0; i<; i++) { + for (int i=0; iw[i][j][k][l]); + for (int j=0; jw[i][j][k][l]); } print_space; } @@ -56,11 +56,11 @@ void print_pooling(int size) { print_dspace; } -void print_kernel_nn(Kernel_nn* k, int size_input, int size_output) { +void print_kernel_nn(Kernel_nn* ker, int size_input, int size_output) { // print bias green; for (int i=0; ibias[i]); + printf("%.2f ", ker->bias[i]); } print_dspace; reset_color; @@ -69,7 +69,7 @@ void print_kernel_nn(Kernel_nn* k, int size_input, int size_output) { red; for (int i=0; iweights[j][i]); + printf("%.2f ", ker->weights[j][i]); } print_space; } @@ -97,17 +97,18 @@ void print_input(float*** input, int depth, int dim) { void print_cnn(Network* network) { int n = network->size; int input_depth, input_width, output_depth, output_width; + //float*** output; + //float*** input; Kernel* k_i; for (int i=0; i<(n-1); i++) { - input = network->input[i]; + //input = network->input[i]; input_depth = network->depth[i]; input_width = network->width[i]; - output = network->input[i+1]; + //output = network->input[i+1]; output_depth = network->depth[i+1]; output_width = network->width[i+1]; k_i = network->kernel[i]; - print_input(input, input_depth, input_width); if (k_i->cnn) { // Convolution print_kernel_cnn(k_i->cnn, input_depth, input_width, output_depth, output_width); @@ -119,5 +120,4 @@ void print_cnn(Network* network) { print_pooling(input_width - output_width +1); } } - print_input(input[n-1], network->depth[n-1], network->width[n-1]); } \ No newline at end of file