Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic OCR training.

Hi,

Attached is part of my program for training OCR library automatically. I want to create two libraries that one for A-Z and one for 0-9. You will find in my program that I train the libraries 15 times for the alphabetic on different locations and 1 time for the first character of phone no. However, when you run my program. You will find that both libraries contain alphabetic and number. I don't understand what's wrong with the program. It seems that the pervious memory is copied to the next loop. Any suggestion?

Thanks,
Bill
0 Kudos
Message 1 of 5
(4,309 Views)
Hello there.

I took a look at you code briefly. I did not find the 'source' of the problem, but I have a general suggestion that might lead to the solution.

In many cases, you are using the index array function to get individual elements of an array. Since you are using for loops, an equivalent, though cleaner way, is to use the Auto Indexing feature in LabVIEW (right-click on the structure tunnels and enable Auto Indexing).

I agree with your analysis that something is being carried over from one iteration to the next. Here are some debugging suggestions:

  1. Manually change the character string that you are sending to your training subVI so that you can check the interactions with that step

  2. Run in highlight execution and use some probes on t
    he ROI descriptor/character combination that is being sent to your OCR Training subVI. My guess is you will see that the case structure in your AutoTrain VI is not behaving exactly as expected.


Hope this helps and happy debugging!
Regards,
Colin C.
Applications Engineering
Colin Christofferson
Community Web Marketing
Blog
0 Kudos
Message 2 of 5
(4,309 Views)
Are there any NI Vision engineers can take a look of this problem?

Bill
0 Kudos
Message 3 of 5
(4,309 Views)
Bill -

I took a quick look at your code, and I think I've found the problem. Each time you call "OCR Training.vi", you are passing the same OCR session in, and at the end of the OCR Training VI, it is saved to a file. The OCR sessions are references (just like the Image datatype) and not values, so since you're using the same OCR Session and just training more characters into that session, every time the OCR Session is written out to a file, it contains all characters that have been trained so far. This is why the a.abc file ends up with only a "0" and a "1" in it, while the b.abc file ends up with "0", "1", and "2" in it.

The solution is probably to have two different OCR sessions - one for letters and one for numbers. Train all of the letters into one
session and then write that out to a.abc, and train all of the numbers into the other session and then write that out to b.abc.

Greg Stoll
IMAQ R & D
National Instruments
Greg Stoll
LabVIEW R&D
Message 4 of 5
(4,309 Views)
Bill,

Your guess that the OCR data is copied in memory is correct. In particular the data is stored in the IMAQ OCR reference.

Make a call to IMAQ OCR Delete Character just after your call to OCR Training to delete the alphabet characters before your program learns the number characters. Wire a TRUE constant to the "All Characters" terminal to remove all 15 alphabet characters (see attached image).

Good Luck,
Nick
~~
0 Kudos
Message 5 of 5
(4,309 Views)