5.Pedestrian Detection - Cascade classifier
Cascade classifier
1. Casacde classifier : face detection
- Viola - Jones face detection
- It could train positive image(face image) and negative image(normal image) and detect accuratly face area.
- Different point with before methods is that Haar-like feature, robust classifier function based on AdaBoost, rapid operation speed through cascade method are used.
- Haar-like feature
- Using the set of filter of rectangle form
- Extracting the result value pixel value is minused from black rectangle area to whole white rectangle area.
- Cascade classifier
- Although There is one or two face in normal image, other area is almost non-face area.
- Conducting Mutistage inspection to skip Non-face are.
- CascadeClassifier code
cv2.CascadeClassifier.detectMultiScale(image, scaleFactor=None, minNeighbors=None, flags=None, minSize=None, maxSize=None) -> result
- image : input image
- scaleFactor : image shrinkage ratio. default is 1.1
- minNeighbors: Specifying how many neighbor rectangle is detected to set to fianal detection area.
- flags : not use
- minSize : min object size
- maxSize : max object size
- result : numpy.ndarray put in rectangle information of detected object such as (x,y,w,h)
2. Hisgogram of Oriented Gradients (Hog)
- Hog
- Using oriented gradient of image as feature vector
- It’s widely used to pedstrian detection mehod at CVPR conference in 2005
- The code Loading pre-learn clssifier coefficient for making HOG descriptor object or detecting pedestrian.
cv2.HOGDescriptor() -> <CascadeClassifier object>
cv2.HOGDescriptor_getDefaultPeopleDetector() -> retval
- retval : pre-trained feature vector
- Enrolling SVM classifier coefficient
cv2.HOGDescriptor.setSVMDetector(svmdetector) -> None
- svmdetector : coefficient for linear SVM classifier
- HOG multiscale object detection code
cv2.HOGDescriptor.detectMultiScale(img, hitThreshold=None, winStride=None, padding=None, scale=None, finalThreshold=None, useMeanshiftGrouping=None) -> foundLocations, foundWeights
- img : input image
- hitTreshold : Threshold for distance of between feature vector and SVM classifer plane
- winStride : Moving size of shall window
- padding : Padding size
- scale : Size ration of search window
- finalThreshold : Threshold for detection determination
- useMeanshiftGrouping : The method superimposed window combine
- foundLocations : Rectangle area information
- foundWeights : Confidence for rectangle area
- HOG pedestrian detection result example
Leave a comment