Improve result display.
This commit is contained in:
@@ -22,8 +22,10 @@ int main(int argc, char *const argv[]) {
|
|||||||
cout << "Result for " << image << ":" << endl;
|
cout << "Result for " << image << ":" << endl;
|
||||||
auto res = simulator.simulate(image);
|
auto res = simulator.simulate(image);
|
||||||
if (!labels.empty()) {
|
if (!labels.empty()) {
|
||||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
auto scores = combine(res, labels);
|
||||||
cout << res[i] << " " << labels[i] << endl;
|
sort(scores.begin(), scores.end(), greater<>());
|
||||||
|
for (unsigned int i = 0; i < scores.size() && i < 5; ++i) {
|
||||||
|
cout << scores[i].first << " " << scores[i].second << endl;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cout << "Best result: " << *(max_element(res.begin(), res.end())) << endl;
|
cout << "Best result: " << *(max_element(res.begin(), res.end())) << endl;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace fmri
|
namespace fmri
|
||||||
{
|
{
|
||||||
@@ -40,4 +41,17 @@ namespace fmri
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class U>
|
||||||
|
std::vector<std::pair<T, U>> combine(const std::vector<T>& a, const std::vector<U>& b)
|
||||||
|
{
|
||||||
|
assert(a.size() == b.size());
|
||||||
|
std::vector<std::pair<T, U>> res;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < a.size(); ++i) {
|
||||||
|
res.emplace_back(a[i], b[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user