Ask Your Question

Missing HOG Cascade in Ver 3

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

mefmef gravatar image

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

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");
    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


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

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

I've edited the question

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

2 answers

Sort by ยป oldest newest most voted

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

LorenaGdL gravatar image

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

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


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 -0500 )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 -0500 )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 -0500 )edit

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 -0500 )edit

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 -0500 )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 -0500 )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 -0500 )edit

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 -0500 )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 -0500 )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 -0500 )edit

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

ComputerVisionary gravatar image

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

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



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 -0500 )edit

Question Tools

1 follower


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

Seen: 4,378 times

Last updated: Mar 29 '20