Showing posts with label otimization. Show all posts
Showing posts with label otimization. Show all posts

Tuesday, September 17, 2013

Final Report : Part 2

At the beginning of the project, I spent some time finalising the tools I would be using.
Having done so, I started with the pre-processor, and finally, by the mid-term, a working prototype of the Whitewashing code was completed.

During this period, I also realised how difficult it was to generate good data for training/testing purposes. They were awful in the begining, when I got the results for whole words instead of characters. But gradually the quality improved. During these trials, I tried out various methods for generating the data and eventually the box files, some of them are :

  1.  Ari's trainer  helped a lot in learning about the training procedure
  2.  OCR chopper was easy to use to make box files, but not always accurate. It needed lots of manual editing.
  3. BoxMaker was similar to OCR chopper, but more flexible in terms of size
  4.  I also tried with some data from Parichit 
  5.  Open source icr , a project related to Ari's project mentioned above, was somewhat helpful.
  6. Some amazing work at Silpa inspired and motivated me, but i ended up not using them because I felt they were not very easy to incorporate in the project.
  7. Debayan's Tesseract Indic project has been a great help and provided me with much required guidance to get started.
After having tried all the methods, I took the decision to use Cairo-Pango in combination, and though had some problem initially, finally it worked out.

Further reading made it clear that I should always jumble up and mix the characters in a training set. I took it one step further, and decided to mix up even the sizes of the different images. And for that, I wrote another script. This helps in better training.
For the final leg of this, I was trying to make a  python script, but it was not working. In the end, I switched to using ImageMagick as it does the trick with a single command. There was no point in making things more complicated than necessary.

Along with this, I continued my work on testing various filters on different types of documents. I will publish it in the next post.

Monday, September 16, 2013

Final Report : Part 1

Finally, The Summer has come to an end, and it's time to look back on the journey.
It turned out to be very different from what I had thought at the beginning. To sum up, my work towards GSoC 2013 can be categorised in two parts : the whitewashing algorithm, and the data generation method.

My First plan was to have a pre-processor and a post-processor, which would combine and work around the OCR to improve the quality of the final result. But after learning about the InfoRescue project, the plan for the post-processor changed, and in the final implementation, I have the pre-processor, and a system for generating data easily.
For the result, my initial plan was to chart out the performance of the individual systems, but instead, I ended up doing a table that helps in the pre-processing of the documents.
Here, I will  sum up my Aimed vs Achieved Goals in brief, and then in the following post(s), I will explain in detail the arguments and train of thoughts/events that lead to the changes in the plan.

Set Goals :
  1. Pre-processor : shirorekha chopper
  2. Post-processor : CBR-based
  3. Output matrix : performance based comparison
Achieved Goals :
  1. Pre-processor : Whitewashing code , a modified shirorekha chopper that paints over the shirorekha instead of chopping only at the gaps.
  2. Data generation : It helps in generating data that may be used for testing, as well as used to make the box-files to train the system.
  3. Output table : Several filters and their effect on different type of documents was tested, in hope of providing a  guideline to better pre-process any document that needs to be OCR'ed.
Key extra takeaways :
  • Learnt a lot about OCR software, specifically about Tesseract.
  • Learnt about Pango-Cairo. 
  • Used IPython and Notebooks with EPD. I am definitely going to use them a lot now.
  • Practised modular development as a single developer on this big a project for the first time.
In the next few posts, I will explain my reasoning for the changes I made to the plan along the way.
So Long.

Sunday, September 15, 2013

code clean up

It was bugging me to put up the whole code in a single file, specially after having used a very nice, modular  structure in the notebooks.  So I spent the day scrubbing, and finally I have split them up in manageable parts, and pushed everything to the repository.
Also included with the code is instructions on how to use them, and my personal views and suggestion at some points, in the form of README files.
In the future, I would like to continue and maybe develop a GUI to make it easier to use.  
However, it's time to stop coding, and start documenting whatever is left. 

Thursday, September 5, 2013

importance of color profiles

2 days ago, talking to a professor made my realise how useful HSI profiles could be. Then I spent the time till now looking into it, and if it could help us in our goal.
The basic idea is : we could jump to I-parameter, and depending on that, we could infer if any useful information could be retrieved from the data. This could theoretically also lead to a probabilistic model to assign weights to different training samples.
However, while very interesting, it seems to be very vast a topic in itself, and I am back to my senses, and would not spend any more time on this issue immediately. It's time to focus on wrapping up things at hand. So Long.

Monday, July 29, 2013

minor tweaks and documentation

This past week, I have been working on tweaking the code to optimise it at various places.
Now, it has the facility to check for the input image mode and convert it to grayscale only if needed, unlike earlier when it always converted it. It was a pretty simple, but important thing. One that I had been thinking about for sometime, and at long last, managed to get around to it.
Another notable change is the way the directories work. Earlier, I was using explicit, absolute path based locations for the input files. Now, I have updated to take them as a variabe-based relative path. Next to do : Take the path as argument input, but I will do that when I translate everything to a *.py from the notebook at the end.
Also,  I spent some time documenting the existing code, and though split in 3 notebooks, they have all the documentation in a manner I intended them for now. Later, when merging the notebooks, I will be using the respective parts (cell blocks) from the different notebooks to form the final script.
So Long.