找不到 caffe `"Python"` 层?
caffe `"Python"` layer not found?
我安装了caffe,取消注释
WITH_PYTHON_LAYER=1
在'Makefile.config'
当我在 net.prototxt 中使用 python 数据层时,它显示
Unknown layer type: Python
在python界面交叉检查,
我试过了
import caffe
from caffe import layers as L
L.Python()
这似乎有效,然后没有错误。
问题出在哪里?
你可以简单地通过检查 caffe.layer_types_list()
来找出 caffe 在 python 中有哪些层类型。例如,如果您实际上有一个 "Python"
层,则
list(caffe.layer_type_list()).index('Python')
实际上应该 return 层类型列表中其名称的索引。
至于L.Python()
- 此caffe.NetSpec()
接口用于以编程方式编写网络原型文本,在编写阶段不检查图层类型。你实际上可以写任何你想要的层:
L.YouDontThinkTheyNameALayerLikeThis()
非常酷。甚至将其转换为 prototxt:
print "{}".format(L.YouDontThinkTheyNameALayerLikeThis().to_proto())
实际结果是:
layer {
name: "YouDontThinkTheyNameALayerLikeThis1"
type: "YouDontThinkTheyNameALayerLikeThis"
top: "YouDontThinkTheyNameALayerLikeThis1"
}
一旦您尝试 运行 使用 caffe "net",您将收到一条错误消息...
我安装了caffe,取消注释
WITH_PYTHON_LAYER=1
在'Makefile.config'
当我在 net.prototxt 中使用 python 数据层时,它显示
Unknown layer type: Python
在python界面交叉检查, 我试过了
import caffe
from caffe import layers as L
L.Python()
这似乎有效,然后没有错误。 问题出在哪里?
你可以简单地通过检查 caffe.layer_types_list()
来找出 caffe 在 python 中有哪些层类型。例如,如果您实际上有一个 "Python"
层,则
list(caffe.layer_type_list()).index('Python')
实际上应该 return 层类型列表中其名称的索引。
至于L.Python()
- 此caffe.NetSpec()
接口用于以编程方式编写网络原型文本,在编写阶段不检查图层类型。你实际上可以写任何你想要的层:
L.YouDontThinkTheyNameALayerLikeThis()
非常酷。甚至将其转换为 prototxt:
print "{}".format(L.YouDontThinkTheyNameALayerLikeThis().to_proto())
实际结果是:
layer { name: "YouDontThinkTheyNameALayerLikeThis1" type: "YouDontThinkTheyNameALayerLikeThis" top: "YouDontThinkTheyNameALayerLikeThis1" }
一旦您尝试 运行 使用 caffe "net",您将收到一条错误消息...