Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 1117

problem while load trained svm android

$
0
0
hello guys, i'm working on regions detection, so i'm using SVM with opencv 3.4 on Android studio, i tried to save the trained model of SVM and loaded after but for some reasons that i don't know the load function didn't work in my case ( I'm using Blue stack 4 emulator connected to android studio).The SVM is working fine if i trained him each time ( without using save and load), in my code i used the "getAbsolutePath()" function to get the xml file path and give it to the load function but it don't works. the problem is in the opencv android or in my code please help SVM svm = SVM.create(); svm.setType(SVM.C_SVC); svm.setKernel(SVM.RBF); svm.setC(10000); svm.setGamma(0.00001); svm.setTermCriteria(new TermCriteria(TermCriteria.MAX_ITER, 100, 1e-6)); svm.train(trainingDataMat, ROW_SAMPLE, labelsMat); File datasetFile = new File(Environment.getExternalStorageDirectory(), "dataset.xml"); svm.save(datasetFile.getAbsolutePath()); for loading the trained SVM i used this lines of code String path = "/storage/emulated/0/dataset.xml"; svm.load(datasetFile.getAbsolutePath());

Viewing all articles
Browse latest Browse all 1117