Commit e544b45abada4360b82c541730326c8e27212940
1 parent
fd2c2ed7
Fixed using tabs instead of spaces, and added myself to the bib file
Showing
2 changed files
with
51 additions
and
45 deletions
openbr/plugins/gallery.cpp
| @@ -1033,47 +1033,47 @@ class topPredictionsGallery : public Gallery | @@ -1033,47 +1033,47 @@ class topPredictionsGallery : public Gallery | ||
| 1033 | Q_PROPERTY(float out_count READ get_out_count WRITE set_out_count RESET reset_out_count STORED false) | 1033 | Q_PROPERTY(float out_count READ get_out_count WRITE set_out_count RESET reset_out_count STORED false) |
| 1034 | BR_PROPERTY(float, out_count, 3) | 1034 | BR_PROPERTY(float, out_count, 3) |
| 1035 | 1035 | ||
| 1036 | - QMap<float, QString> attributes; | 1036 | + QMap<float, QString> attributes; |
| 1037 | 1037 | ||
| 1038 | ~topPredictionsGallery() | 1038 | ~topPredictionsGallery() |
| 1039 | { | 1039 | { |
| 1040 | - QString result = QString("# of attributes: %1").arg(QString::number(attributes.count())); | 1040 | + QString result = QString("# of attributes: %1").arg(QString::number(attributes.count())); |
| 1041 | QtUtils::writeFile(file.name, result); | 1041 | QtUtils::writeFile(file.name, result); |
| 1042 | if (!attributes.isEmpty()) | 1042 | if (!attributes.isEmpty()) |
| 1043 | - { | ||
| 1044 | - QMapIterator <float, QString> it(attributes); | ||
| 1045 | - it.toBack(); | ||
| 1046 | - if (out_count > 1) | ||
| 1047 | - { | ||
| 1048 | - if (attributes.count() < out_count) | ||
| 1049 | - out_count = attributes.count(); | ||
| 1050 | - | ||
| 1051 | - for (int i = 0; i < out_count; i++) | ||
| 1052 | - { | ||
| 1053 | - it.previous(); | ||
| 1054 | - result = QString("%1) %2 : %3").arg(QString::number(i + 1), it.value(), QString::number((float)it.key())); | ||
| 1055 | - QtUtils::writeFile(file.name, result); | ||
| 1056 | - } | ||
| 1057 | - } | ||
| 1058 | - else | ||
| 1059 | - { | ||
| 1060 | - int count = 0; | ||
| 1061 | - it.toBack(); | ||
| 1062 | - while (it.hasPrevious()) | ||
| 1063 | - { | ||
| 1064 | - it.previous(); | ||
| 1065 | - if (it.key() >= out_count) | ||
| 1066 | - { | ||
| 1067 | - result = QString("%1) %2 : %3").arg(QString::number(count + 1), it.value(), QString::number((float)it.key())); | ||
| 1068 | - QtUtils::writeFile(file.name, result); | ||
| 1069 | - count++; | ||
| 1070 | - } | ||
| 1071 | - } | ||
| 1072 | - } | ||
| 1073 | - } | 1043 | + { |
| 1044 | + QMapIterator <float, QString> it(attributes); | ||
| 1045 | + it.toBack(); | ||
| 1046 | + if (out_count > 1) | ||
| 1047 | + { | ||
| 1048 | + if (attributes.count() < out_count) | ||
| 1049 | + out_count = attributes.count(); | ||
| 1050 | + | ||
| 1051 | + for (int i = 0; i < out_count; i++) | ||
| 1052 | + { | ||
| 1053 | + it.previous(); | ||
| 1054 | + result = QString("%1) %2 : %3").arg(QString::number(i + 1), it.value(), QString::number((float)it.key())); | ||
| 1055 | + QtUtils::writeFile(file.name, result); | ||
| 1056 | + } | ||
| 1057 | + } | ||
| 1058 | + else | ||
| 1059 | + { | ||
| 1060 | + int count = 0; | ||
| 1061 | + it.toBack(); | ||
| 1062 | + while (it.hasPrevious()) | ||
| 1063 | + { | ||
| 1064 | + it.previous(); | ||
| 1065 | + if (it.key() >= out_count) | ||
| 1066 | + { | ||
| 1067 | + result = QString("%1) %2 : %3").arg(QString::number(count + 1), it.value(), QString::number((float)it.key())); | ||
| 1068 | + QtUtils::writeFile(file.name, result); | ||
| 1069 | + count++; | ||
| 1070 | + } | ||
| 1071 | + } | ||
| 1072 | + } | ||
| 1073 | + } | ||
| 1074 | } | 1074 | } |
| 1075 | 1075 | ||
| 1076 | - //Pure virtial function so needs an implementation | 1076 | + //Pure virtial function so needs an implementation |
| 1077 | TemplateList readBlock(bool *done) | 1077 | TemplateList readBlock(bool *done) |
| 1078 | { | 1078 | { |
| 1079 | *done = true; | 1079 | *done = true; |
| @@ -1082,17 +1082,17 @@ class topPredictionsGallery : public Gallery | @@ -1082,17 +1082,17 @@ class topPredictionsGallery : public Gallery | ||
| 1082 | 1082 | ||
| 1083 | void write(const Template &t) | 1083 | void write(const Template &t) |
| 1084 | { | 1084 | { |
| 1085 | - QList<QString> keys = t.file.localKeys(); | ||
| 1086 | - for (int i = 0; i < keys.count(); i++) | ||
| 1087 | - { | ||
| 1088 | - QString key = keys.at(i); | ||
| 1089 | - if (key.startsWith("predicted_")) | ||
| 1090 | - { | ||
| 1091 | - float val = t.file.get<float>(key); | ||
| 1092 | - attributes.insert(val, key); //use float as key to keep in order | ||
| 1093 | - } | ||
| 1094 | - | ||
| 1095 | - } | 1085 | + QList<QString> keys = t.file.localKeys(); |
| 1086 | + for (int i = 0; i < keys.count(); i++) | ||
| 1087 | + { | ||
| 1088 | + QString key = keys.at(i); | ||
| 1089 | + if (key.startsWith("predicted_")) | ||
| 1090 | + { | ||
| 1091 | + float val = t.file.get<float>(key); | ||
| 1092 | + attributes.insert(val, key); //use float as key to keep in order | ||
| 1093 | + } | ||
| 1094 | + | ||
| 1095 | + } | ||
| 1096 | } | 1096 | } |
| 1097 | }; | 1097 | }; |
| 1098 | 1098 |
share/openbr/openbr.bib
| @@ -400,3 +400,9 @@ | @@ -400,3 +400,9 @@ | ||
| 400 | booktitle={IEEE Conf. on Computer Vision and Pattern Recognition, 2011}, | 400 | booktitle={IEEE Conf. on Computer Vision and Pattern Recognition, 2011}, |
| 401 | pages={513--520} | 401 | pages={513--520} |
| 402 | } | 402 | } |
| 403 | + | ||
| 404 | +@misc{baba1472, | ||
| 405 | + Author = {Babatunde Ogunfemi}, | ||
| 406 | + Howpublished = {https://github.com/baba1472}, | ||
| 407 | + Title = {ogunfemi.b at gmail.com}} | ||
| 408 | + |