Bag of words training samples

天大地大妈咪最大 提交于 2019-12-21 05:42:24

问题


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)?


回答1:


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.



来源:https://stackoverflow.com/questions/16214920/bag-of-words-training-samples

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!