一、下载
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:\Anaconda2\envs\py3 )
:: 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 Files\NVIDIA GPU Computing Toolkit\CUDA\cuda ^ -C "D:\tyang\caffe-builder\build_v140_x64\libraries\caffe-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在电脑环境目录里
scripts\build_win.cmd
过程中会报错:libraries_v140_x64_py35_1.1.0.tar下载失败
手动下载: 地址
然后重命名 .tar.bz2 放到 C:\Users\tyang\.caffe\dependencies\download
再试一次
四、VS 编译
上面编译完会生成一个build文件夹,里面就是VS工程了
用VS2015打开选择Release生成ALL_BUILD
五、 Python接口
将 caffe-ssd\python\caffe 拷贝到 python所在\Lib\site-packages
原文地址:https://www.cnblogs.com/xuanyuyt/p/9772819.html
时间: 2024-11-09 07:47:41