python - Caffe:如何通过代码获取 `solver.prototxt`参数?

标签 python neural-network deep-learning caffe conv-neural-network

我想从 python 代码访问 solver.prototxt 参数,例如 base_lr(基础学习率)或 weight_decay

有没有办法从 solver.net 对象访问这些?

谢谢

最佳答案

根据 this tutorial ,您可以通过以下方式访问它:

### define solver
from caffe.proto import caffe_pb2
s = caffe_pb2.SolverParameter()

# Set a seed for reproducible experiments:
# this controls for randomization in training.
s.random_seed = 0xCAFFE

# Specify locations of the train and (maybe) test networks.
s.train_net = train_net_path
s.test_net.append(test_net_path)
s.test_interval = 500  # Test after every 500 training iterations.
s.test_iter.append(100) # Test on 100 batches each time we test.

s.max_iter = 10000     # no. of times to update the net (training iterations)

# EDIT HERE to try different solvers
# solver types include "SGD", "Adam", and "Nesterov" among others.
s.type = "SGD"
# Set the initial learning rate for SGD.
s.base_lr = 0.01  # EDIT HERE to try different learning rates

等等

关于python - Caffe:如何通过代码获取 `solver.prototxt`参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38026431/

相关文章:

python - 如何根据另一列查找时差

Python attrs/cattrs 使用卡住的 attrs 类作为字典键序列化字典

machine-learning - 如何训练具有不同大小输入的神经网络?

python - 如何使用 Keras 在密集层中使用 dropout 创建自动编码器

python - 如何防止在 Keras 中打印 Predict_proba() 输出?

python - 如何定义可为空的响应属性?

python - 计算字符串中单词中元音的数量

python - 使用贝叶斯优化时队列为空

python - 了解交叉熵损失

python - 类型错误 : Inconsistency in the inner graph of scan 'scan_fn' . ... 'TensorType(float64, col)' 和 'TensorType(float64, matrix)'