一、编译caffe

1、安装python-3.5.2-amd64.exe https://www.python.org/ftp/python/3.5.2/python-3.5.2-amd64.exe

2、安装matlab2016

3、安装vs2015

4、安装git

5、新建D:\Projects,进入该文件夹,下载源码

git clone:git clone https://github.com/BVLC/caffe.git

6、进入caffe文件夹

cd caffe

7、切换分支

git checkout windows

8、修改scripts\build_win.cmd ,高亮为修改内容

@echo off
@setlocal EnableDelayedExpansion :: Default values
if DEFINED APPVEYOR (
echo Setting Appveyor defaults
if NOT DEFINED MSVC_VERSION set MSVC_VERSION=
if NOT DEFINED WITH_NINJA set WITH_NINJA=
if NOT DEFINED CPU_ONLY set CPU_ONLY=
if NOT DEFINED CUDA_ARCH_NAME set CUDA_ARCH_NAME=Auto
if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=Release
if NOT DEFINED USE_NCCL set USE_NCCL=
if NOT DEFINED CMAKE_BUILD_SHARED_LIBS set CMAKE_BUILD_SHARED_LIBS=
if NOT DEFINED PYTHON_VERSION set PYTHON_VERSION=
if NOT DEFINED BUILD_PYTHON set BUILD_PYTHON=
if NOT DEFINED BUILD_PYTHON_LAYER set BUILD_PYTHON_LAYER=
if NOT DEFINED BUILD_MATLAB set BUILD_MATLAB=
if NOT DEFINED PYTHON_EXE set PYTHON_EXE=python
if NOT DEFINED RUN_TESTS set RUN_TESTS=
if NOT DEFINED RUN_LINT set RUN_LINT=
if NOT DEFINED RUN_INSTALL set RUN_INSTALL= :: Set python 2.7 with conda as the default python
if !PYTHON_VERSION! EQU (
set CONDA_ROOT=C:\Miniconda-x64
)
:: Set python 3.5 with conda as the default python
if !PYTHON_VERSION! EQU (
set CONDA_ROOT=C:\Miniconda35-x64
)
set PATH=!CONDA_ROOT!;!CONDA_ROOT!\Scripts;!CONDA_ROOT!\Library\bin;!PATH! :: Check that we have the right python version
!PYTHON_EXE! --version
:: Add the required channels
conda config --add channels conda-forge
conda config --add channels willyd
:: Update conda
conda update conda -y
:: Download other required packages
conda install --yes cmake ninja numpy scipy protobuf==3.1. six scikit-image pyyaml pydotplus graphviz if ERRORLEVEL (
echo ERROR: Conda update or install failed
exit /b
) :: Install cuda and disable tests if needed
if !WITH_CUDA! == (
call %~dp0\appveyor\appveyor_install_cuda.cmd
set CPU_ONLY=
set RUN_TESTS=
set USE_NCCL=
) else (
set CPU_ONLY=
) :: Disable the tests in debug config
if "%CMAKE_CONFIG%" == "Debug" (
echo Disabling tests on appveyor with config == %CMAKE_CONFIG%
set RUN_TESTS=
) :: Disable linting with python until we find why the script fails
if !PYTHON_VERSION! EQU (
set RUN_LINT=
) ) else (
:: Change the settings here to match your setup
:: Change MSVC_VERSION to to use VS
if NOT DEFINED MSVC_VERSION set MSVC_VERSION=
:: Change to to use Ninja generator (builds much faster)

if NOT DEFINED WITH_NINJA set WITH_NINJA=

    :: Change to  to build caffe without CUDA support
   

if NOT DEFINED CPU_ONLY set CPU_ONLY=

    :: Change to generate CUDA code for one of the following GPU architectures
:: [Fermi Kepler Maxwell Pascal All]
if NOT DEFINED CUDA_ARCH_NAME set CUDA_ARCH_NAME=Auto
:: Change to Debug to build Debug. This is only relevant for the Ninja generator the Visual Studio generator will generate both Debug and Release configs

if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=

Debug
:: Set to to use NCCL
if NOT DEFINED USE_NCCL set USE_NCCL=
:: Change to to build a caffe.dll
if NOT DEFINED CMAKE_BUILD_SHARED_LIBS set CMAKE_BUILD_SHARED_LIBS=
:: Change to if using python 3.5 (only 2.7 and 3.5 are supported)

if NOT DEFINED PYTHON_VERSION set PYTHON_VERSION=

    :: Change these options for your needs.
if NOT DEFINED BUILD_PYTHON set BUILD_PYTHON=
if NOT DEFINED BUILD_PYTHON_LAYER set BUILD_PYTHON_LAYER=

if NOT DEFINED BUILD_MATLAB set BUILD_MATLAB=

    :: If python is on your path leave this alone
if NOT DEFINED PYTHON_EXE set PYTHON_EXE=python
:: Run the tests
if NOT DEFINED RUN_TESTS set RUN_TESTS=
:: Run lint
if NOT DEFINED RUN_LINT set RUN_LINT=
:: Build the install target

if NOT DEFINED RUN_INSTALL set RUN_INSTALL=

)

