MCPcopy Index your code
hub / github.com/JimmyHHua/opencv_tutorials / svm_train

Function svm_train

python/code_104/opencv_104.py:41–50  ·  view source on GitHub ↗
(positive_dir, negative_dir)

Source from the content-addressed store, hash-verified

39
40
41def svm_train(positive_dir, negative_dir):
42 svm = cv.ml.SVM_create()
43 svm.setKernel(cv.ml.SVM_LINEAR)
44 svm.setType(cv.ml.SVM_C_SVC)
45 svm.setC(2.67)
46 svm.setGamma(5.383)
47 trainData, responses = get_dataset(positive_dir, negative_dir)
48 responses = np.reshape(responses, [-1, 1])
49 svm.train(trainData, cv.ml.ROW_SAMPLE, responses)
50 svm.save('svm_data.dat')
51
52
53def elec_detect(image):

Callers

nothing calls this directly

Calls 1

get_datasetFunction · 0.70

Tested by

no test coverage detected