I have trained my SVM classifier by extracting HOG features from a positive and negative dataset
from sklearn.svm import SVC
import cv2
import numpy as np
hog = cv2.HOGDescriptor()
def hoggify(x,z):
data=[]
for i in range(1,int(z)):
image = cv2.imread("/Users/munirmalik/cvprojek/cod/"+x+"/"+"file"+str(i)+".jpg", 0)
dim = 128
img = cv2.resize(image, (dim,dim), interpolation = cv2.INTER_AREA)
img = hog.compute(img)
img = np.squeeze(img)
data.append(img)
return data
def svmClassify(features,labels):
clf=SVC(C=10000,kernel="linear",gamma=0.000001)
clf.fit(features,labels)
return clf
def list_to_matrix(lst):
return np.stack(lst)
I want to apply that training so that the program will be able to detect my custom object (chairs).
I have added labels to each set already; what needs to be done next?