opencv: CPU CascadeClassifier with HOG not working anymore with opencv 3.0.0.rc1
Transferred from http://code.opencv.org/issues/4336
|| Valentino Proietti on 2015-05-14 09:47
|| Priority: Normal
|| Affected: branch 'master' (3.0-dev)
|| Category: objdetect
|| Tracker: Bug
|| Difficulty: Hard
|| PR:
|| Platform: x64 / Linux
CPU CascadeClassifier with HOG not working anymore with opencv 3.0.0.rc1
Hi,
While moving from opencv 2.4.10 to opencv 3.0.0rc1 I found that the CPU CascadeClassifier is not working anymore with HOG.
Digging into the code I discovered that the HOGEvaluator is completely missing in 3.0.
This is the FeatureEvaluator::create() method from the *2.4* version:
<pre>
Ptr<FeatureEvaluator> FeatureEvaluator::create( int featureType )
{
return featureType == HAAR ? Ptr<FeatureEvaluator>(new HaarEvaluator) :
featureType == LBP ? Ptr<FeatureEvaluator>(new LBPEvaluator) :
featureType == HOG ? Ptr<FeatureEvaluator>(new HOGEvaluator) :
Ptr<FeatureEvaluator>();
}
</pre>
And this is the same method from the *3.0* version:
<pre>
Ptr<FeatureEvaluator> FeatureEvaluator::create( int featureType )
{
return featureType == HAAR ? Ptr<FeatureEvaluator>(new HaarEvaluator) :
featureType == LBP ? Ptr<FeatureEvaluator>(new LBPEvaluator) :
Ptr<FeatureEvaluator>();
}
</pre>
They are both extracted from the "cascadedetect.cpp" source file of the relative version.
The "opencv_traincascade" utility included in the 3.0.0rc1 version still permits us to use HOG for training but we don't know how to use the training results anymore.
Is it a bug or a decision ?
If the latter: how are supposed to be used files produced by "opencv_traincascade" with HOG ?
Thank you
Valentino
History
Alex D on 2015-05-15 12:58
Valentino Proietti wrote:
> Hi,
> While moving from opencv 2.4.10 to opencv 3.0.0rc1 I found that the CPU CascadeClassifier is not working anymore with HOG.
> Digging into the code I discovered that the HOGEvaluator is completely missing in 3.0.
>
> This is the FeatureEvaluator::create() method from the *2.4* version:
> [...]
>
> And this is the same method from the *3.0* version:
> [...]
>
> They are both extracted from the "cascadedetect.cpp" source file of the relative version.
>
> The "opencv_traincascade" utility included in the 3.0.0rc1 version still permits us to use HOG for training but we don't know how to use the training results anymore.
> Is it a bug or a decision ?
> If the latter: how are supposed to be used files produced by "opencv_traincascade" with HOG ?
>
> Thank you
> Valentino
I have exactly the same problem.
Vadim Pisarevsky on 2015-05-18 14:30
- Category set to objdetect
Vadim Pisarevsky on 2015-05-28 14:24
We decided to drop the current HOG cascades in OpenCV 3.x. The implemented HOG features are quite weird - different from Dalal's interpretation of HOG, different from P. Dollar integral channel features. In xobjdetect we slowly grow superior ICF/ACF+WaldBoost-based detector, which is there already and will be improved during 2015.
- Difficulty set to Hard
- Assignee set to Vadim Pisarevsky
- Status changed from New to Cancelled
Valentino Proietti on 2015-05-29 09:56
I'm just wondering why this "design decision" has not been evidenced as needed on the release notes, but may be it's just my fault.
Thank you very much indeed Vadim !!!
Steven Puttemans on 2015-06-10 09:36
Valentino Proietti wrote:
> I'm just wondering why this "design decision" has not been evidenced as needed on the release notes, but may be it's just my fault.
>
> Thank you very much indeed Vadim !!!
Actually that is a very good point. It should be mentioned if functionality is dropped. We should remove the ability to train HOG features than also from the training interface. Will take a look at it later on! I will reopen this bugreport simply so I can link the PR for the deletion of the functionality.
- Assignee changed from Vadim Pisarevsky to Steven Puttemans
- Status changed from Cancelled to Open
About this issue
- Original URL
- State: open
- Created 9 years ago
- Comments: 39 (11 by maintainers)
Removing a useful feature like HOG Cascade is not a good approach. Instead if the current developers don’t understand the original code, and the original developers are not available to help, then we should just leave the feature in, until we can find someone who can understand and take over the code. The SVM based HOGDescriptor is great, but as researchers, we want to train our own HOGDescriptors and not just make use of the canned vectors. Is it not possible to just add back the version 2.4 Cascade based HOG classifier code?
@anonym24 If you so desperately need it, why not provide the PR yourself?
I hate the situation, get it back already!
Hey guys, I also needed the HOG cascade for my project, so I “ported/copied” it from the OpenCV2.x branch. I created a repository for it: https://github.com/Schmetzler/opencv3_CascadeHOG It is not as integrated as it was in OpenCV2, but at least its usable.
@StevenPuttemans The only problem with HOG+SVM is it’s not real-time performance. HOG cascade was real time. Unless there is a way for HOG+SVM to reject subwindows early… but then I would think that would make it a cascade. I’ll check out the DPM too, thanks.
People detection is the application where I need it also. Which HOG is great for, but HAAR not so much. The existing HOG cascade worked fairly well and was fast.
Well just another point I want to make is that as an alternative, to HOG, I’d been using HAAR CascadeClassifier in my project. And the results are not nearly as good for people detection. We definitely need to resurrect the HOG detector within OpenCV.
@StevenPuttemans Thanks that link. It will be helpful, if and when I implement a SVM HOG training program. Of course, I know that SVM HOG is different from Cascade HOG. I’m just saying that we did have the CascadeClassifier with HOG runing fine in 2.4. So why take out the functionality just because no one is there to maintain it or someone thinks the implementation was not what we had expected. I’m all for adding it back, and after my current work assignment may take on the task of adding it back.
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/triggs/student/vj/zhu-cvpr06.pdf
So, it seems that in contrast to what @Dikay900 and @vpisarev mentioned, it is a valid implementation.