-
大小: 118KB文件類(lèi)型: .rar金幣: 2下載: 0 次發(fā)布日期: 2021-06-03
- 語(yǔ)言: Python
- 標(biāo)簽: log畫(huà)圖??
資源簡(jiǎn)介
該程序是利用針對(duì)caffe的日志繪制accuracy和loss曲線(xiàn)的工具,該工具是caffe自帶的,但是原版工具有各種小問(wèn)題。我的底版是由@非文藝小燕兒_Vivien制作的資源修改而來(lái)。詳細(xì)內(nèi)容,使用方法在文檔的readme中已經(jīng)寫(xiě)明了。python2的話(huà)的請(qǐng)參考@非文藝小燕兒_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
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件?????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
評(píng)論
共有 條評(píng)論