一、编译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. RabbitMQ(4) TopicExchange

    topic 是RabbitMQ中最灵活的一种方式,可以根据routing_key自由的绑定不同的队列 生产者工程 package com.example.demo.rabbitMq.exchange. ...

  2. vs2015 ncnn

    1.vs2015编译器编译protobuf   (VS2015 x64本机工具命令) 下载源码:https://github.com/google/protobuf/archive/v3.4.0.zi ...

  3. 『TensorFlow』读书笔记_VGGNet

    VGGNet网络介绍 VGG系列结构图, 『cs231n』卷积神经网络工程实践技巧_下 1,全部使用3*3的卷积核和2*2的池化核,通过不断加深网络结构来提升性能. 所有卷积层都是同样大小的filte ...

  4. hdu6133 Army Formations 线段树合并

    给你一棵有n个节点的二叉树,每个节点有一个权值,对于一棵子树u,将u的子树中的节点权值从大到小排序,令sz[u]为子树u的大小, 则ans[u] = 1 * a[1] + 2 * a[2] + ... ...

  5. PAT 1054 The Dominant Color

    1054 The Dominant Color (20 分)   Behind the scenes in the computer's memory, color is always talked ...

  6. 线程池threadPools

    1.线程池是用来存储线程的容器 2.Executors.newFixedThreadPool(int n);创建线程池,并且设置线程池的容量为n 3.submit开启线程 4.会返回一个对象futur ...

  7. 包的作用域(public、private)

    包的作用域一共有三种情况 修饰符public:标记为public的部分可以被任意的类使用: 修饰符private:标记为private的部分只能被定义他们的类使用: 没有指定修饰符的部分:这部分(类. ...

  8. python笔记17-全局变量、局部变量

    在函数里面定义变量叫局部变量,它只能在函数里面用出了该函数外,就不能使用了在函数外面定义的变量,是全局变量,在函数内也可以使用 如果想在函数里面修改全局变量的值,那么要先用global关键字声明 要修 ...

  9. linux下使用命令修改IP地址

    使用root用户登录进入Linux,打开进去终端 在终端中输入:vi /etc/sysconfig/network-scripts/ifcfg-eth0 (最后的eth0是网卡名,我的是Auto_et ...

  10. GraphHttpClient概述

    博客地址:http://blog.csdn.net/FoxDave 目前这个东西还在预览阶段,所以不推荐在正式生产环境中使用. 我们可以使用Microsoft Graph接口来构建强大的解决方案来访问 ...