Compare commits

..

2 Commits

Author SHA1 Message Date
c212109a27 finale Änderungen 2025-11-15 21:55:42 +01:00
5f068f1337 finale Änderungen 2025-11-15 21:51:57 +01:00
2 changed files with 7 additions and 0 deletions

View File

@ -118,6 +118,10 @@ static void assignActivations(NeuralNetwork model)
if(model.numberOfLayers > 0) if(model.numberOfLayers > 0)
model.layers[model.numberOfLayers-1].activation = softmax; model.layers[model.numberOfLayers-1].activation = softmax;
} }
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "neuralNetwork.h"
NeuralNetwork loadModel(const char *path) NeuralNetwork loadModel(const char *path)
{ {
@ -168,6 +172,7 @@ NeuralNetwork loadModel(const char *path)
return model; return model;
} }
static Matrix imageBatchToMatrixOfImageVectors(const GrayScaleImage images[], unsigned int count) static Matrix imageBatchToMatrixOfImageVectors(const GrayScaleImage images[], unsigned int count)
{ {
Matrix matrix = {NULL, 0, 0}; Matrix matrix = {NULL, 0, 0};
@ -254,6 +259,7 @@ unsigned char *predict(const NeuralNetwork model, const GrayScaleImage images[],
return result; return result;
} }
void clearModel(NeuralNetwork *model) void clearModel(NeuralNetwork *model)
{ {
if(model != NULL) if(model != NULL)

View File

@ -38,6 +38,7 @@ static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn)
fwrite(layer.biases.buffer, sizeof(MatrixType), biasCount, file); fwrite(layer.biases.buffer, sizeof(MatrixType), biasCount, file);
} }
// End-Marker (inputDim = 0) // End-Marker (inputDim = 0)
unsigned int zero = 0; unsigned int zero = 0;
fwrite(&zero, sizeof(unsigned int), 1, file); fwrite(&zero, sizeof(unsigned int), 1, file);