Tweeter button

Archive for September, 2008

Everybody is the friend of a friend

Wednesday, September 24th, 2008

Something is really fascinating me on social networking websites like Facebook and since this is already the third time that it happens to me in only a few months, I had to write about it in this journal!

- Primary school friends and middle school friends know each other although I didn’t go to the middle school most of my primary school friends went to and my middle school is quite far away from my primary school.

- The friend of a friend I met in France is the friend of a friend I met in Japan (happened twice).

I’ve once been told that within a distance a 6 intermediate friends, everyone on Facebook is the friend of a friend. This is fascinating yet this sounds very plausible to me.

See also Six degrees of separation @ Wikipedia

ibus

Saturday, September 20th, 2008

I was checking the web to see whether it’s possible to write an input method for SCIM using Python (the answer was yes), and I found ibus. ibus is a new input framework, by the author of SCIM himself. A particularity is that most of the core seems to be written in Python, which is interesting for such a low level thing as an input method.

Input methods like ibus-pinyin, ibus-anthy are thus written directly in Python. It should be pretty easy to integrate Zinnia into ibus then! (using the canvas widget provided by libtegaki-gtk)

- ibus @ Google Code
- Ibus @ Github

Zinnia

Saturday, September 20th, 2008

In my last post, I was writing about this impressive Chinese character recognition demo using AJAX on the client side and Support Vector Machines (SVM) on the server side, for the recognition process. Well, I don’t know if it’s just a coincidence (this demo was from 2 years ago) but Taku Kudo released last week the backend he’s using as free software. Needless to say that this was awesome news for me! I know the basic principle of SVM but time to learn more about it I guess…

His project, called Zinnia, has been rewritten from scratch to be more flexible and reusable. Models for Japanese and Chinese are included but models for other languages can be built easily provided that you have training data. I’m pretty sure that this package could also be useful for Gesture Recognition because it’s so close to Handwriting Recognition…

For the sake of comparison, I wanted to evaluate how Zinnia performs compared to both Tomoe and my own HMM experiment. I used the same evaluation corpus as I wrote about in earlier posts, that is two sets of 50 kanjis written by a Japanese friend of mine and me. The characters have the correct stroke order and were drawn carefully. Therefore, the results below indicate how the different recognizers perform in ideal conditions and don’t indicate how robust they would be in more difficult conditions.

Tomoe - Zinnia

  Tomoe Zinnia
1st match accuracy 61% 77%
5 matches accuracy 74% 92%
10 matches accuracy 74% 93%
Recognition time 21 / 100 = 0.21 s 3 / 100 = 0.03 s
Total number of kanji 3000 3000

1st match accuracy is the percentage of characters that were recognized as first match.
5 matches accuracy is the percentage of characters that were recognized in the first 5 matches.

You can download my evaluation script for Zinnia here. Tomoe’s evaluation script is sitting in Tomoe’ SVN, in the benchmark/ folder.

A few remarks:
- Zinnia is notably better than Tomoe in terms of accuracy
- Zinnia is about 7 times faster than Tomoe, making it a good candidate for an embedded platform
- In both cases, 5 matches and 10 matches accuracy are about the same, meaning that it would be enough for the user interface to display the first 5 matches only.

Project Tegaki - Zinnia

Due to lack of training data, my personal HMM experiment (project Tegaki) was only conducted over a set of 50 characters. However, Zinnia supports over 3000 characters. For fair comparison, I thus created new models for Zinnia using the same training data as I used for my experiment.

Zinnia was trained with only one sample per character, using the same data as Tomoe, which is template-based. While SVM seems to be able to cope with only one sample per character, it’s a little bit more complicated to do that with HMM because of the need to find the parameters of the Observation Probability Density Function (e.g. mean and variance for a Gaussian).

  Project Tegaki Zinnia
1st match accuracy 92% 100%
5 matches accuracy 100% 100%
10 matches accuracy 100% 100%
Recognition time 14 / 100 = 0.14 s 1.50 / 100 = 0.015 s
Total number of kanji 50 50

A few remarks:
- My experiment is slow, which is probably due to the fact that I’m using Character-level models. Stroke-level models are known to scale much better.
- My experiment has slightly worse accuracy, which is probably because I’m only using two features per observation.

Handwriting database

If you follow my adventures in the world of handwritten Chinese character recognition, you probably know that I’m planning to create a handwriting database website. This database will aim to 1) make it easy and attractive for people to contribute their handwriting samples and 2) make it easy for the database staff to manage and organize what is supposed to become a large collection of handwriting samples.

The database will use a client/server architecture. So far I’m thinking of four important clients:
- A client that people will be able to use directly in their web browser, using my web canvas
- A client for the Maemo platform
- A client for the Iphone
- A multi-platform client for the Destkop

A client of slightly lesser priority would be a Facebook application.

The handwriting samples collected will be distributed in free software license. For projects like Zinnia or Project Tegaki, this will mean more training data and more means to evaluate the performance. I consider this database one of my priorities among my free software projects but it’s going to be quite hard for me to find time for that before December…

Contribute

As always, more people are welcome to contribute.

To download the source code of my work,

$ git clone http://www.mblondel.org/code/hwr.git

web interface

HCCR using AJAX and SVM

Tuesday, September 9th, 2008

I came across this impressive page (in Japanese), which shows a demonstration of Handwritten Chinese Character Recognition using AJAX for the user interface and Support Vector Machines for the training algorithm.

Looking at the Javascript code, I was surprised to see that, unlike my web canvas, it doesn’t use the <canvas> tag! It simply uses a combination of Javascript and CSS. Even though it has a few quirks, the interface is quite responsive.

The recognition process itself happens on the server side but thanks to the use of AJAX, the results are displayed very smoothly, without the need to refresh the page.

Taku Kudo, the author, explains in the page that he’s using the handwriting data from Tomoe. However since Tomoe uses a template-based algorithm, it only has one handwriting sample per character. I’m impressed that Taku Kudo can train his system only with one sample per character. Overall, the accuracy is not very impressive but I think it could improve a lot with more training samples. That’s why my handwriting database project is going to be very useful. I’ve been willing to try SVM in addition to HMMs so the fact that this project uses SVM confirmed my interest for it.

Taku Kudo’s page has neat stuff regarding Natural Language Processing and Machine Learning. He published a lot of libraries as free software, including Mecab and TinySVM. If you like fancy stuff in AJAX, you’ll also like his Japanese Input Method.

Interactive whiteboard with a Wiimote

Tuesday, September 9th, 2008

If you haven’t seen all the cool stuff that Johnny Chung Lee is doing with a Wiimote, you should definitely take a look at his projects. You’ll see that Johnny is not only a good engineer but he’s also very good at making his projects attractive.

He has a video on how to make a cheap interactive whiteboard or how to turn your laptop into a tablet pc, with a Wiimote. This could be pretty handy for using Chinese character recognition!