# Initialize HOG detector. hog = cv2.HOGDescriptor() detectorCoefficients = cv2.HOGDescriptor_getDefaultPeopleDetector() hog.setSVMDetector( detectorCoefficients ) # Load test image filename = 'person1.jpg' img = cv2.imread(filename) # Detect humans found, w = hog.detectMultiScale(img, winStride=(8,8), padding=(32,32), scale=1.05, hitThreshold = -1) draw_detections(img, found)
The first classifier was K-Nearest Neighbor, which searches K (e.g., K=5) nearest samples and copies the most frequent class label to the query sample. The benefit is its simplicity and flexibility, but a major drawback is the slow speed at prediction time.
Linear classifiers are a simpler alternative. A linear classifier is characterized by a linear decision boundary, and described by the decision rule:
F(x) = "class 1" if wTx > b
F(x) = "class 0" if wTx <= b
Here, w and b are the weights and constant offset learnt from the data and x is the new sample to be classified.
If you dare, you may test an image detection/recognition demo using deep learning from Google's Tensorflow project. It is available for Android phones as unverified apk at this link. Below is one detection example from last weekend. (Standard disclaimers on using unverified apps apply. Only install at your own risk).
Ei kommentteja:
Lähetä kommentti