Skip to content

Commit

Permalink
Updated to reflect comments. Also minor changes to br app to reflect …
Browse files Browse the repository at this point in the history
…new command line options
  • Loading branch information
JordanCheney committed Dec 3, 2014
1 parent ad5854c commit 7a540d8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/br/br.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ class FakeMain : public QRunnable
check((parc >= 2) && (parc <= 3), "Incorrect parameter count for 'evalClustering'.");
br_eval_clustering(parv[0], parv[1], parc == 3 ? parv[2] : "");
} else if (!strcmp(fun, "evalDetection")) {
check((parc >= 2) && (parc <= 5), "Incorrect parameter count for 'evalDetection'.");
br_eval_detection(parv[0], parv[1], parc >= 3 ? parv[2] : "", parc >= 4 ? atoi(parv[3]) : 0, parc == 5 ? atoi(parv[4]) : 0);
check((parc >= 2) && (parc <= 6), "Incorrect parameter count for 'evalDetection'.");
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);
} else if (!strcmp(fun, "evalLandmarking")) {
check((parc >= 2) && (parc <= 5), "Incorrect parameter count for 'evalLandmarking'.");
br_eval_landmarking(parv[0], parv[1], parc >= 3 ? parv[2] : "", parc >= 4 ? atoi(parv[3]) : 0, parc >= 5 ? atoi(parv[4]) : 1);
Expand Down
10 changes: 3 additions & 7 deletions openbr/core/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ struct SortedDetection
SortedDetection() : truth_idx(-1), predicted_idx(-1), overlap(-1) {}
SortedDetection(int truth_idx_, int predicted_idx_, float overlap_)
: truth_idx(truth_idx_), predicted_idx(predicted_idx_), overlap(overlap_) {}
inline bool operator<(const SortedDetection &other) const { return overlap > other.overlap; }
};

struct Detections
Expand Down Expand Up @@ -832,16 +833,11 @@ static QMap<QString, Detections> getDetections(const File &predictedGallery, con
return allDetections;
}

static int getNumberOfImages(const QMap<QString, Detections> detections)
static inline int getNumberOfImages(const QMap<QString, Detections> detections)
{
return detections.keys().size();
}

static bool sortedCompare(const SortedDetection &a, const SortedDetection &b)
{
return a.overlap > b.overlap;
}

static int associateGroundTruthDetections(QList<ResolvedDetection> &resolved, QList<ResolvedDetection> &falseNegative, QMap<QString, Detections> &all, QRectF &offsets)
{
float dLeftTotal = 0.0, dRightTotal = 0.0, dTopTotal = 0.0, dBottomTotal = 0.0;
Expand Down Expand Up @@ -871,7 +867,7 @@ static int associateGroundTruthDetections(QList<ResolvedDetection> &resolved, QL
}
}

std::sort(sortedDetections.begin(), sortedDetections.end(), sortedCompare);
std::sort(sortedDetections.begin(), sortedDetections.end());

QList<int> removedTruth;
QList<int> removedPredicted;
Expand Down
2 changes: 1 addition & 1 deletion openbr/core/eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace br
float InplaceEval(const QString & simmat, const QString & target, const QString & query, const QString & csv = "");

void EvalClassification(const QString &predictedGallery, const QString &truthGallery, QString predictedProperty = "", QString truthProperty = "");
float EvalDetection(const QString &predictedGallery, const QString &truthGallery, const QString &csv = "", bool normalize = false, int minSize = 0); // Return average overlap
float EvalDetection(const QString &predictedGallery, const QString &truthGallery, const QString &csv = "", bool normalize = false, int minSize = 0, int maxSize = 0); // Return average overlap
float EvalLandmarking(const QString &predictedGallery, const QString &truthGallery, const QString &csv = "", int normalizationIndexA = 0, int normalizationIndexB = 1); // Return average error
void EvalRegression(const QString &predictedGallery, const QString &truthGallery, QString predictedProperty = "", QString truthProperty = "");
}
Expand Down
4 changes: 2 additions & 2 deletions openbr/openbr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ void br_eval_clustering(const char *csv, const char *gallery, const char *truth_
EvalClustering(csv, gallery, truth_property);
}

float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv, bool normalize, int minSize)
float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv, bool normalize, int minSize, int maxSize)
{
return EvalDetection(predicted_gallery, truth_gallery, csv, normalize, minSize);
return EvalDetection(predicted_gallery, truth_gallery, csv, normalize, minSize, maxSize);
}

float br_eval_landmarking(const char *predicted_gallery, const char *truth_gallery, const char *csv, int normalization_index_a, int normalization_index_b)
Expand Down
2 changes: 1 addition & 1 deletion openbr/openbr.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ BR_EXPORT void br_eval_clustering(const char *csv, const char *gallery, const ch
* \param normalize Optional \c bool flag to normalize predicted bounding boxes for improved detection.
* \return Average detection bounding box overlap.
*/
BR_EXPORT float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv = "", bool normalize = false, int minSize = 0);
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);

/*!
* \brief Evaluates and prints landmarking accuracy to terminal.
Expand Down

0 comments on commit 7a540d8

Please sign in to comment.