custom trained SVM in hog.setSVMDetector (python)
I successfully trained a svm with BOW in python (opencv 3). Now I would like to pass it to a hog with setSVMDetector. Is this possible or am I misunderstanding the use of the method? when i try to pass a trained svm to a hog detector like this:
svm = cv2.ml.SVM_create() # opencv 3.0-rc1 API
"""train svm..."""
hog = cv2.HOGDescriptor()
hog.setSVMDetector(svm)
i get
TypeError: _svmdetector is not a numpy array, neither a scalar
I tried saving the svm to xml and then reload it and discovered the load() method in opencv 3 and discovered the load() method of SVM is gone.
hog.setSVMDetector(something), expects a serialized float vector (made from a trained svm's support vectors, and rho) , definitely not the svm instance.
thanks @berak - is there a particular way to serialize the svm?
you're mixing up ideas, that don't go together well.
BOW is a tecnique clustering float feature2d descriptors, like SIFT or SURF to a vocabulary (index) vector.
HOG is using different features, and is using it's svm in a much different way
tl;dr: i don't think, there's a pre-built way , to achieve , what you're trying)