Showing posts with label neural network. Show all posts
Showing posts with label neural network. Show all posts

December 01, 2013

Number recognition with neural network in LabVIEW

Introduction

I have a class about neural nets at the university, so I tried to program one for number recognition like this but in LabView. Then I realized: I didn't have enought knowledge for this, so I google neural networks and found this awesome course: https://www.coursera.org/course/neuralnets

So how it's working?

It has a recognition and a learning mode. As input the network get xij, an 8x8 boolean array with the pixels of the image. And there is wkij, the weight; a 3D integer array. It contains for all the 10 numbers (this is the first dimension) for all the pixels (2nd and 3rd dimension) the probability of this pixel is in the image of the number. If the pixel is always in the image, then it's a big positive number. If it's never there, it's big negative number.
In recognition mode it makes a sum of product for each numbers so: sumi=0->7( sumj=0->7( Xij*wkij)) (Xij is +1 if xij true, and -1 if xij false) and the result is a 1 D integer array yk. Then it looks for the maximum of the array y, and the index of the maximum is the result.

In learning mode it needs the image of a number, the number itself and from these information it calculates and changes the weight. It goes through all the numbers and for each number every pixel. If the number is equal the given number AND the pixel is true, then +10 to the weight, if pixel is false -10 to the weight for this case. If the number is NOT equal with the given one, AND the pixel is true, then -1 to the weight and +1 if the pixel is false. Train the system at least 2-3 image for each number, but the more image you train, the better result you get. But you have to use the same amount of image for each numbers, otherwise it will give back an incorrect result.

Result

It was also surprising for me, how good it works:
The code is available here

Best regards:

Mark