diff --git a/src/mnist/mnist.h b/src/mnist/mnist.h new file mode 100644 index 0000000..00cca2c --- /dev/null +++ b/src/mnist/mnist.h @@ -0,0 +1,15 @@ +#include +#include +#include +#include + +#ifndef DEF_MNIST_H +#define DEF_MNIST_H + +uint32_t swap_endian(uint32_t val); +int** read_image(unsigned int width, unsigned int height, FILE* ptr); +int* read_mnist_images_parameters(char* filename); +int*** read_mnist_images(char* filename); +unsigned int* read_mnist_labels(char* filename); + +#endif \ No newline at end of file diff --git a/src/mnist/neural_network.c b/src/mnist/neural_network.c index 6503a76..2887b19 100644 --- a/src/mnist/neural_network.c +++ b/src/mnist/neural_network.c @@ -4,18 +4,10 @@ #include #include -#include "struct/neuron.c" +#include "struct/neuron.h" #define TAUX_APPRENTISSAGE 0.15 // Définit le taux d'apprentissage du réseau neuronal, donc la rapidité d'adaptation du modèle (compris entre 0 et 1) -void creation_du_reseau_neuronal(Reseau* reseau_neuronal, int* neurones_par_couche, int nb_couches); -void suppression_du_reseau_neuronal(Reseau* reseau_neuronal); -void forward_propagation(Reseau* reseau_neuronal); -int* creation_de_la_sortie_voulue(Reseau* reseau_neuronal, int pos_nombre_voulu); -void backward_propagation(Reseau* reseau_neuronal, int* sortie_voulue); -void modification_du_reseau_neuronal(Reseau* reseau_neuronal); -void initialisation_du_reseau_neuronal(Reseau* reseau_neuronal); - void creation_du_reseau_neuronal(Reseau* reseau_neuronal, int* neurones_par_couche, int nb_couches) { diff --git a/src/mnist/neural_network.h b/src/mnist/neural_network.h new file mode 100644 index 0000000..82a07c7 --- /dev/null +++ b/src/mnist/neural_network.h @@ -0,0 +1,21 @@ +#include +#include +#include +#include +#include + +#include "struct/neuron.h" + +#ifndef DEF_NEURAL_NETWORK_H +#define DEF_NEURAL_NETWORK_H + +void creation_du_reseau_neuronal(Reseau* reseau_neuronal, int* neurones_par_couche, int nb_couches); +void suppression_du_reseau_neuronal(Reseau* reseau_neuronal); +void forward_propagation(Reseau* reseau_neuronal); +int* creation_de_la_sortie_voulue(Reseau* reseau_neuronal, int pos_nombre_voulu); +void backward_propagation(Reseau* reseau_neuronal, int* sortie_voulue); +void modification_du_reseau_neuronal(Reseau* reseau_neuronal); +void initialisation_du_reseau_neuronal(Reseau* reseau_neuronal); + + +#endif diff --git a/src/mnist/neuron_io.c b/src/mnist/neuron_io.c index a2eb602..09f148f 100644 --- a/src/mnist/neuron_io.c +++ b/src/mnist/neuron_io.c @@ -3,12 +3,11 @@ #include #include -#include "struct/neuron.c" - - +#include "struct/neuron.h" #define MAGIC_NUMBER 2023 + Neurone* lire_neurone(uint32_t nb_poids_sortants, FILE *ptr) { Neurone* neurone = malloc(sizeof(Neurone)); float activation; diff --git a/src/mnist/neuron_io.h b/src/mnist/neuron_io.h new file mode 100644 index 0000000..2a9864a --- /dev/null +++ b/src/mnist/neuron_io.h @@ -0,0 +1,17 @@ +#include +#include +#include +#include +#include "struct/neuron.h" + +#ifndef DEF_NEURON_IO_H +#define DEF_NEURON_IO_H + +Neurone* lire_neurone(uint32_t nb_poids_sortants, FILE *ptr); +Neurone** lire_neurones(uint32_t nb_neurones, uint32_t nb_poids_sortants, FILE *ptr); +Reseau* lire_reseau(char* filename); +void ecrire_neurone(Neurone* neurone, int poids_sortants, FILE *ptr); +int ecrire_reseau(char* filename, Reseau* reseau); + + +#endif diff --git a/src/mnist/preview.h b/src/mnist/preview.h new file mode 100644 index 0000000..b7be4a3 --- /dev/null +++ b/src/mnist/preview.h @@ -0,0 +1,16 @@ +#include +#include +#include +#include + +#ifndef DEF_PREVIEW_H +#define DEF_PREVIEW_H + +uint32_t swap_endian(uint32_t val); +void print_image(unsigned int width, unsigned int height, FILE* ptr, int start); +void read_mnist_images(char* filename, unsigned int* labels); +unsigned int* read_mnist_labels(char* filename); + +#endif + + \ No newline at end of file diff --git a/src/mnist/struct/neuron.c b/src/mnist/struct/neuron.h similarity index 100% rename from src/mnist/struct/neuron.c rename to src/mnist/struct/neuron.h