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 | 131 | } else if (!strcmp(fun, "evalClassification")) { |
| 132 | 132 | check(parc == 2, "Incorrect parameter count for 'evalClassification'."); |
| 133 | 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 | 140 | } else if (!strcmp(fun, "evalRegression")) { |
| 135 | 141 | check(parc == 2, "Incorrect parameter count for 'evalRegression'."); |
| 136 | 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 | 143 | } else if (!strcmp(fun, "confusion")) { |
| 141 | 144 | check(parc == 2, "Incorrect parameter count for 'confusion'."); |
| 142 | 145 | int true_positives, false_positives, true_negatives, false_negatives; |
| ... | ... | @@ -217,8 +220,9 @@ private: |
| 217 | 220 | "-cat <gallery> ... <gallery> {gallery}\n" |
| 218 | 221 | "-convert (Format|Gallery|Output) <input_file> {output_file}\n" |
| 219 | 222 | "-evalClassification <predicted_gallery> <truth_gallery>\n" |
| 223 | + "-evalClustering <clusters> <gallery>\n" | |
| 224 | + "-evalDetection <predicted_gallery> <truth_gallery>\n" | |
| 220 | 225 | "-evalRegression <predicted_gallery> <truth_gallery>\n" |
| 221 | - "-evalClusters <clusters> <sigset>\n" | |
| 222 | 226 | "-confusion <file> <score>\n" |
| 223 | 227 | "-plotMetadata <file> ... <file> <columns>\n" |
| 224 | 228 | "-getHeader <matrix>\n" | ... | ... |
openbr/core/classify.cpp
| ... | ... | @@ -81,15 +81,21 @@ void br::EvalClassification(const QString &predictedInput, const QString &truthI |
| 81 | 81 | const float precision = counter.truePositive / (float)(counter.truePositive + counter.falsePositive); |
| 82 | 82 | const float recall = counter.truePositive / (float)(counter.truePositive + counter.falseNegative); |
| 83 | 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 | 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 | 99 | void br::EvalRegression(const QString &predictedInput, const QString &truthInput) |
| 94 | 100 | { |
| 95 | 101 | qDebug("Evaluating regression of %s against %s", qPrintable(predictedInput), qPrintable(truthInput)); | ... | ... |
openbr/core/classify.h
| ... | ... | @@ -23,6 +23,7 @@ |
| 23 | 23 | namespace br |
| 24 | 24 | { |
| 25 | 25 | void EvalClassification(const QString &predictedInput, const QString &truthInput); |
| 26 | + void EvalDetection(const QString &predictedInput, const QString &truthInput); | |
| 26 | 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 | 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 | 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 | 160 | |
| 161 | 161 | /*! |
| 162 | 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 | 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 | 170 | * \brief Evaluates and prints clustering accuracy to the terminal. |
| 171 | 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 | 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 | 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 | 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 | 194 | * \brief Wraps br::Context::finalize() | ... | ... |