I am training normal bayes classifier using opencv 3.1.0 C++ to classify face images. I am passing a floating point matrix as classification data and a matrix of integers as labels (responses). Opencv does not throw any exception but the classifier takes a very long time without finishing classification. Below is my code. Kind regards
void trainBayes(Mat hists, vector<int> labels)
{
Mat responses(labels);
responses.convertTo(responses, CV_32SC1);
Ptr<NormalBayesClassifier> bayes = NormalBayesClassifier::create();
cout << "Training Bayes..." << endl;
bayes->train(hists, ml::ROW_SAMPLE, responses);
bool trained = bayes->isTrained();
if (trained)
{
cout << "Normal Bayes Classifier is Trained" << endl;
bayes->save(".\\Trained Models\\LBPBayes.xml");
}
}