caffe 如何prototxt文件中,添加并传递变量

隔几天没有记录下来,竟然自己都快忘记了的节奏。。。

********solver.prototxt************************************************************************************************

solver.prototxt文件中添加变量:resultforsnap  = 0.64

在src/caffe/proto/caffe.proto 文件中,

message SolverParameter {}中添加:

optional float resultforsnap = 40 [default = 1e-8];


在include/caffe/solver.hpp文件中添加变量:

float maxresult;


如何使用:

在solver.cpp中调用示例为:

maxresult = param_.resultforsnap();  


并且一定要make clean--->make...

*******************************************************************************************************


********train_test.prototxt************************************************************************************************

在prototxt文件中,添加:
softmaxloss_param{
    temp: 0.5
 }


在src/caffe/proto/caffe.proto 文件中,

添加(如果已经有,就不用了):
optional SoftmaxLossParameter softmaxloss_param =41;

同时添加:
message SoftmaxLossParameter {
  optional float temp= 1 [default =0.5];
}

如何使用?

请在对应的layer中,

this->layer_param_.softmaxloss_param().temp()


就可以调用其参数啦!

************************************************************************************************
************************************************************************************************

哈哈,整理完毕!
整理完,自己这条理也理清楚他们的关系啦~





  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值