Ask Your Question
0

Combining classifiers

asked 2018-04-20 19:48:55 -0600

holger gravatar image

Hello,

I am familar with the opencv_createsamples and opencv_traincascade tool. During my reading, i came about to read this documentation https://docs.opencv.org/3.1.0/dc/dd6/...

"Boosting is a powerful learning concept that provides a solution to the supervised classification learning task. It combines the performance of many "weak" classifiers to produce a powerful committee [139] . A weak classifier is only required to be better than chance, and thus can be very simple and computationally inexpensive. However, many of them smartly combine results to a strong classifier that often outperforms most "monolithic" strong classifiers such as SVMs and Neural Networks."

So how i understand it i could train several small feature classifiers and use them together. For example train a face and body classifier if want to detect humans.

Is my understandig correct / does this makes sense? And if so - can i do it from command line or do i have to do it programatically?

Thanks four your answer and sorry for the maybe newbie question.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-04-25 07:43:40 -0600

updated 2018-04-25 07:46:03 -0600

That is indeed how the boosting principle works. However it more like, we want to build a face detector, and in order to do so we combine weak classifiers that look at ears, nose, mouth, hair, eyebrows, ... but in theory that principle could indeed be expanded towards a larger main class with more subclasses like pedestrians. In principle that is what ICF/ACF does, without telling the classifiers what to look for first. You could force classifiers to look for specific parts in your seperate weak stages of classifiers inside the cascade and that way force the boosting to look for features related to specific parts of an object.

Doing this from command line, without any combinational programming will be impossible, but what you can do

  • Make different cascades
  • Then write software that simple subsequently executes those cascades

However one could wonder if this will be more efficient than simply going for a person at once! A benefit I see is that you could weight the separate cascades and through that way somehow cover partial occlusion.

edit flag offensive delete link more

Comments

"However one could wonder if this will be more efficient than simply going for a person at once! " I am wondering too :-) I guess the answer is "Try it out". I will try to do this. Maybe it makes sense too because you could also reuse classifiers for differerent models?

So some further question for clarification: What does ICF/ACF stands for?

You suggested : - "Make different cascades" Ok i can do this.

"Then write software that simple subsequently executes those cascades" What does "execute cascade" means? Multiple calls of detectMultiScale to detect all feature? Multiple calls of forward() on the net after configuring it? Should i take a look at the source of the opencv_traincascade tool(had a short look some time ago)?

Sorry for the confusion and thank you in advance, Holger

holger gravatar imageholger ( 2018-04-25 08:21:31 -0600 )edit

Lets sum some things up

  1. Yep trying stuff is the only way to verify if it actually works.
  2. ICF is integral channel features detector, while ACF stands for aggregate channel features detector. They are both a more advanced algorithm based on the viola and jones approach and generalized for other object categories. Have a look at their papers. OpenCV does not contain them, but several C++ version retrievable on the net.
  3. Subsequent calls --> first go through cascade 1 --> if you get a true positive, pass it to the second cascade --> continue this until the end of all your cascades.
  4. I do not get how you mix up detectMultiScale and forward(). They are both complete different approaches and thus you have to make a choice. Either classic with Viola&Jones or SOTA with deep learning.
StevenPuttemans gravatar imageStevenPuttemans ( 2018-04-26 07:15:27 -0600 )edit

Thank you again, i mixed detectMultiScale() and net.forward() because my understanding is still to little :-/. Maybe i can clarify this?. What is a cascade classifier? https://en.wikipedia.org/wiki/Cascadi...

What is a cnn? https://de.wikipedia.org/wiki/Convolu...

So my current understanding (please correct if wrong). For both you need information about the image. These information are called features. Several feature extracting methods exists (HAAR, HOG, LBP) In both cases you feed these information to a neuronal network. Ok about the sentence above i am not sure, the rest should be correct.

So a cascade classifiers is a combination of weak classifier. And a cnn does classification too, so again somthing overlapping. I hope i am not completly of the track.

holger gravatar imageholger ( 2018-04-26 07:36:03 -0600 )edit

In both cases you feed these information to a neuronal network well that is possible, but in general, classic machine learning like cascades need features, while for cnn's we simply provide the raw pixel data and NOT image features.

StevenPuttemans gravatar imageStevenPuttemans ( 2018-04-26 07:41:27 -0600 )edit

Thank you - things are getting a bit clear for me now - its hard to find someone who gives basic explanation on the topic. But i dont blame anyone - the topic itself is difficult (but rewarding).

holger gravatar imageholger ( 2018-04-26 07:52:18 -0600 )edit

Ok one last thing because i dont really got it. You wrote: "Subsequent calls --> first go through cascade 1 --> if you get a true positive, pass it to the second cascade --> continue this until the end of all your cascades."

I think the api calls i have to make are around this class? https://docs.opencv.org/3.0-beta/modu...

Would make sense as my initial question on which you answered was referencing to combining classifiers. Should be - hope i am on right track this time (cross fingers):-)

Thx again + Greetings, Holger

holger gravatar imageholger ( 2018-04-26 07:56:51 -0600 )edit

Wow wait, no this has nothing to do with support vector machines, that is again a complete different class of machine learning algorithms. You have to stick with cascade classifiers, which are based on the internal boosting algorithm as machine learning step.

StevenPuttemans gravatar imageStevenPuttemans ( 2018-04-26 08:54:58 -0600 )edit

Oh well - i am lost right now :-) The only thing left i can imagine is that you talking about the same things the training tool does. The tool trains cascades. So i would need to study the training tool source code for getting into the matter? Can you give me a class in the api where to start?

https://docs.opencv.org/3.4.1/d0/d0b/... Seems to be one of the parts i need to use.

Greetings, Holger

holger gravatar imageholger ( 2018-04-26 11:07:54 -0600 )edit

@holger, I suggest you read chapter 5 of the OpenCV 3 Blueprints book which discusses the complete architecture of cascades quite in the detail. That being said, the train cascade tool, what it basically does internally is create a feature representation of your image, which can be HAAR or LBP style, then give that to a boosting algorithm that trains your cascade tree structure. The base class for that is the boosting class, which can be found here.

StevenPuttemans gravatar imageStevenPuttemans ( 2018-04-27 02:26:00 -0600 )edit
1

That helps! Its like always - you need to understand the thing before using an api for the thing. Had a bad day yesterday ;-)

holger gravatar imageholger ( 2018-04-27 05:50:54 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-04-20 19:48:55 -0600

Seen: 766 times

Last updated: Apr 25 '18