loading
 
OCR database creation
Thomas Wagner from Germany  [51 posts]
9 year
STeven,

I am not sure that I have understood the concept of OCR database creation and modification correctly. From what I had read in the help files, my assumption was, that I have to
1. Delete the ocr_database.dat file
2. Modify the *.gif files in the OCR directory

and then, with the next run (whatever that means: loop, restart run or restart RoboRealm) of the program,
3. a new OCR_database.dat file will be created and
4. the recognition will behave differently.

I cannot observe 3 or 4, though I have done 1 and furthermore removed some digits completely (all files of digit, but that digit still shows up). And I have restarted the RoboRealm application completely.

What am I missing here?

Thanks,

Thomas.
Steven Gentner from United States  [1446 posts] 9 year
Thomas,

You have it correct ... as we didn't really expect anyone to want to do this a couple points may help clarify the process (I'll add these to the docs too).

The ocr_database.dat file is actually a cached version of all the *.gif files that loads quicker and has already processed the files in the way that the module uses. We added this due to a significant pause that was happening the first time the module is used while it was loading all the gif files. So, yes, when deleted it should be regenerated as soon as you add the module to the pipeline ... after a slight pause (should be < 10 seconds). If it isn't getting regenerated then something else is going wrong.

On the actual *.gif images, you will notice they are named in a very specific way. The actual ascii code of the letter is the first number and the second is the instance number. So for two instances of the capital letter 'A' one would expect to have 65_1.gif and 62_2.gif.

When you add or delete a file you MUST ensure that the instance chain is not broken. I.e. if you delete 65_2.gif the system will not see 65_3.gif (if one exists) since it thinks the instance numbering is broken. So if you delete one, rename the last letter to occupy the spot that was deleted to ensure the chain is preserved. We're aware that this isn't ideal but didn't think anyone would be altering that database ... if that's a common need, we can make this much easier.

Note that the *.gif files need to be in the same folder where the ocr_database.dat was deleted ... that's the only folder the module will check for image files (there isn't any way to specify a different folder).

Also be sure you are running the latest version as we did notice an issue where the ocr_database file was not getting regenerated when necessary in versions last month.

Finally, if you do have files that you want added and think that others could benefit from the addition of those letters please post them here and we'll add them to the existing database.

If you continue to have issues, please post a zip of the test image here and the .gif files that attempted to add and we'll check it out.

Thanks!
STeven.
Thomas Wagner from Germany  [51 posts] 9 year
STeven,

thanks for your reply, which explained some things to me (such as the concept of not breaking the instance chain).

At the same time, I find that
1.) still no ocr_database file is created, but nevertheless
2.) Some OCR functionality seems to work without an OCR file being present (execution time for OCR being around 0.1 sec)

I wonder whether the reason for 1.) might be that I work under Win7 not using a full admin account, so there may be problems with write privileges in the program directory.
Running Roborealm in that accoutn with admin rights does not work because it wants to install a new license, the same being true for running it in my admin account.

For 2.), I assumed that the fallback without ocr_database being present is that you read the *.gif, but even if I empty that directory OCR completely and restart RoboRealm, OCR recognition still works.
Steven Gentner from United States  [1446 posts] 9 year
Thomas,

Most likely what is happening is the ocr_database file is getting created in Win7's Virtual Store. If you check

C:\Users\Your User Name\AppData\Local\VirtualStore\Program Files (x86)\RoboRealm

and replace it with your user name you will probably see a file in the OCR folder. When you don't have the right privileges Win7 will create and write to that location.

STeven.
Thomas Wagner from Germany  [51 posts] 9 year
STeven,

I have added an example since this may be nice for demonstration. This is digit recognition. No rotation invariance needed. One font only.

A.) My problem at the moment is that 1 and 7 do not get recognized properly. Looking into your training samples the reason for this is obvious (many 1's may be considered to be 7's if you do not know the font type), that's why I wanted to modify the ocr_database.

For the applications typically done here, I think that people will quite often want to recognize one font only (e.g. reading a digital meter etc), so you may want to think of a functionality to easily select a "close" font (the seem to be sorted in your training sets anyway). Might improve performance a lot in some applications.

B.) Trying to adapt to the "one font only problem", I tried to create my own data set, but have not found a convenient way to cut and write blobs to files automatically (or even to show the bounding rectangles for blobs). I have seen a hint here in the forum that one can use geometrics statistics and display rectangle, but doing so, I'll have to write a brief script which creates a bounding box edge point list from the min_x, max_y etc values for the geom statistics module. I think such a feature might be required more frequently, one might even thing of some flexible list merge module instead of adding that functionality to each single module.

Thanks again for your patience, maybe some of tthe thoughts help.

Thomas

  

program.robo
Thomas Wagner from Germany  [51 posts] 9 year
STeven,

thanks for the hint on database storage, you are correct, there it is.

I was almost there, having looked in
c:\Users\Thomas\AppData\Roaming\RoboRealm\

but only finding the licence key there.

Thomas
Thomas Wagner from Germany  [51 posts] 9 year
STeven,

works with the shape matching module when manually extracting the single digits for training.

Maybe some of the remarks above help with further improvement.

Thanks,

Thomas

Steven Gentner from United States  [1446 posts] 9 year
Thomas,

The image posted seems to work "out of the box" so to speak. Perhaps something got a little wired wrong when it was regenerated. I've attached the robofile I was using that increases the word separation which helps combine the digits into a single number.

If you still get the 7 instead of a 1 can you zip and post your ocr_database.dat file?

Thanks,
STeven.


 

program.robo
Thomas Wagner from Germany  [51 posts] 9 year
STeven,

sorry, this was my fault, and has nothing to do with word separation. What actually happened was that I restored the original ocr-database.dat file, but forgot (or did not know at that stage) that the modified ocr-database.dat file in "c:\Users\Thomas\AppData\Local\VirtualStore\Program Files (x86)\RoboRealm\OCR\ocr_database.dat" takes priority over the other file if it exists.

Removing my modified file gives the same results as you have listed.

In order to avoid that, one could show the path to the database file used when opening the OCR window, or show a flag that the original OCR file is modified.

The bad news:
Unfortunately this works only for the sample I have sent you before, I have sent a new one where the left "1" is mistaken as "7", also with the original database.

Thomas

 

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index