classify.py error (no attribute 'set_mode_cpu')
Hello,
what could be the reason for this error?
python classify.py --pretrained_model=./../models/bvlc_googlenet/bvlc_googlenet_iter_101.caffemodel --model_def=./../models/bvlc_googlenet/deploy.prototxt --mean_file=./../python/out.npy ./../test.jpg ./output.txt
Traceback (most recent call last):
File "classify.py", line 138, in <module>
main(sys.argv)
File "classify.py", line 103, in main
caffe.set_mode_cpu()
AttributeError: 'module' object has no attribute 'set_mode_cpu'
Solved by recompiling caffe from scratch.
how did you solve it precisely?
help! same error here... i tried recompiling caffe but it did not solve anything
@etienne87 did you recompile pycaffe? make pycaffe?
OK :+1:
here is the list of actions for dumb ppl like me :
- search for hours doing stupid check in python path
- say "bye bye" to your caffe directory !
- edit /etc/bash.bashrc export PATH=/usr/local/cuda-7.0/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-7.0/lib64:$LD_LIBRARY_PATH export PYTHONPATH=/home/xxx/Desktop/caffe/python:$PYTHONPATH
- follow from "Install dependencies" following link on ubuntu 14.04 (if you are under windows...well i'm sorry for you) : https://github.com/BVLC/caffe/wiki/Ubuntu-14.04-VirtualBox-VM (you will re-git clone blvc/caffe.git)
- just in case : if you have error importing numpy http://stackoverflow.com/questions/8917977/installing-lapack-for-numpy
- try python; import caffe; caffe.set_mode_cpu();
It should work now...
For those of you who do not want to repeat the installation, try changing caffe.set_mode_cpu() to caffe._caffe.set_mode_cpu(). It worked for me.
Hello, I am getting the same error. I am using Arch linux. I have tried everything mentioned. Still the error not resolved.
I got the same error, but fixed it with make the /path/caffe/python be the first of the $PYTHONPATH
here is the list of actions for dumb ppl like me :
- search for hours doing stupid check in python path
- say "bye bye" to your caffe directory !
Could you explain for more stupid person these two steps? ))
I set CPU_ONLY := 1in Makefile.config, then make clean, then make again, but I still have this Error:
caffe.set_mode_gpu()
AttributeError: module 'caffe' has no attribute 'set_mode_gpu'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/yulduz/Projects/GitHub/3dmm_cnn/demoCode/testBatchModel.py", line 113, in <module>
caffe.set_mode_cpu()
AttributeError: module 'caffe' has no attribute 'set_mode_cpu'