Commit 7790361b95a69c5b8ab641b61633528f53de11ab
1 parent
efd7e096
Updated eval code
Showing
1 changed file
with
6 additions
and
6 deletions
openbr/core/eval.cpp
| @@ -1251,7 +1251,7 @@ void EvalEER(const QString &predictedXML, QString gt_property, QString distribut | @@ -1251,7 +1251,7 @@ void EvalEER(const QString &predictedXML, QString gt_property, QString distribut | ||
| 1251 | const TemplateList templateList(TemplateList::fromGallery(predictedXML)); | 1251 | const TemplateList templateList(TemplateList::fromGallery(predictedXML)); |
| 1252 | 1252 | ||
| 1253 | QHash<QString, int> gtLabels; | 1253 | QHash<QString, int> gtLabels; |
| 1254 | - QHash<QString, QList<float> > scores; | 1254 | + QHash<QString, float > scores; |
| 1255 | for (int i=0; i<templateList.size(); i++) { | 1255 | for (int i=0; i<templateList.size(); i++) { |
| 1256 | if (!templateList[i].file.contains(distribution_property) || !templateList[i].file.contains(gt_property)) | 1256 | if (!templateList[i].file.contains(distribution_property) || !templateList[i].file.contains(gt_property)) |
| 1257 | continue; | 1257 | continue; |
| @@ -1259,7 +1259,7 @@ void EvalEER(const QString &predictedXML, QString gt_property, QString distribut | @@ -1259,7 +1259,7 @@ void EvalEER(const QString &predictedXML, QString gt_property, QString distribut | ||
| 1259 | const int gtLabel = templateList[i].file.get<int>(gt_property); | 1259 | const int gtLabel = templateList[i].file.get<int>(gt_property); |
| 1260 | if (gtLabel == 1) | 1260 | if (gtLabel == 1) |
| 1261 | classOneTemplateCount++; | 1261 | classOneTemplateCount++; |
| 1262 | - const QList<float> templateScores = templateList[i].file.getList<float>(distribution_property); | 1262 | + const float templateScores = templateList[i].file.get<float>(distribution_property); |
| 1263 | gtLabels[templateKey] = gtLabel; | 1263 | gtLabels[templateKey] = gtLabel; |
| 1264 | scores[templateKey] = templateScores; | 1264 | scores[templateKey] = templateScores; |
| 1265 | } | 1265 | } |
| @@ -1278,13 +1278,13 @@ void EvalEER(const QString &predictedXML, QString gt_property, QString distribut | @@ -1278,13 +1278,13 @@ void EvalEER(const QString &predictedXML, QString gt_property, QString distribut | ||
| 1278 | foreach(const QString &key, scores.keys()) { | 1278 | foreach(const QString &key, scores.keys()) { |
| 1279 | int gtLabel = gtLabels[key]; | 1279 | int gtLabel = gtLabels[key]; |
| 1280 | //> thresNorm = class 0 (spoof) : < thresNorm = class 1 (genuine) | 1280 | //> thresNorm = class 0 (spoof) : < thresNorm = class 1 (genuine) |
| 1281 | - if (scores[key][0] >= thresNorm && gtLabel == 0) | 1281 | + if (scores[key] >= thresNorm && gtLabel == 0) |
| 1282 | continue; | 1282 | continue; |
| 1283 | - else if (scores[key][0] < thresNorm && gtLabel == 1) | 1283 | + else if (scores[key] < thresNorm && gtLabel == 1) |
| 1284 | continue; | 1284 | continue; |
| 1285 | - else if (scores[key][0] >= thresNorm && gtLabel == 1) | 1285 | + else if (scores[key] >= thresNorm && gtLabel == 1) |
| 1286 | FR +=1; | 1286 | FR +=1; |
| 1287 | - else if (scores[key][0] < thresNorm && gtLabel == 0) | 1287 | + else if (scores[key] < thresNorm && gtLabel == 0) |
| 1288 | FA +=1; | 1288 | FA +=1; |
| 1289 | } | 1289 | } |
| 1290 | const float FAR = FA / float(numTemplates - classOneTemplateCount); | 1290 | const float FAR = FA / float(numTemplates - classOneTemplateCount); |