Compare commits
2 Commits
05fbd80b8c
...
c212109a27
| Author | SHA1 | Date | |
|---|---|---|---|
| c212109a27 | |||
| 5f068f1337 |
@ -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)
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user