Ask Your Question
0

HoG Training Using SVM

asked 2016-03-26 22:57:51 -0500

Taseer gravatar image

updated 2016-03-29 04:34:01 -0500

I have successfully trained my positive and negative samples of my dataset. However, when I try to use the hog.setSVMDetector(), I get the following error :

_svmdetector data type = 17 is not supported

Here is the code:

hog = cv2.HOGDescriptor()
svm = cv2.SVM()
svm.load('trained.xml')
img = cv2.imread('t_.png', cv2.IMREAD_COLOR)
h = hog.compute(img)
p = svm.predict(h)
print p
hog.setSVMDetector(np.array(svm))
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2016-03-26 23:35:43 -0500

Taseer gravatar image

I got the answer from the following link:

http://answers.opencv.org/question/56...

edit flag offensive delete link more
3

answered 2016-03-26 23:20:58 -0500

berak gravatar image

updated 2016-03-26 23:23:05 -0500

no, you can't set an svm instance as setSVMDetector. instead, you need to retrieve the support vector and (-)rho from your trained SVM, then put it all into a float array.

please have a look at the (opencv3) c++ example (and i doubt, that this is doable from python with opencv2.4 at all)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-03-26 22:57:51 -0500

Seen: 694 times

Last updated: Mar 29 '16