Commit 7a540d85c3bf74f7f998d014dc6d98ebb8dbdb9b
1 parent
ad5854c9
Updated to reflect comments. Also minor changes to br app to reflect new command line options
Showing
5 changed files
with
9 additions
and
13 deletions
app/br/br.cpp
| ... | ... | @@ -157,8 +157,8 @@ public: |
| 157 | 157 | check((parc >= 2) && (parc <= 3), "Incorrect parameter count for 'evalClustering'."); |
| 158 | 158 | br_eval_clustering(parv[0], parv[1], parc == 3 ? parv[2] : ""); |
| 159 | 159 | } else if (!strcmp(fun, "evalDetection")) { |
| 160 | - check((parc >= 2) && (parc <= 5), "Incorrect parameter count for 'evalDetection'."); | |
| 161 | - br_eval_detection(parv[0], parv[1], parc >= 3 ? parv[2] : "", parc >= 4 ? atoi(parv[3]) : 0, parc == 5 ? atoi(parv[4]) : 0); | |
| 160 | + check((parc >= 2) && (parc <= 6), "Incorrect parameter count for 'evalDetection'."); | |
| 161 | + br_eval_detection(parv[0], parv[1], parc >= 3 ? parv[2] : "", parc >= 4 ? atoi(parv[3]) : 0, parc >= 5 ? atoi(parv[4]) : 0, parc == 6 ? atoi(parv[5]) : 0); | |
| 162 | 162 | } else if (!strcmp(fun, "evalLandmarking")) { |
| 163 | 163 | check((parc >= 2) && (parc <= 5), "Incorrect parameter count for 'evalLandmarking'."); |
| 164 | 164 | br_eval_landmarking(parv[0], parv[1], parc >= 3 ? parv[2] : "", parc >= 4 ? atoi(parv[3]) : 0, parc >= 5 ? atoi(parv[4]) : 1); | ... | ... |
openbr/core/eval.cpp
| ... | ... | @@ -667,6 +667,7 @@ struct SortedDetection |
| 667 | 667 | SortedDetection() : truth_idx(-1), predicted_idx(-1), overlap(-1) {} |
| 668 | 668 | SortedDetection(int truth_idx_, int predicted_idx_, float overlap_) |
| 669 | 669 | : truth_idx(truth_idx_), predicted_idx(predicted_idx_), overlap(overlap_) {} |
| 670 | + inline bool operator<(const SortedDetection &other) const { return overlap > other.overlap; } | |
| 670 | 671 | }; |
| 671 | 672 | |
| 672 | 673 | struct Detections |
| ... | ... | @@ -832,16 +833,11 @@ static QMap<QString, Detections> getDetections(const File &predictedGallery, con |
| 832 | 833 | return allDetections; |
| 833 | 834 | } |
| 834 | 835 | |
| 835 | -static int getNumberOfImages(const QMap<QString, Detections> detections) | |
| 836 | +static inline int getNumberOfImages(const QMap<QString, Detections> detections) | |
| 836 | 837 | { |
| 837 | 838 | return detections.keys().size(); |
| 838 | 839 | } |
| 839 | 840 | |
| 840 | -static bool sortedCompare(const SortedDetection &a, const SortedDetection &b) | |
| 841 | -{ | |
| 842 | - return a.overlap > b.overlap; | |
| 843 | -} | |
| 844 | - | |
| 845 | 841 | static int associateGroundTruthDetections(QList<ResolvedDetection> &resolved, QList<ResolvedDetection> &falseNegative, QMap<QString, Detections> &all, QRectF &offsets) |
| 846 | 842 | { |
| 847 | 843 | float dLeftTotal = 0.0, dRightTotal = 0.0, dTopTotal = 0.0, dBottomTotal = 0.0; |
| ... | ... | @@ -871,7 +867,7 @@ static int associateGroundTruthDetections(QList<ResolvedDetection> &resolved, QL |
| 871 | 867 | } |
| 872 | 868 | } |
| 873 | 869 | |
| 874 | - std::sort(sortedDetections.begin(), sortedDetections.end(), sortedCompare); | |
| 870 | + std::sort(sortedDetections.begin(), sortedDetections.end()); | |
| 875 | 871 | |
| 876 | 872 | QList<int> removedTruth; |
| 877 | 873 | QList<int> removedPredicted; | ... | ... |
openbr/core/eval.h
| ... | ... | @@ -29,7 +29,7 @@ namespace br |
| 29 | 29 | float InplaceEval(const QString & simmat, const QString & target, const QString & query, const QString & csv = ""); |
| 30 | 30 | |
| 31 | 31 | void EvalClassification(const QString &predictedGallery, const QString &truthGallery, QString predictedProperty = "", QString truthProperty = ""); |
| 32 | - float EvalDetection(const QString &predictedGallery, const QString &truthGallery, const QString &csv = "", bool normalize = false, int minSize = 0); // Return average overlap | |
| 32 | + float EvalDetection(const QString &predictedGallery, const QString &truthGallery, const QString &csv = "", bool normalize = false, int minSize = 0, int maxSize = 0); // Return average overlap | |
| 33 | 33 | float EvalLandmarking(const QString &predictedGallery, const QString &truthGallery, const QString &csv = "", int normalizationIndexA = 0, int normalizationIndexB = 1); // Return average error |
| 34 | 34 | void EvalRegression(const QString &predictedGallery, const QString &truthGallery, QString predictedProperty = "", QString truthProperty = ""); |
| 35 | 35 | } | ... | ... |
openbr/openbr.cpp
| ... | ... | @@ -124,9 +124,9 @@ void br_eval_clustering(const char *csv, const char *gallery, const char *truth_ |
| 124 | 124 | EvalClustering(csv, gallery, truth_property); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | -float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv, bool normalize, int minSize) | |
| 127 | +float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv, bool normalize, int minSize, int maxSize) | |
| 128 | 128 | { |
| 129 | - return EvalDetection(predicted_gallery, truth_gallery, csv, normalize, minSize); | |
| 129 | + return EvalDetection(predicted_gallery, truth_gallery, csv, normalize, minSize, maxSize); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | float br_eval_landmarking(const char *predicted_gallery, const char *truth_gallery, const char *csv, int normalization_index_a, int normalization_index_b) | ... | ... |
openbr/openbr.h
| ... | ... | @@ -197,7 +197,7 @@ BR_EXPORT void br_eval_clustering(const char *csv, const char *gallery, const ch |
| 197 | 197 | * \param normalize Optional \c bool flag to normalize predicted bounding boxes for improved detection. |
| 198 | 198 | * \return Average detection bounding box overlap. |
| 199 | 199 | */ |
| 200 | -BR_EXPORT float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv = "", bool normalize = false, int minSize = 0); | |
| 200 | +BR_EXPORT float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv = "", bool normalize = false, int minSize = 0, int maxSize = 0); | |
| 201 | 201 | |
| 202 | 202 | /*! |
| 203 | 203 | * \brief Evaluates and prints landmarking accuracy to terminal. | ... | ... |