1 image - 10 haar classifiers - process image once [closed]

asked 2019-01-28 16:26:02 -0600

Hi, I created 10 Haar classifiers for recognizing digits. Because of that I got to create 10 CascadeClassifier objects and run detectMultiScale 10 times in order to find a number in a single Mat. I was thinking to investigate if there is a point in creating a new class CascadeClassifierGroup that would allow to load many classifiers and detect objects for each of them in a single run, taking into account cache friendliness etc. But before doing that, I wanted to ask if you see some better option in terms of performance.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Michał Kowalczyk
close date 2019-01-29 09:25:15.013831

Comments

I was thinking to investigate if there is a point in creating a new class CascadeClassifierGroup that would allow to load many classifiers and detect objects for each of them in a single run

no there is no point doing that, you cannot share anything between your classifiers. that's why the whole approach won't scale.

also note, that those haar classifiers are "on the way out", 4.0 does no more come with tools to train them, the gpu version was removed entirely, etc. (this was one of the last remainders of the arcane c-api code, which noone wants to maintain)

berak gravatar imageberak ( 2019-01-28 23:55:51 -0600 )edit

Thanks @berak, that also explains why I saw no improvement when using UMat with detectMultiScale. Is there any migration path, suggested ways to go when Haar Classifiers wont be supported anymore?

Michał Kowalczyk gravatar imageMichał Kowalczyk ( 2019-01-29 08:58:26 -0600 )edit

I saw no improvement when using UMat

there is no opencl optimization for this (i'm wrong)

Is there any migration path

idk. this depends very much on your application. (will you really need numbers only ?)

opencv has a couple of ways to detect text, ranging from simple MSER to dnn based EAST (and a whole text module in contrib). networks, or a simple SVM will also be better at the classification part.

last, there are e.g. SSD networks(able to do detection & classification in one go), that can be retrained for your goal.

berak gravatar imageberak ( 2019-01-29 09:16:30 -0600 )edit

I am handling 7-segment digits (power usage counter). I tried several OCR libraries, unfortunately, recognitions have poor quality. Haar classifier was successful but a bit slow, when running 10 classifiers sequentially. Anyway, I'll check methods that you suggested. Thanks! (-:

Michał Kowalczyk gravatar imageMichał Kowalczyk ( 2019-01-29 09:21:09 -0600 )edit

interesting to hear, that the current approach worked for you !

berak gravatar imageberak ( 2019-01-29 09:22:53 -0600 )edit
sturkmen gravatar imagesturkmen ( 2019-01-29 10:47:44 -0600 )edit