mirror of
https://github.com/augustin64/projet-tipe
synced 2025-01-24 07:36:24 +01:00
Update mnist .h files
This commit is contained in:
parent
f2474cba74
commit
b7eda807fc
@ -1,9 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mnist.c"
|
||||
|
||||
#include "include/cuda_utils.h"
|
||||
#include "include/mnist.h"
|
||||
|
||||
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#ifndef DEF_CUDA_UTILS_H
|
||||
#define DEF_CUDA_UTILS_H
|
||||
|
||||
#include "../cuda_utils.cu"
|
||||
/*
|
||||
* Il est entendu par "device" le GPU supportant CUDA utilisé
|
||||
*/
|
||||
|
@ -1,19 +1,7 @@
|
||||
#ifndef DEF_MAIN_H
|
||||
#define DEF_MAIN_H
|
||||
|
||||
/*
|
||||
* Structure donnée en argument à la fonction 'train_images'
|
||||
*/
|
||||
typedef struct TrainParameters {
|
||||
Network* network;
|
||||
int*** images;
|
||||
int* labels;
|
||||
int start;
|
||||
int nb_images;
|
||||
int height;
|
||||
int width;
|
||||
float accuracy;
|
||||
} TrainParameters;
|
||||
#include "../main.c"
|
||||
|
||||
/*
|
||||
* Affiche une image ainsi que les prévisions faites par le réseau de neurones sur sa valeur
|
||||
|
@ -6,6 +6,8 @@
|
||||
#ifndef DEF_MNIST_H
|
||||
#define DEF_MNIST_H
|
||||
|
||||
#include "../mnist.c"
|
||||
|
||||
uint32_t swap_endian(uint32_t val);
|
||||
|
||||
/*
|
||||
|
@ -10,6 +10,8 @@
|
||||
#ifndef DEF_NEURAL_NETWORK_H
|
||||
#define DEF_NEURAL_NETWORK_H
|
||||
|
||||
#include "../neural_network.c"
|
||||
|
||||
/*
|
||||
* Fonction max pour les floats
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef DEF_NEURON_IO_H
|
||||
#define DEF_NEURON_IO_H
|
||||
|
||||
|
||||
#include "../neuron_io.c"
|
||||
|
||||
// Lecture d'un réseau neuronal
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
#ifndef DEF_PREVIEW_H
|
||||
#define DEF_PREVIEW_H
|
||||
|
||||
#include "../preview.c"
|
||||
|
||||
/*
|
||||
* Affiche un chiffre de taille width x height
|
||||
*/
|
||||
|
@ -6,11 +6,9 @@
|
||||
#include <pthread.h>
|
||||
#include <sys/sysinfo.h>
|
||||
|
||||
#include "mnist.c"
|
||||
#include "neuron_io.c"
|
||||
#include "neural_network.c"
|
||||
|
||||
#include "include/main.h"
|
||||
#include "include/mnist.h"
|
||||
#include "include/neuron_io.h"
|
||||
#include "include/neural_network.h"
|
||||
|
||||
#define EPOCHS 10
|
||||
#define BATCHES 100
|
||||
@ -21,6 +19,20 @@
|
||||
# define MAX_CUDA_THREADS 1024 // from NVIDIA documentation
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure donnée en argument à la fonction 'train_images'
|
||||
*/
|
||||
typedef struct TrainParameters {
|
||||
Network* network;
|
||||
int*** images;
|
||||
int* labels;
|
||||
int start;
|
||||
int nb_images;
|
||||
int height;
|
||||
int width;
|
||||
float accuracy;
|
||||
} TrainParameters;
|
||||
|
||||
|
||||
void print_image(unsigned int width, unsigned int height, int** image, float* previsions) {
|
||||
char tab[] = {' ', '.', ':', '%', '#', '\0'};
|
||||
|
@ -3,8 +3,6 @@
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "include/mnist.h"
|
||||
|
||||
uint32_t swap_endian(uint32_t val) {
|
||||
val = ((val << 8) & 0xFF00FF00) | ((val >> 8) & 0xFF00FF);
|
||||
return (val << 16) | (val >> 16);
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "include/neuron.h"
|
||||
#include "include/neural_network.h"
|
||||
|
||||
// Définit le taux d'apprentissage du réseau neuronal, donc la rapidité d'adaptation du modèle (compris entre 0 et 1)
|
||||
// Cette valeur peut évoluer au fur et à mesure des époques (linéaire c'est mieux)
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "include/neuron.h"
|
||||
#include "include/neuron_io.h"
|
||||
|
||||
#define MAGIC_NUMBER 2023
|
||||
#define DELTA_MAGIC_NUMBER 2024
|
||||
|
@ -3,8 +3,7 @@
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "mnist.c"
|
||||
#include "include/preview.h"
|
||||
#include "include/mnist.h"
|
||||
|
||||
|
||||
void print_image(unsigned int width, unsigned int height, int** image) {
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include <string.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "neural_network.c"
|
||||
#include "neuron_io.c"
|
||||
#include "mnist.c"
|
||||
#include "include/neural_network.h"
|
||||
#include "include/neuron_io.h"
|
||||
#include "include/mnist.h"
|
||||
|
||||
/*
|
||||
Contient un ensemble de fonctions utiles pour le débogage
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../src/mnist/cuda_utils.cu"
|
||||
#include "../src/mnist/include/cuda_utils.h"
|
||||
#define MAX_CUDA_THREADS 1024
|
||||
|
||||
#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "../src/mnist/mnist.c"
|
||||
#include "../src/mnist/include/mnist.h"
|
||||
|
||||
|
||||
void read_test(int nb_images, int width, int height, int*** images, unsigned int* labels) {
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "../src/mnist/neural_network.c"
|
||||
#include "../src/mnist/neuron_io.c"
|
||||
#include "../src/mnist/include/neural_network.h"
|
||||
#include "../src/mnist/include/neuron_io.h"
|
||||
|
||||
int main() {
|
||||
printf("Création du réseau\n");
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "../src/mnist/neuron_io.c"
|
||||
#include "../src/mnist/neural_network.c"
|
||||
#include "../src/mnist/include/neuron_io.h"
|
||||
#include "../src/mnist/include/neural_network.h"
|
||||
|
||||
|
||||
Neuron* creer_neuron(int nb_sortants) {
|
||||
|
Loading…
Reference in New Issue
Block a user