简体   繁体   English

将多个Haar分类器与OpenCV相结合

[英]Combining multiple Haar Classifiers with OpenCV

I was wandering if there is a way to combine Haar-Classifiers from different trained cascades? 如果有办法结合来自不同训练级联的Haar-Classifiers,我会徘徊? I have a scenario, where I detect one object that differs depending on the angle of the object. 我有一个场景,我检测到一个对象根据对象的角度而有所不同。 So I separated my training samples to train multiple classifiers. 所以我将训练样本分开训练多个分类器。 They work OK for their classes. 他们的班级工作正常。 Right now I run them sequentially which is costing me a lot of calculation time. 现在我按顺序运行它们,这花费了我很多计算时间。

I figured that OpenCV is probably calculating all the features every time thus iterating newly every time. 我认为OpenCV可能每次都在计算所有的功能,因此每次都会重新进行迭代。 I thought, if I could combine my classifiers by an OR operation, then OpenCV might be able to just use one cascade thus only iterating once and only calculating the needed features once and so on. 我想,如果我可以通过OR操作组合我的分类器,那么OpenCV可能只能使用一个级联,因此只迭代一次,只计算所需的特征一次,依此类推。 This might increase my performance dramatically. 这可能会大大提高我的表现。 However I am not sure if (and how) this could be done. 但是我不确定是否(以及如何)这样做。 Maybe someone else has tried something similar before? 也许其他人之前尝试过类似的东西?

Cheers! 干杯! -- artur - artur

我将每个人作为一个单独的并行任务运行。

我不是等待所有人,而是通过举办活动来处理每个人。

Well, when you train a specific classifier, AdaBoost algorithm (at every stage) picks different features to minimize training error. 好吧,当你训练一个特定的分类器时,AdaBoost算法(在每个阶段)选择不同的功能,以尽量减少训练错误。 That procedure is done for every stage of an cascade. 该过程是针对级联的每个阶段完成的。

Unfortunately for every object those features are not the same (different size although you have fixed number of feature shapes), thus a feature space is not the same either. 不幸的是,对于每个对象,这些特征都不相同(虽然您具有固定数量的特征形状,但是大小不同),因此特征空间也不相同。 So even that there is a way to combine those classifiers, the benefit would be marginal because you probably do not have the same features for different objects so you would need evaluate almost every feature again. 因此,即使有一种方法可以将这些分类器组合在一起,但由于您可能没有针对不同对象的相同功能,因此您可能需要再次评估几乎所有功能。

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

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