Commit e1e824d5ab137852d1089d830b73a4e73a9cd338
1 parent
bd3fbd91
Added rankOuput
Showing
4 changed files
with
50 additions
and
1 deletions
sdk/core/plot.cpp
| ... | ... | @@ -254,6 +254,13 @@ float Evaluate(const QString &simmat, const QString &mask, const QString &csv) |
| 254 | 254 | lines.append(qPrintable(QString("CMC,%1,%2").arg(QString::number(i), QString::number(float(realizedReturns)/possibleReturns)))); |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | + // Write good matches and bad matches | |
| 258 | + /* | |
| 259 | + const int Good_Matches = 3; | |
| 260 | + const int Bad_Matches = 3; | |
| 261 | + | |
| 262 | + for (int i = 1; i<=)*/ | |
| 263 | + | |
| 257 | 264 | if (!csv.isEmpty()) QtUtils::writeFile(csv, lines); |
| 258 | 265 | qDebug("TAR @ FAR = 0.01: %.3f", result); |
| 259 | 266 | return result; | ... | ... |
sdk/plugins/output.cpp
| ... | ... | @@ -259,6 +259,46 @@ BR_REGISTER(Output, EmptyOutput) |
| 259 | 259 | |
| 260 | 260 | /*! |
| 261 | 261 | * \ingroup outputs |
| 262 | + * \brief Outputs highest ranked matches with scores. | |
| 263 | + * \author Scott Klum \cite sklum | |
| 264 | + */ | |
| 265 | +class rankOutput : public MatrixOutput | |
| 266 | +{ | |
| 267 | + Q_OBJECT | |
| 268 | + | |
| 269 | + ~rankOutput() | |
| 270 | + { | |
| 271 | + if (targetFiles.isEmpty() || queryFiles.isEmpty()) return; | |
| 272 | + | |
| 273 | + QList<int> ranks; | |
| 274 | + QList<double> scores; | |
| 275 | + QStringList lines; | |
| 276 | + | |
| 277 | + for (int i=0; i<queryFiles.size(); i++) { | |
| 278 | + typedef QPair<float,int> Pair; | |
| 279 | + int rank = 1; | |
| 280 | + foreach (const Pair &pair, Common::Sort(OpenCVUtils::matrixToVector(data.row(i)), true)) { | |
| 281 | + if(targetFiles[pair.second].label() == queryFiles[i].label()) { | |
| 282 | + ranks.append(rank); | |
| 283 | + scores.append(pair.first); | |
| 284 | + break; | |
| 285 | + } | |
| 286 | + rank++; | |
| 287 | + } | |
| 288 | + } | |
| 289 | + | |
| 290 | + typedef QPair<int,int> RankPair; | |
| 291 | + foreach (const RankPair &pair, Common::Sort(ranks, false)) | |
| 292 | + lines.append(queryFiles[pair.second].name + " " + QString::number(pair.first) + " " + QString::number(scores[pair.second]) + " " + targetFiles[pair.second].name); | |
| 293 | + | |
| 294 | + QtUtils::writeFile(file, lines); | |
| 295 | + } | |
| 296 | +}; | |
| 297 | + | |
| 298 | +BR_REGISTER(Output, rankOutput) | |
| 299 | + | |
| 300 | +/*! | |
| 301 | + * \ingroup outputs | |
| 262 | 302 | * \brief The highest scoring matches. |
| 263 | 303 | * \author Josh Klontz \cite jklontz |
| 264 | 304 | */ | ... | ... |
sdk/plugins/stasm.cpp
| ... | ... | @@ -45,7 +45,7 @@ class StasmTransform : public UntrainableTransform |
| 45 | 45 | |
| 46 | 46 | AsmSearchDll(&nlandmarks, landmarks, |
| 47 | 47 | qPrintable(src.file.name), reinterpret_cast<char*>(src.m().data), src.m().cols, src.m().rows, |
| 48 | - src.m(), (src.m().channels() == 3), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-68-1d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-76-2d.conf")); | |
| 48 | + src.m(), (src.m().channels() == 3), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-68-1d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-76-2d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/")); | |
| 49 | 49 | |
| 50 | 50 | if (nlandmarks == 0) qWarning("Unable to detect Stasm landmarks"); |
| 51 | 51 | ... | ... |
share/openbr/cmake/FindStasm.cmake
| ... | ... | @@ -12,6 +12,8 @@ find_path(Stasm_DIR include/stasm.hpp ${CMAKE_SOURCE_DIR}/3rdparty/*) |
| 12 | 12 | |
| 13 | 13 | add_subdirectory(${Stasm_DIR} ${Stasm_DIR}/build) |
| 14 | 14 | |
| 15 | +set(SRC ${SOURCE};${SRC}) | |
| 16 | + | |
| 15 | 17 | include_directories(${Stasm_DIR}/include) |
| 16 | 18 | link_directories(${Stasm_DIR}/build) |
| 17 | 19 | ... | ... |