Perceptron Handwriting Recognition

2008

  • Adapted the artificial neural network perceptron to implement a handwriting recognition application that recognizes stylus inputs on tablet PCs using Python with customized Graphic User Interface (GUI) written in Tkinter.
  • The application can be taught to recognize inputs of numbers, letters, and characters from various languages
  • Recognition process improves as the number of training session increases
  • It is possible to export the same handwriting recognition application to other mobile platforms such as smartphones and tablets

Perceptron Interface

 

Technique and Description

This project is to demonstrate the application of AI technique using Python and TKinter. Perceptron learning technique is used to recognize a set of pre-defined images. It means that the label associates with each image must be defined in the program prior to recognition process. In this project the AI is used for hand-written characters recognition. The user can “teach” the perceptron to recognize his or her unique hand-writing style. The change of prototype weights of each class is showed in during the program execution.  After multiplying the input vector by the prototype weights of a defined label and sum them up, we can acquire a score for that class. After computing the score for every defined label class, the perceptron AI pick the class with the highest score and output its label. However, if the output label is not correct, the perceptron classifier must be trained to recognize the label for that given image. Each label on the record of the perceptron AI program has its own class of prototype weights. For the class of a label which was mis-selected by the perceptron AI, its prototype weights are decremented by the input vector; for the class of a label which was not selected but supposed to, its prototype weights are incremented by the input vector. Such change in prototype weights of both labels ensures that next time, the class of right label will be more likely to get selected by the AI perceptron.

 

Demo

To use the program, one first needs to create a bmp image file with dimension of 112 x 112. Write down  single digit or character  and save it under the same folder as the program files. Then click interface.py file will start the program. After the program is successfully started, click “Load Input” button on the graphic user interface, and the program will convert the bmp image file to a file contains a datum object and save it under the same folder. Once the datum object is created, recognition process can begin. Click on “Recognize” button and the program will display its guess of label in “Guess Character” section. If the guess is not correct, you can tell the program the correct one by click “Label Entered” button and enter the label for that datum object. The value you just entered now shows up in the “Input character” section. Now click on “Training” button, and the program starts the training session. After training is finished, click on “Recognize” button to show changes of the prototype weights of the user input label and pre-guessed label. If there are too many zero to see the weight change. Click on “Toggle” to remove all the zero from the canvas. Click again to put them back.

 

Project Files

 

Reference

http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm

http://www.java2s.com/Code/Python/CatalogPython.htm

http://www.pythonware.com/library/pil/handbook/image.htm

http://effbot.org/zone/tkinter-complex-canvas.htm

This entry was posted in .

Leave a Reply