Ask Your Question

HOG detection clarification

asked 2018-04-27 01:39:56 -0500

Macho gravatar image

Hello, i am new to Computer vision and Machine learning, i searched a lot but did not find an answer for my questions.

First: I want to know what is the difference between all of these detection methods.




Second: I read that HOG.setSvmDetector() used only for detecting one object since SVM is a binary classfication, i was wondering can we train multi class SVM (One vs All) and for each single class of SVM we apply a new instance of HOG.setSvmDetector() ?

for an examlpe if i constructed 2 SVM's which means now i have Multi class SVM of 2 classes can i do smth like this:

HOGDescriptor hog1 = newHOGDescriptor()

HOGDescriptor hog2 = new HOGDescriptor()

HOG.setSvmDetector( CLASS ONE )

HOG.setSvmDetector( CLASS TWO )

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-04-27 01:56:41 -0500

berak gravatar image

updated 2018-04-27 01:57:16 -0500

1) HOG.detect() can only detect objects in exactly the size it was trained upon (faster)

2) HOG.detectMultiScale() applies a scale pyramid on the image, so it can also find objects closer or more far away (slower)

3) you can only detect a single class of objects per HogDescriptor

(you can also only set a single SVMDetector per instance) ofc. you can try to train several, and use several instances, but this will be terribly inefficient. if you need multiple classes, have a look at SSD, YOLO or RCNN neural networks in the dnn module.

edit flag offensive delete link more


Thank you for your answer, but now since HOG.detect() detect only trained objects of exactly same size what make it different from HOG.setSvmDetector() that is also detect trained objects of same size ?

Macho gravatar imageMacho ( 2018-04-27 02:06:02 -0500 )edit

i do not understand your question. HOG.setSvmDetector() does not detect anything. it is a means of transporting a pretrained svm support vector to the HOGDescriptor

berak gravatar imageberak ( 2018-04-27 02:09:18 -0500 )edit

Doesn't HOG.setSvmDetector( HOGDescriptor.getDefaultPeopleDetector() ) detect pedestrians, the one that is implemented in openCV ?

Macho gravatar imageMacho ( 2018-04-27 02:12:00 -0500 )edit

HOG.detect() or detectMultiScale() detects something. what that is, depends on the pretrained SVMDetector. getDefaultPeopleDetector() and getDaimlerPeopleDetector() are indeed trained on upright humans (INRIA or DAIMLER dataset), but you can also train your own detector, and use that instead.

berak gravatar imageberak ( 2018-04-27 02:16:37 -0500 )edit

Ahhh, now i understand you we use either hog.detect() or hog.detectMultiScale() after we train our classifier. Thank you :)

Macho gravatar imageMacho ( 2018-04-27 02:26:22 -0500 )edit

@berak I am sorry to bother again would you mind to take a look at this question on your free time, as i saw you answering things related to multi classification? Thanks

Macho gravatar imageMacho ( 2018-04-28 09:01:43 -0500 )edit

Question Tools

1 follower


Asked: 2018-04-27 01:39:56 -0500

Seen: 621 times

Last updated: Apr 27 '18