:: Set the appropriate CMake generator
:: Use the exclamation mark ! below to delay the
:: expansion of CMAKE_GENERATOR
if %WITH_NINJA% EQU (
if "%MSVC_VERSION%"=="" (
set CMAKE_GENERATOR=Visual Studio Win64
)
if "%MSVC_VERSION%"=="" (
set CMAKE_GENERATOR=Visual Studio Win64
)
if "!CMAKE_GENERATOR!"=="" (
echo ERROR: Unsupported MSVC version
exit /B
)
) else (
set CMAKE_GENERATOR=Ninja
) echo INFO: ============================================================
echo INFO: Summary:
echo INFO: ============================================================
echo INFO: MSVC_VERSION = !MSVC_VERSION!
echo INFO: WITH_NINJA = !WITH_NINJA!
echo INFO: CMAKE_GENERATOR = "!CMAKE_GENERATOR!"
echo INFO: CPU_ONLY = !CPU_ONLY!
echo INFO: CUDA_ARCH_NAME = !CUDA_ARCH_NAME!
echo INFO: CMAKE_CONFIG = !CMAKE_CONFIG!
echo INFO: USE_NCCL = !USE_NCCL!
echo INFO: CMAKE_BUILD_SHARED_LIBS = !CMAKE_BUILD_SHARED_LIBS!
echo INFO: PYTHON_VERSION = !PYTHON_VERSION!
echo INFO: BUILD_PYTHON = !BUILD_PYTHON!
echo INFO: BUILD_PYTHON_LAYER = !BUILD_PYTHON_LAYER!
echo INFO: BUILD_MATLAB = !BUILD_MATLAB!
echo INFO: PYTHON_EXE = "!PYTHON_EXE!"
echo INFO: RUN_TESTS = !RUN_TESTS!
echo INFO: RUN_LINT = !RUN_LINT!
echo INFO: RUN_INSTALL = !RUN_INSTALL!
echo INFO: ============================================================ :: Build and exectute the tests
:: Do not run the tests with shared library
if !RUN_TESTS! EQU (
if %CMAKE_BUILD_SHARED_LIBS% EQU (
echo WARNING: Disabling tests with shared library build
set RUN_TESTS=
)
) if NOT EXIST build mkdir build
pushd build :: Setup the environement for VS x64
set batch_file=!VS%MSVC_VERSION%0COMNTOOLS!..\..\VC\vcvarsall.bat
call "%batch_file%" amd64 :: Configure using cmake and using the caffe-builder dependencies
:: Add -DCUDNN_ROOT=C:/Projects/caffe/cudnn-8.0-windows10-x64-v5./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= ^
-DINSTALL_PREREQUISITES:BOOL= ^
-DUSE_NCCL:BOOL=!USE_NCCL! ^
-DCUDA_ARCH_NAME:STRING=%CUDA_ARCH_NAME% ^
"%~dp0\.." if ERRORLEVEL (
echo ERROR: Configure failed
exit /b
) :: Lint
if %RUN_LINT% EQU (
cmake --build . --target lint --config %CMAKE_CONFIG%
) if ERRORLEVEL (
echo ERROR: Lint failed
exit /b
) :: Build the library and tools
cmake --build . --config %CMAKE_CONFIG% if ERRORLEVEL (
echo ERROR: Build failed
exit /b
) :: Build and exectute the tests
if !RUN_TESTS! EQU (
cmake --build . --target runtest --config %CMAKE_CONFIG% if ERRORLEVEL (
echo ERROR: Tests failed
exit /b
) if %BUILD_PYTHON% EQU (
if %BUILD_PYTHON_LAYER% EQU (
:: Run python tests only in Release build since
:: the _caffe module is _caffe-d is debug
if "%CMAKE_CONFIG%"=="Release" (
:: Run the python tests
cmake --build . --target pytest if ERRORLEVEL (
echo ERROR: Python tests failed
exit /b
)
)
)
)
) if %RUN_INSTALL% EQU (
cmake --build . --target install --config %CMAKE_CONFIG%
) popd
@endlocal

9、编译caffe

scripts\build_win.cmd

编译过程中需要下载依赖包libraries_v140_x64_py35_1.1.0.tar.bz2依赖包,速度极慢,所以提前下载https://github.com/willyd/caffe-builder/releases

先停止编译,将下载好的依赖包放到对应目录下,并且到上一级目录,将libraries_v140_x64_py35_1.1.0文件夹删除。

重新编译,等待编译成功。

10、生成的工程在caffe/build/目录下,可用VS2015打开Caffe.sln。

11、对着ALL_BUILD,右键,生成。

二、matcaffe部署及测试

1、将生成的matcaffe接口:D:\Projects\caffe\matlab\+caffe\private\Debug\caffe_.mexw64拷贝到private目录下;

2、测试

(1)打开matlab,将工作目录切换至D:\Projects\caffe;

(2)输入如下代码

>> cd d:
>> cd Projects
>> cd caffe
>> addpath('matlab')
>> caffe.set_mode_cpu();
>> fprintf(['Caffe Version = ', caffe.version(), '\n']);
Caffe Version = 1.0.
>>

