2023-01-06 18:27:56 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
2023-05-12 16:16:34 +02:00
|
|
|
#include "../src/common/include/colors.h"
|
2023-01-06 18:27:56 +01:00
|
|
|
#include "../src/cnn/include/creation.h"
|
2023-05-15 18:25:29 +02:00
|
|
|
#include "../src/cnn/include/models.h"
|
2023-01-06 18:27:56 +01:00
|
|
|
#include "../src/cnn/include/utils.h"
|
|
|
|
#include "../src/cnn/include/free.h"
|
2023-05-26 20:46:58 +02:00
|
|
|
#include "../src/cnn/include/cnn.h"
|
2023-01-06 18:27:56 +01:00
|
|
|
|
2023-11-10 23:09:48 +01:00
|
|
|
#include "include/test.h"
|
2023-01-06 18:27:56 +01:00
|
|
|
|
|
|
|
int main() {
|
2023-11-10 23:09:48 +01:00
|
|
|
_TEST_PRESENTATION("Description Architecture LeNet5");
|
|
|
|
|
2023-01-06 18:27:56 +01:00
|
|
|
Kernel* kernel;
|
2023-05-26 20:46:58 +02:00
|
|
|
Network* network = create_network_lenet5(0, 0, 3, 2, 32, 1, NN_ONLY); // Pas besoin d'initialiser toute la backprop
|
2023-11-10 23:09:48 +01:00
|
|
|
_TEST_ASSERT(true, "Création du réseau");
|
2023-01-06 18:27:56 +01:00
|
|
|
|
|
|
|
printf("Architecture LeNet5:\n");
|
2023-01-17 15:25:34 +01:00
|
|
|
for (int i=0; i < network->size-1; i++) {
|
2023-01-06 18:27:56 +01:00
|
|
|
kernel = network->kernel[i];
|
|
|
|
if ((!kernel->cnn)&&(!kernel->nn)) {
|
2023-03-08 20:48:34 +01:00
|
|
|
if (kernel->pooling == AVG_POOLING) {
|
2023-02-03 15:12:59 +01:00
|
|
|
printf("\n==== Couche %d de type "YELLOW"Average Pooling"RESET" ====\n", i);
|
|
|
|
} else {
|
|
|
|
printf("\n==== Couche %d de type "YELLOW"Max Pooling"RESET" ====\n", i);
|
|
|
|
}
|
2023-05-14 17:58:50 +02:00
|
|
|
int kernel_size = 2*kernel->padding + network->width[i] + kernel->stride - network->width[i+1]*kernel->stride;
|
|
|
|
printf("kernel: %dx%d, pad=%d, stride=%d\n", kernel_size, kernel_size, kernel->padding, kernel->stride);
|
2023-01-06 18:27:56 +01:00
|
|
|
} else if (!kernel->cnn) {
|
|
|
|
printf("\n==== Couche %d de type "GREEN"NN"RESET" ====\n", i);
|
2023-05-14 17:58:50 +02:00
|
|
|
if (kernel->linearisation) {
|
|
|
|
printf(YELLOW"Linéarisation: %d\n"RESET, kernel->linearisation);
|
|
|
|
}
|
2023-02-19 12:50:27 +01:00
|
|
|
printf("input: %d\n", kernel->nn->size_input);
|
2023-02-19 12:53:08 +01:00
|
|
|
printf("output: %d\n", kernel->nn->size_output);
|
2023-01-06 18:27:56 +01:00
|
|
|
} else {
|
|
|
|
printf("\n==== Couche %d de type "BLUE"CNN"RESET" ====\n", i);
|
2023-05-14 17:58:50 +02:00
|
|
|
printf("kernel: %dx%d, pad=%d, stride=%d\n", kernel->cnn->k_size, kernel->cnn->k_size, kernel->padding, kernel->stride);
|
|
|
|
printf("%d kernels\n", kernel->cnn->columns);
|
|
|
|
}
|
|
|
|
if (!kernel->nn) {
|
|
|
|
printf("depth: %d\n", network->depth[i]);
|
|
|
|
printf("width: %d\n", network->width[i]);
|
2023-01-06 18:27:56 +01:00
|
|
|
}
|
2023-05-14 17:58:50 +02:00
|
|
|
if (kernel->nn || kernel->cnn) {
|
|
|
|
printf("activation: %d\n", kernel->activation);
|
2023-01-13 15:59:04 +01:00
|
|
|
}
|
2023-01-06 18:27:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
free_network(network);
|
2023-11-10 23:09:48 +01:00
|
|
|
_TEST_ASSERT(true, "Libération de la mémoire");
|
2023-01-06 18:27:56 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|