Murga-Projects Forums

Full Version: MurgaLua Number OCR
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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
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.

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.
Reference URL's