ssd 环境配置

来源:互联网 发布:网络女歌手唱的谁不是 编辑:程序博客网 时间:2024/06/08 07:23
ssd环境配置有好多坑。因为要编译pycaffe需要自己修改makefile.config的代码

主要是因为之前只用了anaconda3,编译pycaffe之后,版本不太兼容()。

这里是caffe官网的原文

Caffe’s Python interface works with Python 2.7. Python 3.3+ should work out of the box without protobuf support. For protobuf support please install protobuf 3.0 alpha (https://developers.google.com/protocol-buffers/). Earlier Pythons are your own adventure


之后重新装了anaconda2


这里觉得比较保险的配置过程是先编译caffe
再使用指令验证是否能正常加载Python库

import caffe

如果没有错误了 则表示可以使用了


值得一提的是使用makefile.config

1. 修改一下CUDA的编译选项

#CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \#-gencode arch=compute_20,code=sm_21 \#-gencode arch=compute_30,code=sm_30 \#-gencode arch=compute_35,code=sm_35 \#-gencode arch=compute_50,code=sm_50 \#-gencode arch=compute_52,code=sm_52 \#-gencode arch=compute_60,code=sm_60 \#-gencode arch=compute_61,code=sm_61 \#-gencode arch=compute_61,code=compute_61CUDA_ARCH := -gencode arch=compute_30,code=sm_30


2. 修改python库的编译 指向anaconda

# NOTE: this is required only if you will compile the python interface.# We need to be able to find Python.h and numpy/arrayobject.h.# PYTHON_INCLUDE := /usr/include/python2.7 \# /usr/lib/python2.7/dist-packages/numpy/core/include# Anaconda Python distribution is quite popular. Include path:# Verify anaconda location, sometimes it's in root.ANACONDA_HOME := $(HOME)/anaconda2PYTHON_INCLUDE := $(ANACONDA_HOME)/include \$(ANACONDA_HOME)/include/python2.7 \$(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include# Uncomment to use Python 3 (default is Python 2)# PYTHON_LIBRARIES := boost_python3 python3.5m# PYTHON_INCLUDE := /usr/include/python3.5m \#                 /usr/lib/python3.5/dist-packages/numpy/core/include# We need to be able to find libpythonX.X.so or .dylib.# PYTHON_LIB := /usr/libPYTHON_LIB := $(ANACONDA_HOME)/lib

3. 修改环境变量

gedit ~/.bashrc

#caffe path#export PYTHONPATH=/home/billbliss/caffe/python:$PYTHONPATH


接下来也是一样的方式配置ssd-caffe

使用makefile.config

1. 修改一下CUDA的编译选项

2. 修改python库的编译 指向anaconda

3. 修改环境变量

#ssd pathexport PYTHONPATH=/home/billbliss/ssd/caffe/python:$PYTHONPATH