一、编译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. 20175317 《Java程序设计》第五周学习总结

    20175317 <Java程序设计>第五周学习总结 教材学习内容总结 第五周我学习了教材第六章的内容,了解了接口的知识,学到了以下内容: 明白了什么是接口 学会了如何实现接口 了解了接口 ...

  2. JavaScript基础三

    1.10 关于DOM的事件操作 1.10.1 JavaScript的组成 JavaScript基础分为三个部分: ECMAScript:JavaScript的语法标准.包括变量.表达式.运算符.函数. ...

  3. selenium java 文件上传、下载

    1.webdriver对页面文件的下载 我们一般操作浏览器下载时会让我们选择下载的目录然后经过一系列操作后才进行文件下载操作,但是用webdriver不能按这样的方式操作.经过查询资料找到了如下的实现 ...

  4. python自动化测试入门篇-jemter连接mysql数据库

    jmeter对数据库的操作主要包括以下几个步骤:1.导入mysqlde jdbc的jar包:2.创建数据库连接配置:3.线程组添加jdbc request;4.启动按钮,添加查看结果树 一.准备好驱动 ...

  5. Dockerfile命令大全

    Dockerfile 制作Dockerfile为Docker入门学习的第一步. Dockerfile可以快速的帮助我们去构建镜像, 是在工作中必备的一项技能, 下面整理了一些命令 FROM 功能为指定 ...

  6. 轻松学习java可重入锁(ReentrantLock)的实现原理

    转载自https://blog.csdn.net/yanyan19880509/article/details/52345422,(做了一些补充) 前言 相信学过java的人都知道 synchroni ...

  7. 网站压力测试工具http_load的安装与使用

    一.安装 1.下载地址:http://www.acme.com/software/http_load/http_load-09Mar2016.tar.gz 2.解压后进入目录,执行make & ...

  8. mysql sql文件批量处理

    简单动作复杂化,导致处理文件误入坑, 数据库拷贝,备份还原是每个面向对象的开发人员避免不了的动作,在数据库使用中,习惯性的使用第三方数据库管理软件,最近需要做数据库迁移,导出的批量sql文件不知如何区 ...

  9. JQ 关于each() 箭头函数报错的问题

  10. idea:打包jar(原文by曲高终和寡)

    idea打包java可执行jar包   1,在项目上鼠标右键 --> Open Module Settings 2, Artifacts --> + --> JAR --> F ...