资源简介
该程序是利用针对caffe的日志绘制accuracy和loss曲线的工具,该工具是caffe自带的,但是原版工具有各种小问题。我的底版是由@非文艺小燕儿_Vivien制作的资源修改而来。详细内容,使用方法在文档的readme中已经写明了。python2的话的请参考@非文艺小燕儿_Vivien的博客:http://blog.csdn.net/fuwenyan/article/details/70285425
还有:http://blog.csdn.net/sunshine_in_moon/article/details/53541573(不知道是不是最原始出处)。
最低资源分分享,喜欢的自己拿吧
代码片段和文件信息
#if defined(_MSC_VER)
#include
#define getpid() _getpid()
#endif
#include
#include
#include
#include
#include
#include “caffe/common.hpp“
#include “caffe/util/rng.hpp“
//add for log output by fwy start
#include
#include
#include
//add for log output by fwy end
namespace caffe {
// Make sure each thread can have different values.
static boost::thread_specific_ptr thread_instance_;
Caffe& Caffe::Get() {
if (!thread_instance_.get()) {
thread_instance_.reset(new Caffe());
}
return *(thread_instance_.get());
}
// random seeding
int64_t cluster_seedgen(void) {
int64_t s seed pid;
FILE* f = fopen(“/dev/urandom“ “rb“);
if (f && fread(&seed 1 sizeof(seed) f) == sizeof(seed)) {
fclose(f);
return seed;
}
LOG(INFO) << “System entropy source not available “
“using fallback algorithm to generate seed instead.“;
if (f)
fclose(f);
pid = getpid();
s = time(NULL);
seed = std::abs(((s * 181) * ((pid - 83) * 359)) % 104729);
return seed;
}
//add for log output by fwy start
void initGlog() {
FLAGS_log_dir = “.\\log\\“;//存放日志文件的文件夹路径,我们可以自己指定
_mkdir(FLAGS_log_dir.c_str());
std::string LOG_INFO_FILE;
std::string LOG_WARNING_FILE;
std::string LOG_ERROR_FILE;
std::string LOG_FATAL_FILE;
std::string now_time = boost::posix_time::to_iso_extended_string(boost::posix_time::second_clock::local_time());
now_time[13] = ‘-‘;
now_time[16] = ‘-‘;
LOG_INFO_FILE = FLAGS_log_dir + “INFO“ + now_time + “.log“;
google::SetLogDestination(google::GLOG_INFO LOG_INFO_FILE.c_str());
LOG_WARNING_FILE = FLAGS_log_dir + “WARNING“ + now_time + “.txt“;
google::SetLogDestination(google::GLOG_WARNING LOG_WARNING_FILE.c_str());
LOG_ERROR_FILE = FLAGS_log_dir + “ERROR“ + now_time + “.txt“;
google::SetLogDestination(google::GLOG_ERROR LOG_ERROR_FILE.c_str());
LOG_FATAL_FILE = FLAGS_log_dir + “FATAL“ + now_time + “.txt“;
google::SetLogDestination(google::GLOG_FATAL LOG_FATAL_FILE.c_str());
}
//add for log output by fwy end
void GlobalInit(int* pargc char*** pargv) {
// Google flags.
::gflags::ParseCommandLineFlags(pargc pargv true);
// Google logging.
//add for log output by fwy start
initGlog();
//add for log output by fwy end
::google::InitGoogleLogging(*(pargv)[0]);
// Provide a backtrace on segfault.
// Windows port of glogs doesn‘t have this function built
#if !defined(_MSC_VER)
::google::InstallFailureSignalHandler();
#endif
}
#ifdef CPU_ONLY // CPU-only Caffe.
Caffe::Caffe()
: random_generator_() mode_(Caffe::CPU)
solver_count_(1) solver_rank_(0) multiprocess_(false) { }
Caffe::~Caffe() { }
void Caffe::set_random_seed(const unsigned int seed) {
// RNG seed
Get().random_generator_.reset(new RNG(seed));
}
void Caffe::SetD
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 104349 2017-03-16 14:23 Cifar10_Net0_20000_diff.log
文件 947840 2017-03-17 13:13 Cifar10_Net1_20000_equal.log
文件 12461 2017-03-16 11:47 common.cpp
文件 2186 2018-03-08 18:02 extract_seconds.py
文件 7186 2018-03-08 18:02 parse_log.py
文件 13524 2018-03-08 18:00 plot_training_log_diff.py
文件 13636 2018-03-08 18:00 plot_training_log_equal.py
文件 1650 2018-03-08 18:07 readme.txt
文件 2000 2017-03-20 09:26 ReadMe_fwy.txt
----------- --------- ---------- ----- ----
1104832 9
- 上一篇:LSTM可以运行
- 下一篇:基于python2.7的LeNet5源代码实现
评论
共有 条评论