windows配置caffe及matlab接口编译和调用(cpu和gpu)
环境:windows 7+matlab2016a+vs2013
caffe下载地址:https://github.com/BVLC/caffe/tree/windows
1 进入caffe-windows的windows文件夹,Copy .\windows\CommonSettings.props.example
to .\windows\CommonSettings.props
2 打开caffe工程,编辑CommonSettings.props文件,以下是cpu版本设置
<CpuOnlyBuild>true</CpuOnlyBuild>
<UseCuDNN>false</UseCuDNN>
<CudaVersion>7.5</CudaVersion>
<PythonSupport>false</PythonSupport>
<MatlabSupport>true</MatlabSupport>
<CudaDependencies></CudaDependencies>
<PropertyGroup Condition="‘$(MatlabSupport)‘==‘true‘">
<MatlabDir>C:\Program Files\MATLAB\R2016a</MatlabDir>
<LibraryPath>$(MatlabDir)\extern\lib\win64\microsoft;$(LibraryPath)</LibraryPath>
<IncludePath>$(MatlabDir)\extern\include;$(IncludePath)</IncludePath>
</PropertyGroup>
3 选择matcaffe项目,点击编译(会自动去下载第三方库),在Build\x64\Release会生成相应的文件
4 将上面Build\x64\Release绝对路径加入到系统环境path变量中,同时将Build\x64\Release\matcaffe加入到matlab路径中。
5 重新启动matlab,调用caffe.reset_all(),则说明ok。
>> caffe.reset_all();
Cleared 0 solvers and 0 stand-alone nets
>>