Ask Your Question

Revision history [back]

Do CvNormalBayesClassifier::train() and CvNormalBayesClassifier::predict() dynamically allocate heap memory internally ?

Hi all,

I'm wondering if any folks with knowledge of OpenCV's internals can offer some advice.

I'm looking for a library which offers a few different classifier types like Naive Bayes, SVM, Neural Nets etc.

I need to be able to call the classifiers preditct/classify methods from a high priority and real-time audio callback thread. This means I cannot use methods which dynamically allocate heap memory internally or block/wait. So no locking or waiting on mutexes etc. Essentially I need things wait free.

I looked into using the mlpack machine learning library but it dynamically allocates / requests heap space from the OS all over the place as does libarmadillo which it uses internally for matrix operations.

Basically I need something which allocates all memory for containers and matrices only inside object constructors and is wait free. So no std::vector push backs or Mat(10, 10) type calls inside predict() - preferably not inside train() either.

Otherwise it looks like I'll be climbing through trying to implement a couple of real-time audio friendly classifiers myself......daunting.

Hoping OpenCV might be the answer.