Using SVM with HOGDescriptor

asked 2018-02-10 11:40:33 -0500

cubud gravatar image

updated 2018-02-10 12:58:26 -0500

I have a .yml file that was created using this (https://docs.opencv.org/3.3.1/d5/d77/...) 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,

edit retag flag offensive close merge delete

Comments

there is load method of HOGDescriptor see this

sturkmen gravatar imagesturkmen ( 2018-02-10 13:14:07 -0500 )edit

Thanks for that. It loaded right up. So i'm guessing I don't need hog.setSVMDetector() at all now?

cubud gravatar imagecubud ( 2018-02-10 13:22:07 -0500 )edit