caffe 在 windows 下的配置(scripts\build_win.cmd)

来源:互联网 发布:怎么加入淘宝类目群 编辑:程序博客网 时间:2024/05/02 01:10

官网配置文档见:GitHub - BVLC/caffe at windows

1. windows 设置

  • requirements: 
    • visual studio 2013/2015
    • CMake >= 3.4(注意添加 cmake 的 bin 路径到 Path 环境变量中,保证命令行可以找到 cmake.exe)

2. 配置和编译 caffe

  • 进入 windows cmd 命令行,执行如下操作:

    C:\Projects> git clone https://github.com/BVLC/caffe.gitC:\Projects> cd caffeC:\Projects\caffe> git checkout windows:: Edit any of the options inside build_win.cmd to suit your needsC:\Projects\caffe> scripts\build_win.cmd
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    注: issue with build_win.cmd #5338

    • 如果不识别 git 命令,则需要在 windows 下安装 (git for windows),并将 bin 添加进环境变量;
    • 尤其注意,执行 git checkout windows(切换 windows 分支)之后,文档中的英文说明,需要根据自己的主机环境配置修改 scripts\build_win.cmd 文件;主要修改如下:

      • set WITH_NINJA=1 ⇒set WITH_NINJA=0,以使用 visual studio generator
      • 在 cmake 命令的倒数第二行,添加如下的两行,以人为指定C和C++编译器:
      -DCMAKE_C_COMPILER=cl.exe ^-DCMAKE_CXX_COMPILER=cl.exe ^
      • 1
      • 2

3. 其他问题

  • CMake Error: Error: generator : Visual Studio 14 2015 Win64 Does not match the generator used previously: Ninja
    删除生成的 build 文件夹,重启 cmd,重新编译;
  • Downloading prebuilt dependencies to failed:windows上命令行cmd下安装caffe 
    • 手动下载,放在指定位置(错误信息提示的位置(C:\Users\xx\.caffe\dependencies\download));
    • 重新编译;