Ajout des headers

This commit is contained in:
Julien Chemillier 2022-04-01 15:41:54 +02:00
parent 497741208b
commit a7bda55410
7 changed files with 72 additions and 12 deletions

15
src/mnist/mnist.h Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#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

View File

@ -4,18 +4,10 @@
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
#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) #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) { void creation_du_reseau_neuronal(Reseau* reseau_neuronal, int* neurones_par_couche, int nb_couches) {

View File

@ -0,0 +1,21 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#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

View File

@ -3,12 +3,11 @@
#include <stdint.h> #include <stdint.h>
#include <inttypes.h> #include <inttypes.h>
#include "struct/neuron.c" #include "struct/neuron.h"
#define MAGIC_NUMBER 2023 #define MAGIC_NUMBER 2023
Neurone* lire_neurone(uint32_t nb_poids_sortants, FILE *ptr) { Neurone* lire_neurone(uint32_t nb_poids_sortants, FILE *ptr) {
Neurone* neurone = malloc(sizeof(Neurone)); Neurone* neurone = malloc(sizeof(Neurone));
float activation; float activation;

17
src/mnist/neuron_io.h Normal file
View File

@ -0,0 +1,17 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#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

16
src/mnist/preview.h Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#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