Ask Your Question
1

Problem with SVM predict on android

asked 2013-12-02 11:03:22 -0600

humbleAR gravatar image

updated 2013-12-03 00:31:08 -0600

Hello everyone,

I am working on an application on android that uses CvSVM class of OpenCV. I tested the code on my mac without any problem and it provides quite good results. The training and the detection part work quite fine, I tested them on mac OS and I included it in iOS without any problem.

I spent several weeks trying to include it in an android application using the NDK. Without Success. I first tried some basic opencv examples on android and it worked fine. But when using SVM, I have a SIGSEGV (Segmentation Fault) when it enters the predict (CvSVM::predict). There is a std::bad_alloc log.

Here is the most relevant log I got :

01-01 04:51:08.863: I/stderr(10641): terminate called after throwing an instance of 'std::bad_alloc'
01-01 04:51:08.863: I/stderr(10641):   what():  **std::bad_alloc**
01-01 04:51:08.867: A/libc(10641): **Fatal signal 11 (SIGSEGV)** at 0xdeadbaad (code=1), thread 10641 (mples.tutorial2)
01-01 04:51:09.004: I/DEBUG(91): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-01 04:51:09.582: I/DEBUG(91): becc40bc  53fb7451  /data/app-lib/org.opencv.samples.tutorial2-1/**libopencv_java.so (CvSVM::predict(float const*, int, bool) const)**

What I already tried (among other things):

  • reducing image size to see if it is a memory problem
  • verify all the classifiers and dictionary
  • verify that there are actually detected key points

I really got our of ideas of what to try to make it work on android. I don't know if there is some restriction on android that makes it impossible to run. It works on iOS and on my Mac OS but not on android.

Thank you much for reading. Any help or suggestion is welcome.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-12-03 00:52:28 -0600

Such behavior looks like some bug. I recommend you to create an issue on project tracker.

edit flag offensive delete link more

Comments

Thank you for your answer Alexander. Getting deeper in OpenCV code, it seems that commenting the "clean" in the predict solves this specific problem. I will confirm after some in depth testing.

humbleAR gravatar imagehumbleAR ( 2013-12-03 10:04:58 -0600 )edit

Cool! OpenCV is open source project, so you can make a contribution. See this page for more deteails: http://code.opencv.org/projects/opencv/wiki/How_to_contribute

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-12-03 12:38:09 -0600 )edit

Question Tools

Stats

Asked: 2013-12-02 11:03:22 -0600

Seen: 923 times

Last updated: Dec 03 '13