| ||||||||||||||
| ||||||||||||||
|
||||||||||||||
Hopfield Image Recognizor (HIR)Download here (56K).
Using HIR2When the program starts up, and loads the program data, it will display (what is supposed to be) the English flag. Use the left and right arrows to the right to look through the 3 images. The second is Japanese for 5, the third is HIR! Now, click on 'Train' and the program will train the network (Hopfield training is REAL quick!) and in the place of the whole images, corrupt images are shown. To get the network to recognize the image, press Run. Red squares will popup where the network changes it.
CallbackThe CHopfield uses a cool way of allowing your program to display the network changing if you want by using a pointer to a function. The CHopfield class will call this function every time a pixel is changed. The function obviously has to be static or global, and have the following signature:int Function(int, int, void *);Obviously, the function name doesn't make a difference. The first two integers are the xy-coordinates of the point change. The void pointer is whatever you want! I use it in the Windows version to provide a pointer to the main dialog class. The callback function is set by calling SetCallback(). You set the pointer data by calling the SetCallbackData() function. Here is the code from the Windows version: m_cHopfield.SetCallback(PaintImage); m_cHopfield.SetCallbackData(reinterpret_cast
Version 2.11Tiny cosmetic change. Added a dialog box after training is complete that explains what has happened, and what the user is then presented with. People got understandably confused.
Version 2.1Added void pointer to the callback function, allowing the Windows version to show the network stabilizing. Also, improved coding slightly - program would resize the rectangle used to calculate the grid every redraw! It does it once now. I also changed the icon too, if anyone cares!
Last Updated: 21/04/2001 Article content copyright © James Matthews, 2001.
|
|
|||||||||||||
All content copyright © 1998-2007, Generation5 unless otherwise noted.
- Privacy Policy - Legal - Terms of Use -