简体   繁体   English

一袋词训练样本

[英]Bag of words training samples

I have implemented Bag Of Words, everything is working smoothly. 我实施了Bag Of Words,一切顺利。 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); 我可以创建弓形描述符作为创建样本的Bag中的最后一步,如此处所示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. 我知道在BOW中我必须用非类(可乐)训练和测试一个类(汽车),我在bow_descriptor向量中创建的仅用于类车,因此我有仅适用于汽车的样本矢量。 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) ? 1-我应该为类(可乐)制作一半的bow_descriptor向量,其余用于非类(可乐),或者我必须为非类(可乐)创建一个新的bow_descriptor?

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 (ie training class BUS,train with the class car in the same system)? 2-我需要进行多级分类,在完成第一个班级(汽车)系统后,我需要训练一个新班级(公共汽车+火车等),我是否应该为每个班级创建一个新的训练模型,或者可以通过以前的培训进行培训程序(即培训班巴士,在同一系统中与班车一起训练)?

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: 关于多类SVM:

You used the SVM tag. 您使用了SVM标记。 So I assume you want to use SVM. 所以我假设你想使用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. 存在使用SVM明确地进行多类分类的方法,更常见的是训练几个二进制SVM并将它们组合以获得多类结果。

You can either use the 1-vs-1 setting, where you train one SVM per class pair. 您可以使用1对1设置,每个类对训练一个SVM。 For testing you evaluate your test example on each SVM. 为了测试,您可以在每个SVM上评估测试示例。 The class which wins those duels the most often then becomes your final result. 赢得那些决赛的班级最常成为你的最终成绩。

The other popular approach is 1-vs-all SVMs. 另一种流行的方法是1-vs-all SVM。 Here you train one SVM per class where samples from the current class are labeled positive and all other samples negative. 在这里,您可以为每个类训练一个SVM,其中当前类的样本标记为正,所有其他样本标记为负。 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. 因此,如果要使用1-vs-1设置,则可以在添加新类时重用某些二进制SVM。 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. 1-vs-All设置是不可能的,因为您需要将新类添加到每个SVM的负样本中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM