From de79f98ad5a3b43cb924527c91ce025c558cf019 Mon Sep 17 00:00:00 2001 From: julienChemillier Date: Sun, 14 May 2023 17:40:50 +0200 Subject: [PATCH] Add AlexNet architecture --- src/cnn/creation.c | 16 ++++++++++++++++ src/cnn/include/creation.h | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/src/cnn/creation.c b/src/cnn/creation.c index 5c5a1ab..c1e433c 100644 --- a/src/cnn/creation.c +++ b/src/cnn/creation.c @@ -50,6 +50,22 @@ Network* create_network_lenet5(float learning_rate, int dropout, int activation, return network; } +Network* create_network_alexnet(float learning_rate, int dropout, int activation, int initialisation, int size_output) { + Network* network = create_network(12, learning_rate, dropout, activation, initialisation, 227, 3); + add_convolution(network, 11, 96, 4, 0, activation); + add_average_pooling(network, 3, 2, 0); + add_convolution(network, 5, 256, 1, 2, activation); + add_average_pooling(network, 3, 2, 0); + add_convolution(network, 3, 384, 1, 1, activation); + add_convolution(network, 3, 384, 1, 1, activation); + add_convolution(network, 3, 256, 1, 1, activation); + add_average_pooling(network, 3, 2, 0); + add_dense_linearisation(network, 4096, activation); + add_dense(network, 4096, activation); + add_dense(network, size_output, activation); + return network; +} + Network* create_simple_one(float learning_rate, int dropout, int activation, int initialisation, int input_width, int input_depth) { Network* network = create_network(3, learning_rate, dropout, activation, initialisation, input_width, input_depth); add_dense_linearisation(network, 80, activation); diff --git a/src/cnn/include/creation.h b/src/cnn/include/creation.h index 7ec1897..dbdded3 100644 --- a/src/cnn/include/creation.h +++ b/src/cnn/include/creation.h @@ -14,6 +14,11 @@ Network* create_network(int max_size, float learning_rate, int dropout, int acti */ Network* create_network_lenet5(float learning_rate, int dropout, int activation, int initialisation, int input_width, int input_depth); +/* +* Renvoie un réseau suivante l'architecture AlexNet +* C'est à dire une entrée de 3x227x227 et une sortie de taille 'size_output' +*/ +Network* create_network_alexnet(float learning_rate, int dropout, int activation, int initialisation, int size_output); /* * Renvoie un réseau sans convolution, similaire à celui utilisé dans src/dense */