Skip to content

Commit

Permalink
Add solver accuracy plotting (fix BVLC#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
aidangomez committed Aug 18, 2015
1 parent e1ee5ff commit 105ddb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/caffe/solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Solver {
int current_step_;
shared_ptr<Net<Dtype> > net_;
vector<shared_ptr<Net<Dtype> > > test_nets_;
vector<Dtype> accuracies;

DISABLE_COPY_AND_ASSIGN(Solver);
};
Expand Down
5 changes: 5 additions & 0 deletions src/caffe/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "caffe/util/io.hpp"
#include "caffe/util/math_functions.hpp"
#include "caffe/util/upgrade_proto.hpp"
#include "caffe/util/plot_data.h"

namespace caffe {

Expand Down Expand Up @@ -344,6 +345,9 @@ void Solver<Dtype>::Test(const int test_net_id) {
loss_msg_stream << " (* " << loss_weight
<< " = " << loss_weight * mean_score << " loss)";
}
if (output_name == "accuracy") {
accuracies.push_back(mean_score);
}
LOG(INFO) << " Test net output #" << i << ": " << output_name << " = "
<< mean_score << loss_msg_stream.str();
}
Expand Down Expand Up @@ -372,6 +376,7 @@ void Solver<Dtype>::Snapshot() {
snapshot_filename = filename + ".solverstate";
LOG(INFO) << "Snapshotting solver state to " << snapshot_filename;
WriteProtoToBinaryFile(state, snapshot_filename.c_str());
drawPNG(filename, accuracies);
}

template <typename Dtype>
Expand Down

0 comments on commit 105ddb0

Please sign in to comment.