Question

I have implemented Bag Of Words, everything is working smoothly. But, I'm confused about some steps and how to implement it.

I could create the bow descriptors as the last step in Bag of words to create the samples, as it shown here bowDE.compute(img, keypoints, bow_descriptor); .. The things is that i'm confused about the next steps.

I know that in BOW that I have to train and test a class (car) with non-class (cola), what I created in bow_descriptor vector is only for the class car, so I have vector for samples that belong only to the car. here are the questions that I have for training my system and test it.

1- Shall I make the vector of bow_descriptor half of it for the class(cola) and the rest for non-class(cola) , or I have to create a new bow_descriptor for the non-class(cola) ?

2- I need to do multi-class classification, after finishing the first system for class (car), and I need to train a new class (Buses+trains and so on), shall I create a new training model for each of them, or it is possible to do the training procedure with the previous training (i.e. training class BUS,train with the class car in the same system)?

Was it helpful?

Solution

It does not matter whether you create one object for all classes or one object for each class, as long as you use the same dictionary for all classes. Creating only one object might be more economical. But the extracted image descriptors should be the same.

Regarding multiclass SVMs:

You used the SVM tag. So I assume you want to use SVM. There do exist ways to do multiclass classifications explicitly with SVMs it is more common to train several binary SVMs and combine them to get a multiclass results.

You can either use the 1-vs-1 setting, where you train one SVM per class pair. For testing you evaluate your test example on each SVM. The class which wins those duels the most often then becomes your final result.

The other popular approach is 1-vs-all SVMs. Here you train one SVM per class where samples from the current class are labeled positive and all other samples negative. During testing the class with the highest score wins.

So if you want to use the 1-vs-1 setting you might be able to reuse some binary SVMs when you add new classes. It is not possible for the 1-vs-All setting, as you need to add the new class to the negative samples for each SVM.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top