Commit 0658fb418c4db064ec534f6c9976c6a7dc493849

Authored by Ben Klein
1 parent 092deb04

update eval

openbr/core/eval.cpp
... ... @@ -100,10 +100,10 @@ static cv::Mat constructMatchingMask(const cv::Mat &scores, const FileList &targ
100 100  
101 101 float Evaluate(const cv::Mat &scores, const FileList &target, const FileList &query, const QString &csv, int partition)
102 102 {
103   - return Evaluate(scores, constructMatchingMask(scores, target, query, partition), QString(), QString(), csv, 0);
  103 + return Evaluate(scores, constructMatchingMask(scores, target, query, partition), csv, QString(), QString(), 0);
104 104 }
105 105  
106   -float Evaluate(const QString &simmat, const QString &mask, const QString &csv, int matches)
  106 +float Evaluate(const QString &simmat, const QString &mask, const QString &csv, unsigned int matches)
107 107 {
108 108 qDebug("Evaluating %s%s%s",
109 109 qPrintable(simmat),
... ... @@ -137,12 +137,12 @@ float Evaluate(const QString &simmat, const QString &mask, const QString &csv, i
137 137 truth = format->read();
138 138 }
139 139  
140   - return Evaluate(scores, truth, target, query, csv, matches);
  140 + return Evaluate(scores, truth, csv, target, query, matches);
141 141 }
142 142  
143   -float Evaluate(const Mat &simmat, const Mat &mask, const QString &target, const QString &query, const QString &csv, int matches)
  143 +float Evaluate(const Mat &simmat, const Mat &mask, const QString &csv, const QString &target, const QString &query, unsigned int matches)
144 144 {
145   - if ((target.isEmpty() || query.isEmpty()) && matches != 0) matches = 0;
  145 + if (target.isEmpty() || query.isEmpty()) matches = 0;
146 146 if (simmat.size() != mask.size())
147 147 qFatal("Similarity matrix (%ix%i) differs in size from mask matrix (%ix%i).",
148 148 simmat.rows, simmat.cols, mask.rows, mask.cols);
... ... @@ -173,7 +173,7 @@ float Evaluate(const Mat &simmat, const Mat &mask, const QString &target, const
173 173 if (comparison.genuine) {
174 174 genuineCount++;
175 175 if (matches != 0){
176   - if (botGenuines.size() < matches) {
  176 + if (botGenuines.size() < (int)matches) {
177 177 botGenuines.append(comparison);
178 178 std::sort(botGenuines.begin(), botGenuines.end());
179 179 } else if (comparison.score < botGenuines.first().score) {
... ... @@ -185,7 +185,7 @@ float Evaluate(const Mat &amp;simmat, const Mat &amp;mask, const QString &amp;target, const
185 185 } else {
186 186 impostorCount++;
187 187 if (matches != 0) {
188   - if (topImpostors.size() < matches) {
  188 + if (topImpostors.size() < (int)matches) {
189 189 topImpostors.append(comparison);
190 190 std::sort(topImpostors.begin(), topImpostors.end());
191 191 } else if (topImpostors.last().score < comparison.score) {
... ... @@ -266,8 +266,8 @@ float Evaluate(const Mat &amp;simmat, const Mat &amp;mask, const QString &amp;target, const
266 266  
267 267 QString filePath = Globals->path;
268 268 if (matches != 0) {
269   - FileList targetFiles = TemplateList::fromGallery(target).files();
270   - FileList queryFiles = TemplateList::fromGallery(query).files();
  269 + const FileList targetFiles = TemplateList::fromGallery(target).files();
  270 + const FileList queryFiles = TemplateList::fromGallery(query).files();
271 271 for (int i=0; i<topImpostors.size(); i++) {
272 272 lines.append("TI,"+QString::number(topImpostors[i].score)+","+targetFiles[topImpostors[i].target].get<QString>("Label")+":"
273 273 +filePath+"/"+targetFiles[topImpostors[i].target].name+":"+queryFiles[topImpostors[i].query].get<QString>("Label")+":"+filePath+"/"+queryFiles[topImpostors[i].query].name);
... ...
openbr/core/eval.h
... ... @@ -23,9 +23,9 @@
23 23  
24 24 namespace br
25 25 {
26   - float Evaluate(const QString &simmat, const QString &mask = "", const QString &csv = "", int matches = 0); // Returns TAR @ FAR = 0.001
  26 + float Evaluate(const QString &simmat, const QString &mask = "", const QString &csv = "", unsigned int matches = 0); // Returns TAR @ FAR = 0.001
27 27 float Evaluate(const cv::Mat &scores, const FileList &target, const FileList &query, const QString &csv = "", int parition = 0);
28   - float Evaluate(const cv::Mat &scores, const cv::Mat &masks, const QString &target = "", const QString &query = "", const QString &csv = "", int matches = 0);
  28 + float Evaluate(const cv::Mat &scores, const cv::Mat &masks, const QString &csv = "", const QString &target = "", const QString &query = "", unsigned int matches = 0);
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 = "");
... ...