# define svm classifier model
model = SVC(kernel='linear', probability=True)
model.fit(face_embd, labels)
how to save it and use it on android kotlin
# define svm classifier model
model = SVC(kernel='linear', probability=True)
model.fit(face_embd, labels)
how to save it and use it on android kotlin
this is not from opencv, we can’t help you
(and besides, what is a `#define’ doing in your python code ?)
however, assuming, you use opencv’s SVM for this,
you’d save the trained model:
svm.save("my.yml")
and later, you’d build a new one from the yml:
svm = ml.SVM.load("my.yml")
main problem on android is, that your saved yml
will end up somewhere in the assets
(or elsewhere in the zipped apk,
where opencv’s C functions cannot read it,
so 1st thing you need to do is copy it to tmp, sdcard or such)
#define is a comment line
tutorial for OpenCV’s SVM (contains code in three selectable languages):
https://docs.opencv.org/4.x/d1/d73/tutorial_introduction_to_svm.html