Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <gflags/gflags.h>
- #include <glog/logging.h>
- #include <cstring>
- #include <map>
- #include <string>
- #include <vector>
- #include "boost/algorithm/string.hpp"
- #include "caffe/caffe.hpp"
- #include "caffe/util/signal_handler.h"
- using caffe::Blob;
- using caffe::Caffe;
- using caffe::Net;
- using caffe::Layer;
- using caffe::Solver;
- using caffe::shared_ptr;
- using caffe::string;
- using caffe::Timer;
- using caffe::vector;
- using std::ostringstream;
- // Train / Finetune a model.
- int main() {
- caffe::SolverParameter solver_param;
- caffe::ReadSolverParamsFromTextFileOrDie("model/lenet_solver.prototxt", &solver_param);
- solver_param.mutable_train_state()->set_level(0);
- Caffe::set_mode(Caffe::CPU);
- caffe::SignalHandler signal_handler(
- caffe::SolverAction::STOP,
- caffe::SolverAction::SNAPSHOT);
- shared_ptr<caffe::Solver<float> >
- solver(caffe::SolverRegistry<float>::CreateSolver(solver_param));
- solver->SetActionFunction(signal_handler.GetActionFunction());
- LOG(INFO) << "Starting Optimization";
- solver->Solve();
- LOG(INFO) << "Optimization Done.";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment