Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using SVM with HOGDescriptor

I have a .yml file that was created using this (https://docs.opencv.org/3.3.1/d5/d77/train_HOG_8cpp-example.html) c++ program with positive and negative images.

How do I use the .yml file with my Python code? I noticed that the default person detector is in the opencv-3.3.0/data/hogcascades saved as hogcascade_pedestrian.xml

This is the Python code I'm trying to implement the trained SVM: hog = cv2.HOGDescriptor() hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector()) cap = cv2.VideoCapture(0)

Using SVM with HOGDescriptor

I have a .yml file that was created using this (https://docs.opencv.org/3.3.1/d5/d77/train_HOG_8cpp-example.html) c++ program with positive and negative images.

How do I use the .yml file with my Python code? I noticed that the default person detector is in the opencv-3.3.0/data/hogcascades saved as hogcascade_pedestrian.xml

This is the Python code I'm trying to implement the trained SVM: SVM:

  1. hog = cv2.HOGDescriptor() hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector()) cv2.HOGDescriptor()
  2. hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
  3. cap = cv2.VideoCapture(0)

Using SVM with HOGDescriptor

I have a .yml file that was created using this (https://docs.opencv.org/3.3.1/d5/d77/train_HOG_8cpp-example.html) c++ program with positive and negative images.

How do I use the .yml file with my Python code? I noticed that the default person detector is in the opencv-3.3.0/data/hogcascades saved as hogcascade_pedestrian.xml

This is the Python code I'm trying to implement the trained SVM:

  1. hog = cv2.HOGDescriptor()
  2. hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
  3. cap = cv2.VideoCapture(0)

This is what the top of my .yml looks like:

%YAML:1.0 my_detector: !!opencv-object-detector-hog winSize: [ 64, 128 ] blockSize: [ 16, 16 ] blockStride: [ 8, 8 ] cellSize: [ 8, 8 ] nbins: 9 derivAperture: 1 winSigma: 4. histogramNormType: 0 L2HysThreshold: 2.0000000000000001e-01 gammaCorrection: 1 nlevels: 64 signedGradient: 0 SVMDetector: [ -6.58533711e-04, -7.21909618e-03, -1.13428337e-03,