1
votes

I have installed caffe, uncommenting

WITH_PYTHON_LAYER=1

in 'Makefile.config'

When I use a python data layer in my net.prototxt, it says

Unknown layer type: Python

To cross check it in python interface, I tried

import caffe
from caffe import layers as L
L.Python()

this seems to work ,no error then. Where is the problem?

1
If you create a network with pycaffe (L.Python()) and really run it - does it work, or is there also an error? - hbaderts
Have you compiled caffe after setting WITH_PYTHON_LAYER = 1? - Shai

1 Answers

2
votes

You can find out what layer types caffe has in python simply by examining caffe.layer_types_list(). For example, if you actually have a "Python" layer, then

list(caffe.layer_type_list()).index('Python')

Should actually return an index for its name in the layer types list.

As for L.Python() - this caffe.NetSpec() interface is used to programatically write a net prototxt, and at the writing stage layer types are not checked. You can actually write whatever layer you want:

L.YouDontThinkTheyNameALayerLikeThis()

Is totally cool. Even converting it to prototxt:

print "{}".format(L.YouDontThinkTheyNameALayerLikeThis().to_proto())

Actually results with this:

layer {
  name: "YouDontThinkTheyNameALayerLikeThis1"
  type: "YouDontThinkTheyNameALayerLikeThis"
  top: "YouDontThinkTheyNameALayerLikeThis1"
}

You'll get an error message once you try to run this "net" using caffe...