Info2-Aufgabe2/neuralNetwork.h

33 lines
773 B
C

#ifndef NEURALNETWORK_H
#define NEURALNETWORK_H
#define checkFileHeader image_input_check_file_header_guard
#define readDimension image_input_read_dimension_guard
#include "imageInput.h"
#undef checkFileHeader
#undef readDimension
#include "matrix.h"
#define NEURAL_NETWORK_FILE_HEADER "__info2_neural_network_file_format__"
typedef void (*ActivationFunctionType)(Matrix *X);
typedef struct
{
Matrix weights;
Matrix biases;
ActivationFunctionType activation;
} Layer;
typedef struct
{
Layer *layers;
unsigned int numberOfLayers;
} NeuralNetwork;
NeuralNetwork loadModel(const char *path);
unsigned char *predict(const NeuralNetwork model, const GrayScaleImage images[], unsigned int numberOfImages);
void clearModel(NeuralNetwork *model);
#endif