Ask Your Question

Arrakis's profile - activity

2013-05-04 10:27:02 -0600 commented question SVM Predict Slow

I'm afraid that doesn't make sense. Performance hasn't improved, but I haven't made any changes.

2013-04-27 12:39:23 -0600 received badge  Supporter (source)
2013-04-27 12:34:43 -0600 commented question SVM Predict Slow

I have a separate SVM data structure copy for each thread. Instantiation code:

static std::vector<cv::SVM> shared_svm;
shared_svm.resize(num_threads);
shared_svm[i].load(classifier_path.c_str());

Classification code:

static void processThread(const std::size_t i)
{
    const cv::SVM &svm = shared_svm[i];
    ...
    const CvMat predictor_old = ...
    CvMat *responses_old_ptr = cvCreateMat(rows, 1, CV_32FC1);
    svm.predict(&predictor_old, responses_old_ptr);
2013-04-18 02:07:38 -0600 received badge  Nice Question (source)
2013-01-23 08:35:17 -0600 commented question SVM Predict Slow

I should add that this situation hasn't changed in version 2.4.3, despite the promise of better multicore performance. Compiling with TBB on actually gave worse performance than with if off.

2012-09-19 06:44:15 -0600 received badge  Student (source)
2012-09-04 10:59:35 -0600 asked a question SVM Predict Slow

Hello all,

I am using a SVM in (what should be) a 30hz application using Ubuntu 10.4 and OpenCV 2.4. I need to do approximately 500 classifications per frame. Even using a linear SVM predict for all 500 samples is very slow for me. I have profiled that cv::SVM takes 75% of all computation time in my program, and it's only running at 17FPS. However only about 1.5 cores of my 4 core CPU are being utilised (running top gives 160%). Programs like GNU Parallel result in ~370% of my CPU being utilised.

My problem is that multithreading the SVM prediction does not give a performance boost. I have tried both the SVM predict API that uses cv::parallel_for, and the API which does not. Using 1 thread gives around 14FPS, using 2 threads gives around 17FPS, and using more still gives ~17FPS.

My Question: Why is the SVM prediction slow, and yet still only using less than half of my CPU cores? Why does manually multithreading and doing half the predictions between 2 threads give only a small speedup? Is the OpenCV SVM just not very fast and should I use another implementation?

Many thanks