python调用caffe

来源:互联网 发布:黑客和程序员哪个厉害 编辑:程序博客网 时间:2024/06/05 13:12

首先需要安装caffe for python,安装过程可以参考:http://blog.csdn.net/u011961856/article/details/76557509

python 中调用caffe库函数为:

import caffe

如果不再caffe目录下运行汇报错:

import caffe

ImportError: No module named caffe

这是因为找不到caffe库,我们可以在代码中设置caffe路径,例如我的caffe安装目录为/home/program/caffe,则设置路径如下:

import syscaffe_root='/home/program/caffe'sys.path.insert(0, caffe_root + '/python')import caffe

调用成功:


阅读全文
0 0
原创粉丝点击