win10 + cuda8.0 + caffe SSD + vs2015 + python3

Posted 学渣

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了win10 + cuda8.0 + caffe SSD + vs2015 + python3相关的知识,希望对你有一定的参考价值。

一、下载

git clone https://github.com/runhang/caffe-ssd.git
cd caffe-ssd

1. 修改 build_win.cmd

    if !PYTHON_VERSION! EQU 2 (
        set CONDA_ROOT=C:Anaconda2
    )
    :: Set python 3.5 with conda as the default python
    if !PYTHON_VERSION! EQU 3 (
        set CONDA_ROOT=C:Anaconda2envspy3
    )

 

:: Configure using cmake and using the caffe-builder dependencies
:: Add -DCUDNN_ROOT=C:/Projects/caffe/cudnn-8.0-windows10-x64-v5.1/cuda ^
:: below to use cuDNN
cmake -G"!CMAKE_GENERATOR!" ^
      -DBLAS=Open ^
      -DCMAKE_BUILD_TYPE:STRING=%CMAKE_CONFIG% ^
      -DBUILD_SHARED_LIBS:BOOL=%CMAKE_BUILD_SHARED_LIBS% ^
      -DBUILD_python:BOOL=%BUILD_PYTHON% ^
      -DBUILD_python_layer:BOOL=%BUILD_PYTHON_LAYER% ^
      -DBUILD_matlab:BOOL=%BUILD_MATLAB% ^
      -DCPU_ONLY:BOOL=%CPU_ONLY% ^
      -DCOPY_PREREQUISITES:BOOL=1 ^
      -DINSTALL_PREREQUISITES:BOOL=1 ^
      -DUSE_NCCL:BOOL=!USE_NCCL! ^
      -DCUDA_ARCH_NAME:STRING=%CUDA_ARCH_NAME% ^
      -DCUDNN_ROOT=C:Program FilesNVIDIA GPU Computing ToolkitCUDAcuda ^
-C "D: yangcaffe-builderuild_v140_x64librariescaffe-builder-config.cmake" ^ "%~dp0.."

(上面粉红色部分就是第三方库的文件位置,根据自己的位置改下,不加上这句的话默认在user/.caffe下)

2. 修改 download_prebuilt_dependencies.py

(v140, 3.6)

3. 修改 WindowsDownloadPrebuiltDependencies.cmake

set(DEPENDENCIES_VERSION 1.1.0)
set(DEPENDENCIES_NAME_1800_27 libraries_v120_x64_py27_${DEPENDENCIES_VERSION})
set(DEPENDENCIES_NAME_1900_27 libraries_v140_x64_py27_${DEPENDENCIES_VERSION})
set(DEPENDENCIES_NAME_1900_36 libraries_v140_x64_py35_${DEPENDENCIES_VERSION})

set(DEPENDENCIES_URL_BASE https://github.com/willyd/caffe-builder/releases/download)
set(DEPENDENCIES_FILE_EXT .tar.bz2)
set(DEPENDENCIES_URL_1800_27 "${DEPENDENCIES_URL_BASE}/v${DEPENDENCIES_VERSION}/${DEPENDENCIES_NAME_1800_27}${DEPENDENCIES_FILE_EXT}")
set(DEPENDENCIES_SHA_1800_27 "ba833d86d19b162a04d68b09b06df5e0dad947d4")
set(DEPENDENCIES_URL_1900_27 "${DEPENDENCIES_URL_BASE}/v${DEPENDENCIES_VERSION}/${DEPENDENCIES_NAME_1900_27}${DEPENDENCIES_FILE_EXT}")
set(DEPENDENCIES_SHA_1900_27 "17eecb095bd3b0774a87a38624a77ce35e497cd2")
set(DEPENDENCIES_URL_1900_36 "${DEPENDENCIES_URL_BASE}/v${DEPENDENCIES_VERSION}/${DEPENDENCIES_NAME_1900_35}${DEPENDENCIES_FILE_EXT}")
set(DEPENDENCIES_SHA_1900_36 "f060403fd1a7448d866d27c0e5b7dced39c0a607")

 

                find_package(PythonInterp 3.6)

 

二、编译第三方库

(就是上面粉红色部分得第三方库)

git clone https://github.com/willyd/caffe-builder.git
cd caffe-builder
build_v140_x64.cmd

速度可能有点慢,而且要下载。。。技术分享图片

三、Cmake 编译

确保cmake在电脑环境目录里

scriptsuild_win.cmd

过程中会报错:libraries_v140_x64_py35_1.1.0.tar下载失败

手动下载: 地址

然后重命名 .tar.bz2 放到 C:Users yang.caffedependenciesdownload

再试一次技术分享图片

 

四、VS 编译

上面编译完会生成一个build文件夹,里面就是VS工程了

用VS2015打开选择Release生成ALL_BUILD

五、 Python接口

将 caffe-ssdpythoncaffe 拷贝到 python所在Libsite-packages

以上是关于win10 + cuda8.0 + caffe SSD + vs2015 + python3的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu 1604 + cuda8.0 + caffe

Ubuntu 16.04系统下CUDA8.0配置Caffe教程

caffe 在window下编译(windows7, cuda8.0,matlab接口编译)

Ubuntu16.04 +cuda8.0+cudnn+caffe+theano+tensorflow配置明细

ubuntu16.04+cuda8.0+cudnn5.0+caffe

caffe-windows编译