# 解析 I0610 04:53:36.096751 13919 solver.cpp:102] Creating training net from net file: /media/junhui/DATA/caffe_workspace/my_linearReggresion/mylr.prototxt # 这两行前面解释过了,区分哪些层用于TRAIN,哪些层用于TEST I0610 04:53:36.097002 13919 net.cpp:296] The NetState phase (0) differed from the phase (1) specified by a rule in layer mnist I0610 04:53:36.097012 13919 net.cpp:296] The NetState phase (0) differed from the phase (1) specified by a rule in layer accuracy I0610 04:53:36.097085 13919 net.cpp:53] Initializing net from parameters:
找到对应位置:
1 2 3 4 5 6 7 8 9 10
void Solver<Dtype>::InitTrainNet() { ... // param_是一个SolverParameter对象,如果mylr.prototxt文件中定义了Net结构,则如下 if (param_.has_net()) { LOG_IF(INFO, Caffe::root_solver()) // 打印Log << "Creating training net from net file: " << param_.net(); // 解析mylr.prototxt中内容,将其内容存入 NetParameter 对象 net_param 中。 // 转换过程由ProtoBuffer工具完成的。 ReadNetParamsFromTextFileOrDie(param_.net(), &net_param); }
如此就将磁盘中的prototxt描述转换到内存。
将内存中模型存储到磁盘
当需要保存当前模型和快照时:
1 2
I0610 04:53:38.909629 13919 solver.cpp:464] Snapshotting to binary proto file my_lr_iter_5000.caffemodel I0610 04:53:38.910568 13919 sgd_solver.cpp:284] Snapshotting solver state to binary proto file my_lr_iter_5000.solverstate