win10+vs2015编译caffe的cpu debug版本、部署matcaffe的更多相关文章

  1. vs2015编译caffe

    有些时候,需要在python3的环境下import caffe,需要用vs2015在python3的环境下,编译pycaffe. microsoft的windows版本的caffe,依赖的库Nuget ...

  2. win10 + VS2015 编译 ARPACK

    step 1: 下载ARPACK , mingw-w64-install 和 mingw-get-inst-20120426.exe: step 2: 安装 MinGW-64默认安装路径即可. ste ...

  3. win10+vs2015编译nanogui

    !!版权声明:本文为博主原创文章,版权归原文作者和博客园共有,谢绝任何形式的 转载!! 作者:mohist 说明: A.OS : win10 1909 ,没有配置OpenGL开发环境的 经历. B. ...

  4. Win10+VS2015+EF6.0+MySQL5.6+MVC环境部署和排错

    本来已经好几个月不弄专业了,今天一哥们问我问题的时候重新捣鼓了一下,就做个文档供后来人参考吧~ 1.首先安装MySQL 5.6 安装很简单我就不说了,你参考下:http://jingyan.baidu ...

  5. win10 编译好的CPU版本caffe 配置自己的图像分类C++DEMO

    VC++目录 包含目录 F:\caffewindows\scripts\build\include F:\caffewindows\scripts\build F:\vs2015\VC\include ...

  6. [Caffe]Win10+VS2015+CUDA8.0+cudnn5.1环境配置

    百度:win10 caffe vs2015 编译caffe.sln工程参见->这里 caffe训练参见->这里 参见->这里 Windows+VS2013爆详细Caffe编译安装教程

  7. Windows下 VS2015编译RocksDB

    VS2015编译RocksDB RocksDB 是一个来自 facebook 的可嵌入式的支持持久化的 key-value 存储系统,也可作为 C/S 模式下的存储数据库,但主要目的还是嵌入式.Roc ...

  8. 实践详细篇-Windows下使用VS2015编译安装Caffe环境(CPU ONLY)

    学习深度学习背景 最近在做一款抢票软件,由于12306经常检测账号状态,抢票抢着抢着就需要重新登录了,然后登录是需要验证码的.所以我最开始是想到了使用java基于感知哈希算法pHash做相似度匹配识别 ...

  9. Win7 下用 VS2015 编译最新 openssl(1.0.2j)包含32、64位debug和release版本的dll、lib(8个版本)

    Win7 64位系统下通过VS2015编译好的最新的OpenSSL(1.0.2j)所有八个版本的链接库, 包含以下八个版本: 1.32位.debug版LIB: 2.32位.release版LIB: 3 ...

随机推荐

  1. legend2---开发日志10(ajax请求的方法是否同样会执行base控制器里面的方法)

    legend2---开发日志10(ajax请求的方法是否同样会执行base控制器里面的方法) 一.总结 一句话总结:会执行的,所以写base控制器里面的方法要注意,base控制器里面的方法要以查数据为 ...

  2. java8中的时间处理

    java8中关于时间的处理整理 package com.xb.utils; import java.time.*; import java.time.format.DateTimeFormatter; ...

  3. Practical Node.js (2018版) 第8章:Building Node.js REST API Servers

    Building Node.js REST API Servers with Express.js and Hapi Modern-day web developers use an architec ...

  4. pip freeze 命令迁移模块

    问题描述:现有一个测试环境安装了脚本相关的各类模块,现需要不通过联网下载,在另一个环境配置安装相同的模块 解决方案: 在安装了python脚本相关的各类模块的测试环境里,进入到任意目录下,导出pyth ...

  5. 『Python CoolBook』数据结构和算法_字典比较&字典和集合

    一.字典元素排序 dict.keys(),dict.values(),dict.items() 结合max.min.sorted.zip进行排序是个很好的办法,另外注意不使用zip时,字典的lambd ...

  6. python中的进程池和线程池

    Python标准模块-concurrent.futures #1 介绍 concurrent.futures模块提供了高度封装的异步调用接口 ThreadPoolExecutor:线程池,提供异步调用 ...

  7. 完美解决xhost +报错: unable to open display "" 装oracle的时候总是在弹出安装界面的时候出错

    详细很多朋友在装oracle的时候总是在弹出安装界面的时候出错,界面就是蹦不出来. oracle安装 先切换到root用户,执行xhost + 然后再切换到oracle用户,执行export DISP ...

  8. Shiro集成web环境[Springboot]-认证与授权

    Shiro集成web环境[Springboot]--认证与授权 在登录页面提交登陆数据后,发起请求也被ShiroFilter拦截,状态码为302 <form action="${pag ...

  9. 微服务架构演变过程-SpringCloud

  10. vue教程自学笔记(二)

    三.模板语法 1.文本 数据绑定最常见的形式就是使用“Mustache”语法 (双大括号) 的文本插值. 通过v-once指令,你也能执行一次性地插值,当数据改变时,插值处的内容不会更新. 2.原始H ...