Title: Dark Blue with Orange
1Artificial Neural Networksfor Pattern Recognition
Jack Breese Computer Systems Quarter 3, Pd. 7
2What is a Neural Network?
- Interconnected neurons
- Weights
- Output
3Uses of Neural Networks
- Pattern Recognition
- Face Recognition
- OCR
4Neurons
- Add up each weighted input
- Use an activation function to determine output
- Pass on output to next layer
5Training Neural Networks
- Large input set
- Outputs are verified, weights adjusted along a
gradient based on these results.
6Program Information
- Neural Network Library written in C
- Currently capable of initializing a two-layer
perceptron with working, but unweighted
connections. - Can load images up to 500x500 pixels in size.
7Data Structure
typedef struct _connection float
weight struct _neuron from
connection typedef struct _neuron //TODO
Implement a neuron which supports
connections. float d connection
cons neuron neuron mkneuron(int c)
neuron n malloc(sizeof(neuron)) n-gtd
0 connection a malloc(csizeof(connection))
n-gtcons a return n
8New Progress
- Saving and Loading of Weights
- New Data Structures
- Optimization
- Testing
9Saving and Loading Weights
int saveWeights(char filename, neuron hidden,
neuron outputs, int insize, int hiddensize, int
outsize) FILE output output
fopen(filename, "wb") if(output
NULL) fprintf(stderr, "Error Unable to open
output file for writing.") exit(1) fprintf
(output, "d\n", insize) fprintf(output,
"d\n", hiddensize) fprintf(output, "d\n",
outsize) // fprintf(output, "s\n", "Hidden
Layer Weights") int i 0 int j 0 for(
j lt hiddensize j) for(i0 i lt insize
i) fprintf(output, "f\n",
hiddenj.consi.weight) // fprintf(outpu
t, "s\n", "Output Layer Weights") i 0 j
0 for( iltoutsize i) for(j0
jlthiddensize j) fprintf(output, "f\n",
outputsi.consj.weight) fprintf(output
, "s\n", "End") fclose(output) return 0
10Saving and Loading, Cont.
- File Format
- Stores size of each layer
- Stores weight of each connection in order
- Loading
- Just like saving, but backwards.
11New Data Structures
- A netsize struct
- Contains three ints
- Makes keeping track of the network size cleaner
- typedef struct _netsize
- int insize
- int hiddensize
- int outsize
- netsize
12Testing
- Memory Usage was tested
- See next slide.
13Problems Encountered
- Initially thought memory usage was low.
- Forgot to reset counter in nested for loops to 0.
- That was dumb.
- Corrected problem, memory usage went up
- Decided to scale back network size/interconnectedn
ess
144th Quarter Goals
- Perform simpler recognition tasks on smaller
images due to memory/processor constraints - Simple face recognition
- Optical character recognition
- Shape recognition
- Grocery store produce recognition