Deep Neural Network for MNIST Handwriting Recognition
1.0
Deep Neural Network for MNIST Handwriting Recognition
|
Core network library for a deep neural network. More...
Go to the source code of this file.
Data Structures | |
struct | Volume |
Data structure defining a 3-dimensional vector used to define the size of a node map. More... | |
struct | LayerDefinition |
Data structure allowing users to define the characteristics of a network. More... | |
struct | Connection |
Data structure attached to a node and pointing to another node as well as to a weight. More... | |
struct | Node |
Variably-sized data structure modeling a neuron with a variable number of connections/weights. More... | |
struct | Column |
Variably-sized data structure modeling a vector of nodes. More... | |
struct | Layer |
Variably-sized data structure holding a definable number of columns that form a layer. More... | |
struct | Network |
Variably-sized data structure that serves as the over container for a whole network. More... | |
Macros | |
#define | MAX_CONVOLUTIONAL_FILTER 10 |
Typedefs | |
typedef struct LayerDefinition | LayerDefinition |
typedef struct Vector3D | Vector3D |
typedef struct Value2D | Value2D |
typedef struct Volume | Volume |
typedef struct Network | Network |
typedef struct Layer | Layer |
typedef struct Column | Column |
typedef struct Node | Node |
typedef struct Connection | Connection |
typedef double | Weight |
typedef unsigned long | ByteSize |
typedef enum LayerType | LayerType |
typedef enum ActFctType | ActFctType |
Enumerations | |
enum | LayerType { EMPTY, INPUT, CONVOLUTIONAL, FULLY_CONNECTED, OUTPUT } |
enum | ActFctType { SIGMOID, TANH, RELU, NONE } |
Functions | |
int | getLayerNodeCount (LayerDefinition *layerDef) |
Returns the number of nodes in a layer. More... | |
int | getNodeBackwardConnectionCount (LayerDefinition *layerDef) |
Returns the number of backward connections of a NODE (not of a layer) More... | |
int | getLayerWeightCount (LayerDefinition *layerDef) |
Returns the number of weights for a layer (based on a given layer definition) More... | |
ByteSize | getLayerWeightBlockSize (LayerDefinition *layerDef) |
Returns the memory (byte) size of the weights block for a specific layer. More... | |
ByteSize | getLayerSize (LayerDefinition *layerDef) |
Returns the memory (byte) size of a specific layer based on a given layer definition. More... | |
int | calcStride (int tgtWidth, int filter, int srcWidth) |
Calculates the stride (number of nodes/columns that are skipped) in a convolutional kernel. More... | |
void | feedInput (Network *nn, Vector *v) |
Feeds some Vector data into the INPUT layer of the network. More... | |
void | feedForwardNetwork (Network *nn) |
Feeds forward (=calculating a node's output value and applying an activation function) layer by layer. More... | |
void | backPropagateNetwork (Network *nn, int targetClassification) |
Backpropagates the output nodes' errors from output layer backwards to first layer. More... | |
int | getNetworkClassification (Network *nn) |
Returns the network's classification of the input image by choosing the node with the hightest output. More... | |
Network * | createNetwork (int layerCount, LayerDefinition *layerDefs) |
Creates the neural network based on a given array of layer definitions. More... | |
LayerDefinition * | setLayerDefinitions (int layerCount,...) |
Returns a pointer to an array of a variable number of layer definitions. More... | |
Core network library for a deep neural network.
#define MAX_CONVOLUTIONAL_FILTER 10 |
typedef enum ActFctType ActFctType |
typedef unsigned long ByteSize |
typedef struct Connection Connection |
typedef struct LayerDefinition LayerDefinition |
typedef double Weight |
enum ActFctType |
enum LayerType |
void backPropagateNetwork | ( | Network * | nn, |
int | targetClassification | ||
) |
Backpropagates the output nodes' errors from output layer backwards to first layer.
The network's backpropagation proceeds in 2 steps:
nn | A pointer to the neural network |
targetClassification | The correct/desired classification (=label) of this recognition/image |
int calcStride | ( | int | tgtWidth, |
int | filter, | ||
int | srcWidth | ||
) |
Calculates the stride (number of nodes/columns that are skipped) in a convolutional kernel.
tgtWidth | Number of columns on the x-axis (horizontally) in the TARGET (=previous) layer |
filter | Number of columns/nodes on the x-axis in a filter window ( |
srcWidth | Number of columns on the x-axis (horizontally) in the SOURCE (=this) layer |
Network* createNetwork | ( | int | layerCount, |
LayerDefinition * | layerDefs | ||
) |
Creates the neural network based on a given array of layer definitions.
Creates a reserved memory block for this network based on the given layer definitions, and then initializes this memory with the respective layer/node/connection/weights structure.
layerCount | The number of layer definitions inside the layer-definition-array (2nd param) |
layerDefs | A pointer to an array of layer definitions |
void feedForwardNetwork | ( | Network * | nn | ) |
Feeds forward (=calculating a node's output value and applying an activation function) layer by layer.
Feeds forward from 2nd=#1 layer (i.e. skips input layer) to output layer
nn | A pointer to the NN |
Feeds some Vector data into the INPUT layer of the network.
nn | A pointer to the neural network |
v | A pointer to the vector holding the input values |
int getLayerNodeCount | ( | LayerDefinition * | layerDef | ) |
Returns the number of nodes in a layer.
layerDef | Pointer to a layer definition |
ByteSize getLayerSize | ( | LayerDefinition * | layerDef | ) |
Returns the memory (byte) size of a specific layer based on a given layer definition.
Each layer's memory size may be different due to a different number of nodes and connections For FEED FORWARD (e.g. OUTPUT) layers, full connectivity is assumed (i.e. each node links to ALL nodes in the previous layer)
layerDef | A pointer to a layer definition |
ByteSize getLayerWeightBlockSize | ( | LayerDefinition * | layerDef | ) |
Returns the memory (byte) size of the weights block for a specific layer.
Each layer's number of weights may be different due to a different number of connections For FEED FORWARD (HIDDEN and OUTPUT) layers, full connectivity is assumed, CONV layers e.g. share weights.
layerDef | A pointer to a layer definition |
int getLayerWeightCount | ( | LayerDefinition * | layerDef | ) |
Returns the number of weights for a layer (based on a given layer definition)
layerDef | A pointer to the layer definition |
int getNetworkClassification | ( | Network * | nn | ) |
Returns the network's classification of the input image by choosing the node with the hightest output.
nn | A pointer to the neural network |
int getNodeBackwardConnectionCount | ( | LayerDefinition * | layerDef | ) |
Returns the number of backward connections of a NODE (not of a layer)
For FEED FORWARD (HIDDEN and OUTPUT) layers, full connectivity is assumed (each node links to ALL nodes in the previous layer)
layerDef | Pointer to a layer definition |
LayerDefinition* setLayerDefinitions | ( | int | layerCount, |
... | |||
) |
Returns a pointer to an array of a variable number of layer definitions.
layerCount | Number of layers of the network |
... | Variabe number of layer definition objects |