i compiled caffe successfully in my ubuntu machine but cannot import in python.
Caffe is installed /home/pbu/Desktop/caffe
i tried adding the /home/pbu/caffe
This happens when you have not run make
for the python files separately.
Run make pycaffe
soon after running make
in the Caffe directory.
You may have to set the path to the python library correctly in Makefile.config
Well, I use the cmake-gui
for making
Caffe. There you need to set the Python paths to the Anaconda-python:
PYTHON_EXECUTABLE <path_to_anaconda_home>/bin/python2.7
PYTHON_INCLUDE_DIRECTORY <path_to_anaconda_home>/include/PYTHON2.7
PYTHON_LIBRARY <path_to_anaconda_home>/lib/libpython2.7.so
I posted my Caffe install notes (my architecture: Arch Linux x86_64 | Intel i7 CPU ...) in an Anaconda Python 2.7 virtual environment here:
Caffe Installation Notes
https://gist.github.com/victoriastuart/fb2cb22209ccb2771963a25c06221213
I also encountered the (downstream) "Import caffe error," for which I needed to resolve my $PYTHONPATH to complete the make compilation and get Caffe finally installed, and also to be able to import it (in Python).
Adding to the above best answer. After you run make
for python files by running make pycaffe
where you ran your previous make
s. Then you have to export that python path by running export PYTHONPATH=<path-to-caffe>/python
. You can choose to run this everytime before running a python code which utilizes caffe or add it to your ~/.bashrc
.
You should build caffe and pycaffe using the command:
cd $FRCN_ROOT/caffe-fast-rcnn
make -j8 && make pycaffe
and before the compilation, you should create a Makefile.config
file and set the corresponding library path, such as python.
More details are presented on the web: bgirshick/py-faster-rcnn.
What's more, when I run the "Beyond the demo" section, it seams that if I Create a symlink of the folder "VOCdevkit" as "VOCdevkit2007" which turns out to be "can't find the dataset". So, I change the folder name as "VOCdevkit2007", and it runs well.