The neural net code is included in the latest firmware build (020109 or later). There are 16 built-in patterns -
unsigned char npattern[NUM_NPATTERNS * 8] = {
0x18, 0x7E, 0x7E, 0xFF, 0xFF, 0x7E, 0x7E, 0x18, // solid ball
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // solid square
0x18, 0x18, 0x18, 0xFF, 0xFF, 0x18, 0x18, 0x18, // cross
0xFF, 0xFF, 0xC3, 0xC3, 0xC3, 0xC3, 0xFF, 0xFF, // box
0x18, 0x7E, 0x66, 0xC3, 0xC3, 0x66, 0x7E, 0x18, // circle
0xC3, 0xC3, 0x24, 0x18, 0x18, 0x24, 0xC3, 0xC3, // xing
0x18, 0x3C, 0x66, 0xC3, 0xC3, 0x66, 0x3C, 0x18, // diamond
0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, // horizontal line
0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, // vertical line
0x03, 0x03, 0x04, 0x18, 0x18, 0x20, 0xC0, 0xC0, // slash
0xC0, 0xC0, 0x20, 0x18, 0x18, 0x04, 0x03, 0x03, // backslash
0x18, 0x18, 0x3C, 0x3C, 0x66, 0x66, 0xC3, 0xC3, // up arrow
0xC3, 0xC3, 0x66, 0x66, 0x3C, 0x3C, 0x18, 0x18, // down arrow
0xC0, 0xF0, 0x3C, 0x07, 0x07, 0x3C, 0xF0, 0xC0, // right arrow
0x03, 0x0F, 0x3C, 0xE0, 0xE0, 0x3C, 0x0F, 0x03, // left arrow
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // blank
};
You can display a pattern (0-f) using the "nd" command, e.g.
nd5
##nd 5
** ** ** **
** ** ** **
** **
** **
** **
** **
** ** ** **
** ** ** **
You can replace a pattern using the "np" command
np57830303030307800
##np 5
nd5
##nd 5
** ** ** **
** **
** **
** **
** **
** **
** ** ** **
Look at
http://code.google.com/p/surveyor-srv1-firmware/source/browse/trunk/blackfin/srv
/font8x8.h and you'll find a full set of 8x8 ASCII patterns -
Once you have your patterns,
1. send "ni" to initialzed the network with random weights
2. then send "nt" to train the network on the stored set of patterns
3. then use "nx" to test the network against various patterns
For example, after adding the 'I' character as pattern 5, I tried
nx3030303030303030
##nx
0 0 1 0 0 97 0 0 16 0 0 0 0 0 0 5
and you can see that it matches best against pattern 5
The next step is to add the "nb" command for matching blobs against patterns. The problem I'm having is that the blob needs to be scaled into an 8x8 pattern to match, and I'm having an issue with aspect ratios, as demonstrated here
These patterns will be okay, because they occupy the full width and height of a template. The problem will occur with characters such as 'I' or numbers such as '1' which don't occupy the full width, or '-' which doesn't occupy full height. I'm open to suggestion on how to handle this. Once we have scaling, we can directly connect the blob search to the neural pattern matching. At that point, we'll add functions to the C and Scheme interpreters for accessing these features.