December 01, 2013

Number recognition with neural network in LabVIEW


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:

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.


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

Best regards:



  1. Congrat, dude! I though, that you can do it! Next time, you should hack the captha-code here in the comment! :)

  2. gud work .. saw this video in youtube,,could you please upload an older version of dis vi..

  3. great work


    greetings from Cd Juarez Mexico

  4. Nice work. I believe the link is no longer valid. Could you please update? Thanks!

  5. Nice work. I believe the link is no longer valid. Could you please update? Thanks!

    1. Oh, sorry, OneDrive broke the link for some reason, I updated the post with the working link.

  6. Nice work. I believe the link is no longer valid. Could you please update? Thanks!


  7. the tutorial makes the program available, sir,,,/

  8. the tutorial makes the program available, sir

  9. First of all thanks for sharing your interesting work. I just find in youtube your video last night and I want to probe in LabView your code, but I am habing problems because in the learning part the Weight Local Variable dont save the values.
    I am using Lavbiew 2017, any idea about the problem??
    Thanks for your time.

  10. I just found my error, I dont initialized the local variable Weight, sorry for my stupid question, now your code runs perfect, thanks for all. Its a practical and interesting form to understand how works the neural netwoorks.

  11. Really nice work. The link for the code seems to be broken. Could you please share the code again?
    Thank you.