diff --git a/app/br/br.cpp b/app/br/br.cpp index 50204a8..fd0dc69 100644 --- a/app/br/br.cpp +++ b/app/br/br.cpp @@ -130,7 +130,7 @@ public: br_convert(parv[0], parv[1], parv[2]); } else if (!strcmp(fun, "evalClassification")) { check(parc == 2, "Incorrect parameter count for 'evalClassification'."); - br_eval_classification(parv[0], parv[1]); + br_eval_classification(parv[0], parv[1], parc >= 3 ? parv[2] : NULL, parc >= 4 ? parv[3] : NULL); } else if (!strcmp(fun, "evalRegression")) { check(parc == 2, "Incorrect parameter count for 'evalRegression'."); br_eval_regression(parv[0], parv[1]); diff --git a/app/examples/age_estimation.cpp b/app/examples/age_estimation.cpp index c2a90e5..39c8252 100644 --- a/app/examples/age_estimation.cpp +++ b/app/examples/age_estimation.cpp @@ -29,7 +29,8 @@ static void printTemplate(const br::Template &t) { - printf("%s age: %d\n", qPrintable(t.file.fileName()), int(t.file.get("Subject"))); + // may use age directly -cao + printf("%s age: %d\n", qPrintable(t.file.fileName()), int(t.file.get("Regressand"))); } int main(int argc, char *argv[]) diff --git a/app/examples/gender_estimation.cpp b/app/examples/gender_estimation.cpp index dd4ebd2..c62d409 100644 --- a/app/examples/gender_estimation.cpp +++ b/app/examples/gender_estimation.cpp @@ -29,7 +29,8 @@ static void printTemplate(const br::Template &t) { - printf("%s gender: %s\n", qPrintable(t.file.fileName()), qPrintable(t.file.get("Subject"))); + // may use gender directly -cao + printf("%s gender: %s\n", qPrintable(t.file.fileName()), qPrintable(t.file.get("Label"))); } int main(int argc, char *argv[]) diff --git a/openbr/core/bee.cpp b/openbr/core/bee.cpp index fb840ca..3ec2cef 100644 --- a/openbr/core/bee.cpp +++ b/openbr/core/bee.cpp @@ -93,10 +93,10 @@ void BEE::writeSigset(const QString &sigset, const br::FileList &files, bool ign QStringList metadata; if (!ignoreMetadata) foreach (const QString &key, file.localKeys()) { - if ((key == "Index") || (key == "Subject")) continue; + if ((key == "Index") || (key == "Label")) continue; metadata.append(key+"=\""+QtUtils::toString(file.value(key))+"\""); } - lines.append("\t("Subject") +"\">"); + lines.append("\t("Label") +"\">"); lines.append("\t\t"); lines.append("\t"); } @@ -260,10 +260,10 @@ void BEE::makeMask(const QString &targetInput, const QString &queryInput, const cv::Mat BEE::makeMask(const br::FileList &targets, const br::FileList &queries, int partition) { - // Would like to use indexProperty for this, but didn't make a version of that for Filelist yet - // -cao - QList targetLabels = targets.get("Subject", "-1"); - QList queryLabels = queries.get("Subject", "-1"); + // Direct use of "Label" isn't general, also would prefer to use indexProperty, rather than + // doing string comparisons (but that isn't implemented yet for FileList) -cao + QList targetLabels = targets.get("Label", "-1"); + QList queryLabels = queries.get("Label", "-1"); QList targetPartitions = targets.crossValidationPartitions(); QList queryPartitions = queries.crossValidationPartitions(); diff --git a/openbr/core/classify.cpp b/openbr/core/classify.cpp index 200bc69..821ca0b 100644 --- a/openbr/core/classify.cpp +++ b/openbr/core/classify.cpp @@ -31,7 +31,7 @@ struct Counter } }; -void br::EvalClassification(const QString &predictedInput, const QString &truthInput) +void br::EvalClassification(const QString &predictedInput, const QString &truthInput, const QString & predictedProperty, const QString & truthProperty) { qDebug("Evaluating classification of %s against %s", qPrintable(predictedInput), qPrintable(truthInput)); @@ -44,9 +44,8 @@ void br::EvalClassification(const QString &predictedInput, const QString &truthI if (predicted[i].file.name != truth[i].file.name) qFatal("Input order mismatch."); - // Typically these lists will be of length one, but this generalization allows measuring multi-class labeling accuracy. - QString predictedSubject = predicted[i].file.get("Subject"); - QString trueSubject = truth[i].file.get("Subject"); + QString predictedSubject = predicted[i].file.get(predictedProperty); + QString trueSubject = truth[i].file.get(truthProperty); QStringList predictedSubjects(predictedSubject); QStringList trueSubjects(trueSubject); @@ -99,13 +98,19 @@ void br::EvalRegression(const QString &predictedInput, const QString &truthInput if (predicted.size() != truth.size()) qFatal("Input size mismatch."); float rmsError = 0; + float maeError = 0; + // Direct use of Regressor/Regressand is not general -cao QStringList truthValues, predictedValues; for (int i=0; i("Subject")-truth[i].file.get("Subject"), 2.f); - truthValues.append(QString::number(truth[i].file.get("Subject"))); - predictedValues.append(QString::number(predicted[i].file.get("Subject"))); + + float difference = predicted[i].file.get("Regressand") - truth[i].file.get("Regressor"); + + rmsError += pow(difference, 2.f); + maeError += fabsf(difference); + truthValues.append(QString::number(truth[i].file.get("Regressor"))); + predictedValues.append(QString::number(predicted[i].file.get("Regressand"))); } QStringList rSource; @@ -125,4 +130,6 @@ void br::EvalRegression(const QString &predictedInput, const QString &truthInput if (success) QtUtils::showFile("EvalRegression.pdf"); qDebug("RMS Error = %f", sqrt(rmsError/predicted.size())); + qDebug("MAE = %f", maeError/predicted.size()); + } diff --git a/openbr/core/classify.h b/openbr/core/classify.h index ac39609..aa1e588 100644 --- a/openbr/core/classify.h +++ b/openbr/core/classify.h @@ -22,7 +22,7 @@ namespace br { - void EvalClassification(const QString &predictedInput, const QString &truthInput); + void EvalClassification(const QString &predictedInput, const QString &truthInput, const QString & predictedProperty="Label", const QString & truthProperty="Label"); void EvalRegression(const QString &predictedInput, const QString &truthInput); } diff --git a/openbr/core/cluster.cpp b/openbr/core/cluster.cpp index fdff3d8..4160516 100644 --- a/openbr/core/cluster.cpp +++ b/openbr/core/cluster.cpp @@ -279,8 +279,8 @@ void br::EvalClustering(const QString &csv, const QString &input) qDebug("Evaluating %s against %s", qPrintable(csv), qPrintable(input)); // We assume clustering algorithms store assigned cluster labels as integers (since the clusters are - // not named). - QList labels = TemplateList::fromGallery(input).files().get("Subject"); + // not named). Direct use of ClusterID is not general -cao + QList labels = TemplateList::fromGallery(input).files().get("ClusterID"); QHash labelToIndex; int nClusters = 0; diff --git a/openbr/frvt2012.cpp b/openbr/frvt2012.cpp index ac47ac8..66bf6ae 100644 --- a/openbr/frvt2012.cpp +++ b/openbr/frvt2012.cpp @@ -132,7 +132,8 @@ int32_t SdkEstimator::estimate_age(const ONEFACE &input_face, int32_t &age) TemplateList templates; templates.append(templateFromONEFACE(input_face)); templates >> *frvt2012_age_transform.data(); - age = templates.first().file.get("Subject"); + // should maybe use "Age" directly -cao + age = templates.first().file.get("Regressand"); return templates.first().file.failed() ? 4 : 0; } @@ -141,6 +142,7 @@ int32_t SdkEstimator::estimate_gender(const ONEFACE &input_face, int8_t &gender, TemplateList templates; templates.append(templateFromONEFACE(input_face)); templates >> *frvt2012_gender_transform.data(); - mf = gender = templates.first().file.get("Subject") == "Male" ? 0 : 1; + // Should maybe use "Gender" directly -cao + mf = gender = templates.first().file.get("Label") == "Male" ? 0 : 1; return templates.first().file.failed() ? 4 : 0; } diff --git a/openbr/gui/classifier.cpp b/openbr/gui/classifier.cpp index 2df9f5e..6ff945f 100644 --- a/openbr/gui/classifier.cpp +++ b/openbr/gui/classifier.cpp @@ -43,14 +43,16 @@ void Classifier::_classify(File file) continue; if (algorithm == "GenderClassification") { + // Should maybe use gender directly -cao key = "Gender"; - value = (f.get("Subject")); + value = f.get("Label"); } else if (algorithm == "AgeRegression") { key = "Age"; - value = QString::number(int(f.get("Subject")+0.5)) + " Years"; + // similarly, age -cao + value = QString::number(int(f.get("Regressand")+0.5)) + " Years"; } else { key = algorithm; - value = f.get("Subject"); + value = f.get("Label"); } break; } diff --git a/openbr/openbr.cpp b/openbr/openbr.cpp index eca6d6f..5217ebd 100644 --- a/openbr/openbr.cpp +++ b/openbr/openbr.cpp @@ -77,9 +77,14 @@ float br_eval(const char *simmat, const char *mask, const char *csv) return Evaluate(simmat, mask, csv); } -void br_eval_classification(const char *predicted_input, const char *truth_input) -{ - EvalClassification(predicted_input, truth_input); +void br_eval_classification(const char *predicted_input, const char *truth_input, const char *predicted_property, const char * truth_property) +{ + if (predicted_property && truth_property) + EvalClassification(predicted_input, truth_input, predicted_property, truth_property); + else if (predicted_property) + EvalClassification(predicted_input, truth_input, predicted_property); + else + EvalClassification(predicted_input, truth_input); } void br_eval_clustering(const char *csv, const char *input) diff --git a/openbr/openbr.h b/openbr/openbr.h index d4add7d..690fa6e 100644 --- a/openbr/openbr.h +++ b/openbr/openbr.h @@ -164,7 +164,7 @@ BR_EXPORT float br_eval(const char *simmat, const char *mask, const char *csv = * \param truth_input The ground truth br::Input. * \see br_enroll */ -BR_EXPORT void br_eval_classification(const char *predicted_input, const char *truth_input); +BR_EXPORT void br_eval_classification(const char *predicted_input, const char *truth_input, const char * predicted_property, const char * truth_property); /*! * \brief Evaluates and prints clustering accuracy to the terminal. diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index 82e5e15..0a67fbd 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -412,6 +412,7 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) // of target images to every partition newTemplates[i].file.set("Partition", -1); } else { + // Direct use of "Subject" is not general -cao const QByteArray md5 = QCryptographicHash::hash(newTemplates[i].file.get("Subject").toLatin1(), QCryptographicHash::Md5); // Select the right 8 hex characters so that it can be represented as a 64 bit integer without overflow newTemplates[i].file.set("Partition", md5.toHex().right(8).toULongLong(0, 16) % crossValidate); diff --git a/openbr/plugins/cluster.cpp b/openbr/plugins/cluster.cpp index e6ff87c..14cdb03 100644 --- a/openbr/plugins/cluster.cpp +++ b/openbr/plugins/cluster.cpp @@ -89,10 +89,12 @@ class KNNTransform : public Transform Q_PROPERTY(br::Distance *distance READ get_distance WRITE set_distance RESET reset_distance STORED false) Q_PROPERTY(bool weighted READ get_weighted WRITE set_weighted RESET reset_weighted STORED false) Q_PROPERTY(int numSubjects READ get_numSubjects WRITE set_numSubjects RESET reset_numSubjects STORED false) + Q_PROPERTY(QString inputVariable READ get_inputVariable WRITE set_inputVariable RESET reset_inputVariable STORED false) BR_PROPERTY(int, k, 1) BR_PROPERTY(br::Distance*, distance, NULL) BR_PROPERTY(bool, weighted, false) BR_PROPERTY(int, numSubjects, 1) + BR_PROPERTY(QString, inputVariable, "Label") TemplateList gallery; @@ -111,13 +113,13 @@ class KNNTransform : public Transform QHash votes; const int max = (k < 1) ? sortedScores.size() : std::min(k, sortedScores.size()); for (int j=0; j("Subject")] += (weighted ? sortedScores[j].first : 1); + votes[gallery[sortedScores[j].second].file.get(inputVariable)] += (weighted ? sortedScores[j].first : 1); subjects.append(votes.keys()[votes.values().indexOf(Common::Max(votes.values()))]); // Remove subject from consideration if (subjects.size() < numSubjects) for (int j=sortedScores.size()-1; j>=0; j--) - if (gallery[sortedScores[j].second].file.get("Subject") == subjects.last()) + if (gallery[sortedScores[j].second].file.get(inputVariable) == subjects.last()) sortedScores.removeAt(j); } diff --git a/openbr/plugins/eigen3.cpp b/openbr/plugins/eigen3.cpp index b179591..d1697c3 100644 --- a/openbr/plugins/eigen3.cpp +++ b/openbr/plugins/eigen3.cpp @@ -318,10 +318,12 @@ class LDATransform : public Transform Q_PROPERTY(bool pcaWhiten READ get_pcaWhiten WRITE set_pcaWhiten RESET reset_pcaWhiten STORED false) Q_PROPERTY(int directLDA READ get_directLDA WRITE set_directLDA RESET reset_directLDA STORED false) Q_PROPERTY(float directDrop READ get_directDrop WRITE set_directDrop RESET reset_directDrop STORED false) + Q_PROPERTY(QString inputVariable READ get_inputVariable WRITE set_inputVariable RESET reset_inputVariable STORED false) BR_PROPERTY(float, pcaKeep, 0.98) BR_PROPERTY(bool, pcaWhiten, false) BR_PROPERTY(int, directLDA, 0) BR_PROPERTY(float, directDrop, 0.1) + BR_PROPERTY(QString, inputVariable, "Label") int dimsOut; Eigen::VectorXf mean; @@ -330,7 +332,7 @@ class LDATransform : public Transform void train(const TemplateList &_trainingSet) { // creates "Label" - TemplateList trainingSet = TemplateList::relabel(_trainingSet, "Subject"); + TemplateList trainingSet = TemplateList::relabel(_trainingSet, inputVariable); int instances = trainingSet.size(); diff --git a/openbr/plugins/gallery.cpp b/openbr/plugins/gallery.cpp index 030f250..05a12b4 100644 --- a/openbr/plugins/gallery.cpp +++ b/openbr/plugins/gallery.cpp @@ -71,7 +71,7 @@ class arffGallery : public Gallery } arffFile.write(qPrintable(OpenCVUtils::matrixToStringList(t).join(','))); - arffFile.write(qPrintable(",'" + t.file.get("Subject") + "'\n")); + arffFile.write(qPrintable(",'" + t.file.get("Label") + "'\n")); } }; @@ -874,7 +874,7 @@ class statGallery : public Gallery void write(const Template &t) { - subjects.insert(t.file.get("Subject")); + subjects.insert(t.file.get("Label")); bytes.append(t.bytes()); } }; diff --git a/openbr/plugins/independent.cpp b/openbr/plugins/independent.cpp index 05b6e98..56bbf75 100644 --- a/openbr/plugins/independent.cpp +++ b/openbr/plugins/independent.cpp @@ -20,11 +20,11 @@ static TemplateList Downsample(const TemplateList &templates, const Transform *t const bool atLeast = transform->instances < 0; const int instances = abs(transform->instances); - QList allLabels = templates.get("Subject"); + QList allLabels = templates.get("Label"); QList uniqueLabels = allLabels.toSet().toList(); qSort(uniqueLabels); - QMap counts = templates.countValues("Subject", instances != std::numeric_limits::max()); + QMap counts = templates.countValues("Label", instances != std::numeric_limits::max()); if ((instances != std::numeric_limits::max()) && (transform->classes != std::numeric_limits::max())) foreach (const QString & label, counts.keys()) diff --git a/openbr/plugins/normalize.cpp b/openbr/plugins/normalize.cpp index 5c85415..f97a162 100644 --- a/openbr/plugins/normalize.cpp +++ b/openbr/plugins/normalize.cpp @@ -127,7 +127,7 @@ private: Mat m; OpenCVUtils::toMat(data.data()).convertTo(m, CV_64F); - const QList labels = data.indexProperty("Subject"); + const QList labels = data.indexProperty("Label"); const int dims = m.cols; vector mv, av, bv; diff --git a/openbr/plugins/output.cpp b/openbr/plugins/output.cpp index 6344cf5..8ef3834 100644 --- a/openbr/plugins/output.cpp +++ b/openbr/plugins/output.cpp @@ -146,8 +146,8 @@ class meltOutput : public MatrixOutput QStringList lines; if (file.baseName() != "terminal") lines.append(QString("Query,Target,Mask,Similarity%1").arg(keys)); - QList queryLabels = queryFiles.get("Subject"); - QList targetLabels = targetFiles.get("Subject"); + QList queryLabels = queryFiles.get("Label"); + QList targetLabels = targetFiles.get("Label"); for (int i=0; i("Subject")); + lines.append(file.name + " " + file.get("Label")); QtUtils::writeFile(file, lines); } }; @@ -426,7 +426,7 @@ class rankOutput : public MatrixOutput typedef QPair Pair; int rank = 1; foreach (const Pair &pair, Common::Sort(OpenCVUtils::matrixToVector(data.row(i)), true)) { - if (targetFiles[pair.second].get("Subject") == queryFiles[i].get("Subject")) { + if (targetFiles[pair.second].get("Label") == queryFiles[i].get("Label")) { ranks.append(rank); positions.append(pair.second); scores.append(pair.first); diff --git a/openbr/plugins/quality.cpp b/openbr/plugins/quality.cpp index d8fb2bb..972fecb 100644 --- a/openbr/plugins/quality.cpp +++ b/openbr/plugins/quality.cpp @@ -26,10 +26,10 @@ class ImpostorUniquenessMeasureTransform : public Transform float calculateIUM(const Template &probe, const TemplateList &gallery) const { - const QString probeLabel = probe.file.get("Subject"); + const QString probeLabel = probe.file.get("Label"); TemplateList subset = gallery; for (int j=subset.size()-1; j>=0; j--) - if (subset[j].file.get("Subject") == probeLabel) + if (subset[j].file.get("Label") == probeLabel) subset.removeAt(j); QList scores = distance->compare(subset, probe); @@ -158,7 +158,7 @@ class MatchProbabilityDistance : public Distance { distance->train(src); - const QList labels = src.indexProperty("Subject"); + const QList labels = src.indexProperty("Label"); QScopedPointer matrixOutput(MatrixOutput::make(FileList(src.size()), FileList(src.size()))); distance->compare(src, src, matrixOutput.data()); @@ -228,7 +228,7 @@ class HeatMapDistance : public Distance { distance->train(src); - const QList labels = src.indexProperty("Subject"); + const QList labels = src.indexProperty("Label"); QList patches; @@ -316,7 +316,7 @@ class UnitDistance : public Distance void train(const TemplateList &templates) { const TemplateList samples = templates.mid(0, 2000); - const QList sampleLabels = samples.indexProperty("Subject"); + const QList sampleLabels = samples.indexProperty("Label"); QScopedPointer matrixOutput(MatrixOutput::make(FileList(samples.size()), FileList(samples.size()))); Distance::compare(samples, samples, matrixOutput.data()); diff --git a/openbr/plugins/quantize.cpp b/openbr/plugins/quantize.cpp index 94840f6..163da7f 100644 --- a/openbr/plugins/quantize.cpp +++ b/openbr/plugins/quantize.cpp @@ -150,7 +150,7 @@ class BayesianQuantizationDistance : public Distance qFatal("Expected sigle matrix templates of type CV_8UC1!"); const Mat data = OpenCVUtils::toMat(src.data()); - const QList templateLabels = src.indexProperty("Subject"); + const QList templateLabels = src.indexProperty("Label"); loglikelihoods = QVector(data.cols*256, 0); QFutureSynchronizer futures; @@ -474,7 +474,7 @@ private: Mat data = OpenCVUtils::toMat(src.data()); const int step = getStep(data.cols); - const QList labels = src.indexProperty("Subject"); + const QList labels = src.indexProperty("Label"); Mat &lut = ProductQuantizationLUTs[index]; lut = Mat(getDims(data.cols), 256*(256+1)/2, CV_32FC1); diff --git a/openbr/plugins/quantize2.cpp b/openbr/plugins/quantize2.cpp index 63ea769..d46db1e 100644 --- a/openbr/plugins/quantize2.cpp +++ b/openbr/plugins/quantize2.cpp @@ -77,7 +77,7 @@ class BayesianQuantizationTransform : public Transform void train(const TemplateList &src) { const Mat data = OpenCVUtils::toMat(src.data()); - const QList labels = src.indexProperty("Subject"); + const QList labels = src.indexProperty("Label"); thresholds = QVector(256*data.cols); diff --git a/openbr/plugins/svm.cpp b/openbr/plugins/svm.cpp index 93727d4..7069be0 100644 --- a/openbr/plugins/svm.cpp +++ b/openbr/plugins/svm.cpp @@ -101,6 +101,8 @@ class SVMTransform : public Transform Q_PROPERTY(Type type READ get_type WRITE set_type RESET reset_type STORED false) Q_PROPERTY(float C READ get_C WRITE set_C RESET reset_C STORED false) Q_PROPERTY(float gamma READ get_gamma WRITE set_gamma RESET reset_gamma STORED false) + Q_PROPERTY(QString inputVariable READ get_inputVariable WRITE set_inputVariable RESET reset_inputVariable STORED false) + Q_PROPERTY(QString outputVariable READ get_outputVariable WRITE set_outputVariable RESET reset_outputVariable STORED false) public: enum Kernel { Linear = CvSVM::LINEAR, @@ -119,6 +121,9 @@ private: BR_PROPERTY(Type, type, C_SVC) BR_PROPERTY(float, C, -1) BR_PROPERTY(float, gamma, -1) + BR_PROPERTY(QString, inputVariable, "") + BR_PROPERTY(QString, outputVariable, "") + SVM svm; QHash labelMap; @@ -128,14 +133,14 @@ private: { Mat data = OpenCVUtils::toMat(_data.data()); Mat lab; - // If we are doing regression, assume subject has float values + // If we are doing regression, the input variable should have float values if (type == EPS_SVR || type == NU_SVR) { - lab = OpenCVUtils::toMat(_data.get("Subject")); + lab = OpenCVUtils::toMat(_data.get(inputVariable)); } - // If we are doing classification, assume subject has discrete values, map them + // If we are doing classification, we should be dealing with discrete values. Map them // and store the mapping data else { - QList dataLabels = _data.indexProperty("Subject", labelMap, reverseLookup); + QList dataLabels = _data.indexProperty(inputVariable, labelMap, reverseLookup); lab = OpenCVUtils::toMat(dataLabels); } trainSVM(svm, data, lab, kernel, type, C, gamma); @@ -146,9 +151,9 @@ private: dst = src; float prediction = svm.predict(src.m().reshape(1, 1)); if (type == EPS_SVR || type == NU_SVR) - dst.file.set("Subject", prediction); + dst.file.set(outputVariable, prediction); else - dst.file.set("Subject", reverseLookup[prediction]); + dst.file.set(outputVariable, reverseLookup[prediction]); } void store(QDataStream &stream) const @@ -162,6 +167,24 @@ private: loadSVM(svm, stream); stream >> labelMap >> reverseLookup; } + + void init() + { + // Since SVM can do regression or classification, we have to check the problem type before + // specifying target variable names + if (inputVariable.isEmpty()) + { + if (type == EPS_SVR || type == NU_SVR) { + inputVariable = "Regressor"; + if (outputVariable.isEmpty()) + outputVariable = "Regressand"; + } + else + inputVariable = "Label"; + } + if (outputVariable.isEmpty()) + outputVariable = inputVariable; + } }; BR_REGISTER(Transform, SVMTransform) @@ -178,6 +201,8 @@ class SVMDistance : public Distance Q_ENUMS(Type) Q_PROPERTY(Kernel kernel READ get_kernel WRITE set_kernel RESET reset_kernel STORED false) Q_PROPERTY(Type type READ get_type WRITE set_type RESET reset_type STORED false) + Q_PROPERTY(QString inputVariable READ get_inputVariable WRITE set_inputVariable RESET reset_inputVariable STORED false) + public: enum Kernel { Linear = CvSVM::LINEAR, @@ -194,13 +219,14 @@ public: private: BR_PROPERTY(Kernel, kernel, Linear) BR_PROPERTY(Type, type, EPS_SVR) + BR_PROPERTY(QString, inputVariable, "Label") SVM svm; void train(const TemplateList &src) { const Mat data = OpenCVUtils::toMat(src.data()); - const QList lab = src.indexProperty("Subject"); + const QList lab = src.indexProperty(inputVariable); const int instances = data.rows * (data.rows+1) / 2; Mat deltaData(instances, data.cols, data.type());