News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
MurgaLua Number OCR
Author Message
jpjacobs
Member
***


Posts: 113
Group: Registered
Joined: Jul 2007
Status: Offline
Reputation: 0
Post: #1
Toungue  MurgaLua Number OCR

Hi!

I started a small test thing to make a number OCR like this one in murgaLua, to have something to show of the FANN library included since the latest beta.
But my FLTK-foo let me down a bit...

I want to make a field 10x10 blocks, where you can draw numbers to train, and have them recognised, but line drawing is doing me in (when you start dragging, a line apears from <0,0> to where ever you start dragging.
Secondly I don't really have a clue about how to detect when a line crosses some boxes or not (the value of the boxes will be the inputs of the ANN).

For the ANN part, it should go ok, I already ported the example from the FANN paper to murgaLua if anyone is interested.

So anyone knowing how to do this, you're welcome.

Greetings,
JP



Attached File(s)
.lua File  ocr_ui.lua (Size: 2.29 KB / Downloads: 4)
12-09-2010 09:59 PM
Find all posts by this user Quote this message in a reply
jpjacobs
Member
***


Posts: 113
Group: Registered
Joined: Jul 2007
Status: Offline
Reputation: 0
Post: #2
RE: MurgaLua Number OCR

Did some reworking of this, and now I've got something more presentable:
Not everything works yet, performance is abysmal (difficult to get a good dataset), etc etc. But the important idea is there!

So what this does is permit the user to train the ANN by drawing numbers (3 times each by default, but you can repeat training) and afterwards you can detect the drawn character (or should be able too Tongue).

The detection rate is bad, I guess because a box is either on or off, so there is no "gray" zone around the lines, there are no transformations, normalizations, whatever...

So the wish list for this little snip for people that want to contribute:

  • preview drawing
  • Better data usage (middeling out the different tries)
  • counters at each preview
  • suggestions, comments, ideas, ...

Writing this, I found some need to have some guidelines for the gui programming concerning good programming practices, like limiting use of globals, and whether it's possible to access widgets by their parents like window.button1:label() or something.

Oh well, hope someone can do something useful with this!

Regards,

Jan-Pieter



Attached File(s)
.lua File  ocr_ui.lua (Size: 4.94 KB / Downloads: 4)
03-12-2011 11:36 AM
Find all posts by this user Quote this message in a reply
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #3
RE: MurgaLua Number OCR

I didn't have a clue what you were doing when you originally made this thread, so I haven't looked into it much. I think it makes more sense to me now.

On the subject of accessing widgets by their parents, I'm guessing the typical way to do it is by creating a table for each set of widgets. For example, if you want to keep all the elements of one window separate from those of another window, you can do something like this:

Code:
window1 = {}
window1.window = fltk:Fl_Window(...)
window1.button = fltk:Fl_Button(...)
etc.

I know that works for most elements, but you may need to play around a bit when it comes to Fl_Window/Fl_Group objects, such as including Fl_End() or add() functions in some cases.

This post was last modified: 03-12-2011 11:19 PM by mikshaw.

03-12-2011 11:17 PM
Find all posts by this user Quote this message in a reply
jpjacobs
Member
***


Posts: 113
Group: Registered
Joined: Jul 2007
Status: Offline
Reputation: 0
Post: #4
RE: MurgaLua Number OCR

Small update:

Got things to really work now, so it actually can tell apart numbers.
Thing was mainly that I used too many inputs, thus running into the Curse of dimensionality.

Now there is one problem which prohibits taking things further, and it is registering the release of a mouse button...

If anyone knows a solution, let me know.

PS: included a sample training data set for the lazy people.



Attached File(s)
.lua File  ocr_ui.lua (Size: 7.05 KB / Downloads: 4)
.txt File  training2.txt (Size: 1.23 KB / Downloads: 3)

This post was last modified: 10-04-2011 11:51 PM by jpjacobs.

10-04-2011 09:39 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: