Commit c3fff4cfab7ac18f9f8c740c6de27e675f272fad
1 parent
7daada02
Use the wonderful File::getList
Showing
2 changed files
with
7 additions
and
3 deletions
openbr/core/eval.cpp
| ... | ... | @@ -435,9 +435,11 @@ QList<Detection> getDetections(QString key, const Template &t, bool isList, bool |
| 435 | 435 | QList<Detection> dets; |
| 436 | 436 | if (isList) { |
| 437 | 437 | QList<QRectF> rects = f.rects(); |
| 438 | - QList<float> confidences = QtUtils::toFloats(f.get<QStringList>("Confidences", QStringList())); | |
| 438 | + QList<float> confidences; | |
| 439 | + if (f.contains("Confidences")) | |
| 440 | + confidences = f.getList<float>("Confidences"); | |
| 439 | 441 | if (!isTruth && rects.size() != confidences.size()) |
| 440 | - qFatal("You don't have enough confidence. I mean, your detections don't have confidence measures."); | |
| 442 | + qFatal("You don't have enough confidence. I mean, your detections don't all have confidence measures."); | |
| 441 | 443 | for (int i=0; i<rects.size(); i++) { |
| 442 | 444 | if (isTruth) |
| 443 | 445 | dets.append(Detection(rects.at(i))); | ... | ... |
openbr/plugins/slidingwindow.cpp
| ... | ... | @@ -116,7 +116,9 @@ private: |
| 116 | 116 | if (detect.file.get<QString>("Label") == "pos") { |
| 117 | 117 | dst.file.appendRect(OpenCVUtils::fromRect(window)); |
| 118 | 118 | float confidence = detect.file.get<float>("Dist"); |
| 119 | - QList<float> confidences = dst.file.get<QList<float> >("Confidences", QList<float>()); | |
| 119 | + QList<float> confidences; | |
| 120 | + if (dst.file.contains("Confidences")) | |
| 121 | + confidences = dst.file.getList<float>("Confidences"); | |
| 120 | 122 | confidences.append(confidence); |
| 121 | 123 | dst.file.set("Confidences", QtUtils::toVariantList(confidences)); |
| 122 | 124 | if (takeLargestScale) return; | ... | ... |