0

I'm following the ipython notebook example on training caffe via its python interface. However the caffe module seems not to contain the modules described in the tutorial

When I enter

import caffe
from caffe import layers as L

I get the error:

ImportError   Traceback (most recent call last)
<ipython-input-5-7cbb5661b7a7> in <module>()
----> 1 from caffe import layers as L

ImportError: cannot import name layers

when I do dir(caffe) I get:

['Classifier',
 'Detector',
 'Layer',
 'Net',
 'SGDSolver',
 'TEST',
 'TRAIN',
 '__builtins__',
 '__doc__',
 '__file__',
 '__name__',
 '__package__',
 '__path__',
 '_caffe',
 'classifier',
 'detector',
 'get_solver',
 'io',
 'proto',
 'pycaffe',
 'set_device',
 'set_mode_cpu',
 'set_mode_gpu']

so it doesn't contain a module called "layers".

Is the tutorial somehow outdated? Is there a newer version which works for my version of caffe?

mcExchange
  • 6,154
  • 12
  • 57
  • 103
  • You may want to try this to get started: [link](https://github.com/VISIONAI/clouddream ) There are lots of dependencies and versions of dependencies ... – cgarner Sep 30 '15 at 03:54
  • This doesn't answer my question at all. Are you trying to make advertisement here? – mcExchange Oct 01 '15 at 13:23
  • It's a comment, not an answer. It has a Docker image that does what I thought you are trying to do and I was able to get it running easily. – cgarner Oct 02 '15 at 01:21
  • Alright. Thanks for the tip then :) – mcExchange Oct 02 '15 at 06:51
  • have you solved this issue? waht version of caffe are you using? it seems like you are running an old version. Try updating (pull from master branch) and re-compile see if that fixes the problem. – Shai Dec 02 '15 at 12:01
  • Thats true. I had some old caffe version, if you cange your comment to an answer I can accept it ;) – mcExchange Dec 02 '15 at 15:45
  • This is odd. I am running the latest version of Caffe and I see the definition of layers inside caffe/python/caffe/net_spec.py. But I still get this error when trying to import. And I also have PYTHONPATH set. Any ideas? – Evan Zamir Feb 11 '16 at 21:48

0 Answers0