在 ubuntu 18.04 LTS 上安装 caffe

Yan*_*ang 5 makefile caffe ubuntu-18.04

我正在 Ubuntu 18.04 LTS 版本上安装 caffe-cpu 和 anaconda。

无论如何,我成功地在我的系统上安装了 Anaconda,但是我在安装 caffe 时遇到了麻烦。

我找到了很多页面,例如youtube,但没有帮助,所以我阅读了很多官方安装手册页面(我认为这是官方页面)。在这个页面,

Installing Caffe from source

We may install the dependencies by merely one line
sudo apt build-dep caffe-cpu        # dependencies for CPU-only version
sudo apt build-dep caffe-cuda       # dependencies for CUDA version
Run Code Online (Sandbox Code Playgroud)

它需要在你的sources.list 中有一个deb-src 行。继续合

我不知道结束行的意思。我试图修复/etc/apt/sources.list为禁用的
“#”部分,但它失败了。我在互联网上找不到正确的方法。当我只是按照编译链接时,他们说使用 Make 或 CMake 进行编译。我也不知道如何跟踪这些信息。我发现了一些makefile.config Github 页面,当我使用make all命令时它失败了。

你能给我一些建议来帮助安装 caffe-cpu 版本吗?感谢您阅读我的问题。

GPr*_*hap 3

我能够按照以下步骤让它工作,

  1. 在这里获取 caffe 源代码(https://github.com/BVLC/caffe.git

  2. 如果需要 GPS 支持,请安装 CUDA ( https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804 )

  3. 如果您需要 GPS 支持,请安装 CUDNN ( https://developer.nvidia.com/rdp/cudnn-download )

  4. 用这个替换现有的Makefile.config(https://gist.github.com/GPrathap/1f9d184c55779509860b8bf92cea416d)这里我已经配置了cuda 9.2。如果您有不同的版本,请搜索 9.2 并更改您已安装的版本。另外,请重新检查 Makefile.config 中声明的所有路径。

  5. 您可以输入make all,然后输入make test

  6. make distribute为了创建最终的 lib,可以在 (caffe/distribute) 中找到 caffe 的包含目录。

  7. 如果您使用的是 CMake 类型项目,请添加在哪里可以找到 caffe,如下所示,

      set(Caffe_DIR "/home/software/caffe/distribute")   
      set(Caffe_INCLUDE_DIRS "/home/software/caffe/distribute/include")  
      set(Caffe_LIBRARIES "/home/software/caffe/distribute/lib/libcaffe.so")
    
    Run Code Online (Sandbox Code Playgroud)
  8. 添加包含目录include_directories(${Caffe_INCLUDE_DIRS})

  9. 添加库${Caffe_LIBRARIES}

  10. 如果您想有另一种构建方式,请适当添加 PATH