Ask Your Question
6

Missing HOG Cascade in Ver 3

asked 2015-09-24 05:19:08 -0600

mefmef gravatar image

updated 2015-09-24 06:36:16 -0600

It seems that opencv 3 no longer support HOG Cascade. Why is that?

in cascadedetect.cpp:

if( featureTypeStr == CC_HAAR )
    featureType = FeatureEvaluator::HAAR;
else if( featureTypeStr == CC_LBP )
    featureType = FeatureEvaluator::LBP;
else if( featureTypeStr == CC_HOG )
{
    featureType = FeatureEvaluator::HOG;
    CV_Error(Error::StsNotImplemented, "HOG cascade is not supported in 3.0");
}
else
    return false;

It was working very good and in many cases the results were better than Haar cascade and LBP!! Moreover, the training time was very good (in my experience 20 times faster than Haar and 2 times faster than LBP).

edit retag flag offensive close merge delete

Comments

Can you give more details of the problem? Afaik, CascadeClassifier still supports HOG descriptors

LorenaGdL gravatar imageLorenaGdL ( 2015-09-24 05:43:43 -0600 )edit

I've edited the question

mefmef gravatar imagemefmef ( 2015-09-24 05:54:23 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
7

answered 2015-09-24 06:02:57 -0600

LorenaGdL gravatar image

updated 2015-09-24 06:11:54 -0600

I wasn't aware of this lack of functionality, but I have found this issue (#4989) where developers state the reasons for dropping.

edit flag offensive delete link more

Comments

They mentioned that "The implemented HOG features are quite weird - different from Dalal's interpretation of HOG, different from P. Dollar integral channel features"

I don't understand why it should be omitted if it is not the same as Dalal's interpretation!!! It was working very good and in many cases the results were better than Haar cascade and LBP!!

mefmef gravatar imagemefmef ( 2015-09-24 06:30:43 -0600 )edit

Actually I think dropping faulty implementations is a good approach since you are telling people that it follows a certain convention while it does not. It will return once somebody can integrate the working HOGDescriptor interface into this. In the meanwhile, just use the 2.4 branch if you want this or port the functionality locally.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-09-24 06:39:51 -0600 )edit

I think instead of dropping, the author of the code can write a document and describe the method.

mefmef gravatar imagemefmef ( 2015-09-24 06:47:06 -0600 )edit
2

The original author was not available for help anymore as I understood from one of the core developers. And actually, there is only 1 way of calculating HOG features so we cannot just add a semiHOG implementation because it does something good... that is not the purpose of a computer vision library...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-09-24 06:49:18 -0600 )edit
2

It is strange that the HOG implementation was not documented so it may be rewritten... I suggest you to do documentation of all the approaches in OpenCV for not having the same problems later... ;)

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-09-24 07:12:34 -0600 )edit

so.. it is not documented anymore but is still callable? because im pretty sure im calling it and getting back a classifier that seems to work decently in certain params and situations (opencv 3 python API)

jsky gravatar imagejsky ( 2015-11-01 21:26:30 -0600 )edit

@jsky there is a difference between HOG cascades and HOG+SVM as the HOGPeopleDetector. The latter still works perfectly fine! The first one is disabled.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-11-02 03:14:32 -0600 )edit
1

but i call pkg-config --modversion opencv : 3.0.0 and opencv_traincascade ... -featureType HOG and i get back a cascade that seems to use HOG features <featureType>HOG</featureType>.. Are you saying this is using an SVM implementation as opposed to decision tree?

jsky gravatar imagejsky ( 2015-11-03 21:14:25 -0600 )edit

Well that is because the traincascade app has not been adapted according to the detection algorithm. So you will be perfectly fine in training one, but as I recall it, at calling detectMultiScale, the featureEvaluator does not know how to handle the HOG features anymore.

  • As you can see here, in the latest master branch, there is no line anymore to evaluate the HOG features.
  • Checked it for 3.0.0 also and there it is also missing.

So even if you train a model using the faulty feature set, you won't be able to call it at detection time.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-11-04 02:13:32 -0600 )edit

hmm i see.. but it seems that i am calling it in detection and getting decent results. i guess its because its still in the python api? as im using python. nowhere do i tell it to use a particular evaluator, i just tell it about the classifier and then call detectMultiscale ..

jsky gravatar imagejsky ( 2015-11-06 00:28:40 -0600 )edit

How are you calling it? We are not talking about the same interface, else it would NOT work, because the python api is a simple wrapper of the C++ API ...Start by giving us some more info.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-11-07 15:00:26 -0600 )edit
1

my bad. i am using cv2 in detection but cv3 in training (as above).

jsky gravatar imagejsky ( 2015-11-08 02:52:07 -0600 )edit

Then indeed, 2.4 should still support it, where 3 does not. We should remove it from the cv3 interface from trainng also. Put it on my weekly todo list!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-11-08 03:20:32 -0600 )edit

It seems that HOGCascade implementation in opencv2.4 is similar to this approach: "Fast Human Detection Using a Cascade of Histograms of Oriented Gradients" http://lear.inrialpes.fr/people/trigg...

So, it seems that in contrast to what @Dikay900 and @vpisarev mentioned, it is a valid implementation.

mefmef gravatar imagemefmef ( 2016-03-07 08:41:13 -0600 )edit
0

answered 2020-03-29 09:27:37 -0600

ComputerVisionary gravatar image

updated 2020-03-29 10:31:54 -0600

You can keep training Hog cascades with opencv <3.0 and use the resulting xml with versions <3.0.

edit flag offensive delete link more

Comments

1

Sorry I was trying to support this community, I remove the link a correct the answer.

ComputerVisionary gravatar imageComputerVisionary ( 2020-03-29 10:29:38 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-09-24 05:19:08 -0600

Seen: 4,724 times

Last updated: Mar 29 '20