Commit b3488cbffd687ccc4533e7502d87e3f223b6583a

Authored by Josh Klontz
1 parent 6080449e

handle QPoint(-1,-1) the same way we handle NaN

Showing 1 changed file with 10 additions and 2 deletions
openbr/core/eval.cpp
... ... @@ -863,12 +863,20 @@ float EvalLandmarking(const QString &predictedGallery, const QString &truthGalle
863 863 if (truthIndex == -1) qFatal("Could not identify ground truth for file: %s", qPrintable(predictedName));
864 864  
865 865 const QList<QPointF> predictedPoints = predicted[i].file.points();
866   - const QList<QPointF> truthPoints = truth[truthIndex].file.points();
  866 + QList<QPointF> truthPoints = truth[truthIndex].file.points();
  867 +
  868 + // Standardize how we represent unlabeled points here
  869 + const QPointF find(-1,-1);
  870 + const QPointF replace(std::numeric_limits<float>::quiet_NaN(), std::numeric_limits<float>::quiet_NaN());
  871 + for (int j=0; j<truthPoints.size(); j++)
  872 + if (truthPoints[j] == find)
  873 + truthPoints[j] = replace;
  874 +
867 875 if (normalizationIndexA >= truthPoints.size()) qFatal("Normalization index A is out of range.");
868 876 if (normalizationIndexB >= truthPoints.size()) qFatal("Normalization index B is out of range.");
869 877 const float normalizedLength = QtUtils::euclideanLength(truthPoints[normalizationIndexB] - truthPoints[normalizationIndexA]);
870 878  
871   - if (predictedPoints.size() != truthPoints.size() || truthPoints.contains(QPointF(-1,-1)) || qIsNaN(normalizedLength)) {
  879 + if (predictedPoints.size() != truthPoints.size() || qIsNaN(normalizedLength)) {
872 880 predicted.removeAt(i);
873 881 predictedNames.removeAt(i);
874 882 truth.removeAt(i);
... ...