Commit 1e85939c875c57798d8dc446f937955c0b79c0c1
merging
Showing
2 changed files
with
8 additions
and
5 deletions
sdk/openbr_plugin.cpp
| @@ -349,6 +349,8 @@ QDataStream &br::operator<<(QDataStream &stream, const File &file) | @@ -349,6 +349,8 @@ QDataStream &br::operator<<(QDataStream &stream, const File &file) | ||
| 349 | QDataStream &br::operator>>(QDataStream &stream, File &file) | 349 | QDataStream &br::operator>>(QDataStream &stream, File &file) |
| 350 | { | 350 | { |
| 351 | return stream >> file.name >> file.m_metadata; | 351 | return stream >> file.name >> file.m_metadata; |
| 352 | + const QVariant label = file.m_metadata.value("Label"); | ||
| 353 | + if (!label.isNull()) file.set("Label", label); // Trigger population of Globals->classes | ||
| 352 | } | 354 | } |
| 353 | 355 | ||
| 354 | /* FileList - public methods */ | 356 | /* FileList - public methods */ |
sdk/plugins/output.cpp
| @@ -271,7 +271,8 @@ class rankOutput : public MatrixOutput | @@ -271,7 +271,8 @@ class rankOutput : public MatrixOutput | ||
| 271 | if (targetFiles.isEmpty() || queryFiles.isEmpty()) return; | 271 | if (targetFiles.isEmpty() || queryFiles.isEmpty()) return; |
| 272 | 272 | ||
| 273 | QList<int> ranks; | 273 | QList<int> ranks; |
| 274 | - QList<double> scores; | 274 | + QList<int> positions; |
| 275 | + QList<float> scores; | ||
| 275 | QStringList lines; | 276 | QStringList lines; |
| 276 | 277 | ||
| 277 | for (int i=0; i<queryFiles.size(); i++) { | 278 | for (int i=0; i<queryFiles.size(); i++) { |
| @@ -280,6 +281,7 @@ class rankOutput : public MatrixOutput | @@ -280,6 +281,7 @@ class rankOutput : public MatrixOutput | ||
| 280 | foreach (const Pair &pair, Common::Sort(OpenCVUtils::matrixToVector(data.row(i)), true)) { | 281 | foreach (const Pair &pair, Common::Sort(OpenCVUtils::matrixToVector(data.row(i)), true)) { |
| 281 | if(targetFiles[pair.second].getString("Label") == queryFiles[i].getString("Label")) { | 282 | if(targetFiles[pair.second].getString("Label") == queryFiles[i].getString("Label")) { |
| 282 | ranks.append(rank); | 283 | ranks.append(rank); |
| 284 | + positions.append(pair.second); | ||
| 283 | scores.append(pair.first); | 285 | scores.append(pair.first); |
| 284 | break; | 286 | break; |
| 285 | } | 287 | } |
| @@ -288,10 +290,9 @@ class rankOutput : public MatrixOutput | @@ -288,10 +290,9 @@ class rankOutput : public MatrixOutput | ||
| 288 | } | 290 | } |
| 289 | 291 | ||
| 290 | typedef QPair<int,int> RankPair; | 292 | typedef QPair<int,int> RankPair; |
| 291 | - foreach (const RankPair &pair, Common::Sort(ranks, false)) { | ||
| 292 | - qDebug() << ranks[pair.second]; | ||
| 293 | - lines.append(queryFiles[pair.second].name + " " + QString::number(pair.first) + " " + QString::number(scores[pair.second]) + " " + targetFiles[ranks[pair.second]].name); | ||
| 294 | -} | 293 | + foreach (const RankPair &pair, Common::Sort(ranks, false)) |
| 294 | + lines.append(queryFiles[pair.second].name + " " + QString::number(pair.first) + " " + QString::number(scores[pair.second]) + " " + targetFiles[positions[pair.second]].name); | ||
| 295 | + | ||
| 295 | QtUtils::writeFile(file, lines); | 296 | QtUtils::writeFile(file, lines); |
| 296 | } | 297 | } |
| 297 | }; | 298 | }; |