Dump intermediate results to PNG images.

This commit is contained in:
2017-10-12 17:09:43 +02:00
parent 672649cfd0
commit 492d84fab0
8 changed files with 164 additions and 9 deletions

View File

@@ -1,8 +1,9 @@
#include <algorithm>
#include <iostream>
#include <memory>
#include "Options.hpp"
#include "Simulator.hpp"
#include "utils.hpp"
#include "PNGDumper.hpp"
using namespace std;
using namespace fmri;
@@ -12,10 +13,15 @@ int main(int argc, char *const argv[]) {
Options options = Options::parse(argc, argv);
vector<string> labels;
if (options.labels() != "") {
if (!options.labels().empty()) {
labels = read_vector<string>(options.labels());
}
unique_ptr<PNGDumper> pngDumper;
if (!options.imageDump().empty()) {
pngDumper.reset(new PNGDumper(options.imageDump()));
}
Simulator simulator(options.model(), options.weights(), options.means());
for (const auto &image : options.inputs()) {
@@ -33,6 +39,10 @@ int main(int argc, char *const argv[]) {
} else {
LOG(INFO) << "Best result: " << *(resultRow.data(), resultRow.data() + resultRow.numEntries()) << endl;
}
for (auto& layer : res) {
pngDumper->dump(layer);
}
}
google::ShutdownGoogleLogging();