Thursday, June 14, 2012

Saving and loading functionality to GML Adaboost Matlab Toolbox

adaboost training error on INRIA pedestrian dataset
Adaboost is a great efficient tool. It uses plain flavor decision trees to build a stairway to classifier's heaven. I am using it for human detection, in both the laser and the camera modules and it's behaving very well.
Of course it can be used in conjuction with much more efficient classifiers than decision trees. So the next step is integrating SVM as a weak classiffier to replace the tree nodes currently in use. Another work in progress is to use different criteria for cross validation in libsvm in order to have more control over it's behaviour.

A. Vezhnevets has developed GML Adaboost Toolbox for Matlab. Another seemingly interesting, but not so well known, matlab adaboost toolbox was written by Alister Cordiner. Myself I use GML right now but I was thinking moving to Cordiner's code cause it seems easier to integrate with libsvm.
Anyway GML is ok for now, except it has a small problem. It can't save and load the tree node objects within matlab. To be more precise, when I am trying to load the saved learners and the corresponding weight values it gives me the following error:
Warning: Element(s) of class 'tree_node_w' do not match the current constructor definition.  The element(s) have been converted to structures. 
I don't know if it's universal but this is what happens in my mac. When matlab saves an object belonging to certain class it also saves information about which class it belongs to. Then when you try to load that save file, and for every object of every class, it invokes the appropriate constructor. But in this case the constructor can't be used to load because it doesn't initialize all the properties needed. So what solves the problem is that the class needs two methods, namely saveobj and loadobj, to do the dirty job. That is converting the object to a simple structure when saving and the opposite when loading. Here is the new file. Use it to replace the original file in the @tree_node_w folder.

What have we gained:

  • Some insight to the object oriented aspects of matlab

Labels: ,


At 16 October, 2013 12:16 , Blogger Adrián said...

This comment has been removed by the author.

At 16 October, 2013 12:19 , Blogger Adrián said...

It seems the code for the replacement file in dropbox is broken. Could you please restore the link?
Many thanks!

At 16 October, 2013 12:46 , Blogger kabamaru said...

Ok seem fixed. You can try again.

At 06 February, 2014 11:38 , Blogger amina riaz said...

if u have Alister Cordiner toolbox can you please upload it

At 06 February, 2014 15:21 , Blogger kabamaru said...

I am sorry don't have it. Did you try to contact him directly?


Post a Comment

Subscribe to Post Comments [Atom]

<< Home