This is my approach
svm = cv2.ml.SVM_create()
svm.setType(cv2.ml.SVM_C_SVC)
svm.setKernel(cv2.ml.SVM_RBF)
svm.trainAuto(data["encodings"], cv2.ml.ROW_SAMPLE,data["names"])
where I get encodings using HOG and names from:
for (i, imagePath) in enumerate(imagePaths):
# extract the person name from the image path
print("[INFO] processing image {}/{}".format(i + 1, len(imagePaths)))
name = imagePath.split(os.path.sep)[-2]
but when I train
'samples is not a numpy array, neither a scalar'
this error appears in the line:
svm.trainAuto(data["encodings"], cv2.ml.ROW_SAMPLE,data["names"])
I think I need to convert the names to a numpy array.
How can I do that?