Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Do I need to calculate hist at prediction time in SVM?

$
0
0
I am training my dataset with the below code: for file in glob.glob('C:\*.png'): image = cv2.imread(file, 1) image = cv2.resize(img, (60, 120)) hog = cv2.HOGDescriptor((60,120), (8,8), (4,4), (4,4), 9) hist = hog.compute(image) samples.append(hist) labels.append(-1) I am using `hist = hog.compute(image)`. This code is in the training part, but when I do the prediction part: hog = cv2.HOGDescriptor((60,120), (8,8), (4,4), (4,4), 9) svm = cv2.ml.SVM_load('svm_data.xml') sv = svm.getSupportVectors() rho, alpha, svidx = svm.getDecisionFunction(0) svm_new = np.append(sv, -rho) hog.setSVMDetector(svm_new) I am not using `hist = hog.compute(image)`, and my results are not as good. Do I need to use hog.compute in prediction part while using `Multiscale`? found, w = hog.detectMultiScale(img,hitThreshold=0,winStride=(8,8),padding=(16,16), scale=1.05, finalThreshold = 2.0,useMeanshiftGrouping=False) When I try to use it, it gives an error, and without it, I am not getting good results. Am I doing wrong in the training part or in the prediction part?

Viewing all articles
Browse latest Browse all 41027


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>