Monday, January 26, 2009

Fixing the cropping issue

I've spent some time now fixing up my cropping function. The reason I've been spending my time on this is because I think that it's really important to have quality training data. If my training data is crap, then nothing will work. I want to be able to cleanly cut out letters. So, I changed my cropping algorithm to the following:
cut the original image into 4 pieces, as follows:


Here is the left piece:


Right piece:


Top piece:


Bottom piece:


I run the hough transform on all four pieces. In each, I know where a line would be, if there exists one. I have some way of thresholding whether or not there is a line there (if the maximum number of votes is higher than a certain percentage of the length of the image). If so, I cut the appropriate piece out.

The performance isn't as great as expected. I think that I need to fix up my hough transform function because sometimes, when there appears to be a dark line, it won't find it (the number of votes is low).

Here are the overall results anyway:


The letters straight out of the training sheet look like this, with no postprocessing:


The next step for me is to fix my hough transform function, get the training data looking good, retrying nearest neighbor, and then moving on to opencv (boosting).

Wednesday, January 14, 2009

Cropping

I get better accuracy now, when I try to classify my test data. However, I noticed that after my "cropping" tool, the test data can get pretty deformed. For example, take a look at a before and after sequence:

Before:


After:


I decreased the dimensionality of the test data by a lot. The new test data characters are 32 by 32 pixels. Before this, it was 120 by 123 pixels. This reduction in dimensionality really brought down the running time of classification. I think that I need to tweak my cropping tool though.

Cropping tool = bad. Exhibit A:
=

When I change it that only 2% of the pixels can be all white (instead of 5%), then the cut out changes to:


Now, the same test set looks like this:

Monday, January 12, 2009

Fixing up training data

I noticed that the actual letters in my training data take up a small area in the actual image. This seems bad, so I fixed up my code to minimize the amount of white space surrounding the actual letter.

Example of old training data:



Example of new training data:

Saturday, January 3, 2009

I'm baaaack

Didn't get enough last year? Miss me? Well, I'm back for more. I will be continuing the same project. Here is a refresher of how the project works:



The first thing that I will be doing this week is getting back to the point I was at at the end of winter 2008. I will then research machine learning methods to apply to the problem, to replace the nearest neighbor approach.