PyCaffe中定义的图层模块在哪里 [英] Where is layer module defined in PyCaffe
问题描述
我正在修改 Caffe教程来实现神经网络,但是我正在努力确定一些pycaffe模块的位置,以便查看某些功能定义.
I am modifying a Caffe tutorial to implement a neural network, but I am struggling to identify where some of the pycaffe modules are location in order to see certain function definitions.
例如,本教程提到:
import caffe
from caffe import layers a L, params as P
....
L.Convolution(bottom, kernel_size=ks, stride=stride, num_output=nout, pad=pad, group=group)
L.InnerProduct(bottom, num_output=nout)
L.ReLU(fc, in_place=True)
...
在哪里可以找到这些函数定义,在哪里可以看到其他预定义的图层类型?我看到layers
和params
是此处定义的,但没有提及类型(例如layers.Convolution
等).
Where can I find these function definitions and where can I see what other types of layers are pre-defined? I see that layers
and params
are defined here but there's no mention of the types (e.g. layers.Convolution
, etc).
我试图弄清楚这一点的原因是因为pycaffe教程中遗漏了其他prototxt参数,我希望能够在生成原型时从Python进行定义.其中包括blob_lr
和include{phase: TRAIN}
.
The reason I am trying to figure this out is because there are other prototxt parameters left out of the pycaffe tutorials that I would like to be able to define from Python when generating the prototxts. These include, blob_lr
and include{phase: TRAIN}
.
推荐答案
您可以像这样添加blob_lr
和phase
:
import caffe
from caffe import layers a L, params as P
ns = caffe.NetSpec()
ns.conv = L.Convolution(bottom, convolution_param={'kernel_size':ks,
'stride':stride,
'num_output':nout,
'pad':pad,
'group':group},
param=[{'lr_mult':1, 'decay_mult':1},
{'lr_mult':2, 'decay_mult':0}],
include={'phase': caffe.TRAIN})
您可以在此答案中看到更多示例.
You can see some more examples in this answer.
这篇关于PyCaffe中定义的图层模块在哪里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!