File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,23 @@ by Shicai Yang([@星空下的巫师](http://weibo.com/shicaiyang))on 2015/08
2222 char *model = "H:\\Models\\Caffe\\bvlc_reference_caffenet.caffemodel";
2323 net->CopyTrainedLayersFrom(model);
2424
25+ ### 读取模型中的每层的结构配置参数(如name,type,kernel size,pad,stride等)
26+
27+ char *model = "H:\\Models\\Caffe\\bvlc_reference_caffenet.caffemodel";
28+ ReadNetParamsFromBinaryFileOrDie(model, ¶m);
29+ int num_layers = param.layer_size();
30+ for (int i = 0; i < num_layers; ++i)
31+ {
32+ LOG(ERROR) << "Layer " << i << ":" << param.layer(i).name() << "\t" << param.layer(i).type();
33+ if (param.layer(i).type() == "Convolution")
34+ {
35+ ConvolutionParameter conv_param = param.layer(i).convolution_param();
36+ LOG(ERROR) << "\t\tkernel size: " << conv_param.kernel_size()
37+ << ", pad: " << conv_param.pad()
38+ << ", stride: " << conv_param.stride();
39+ }
40+ }
41+
2542### 读取图像均值
2643
2744 char *mean_file = "H:\\Models\\Caffe\\imagenet_mean.binaryproto";
You can’t perform that action at this time.
0 commit comments