How do I train my own HOG SVM Detector in openCV
I followed the following steps as I had seen on this link:
g++ `pkg-config --cflags opencv` -c -g -MMD -MP -MF main.o.d -o main.o main.cpp
gcc -c -g `pkg-config --cflags opencv` -MMD -MP -MF svmlight/svm_learn.o.d -o svmlight/svm_learn.o svmlight/svm_learn.c
gcc -c -g `pkg-config --cflags opencv` -MMD -MP -MF svmlight/svm_hideo.o.d -o svmlight/svm_hideo.o svmlight/svm_hideo.c
gcc -c -g `pkg-config --cflags opencv` -MMD -MP -MF svmlight/svm_common.o.d -o svmlight/svm_common.o svmlight/svm_common.c
g++ `pkg-config --cflags opencv` -o opencvhogtrainer main.o svmlight/svm_learn.o svmlight/svm_hideo.o svmlight/svm_common.o `pkg-config --libs opencv`
Can someone please help me out on how do I proceed from here..As in I want to detect humans in images. I am coding in python using OpenCV and I had tried using the default detector but I didn't get good results:
hog = cv2.HOGDescriptor() hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector()) found, w = hog.detectMultiScale(img, winStride=(8, 8), padding=(32, 32), scale=1.05)
Can someone please tell me how do I use the trained SVM in python(preferably) or C++? Thanks
rather use opencv's own hog training , (which is somewhat based on the code you tried to use)
then serialize the single support vector to something, you can read from python.