Skip to content

NDK: unknown text in model file: [1] #12

@furkangercek

Description

@furkangercek

Hi, thanks for this library and the documentation.

I've been trying to load a pre-trained svm-model into my Android application and predict the liveliness of an photo. But I'm having trouble at loading the model.

This is the error I'm getting :

D/LibSVM: LibSVM init
D/LibSVM-NDK: NDK: jniSvmPredict cmd = /storage/emulated/0/libsvm/predict.png /storage/emulated/0/libsvm/MODEL_FILE /storage/emulated/0/libsvm/output 
D/LibSVM-NDK: NDK: unknown text in model file: [1]
    NDK: ERROR: fscanf failed to read model
    NDK: can't open model file /storage/emulated/0/libsvm/MODEL_FILE
Application terminated.

The part where I do the initialization and prediction.
dataPredictPath contains the image I want to test,
modelPath is the MODEL_FILE location
outputPath : ? I'm not sure what this location is, but I have it nonetheless.

String dataPredictPath = appFolderPath+"predict.png ";
String modelPath = appFolderPath+"MODEL_FILE ";
String outputPath = appFolderPath+"output ";
 svm = new LibSVM();
 svm.predict(dataPredictPath + modelPath + outputPath);

My MODEL_FILE goes like this : 1 1:0.094391245 2:0.14827052 3:0.088652398 4:0.28704535 5:0.05657944 6:0.25682053 7:0.28452203 8:0.20615581 9:0.042102296 10:0.25249034 11:0.2981357 12:0.11878572 13:0.047860448 14:0.29053951 15:0.19971732 16:0.11536864 17:0.07729373 18:0.32926438 19:0.20244 20:0.071077895 21:0.20135299 22:0.27581759 23:0.13864515 24:0.065852396 25:0.18637253 26:0.22433392

I had this in the start of the model but I deleted it, seeing its not the same with libsvm format.

svm_type c_svc
kernel_type linear
nr_class 2
total_sv 449
rho 1.33522
label 1 -1
probA -6.83453
probB -0.235144
nr_sv 212 237
SV

Could you please help me out ? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions