1 | initial version |
I use:
knn.save('knn.yml')
to save the model
And:
fs = cv2.FileStorage('knn.yml', cv2.FILE_STORAGE_READ)
knn_yml = fs.getNode('opencv_ml_knn')
knn_format = knn_yml.getNode('format').real()
is_classifier = knn_yml.getNode('is_classifier').real()
default_k = knn_yml.getNode('default_k').real()
samples = knn_yml.getNode('samples').mat()
responses = knn_yml.getNode('responses').mat()
fs.release
knn.train(samples,cv2.ml.ROW_SAMPLE,responses)
to recover it. I hope be of some help