Commit d159dc0820434a5d849b5514fab00d2e81d6777a
1 parent
ce690bf3
added shell code for evalDetection. corrected old documentation
Showing
5 changed files
with
46 additions
and
22 deletions
app/br/br.cpp
| @@ -131,12 +131,15 @@ public: | @@ -131,12 +131,15 @@ public: | ||
| 131 | } else if (!strcmp(fun, "evalClassification")) { | 131 | } else if (!strcmp(fun, "evalClassification")) { |
| 132 | check(parc == 2, "Incorrect parameter count for 'evalClassification'."); | 132 | check(parc == 2, "Incorrect parameter count for 'evalClassification'."); |
| 133 | br_eval_classification(parv[0], parv[1]); | 133 | br_eval_classification(parv[0], parv[1]); |
| 134 | + } else if (!strcmp(fun, "evalClustering")) { | ||
| 135 | + check(parc == 2, "Incorrect parameter count for 'evalClustering'."); | ||
| 136 | + br_eval_clustering(parv[0], parv[1]); | ||
| 137 | + } else if (!strcmp(fun, "evalDetection")) { | ||
| 138 | + check(parc == 2, "Incorrect parameter count for 'evalDetection'."); | ||
| 139 | + br_eval_detection(parv[0], parv[1]); | ||
| 134 | } else if (!strcmp(fun, "evalRegression")) { | 140 | } else if (!strcmp(fun, "evalRegression")) { |
| 135 | check(parc == 2, "Incorrect parameter count for 'evalRegression'."); | 141 | check(parc == 2, "Incorrect parameter count for 'evalRegression'."); |
| 136 | br_eval_regression(parv[0], parv[1]); | 142 | br_eval_regression(parv[0], parv[1]); |
| 137 | - } else if (!strcmp(fun, "evalClusters")) { | ||
| 138 | - check(parc == 2, "Incorrect parameter count for 'evalClusters'."); | ||
| 139 | - br_eval_clustering(parv[0], parv[1]); | ||
| 140 | } else if (!strcmp(fun, "confusion")) { | 143 | } else if (!strcmp(fun, "confusion")) { |
| 141 | check(parc == 2, "Incorrect parameter count for 'confusion'."); | 144 | check(parc == 2, "Incorrect parameter count for 'confusion'."); |
| 142 | int true_positives, false_positives, true_negatives, false_negatives; | 145 | int true_positives, false_positives, true_negatives, false_negatives; |
| @@ -217,8 +220,9 @@ private: | @@ -217,8 +220,9 @@ private: | ||
| 217 | "-cat <gallery> ... <gallery> {gallery}\n" | 220 | "-cat <gallery> ... <gallery> {gallery}\n" |
| 218 | "-convert (Format|Gallery|Output) <input_file> {output_file}\n" | 221 | "-convert (Format|Gallery|Output) <input_file> {output_file}\n" |
| 219 | "-evalClassification <predicted_gallery> <truth_gallery>\n" | 222 | "-evalClassification <predicted_gallery> <truth_gallery>\n" |
| 223 | + "-evalClustering <clusters> <gallery>\n" | ||
| 224 | + "-evalDetection <predicted_gallery> <truth_gallery>\n" | ||
| 220 | "-evalRegression <predicted_gallery> <truth_gallery>\n" | 225 | "-evalRegression <predicted_gallery> <truth_gallery>\n" |
| 221 | - "-evalClusters <clusters> <sigset>\n" | ||
| 222 | "-confusion <file> <score>\n" | 226 | "-confusion <file> <score>\n" |
| 223 | "-plotMetadata <file> ... <file> <columns>\n" | 227 | "-plotMetadata <file> ... <file> <columns>\n" |
| 224 | "-getHeader <matrix>\n" | 228 | "-getHeader <matrix>\n" |
openbr/core/classify.cpp
| @@ -81,15 +81,21 @@ void br::EvalClassification(const QString &predictedInput, const QString &truthI | @@ -81,15 +81,21 @@ void br::EvalClassification(const QString &predictedInput, const QString &truthI | ||
| 81 | const float precision = counter.truePositive / (float)(counter.truePositive + counter.falsePositive); | 81 | const float precision = counter.truePositive / (float)(counter.truePositive + counter.falsePositive); |
| 82 | const float recall = counter.truePositive / (float)(counter.truePositive + counter.falseNegative); | 82 | const float recall = counter.truePositive / (float)(counter.truePositive + counter.falseNegative); |
| 83 | const float fscore = 2 * precision * recall / (precision + recall); | 83 | const float fscore = 2 * precision * recall / (precision + recall); |
| 84 | - output->setRelative(count, i, 0); | ||
| 85 | - output->setRelative(precision, i, 1); | ||
| 86 | - output->setRelative(recall, i, 2); | ||
| 87 | - output->setRelative(fscore, i, 3); | 84 | + output->setRelative(count, i, 0); |
| 85 | + output->setRelative(precision, i, 1); | ||
| 86 | + output->setRelative(recall, i, 2); | ||
| 87 | + output->setRelative(fscore, i, 3); | ||
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | qDebug("Overall Accuracy = %f", (float)tpc / (float)(tpc + fnc)); | 90 | qDebug("Overall Accuracy = %f", (float)tpc / (float)(tpc + fnc)); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | +void br::EvalDetection(const QString &predictedInput, const QString &truthInput) | ||
| 94 | +{ | ||
| 95 | + (void) predictedInput; | ||
| 96 | + (void) truthInput; | ||
| 97 | +} | ||
| 98 | + | ||
| 93 | void br::EvalRegression(const QString &predictedInput, const QString &truthInput) | 99 | void br::EvalRegression(const QString &predictedInput, const QString &truthInput) |
| 94 | { | 100 | { |
| 95 | qDebug("Evaluating regression of %s against %s", qPrintable(predictedInput), qPrintable(truthInput)); | 101 | qDebug("Evaluating regression of %s against %s", qPrintable(predictedInput), qPrintable(truthInput)); |
openbr/core/classify.h
| @@ -23,6 +23,7 @@ | @@ -23,6 +23,7 @@ | ||
| 23 | namespace br | 23 | namespace br |
| 24 | { | 24 | { |
| 25 | void EvalClassification(const QString &predictedInput, const QString &truthInput); | 25 | void EvalClassification(const QString &predictedInput, const QString &truthInput); |
| 26 | + void EvalDetection(const QString &predictedInput, const QString &truthInput); | ||
| 26 | void EvalRegression(const QString &predictedInput, const QString &truthInput); | 27 | void EvalRegression(const QString &predictedInput, const QString &truthInput); |
| 27 | } | 28 | } |
| 28 | 29 |
openbr/openbr.cpp
| @@ -77,19 +77,24 @@ float br_eval(const char *simmat, const char *mask, const char *csv) | @@ -77,19 +77,24 @@ float br_eval(const char *simmat, const char *mask, const char *csv) | ||
| 77 | return Evaluate(simmat, mask, csv); | 77 | return Evaluate(simmat, mask, csv); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | -void br_eval_classification(const char *predicted_input, const char *truth_input) | 80 | +void br_eval_classification(const char *predicted_gallery, const char *truth_gallery) |
| 81 | { | 81 | { |
| 82 | - EvalClassification(predicted_input, truth_input); | 82 | + EvalClassification(predicted_gallery, truth_gallery); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | -void br_eval_clustering(const char *csv, const char *input) | 85 | +void br_eval_clustering(const char *csv, const char *gallery) |
| 86 | { | 86 | { |
| 87 | - EvalClustering(csv, input); | 87 | + EvalClustering(csv, gallery); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | -void br_eval_regression(const char *predicted_input, const char *truth_input) | 90 | +void br_eval_detection(const char *predicted_gallery, const char *truth_gallery) |
| 91 | { | 91 | { |
| 92 | - EvalRegression(predicted_input, truth_input); | 92 | + EvalDetection(predicted_gallery, truth_gallery); |
| 93 | +} | ||
| 94 | + | ||
| 95 | +void br_eval_regression(const char *predicted_gallery, const char *truth_gallery) | ||
| 96 | +{ | ||
| 97 | + EvalRegression(predicted_gallery, truth_gallery); | ||
| 93 | } | 98 | } |
| 94 | 99 | ||
| 95 | void br_finalize() | 100 | void br_finalize() |
openbr/openbr.h
| @@ -160,27 +160,35 @@ BR_EXPORT float br_eval(const char *simmat, const char *mask, const char *csv = | @@ -160,27 +160,35 @@ BR_EXPORT float br_eval(const char *simmat, const char *mask, const char *csv = | ||
| 160 | 160 | ||
| 161 | /*! | 161 | /*! |
| 162 | * \brief Evaluates and prints classification accuracy to terminal. | 162 | * \brief Evaluates and prints classification accuracy to terminal. |
| 163 | - * \param predicted_input The predicted br::Input. | ||
| 164 | - * \param truth_input The ground truth br::Input. | 163 | + * \param predicted_input The predicted br::Gallery. |
| 164 | + * \param truth_input The ground truth br::Gallery. | ||
| 165 | * \see br_enroll | 165 | * \see br_enroll |
| 166 | */ | 166 | */ |
| 167 | -BR_EXPORT void br_eval_classification(const char *predicted_input, const char *truth_input); | 167 | +BR_EXPORT void br_eval_classification(const char *predicted_gallery, const char *truth_gallery); |
| 168 | 168 | ||
| 169 | /*! | 169 | /*! |
| 170 | * \brief Evaluates and prints clustering accuracy to the terminal. | 170 | * \brief Evaluates and prints clustering accuracy to the terminal. |
| 171 | * \param csv The cluster results file. | 171 | * \param csv The cluster results file. |
| 172 | - * \param input The br::input used to generate the \ref simmat that was clustered. | 172 | + * \param gallery The br::Gallery used to generate the \ref simmat that was clustered. |
| 173 | * \see br_cluster | 173 | * \see br_cluster |
| 174 | */ | 174 | */ |
| 175 | -BR_EXPORT void br_eval_clustering(const char *csv, const char *input); | 175 | +BR_EXPORT void br_eval_clustering(const char *csv, const char *gallery); |
| 176 | + | ||
| 177 | +/*! | ||
| 178 | + * \brief Evaluates and prints detection accuracy to terminal. | ||
| 179 | + * \param predicted_gallery The predicted br::Gallery. | ||
| 180 | + * \param truth_galery The ground truth br::Gallery. | ||
| 181 | + * \see br_enroll | ||
| 182 | + */ | ||
| 183 | +BR_EXPORT void br_eval_detection(const char *predicted_gallery, const char *truth_gallery); | ||
| 176 | 184 | ||
| 177 | /*! | 185 | /*! |
| 178 | * \brief Evaluates regression accuracy to disk. | 186 | * \brief Evaluates regression accuracy to disk. |
| 179 | - * \param predicted_input The predicted br::Input. | ||
| 180 | - * \param truth_input The ground truth br::Input. | 187 | + * \param predicted_input The predicted br::Gallery. |
| 188 | + * \param truth_input The ground truth br::Gallery. | ||
| 181 | * \see br_enroll | 189 | * \see br_enroll |
| 182 | */ | 190 | */ |
| 183 | -BR_EXPORT void br_eval_regression(const char *predicted_input, const char *truth_input); | 191 | +BR_EXPORT void br_eval_regression(const char *predicted_gallery, const char *truth_gallery); |
| 184 | 192 | ||
| 185 | /*! | 193 | /*! |
| 186 | * \brief Wraps br::Context::finalize() | 194 | * \brief Wraps br::Context::finalize() |