我有一个千层面密码。我想用caffe创建相同的网络。我可以转换网络。但我需要帮忙处理千层面的超参数。千层面的超参数看上去就像:
lr = 1e-2
weight_decay = 1e-5
prediction = lasagne.layers.get_output(net['out'])
loss = T.mean(lasagne.objectives.squared_error(prediction, target_var))
weightsl2 = lasagne.regularization.regularize_network_params(net['out'], lasagne.regularization.l2)
loss += weight_decay * weightsl2如何在caffe中执行L2正则化部分?是否必须在每个卷积/内积层之后添加正则化层?我的solver.prototxt的相关部分如下:
base_lr: 0.01
lr_policy: "fixed"
weight_decay: 0.00001
regularization_type: "L2"
stepsize: 300
gamma: 0.1
max_iter: 2000
momentum: 0.9也在http://datascience.stackexchange.com上发布。等待答案。
发布于 2017-01-11 08:41:07
看来你已经弄好了。
weight_decay元参数与'solver.prototxt'中的regularization_type: "L2"相结合,告诉caffe在weight_decay = 1e-5中使用L2正则化。
您可能还要调整的另一件事是正则化对每个参数的影响程度。您可以为网络中的每个参数blob设置以下内容
param { decay_mult: 1 }例如,带有偏置的"InnerProduct"层有两个参数:
layer {
type: "InnerProduct"
name: "fc1"
# bottom and top here
inner_product_param {
bias_term: true
# ... other params
}
param { decay_mult: 1 } # for weights use regularization
param { decay_mult: 0 } # do not regularize the bias
}默认情况下,decay_mult被设置为1,即网的所有权重都是正则化的。您可以更改这一点,以规范更多/不太特定的参数块。
https://stackoverflow.com/questions/41585226
复制相似问题