標籤:import mat ini 1.0 ror com lag proc label
一、編譯環境
1.下載caffe windows版源碼
https://github.com/BVLC/caffe/tree/windows
2.CUDA
CUDA 7.5 or 8.0 (use CUDA 8 if using Visual Studio 2015)
3.cuDNN v5
將下載的bin,include及lib拷貝到CUDA對應的目錄(我的為:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5)。
4.Matlab
R2016b(我的版本)
5.Anaconda Python 2.7
https://conda.io/miniconda.html
下載後雙擊可執行程式安裝到C:\Miniconda2。
安裝完畢後啟動cmd.exe,輸入conda list可以看到一些安裝包;
更新conda包
conda update conda
安裝numpy
conda install numpy
二、編譯
進入caffe\windows目錄,複製CommonSettings.props.example檔案為CommonSettings.props(粗體字部分為修改處),其內容如下
<?xml version="1.0" encoding="utf-8"?><Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ImportGroup Label="PropertySheets" /> <PropertyGroup Label="UserMacros"> <BuildDir>$(SolutionDir)..\Build</BuildDir> <!--NOTE: CpuOnlyBuild and UseCuDNN flags can‘t be set at the same time.--> <CpuOnlyBuild>true</CpuOnlyBuild> <UseCuDNN>false</UseCuDNN> <CudaVersion>7.5</CudaVersion> <!-- NOTE: If Python support is enabled, PythonDir (below) needs to be set to the root of your Python installation. If your Python installation does not contain debug libraries, debug build will not work. --> <PythonSupport>true</PythonSupport> <!-- NOTE: If Matlab support is enabled, MatlabDir (below) needs to be set to the root of your Matlab installation. --> <MatlabSupport>true</MatlabSupport> <CudaDependencies></CudaDependencies> <!-- Set CUDA architecture suitable for your GPU. Setting proper architecture is important to mimize your run and compile time. --> <CudaArchitecture>compute_35,sm_35;compute_52,sm_52</CudaArchitecture> <!-- CuDNN 4 and 5 are supported --> <CuDnnPath>$(CUDA_PATH)</CuDnnPath> <ScriptsDir>$(SolutionDir)\scripts</ScriptsDir> </PropertyGroup> <PropertyGroup Condition="‘$(CpuOnlyBuild)‘==‘false‘"> <CudaDependencies>cublas.lib;cuda.lib;curand.lib;cudart.lib</CudaDependencies> </PropertyGroup> <PropertyGroup Condition="‘$(UseCuDNN)‘==‘true‘"> <CudaDependencies>cudnn.lib;$(CudaDependencies)</CudaDependencies> </PropertyGroup> <PropertyGroup Condition="‘$(UseCuDNN)‘==‘true‘ And $(CuDnnPath)!=‘‘"> <LibraryPath>$(CuDnnPath)\lib\x64;$(LibraryPath)</LibraryPath> <IncludePath>$(CuDnnPath)\include;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup> <OutDir>$(BuildDir)\$(Platform)\$(Configuration)\</OutDir> <IntDir>$(BuildDir)\Int\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir> </PropertyGroup> <PropertyGroup> <LibraryPath>$(OutDir);$(CUDA_PATH)\lib\$(Platform);$(LibraryPath)</LibraryPath> <IncludePath>$(SolutionDir)..\include;$(SolutionDir)..\include\caffe\proto;$(CUDA_PATH)\include;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup Condition="‘$(PythonSupport)‘==‘true‘"> <PythonDir>C:\Miniconda2</PythonDir> <LibraryPath>$(PythonDir)\libs;$(LibraryPath)</LibraryPath> <IncludePath>$(PythonDir)\include;$(PythonDir)\Lib\site-packages\numpy\core;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup Condition="‘$(MatlabSupport)‘==‘true‘"> <MatlabDir>C:\Program Files\MATLAB\R2016b</MatlabDir> <LibraryPath>$(MatlabDir)\extern\lib\win64\microsoft;$(LibraryPath)</LibraryPath> <IncludePath>$(MatlabDir)\extern\include;$(MatlabDir)\toolbox\distcomp\gpu\extern\include;$(IncludePath)</IncludePath> </PropertyGroup> <ItemDefinitionGroup Condition="‘$(CpuOnlyBuild)‘==‘true‘"> <ClCompile> <PreprocessorDefinitions>CPU_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="‘$(UseCuDNN)‘==‘true‘"> <ClCompile> <PreprocessorDefinitions>USE_CUDNN;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> <CudaCompile> <Defines>USE_CUDNN</Defines> </CudaCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="‘$(PythonSupport)‘==‘true‘"> <ClCompile> <PreprocessorDefinitions>WITH_PYTHON_LAYER;BOOST_PYTHON_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="‘$(MatlabSupport)‘==‘true‘"> <ClCompile> <PreprocessorDefinitions>MATLAB_MEX_FILE;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup> <ClCompile> <MinimalRebuild>false</MinimalRebuild> <MultiProcessorCompilation>true</MultiProcessorCompilation> <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;USE_OPENCV;USE_LEVELDB;USE_LMDB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <TreatWarningAsError>true</TreatWarningAsError> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="‘$(Configuration)|$(Platform)‘==‘Release|x64‘"> <ClCompile> <Optimization>Full</Optimization> <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> <GenerateDebugInformation>true</GenerateDebugInformation> <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="‘$(Configuration)|$(Platform)‘==‘Debug|x64‘"> <ClCompile> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> </Link> </ItemDefinitionGroup></Project>
Caffe windows編譯