下载编译
0.确认电脑上有VS2013
0.确认显卡GPU Compute Capability>=3.0
1.安装CUDA7.5
2.下载cuDNN v4,添加到CUDA7.5
3.根据https://github.com/Microsoft/caffe进行编译(64位Release模式)
4.需要下载的附加包已传到百度云NugetPackages与caffe文件夹并列存放
获取和生成caffe使用的Mnist数据集
由于自带的脚本是针对Linux系统的,需要修改
get_mnist.sh1.bat
echo "Downloading..." set wget="../../../3rdparty/tools/wget.exe" for %%i in (train-images-idx3-ubyte train-labels-idx1-ubyte t10k-images-idx3-ubyte t10k-labels-idx1-ubyte) do %wget% --no-check-certificate http://yann.lecun.com/exdb/mnist/%%i.gz echo "done"
get_mnist.sh2.bat
echo "Renaming..." set do_7za="../../../3rdparty/tools/7za.exe" for %%i in (train-images-idx3-ubyte train-labels-idx1-ubyte t10k-images-idx3-ubyte t10k-labels-idx1-ubyte) do %do_7za% x %%i.gz rename train-images.idx3-ubyte train-images-idx3-ubyte rename train-labels.idx1-ubyte train-labels-idx1-ubyte rename t10k-images.idx3-ubyte t10k-images-idx3-ubyte rename t10k-labels.idx1-ubyte t10k-labels-idx1-ubyte echo "done"
create_mnist-lmdb.sh.bat
set DATA=../../data/mnist set EXAMPLE=../../examples/mnist set TOOLS=../../Build/x64/Release set BACKEND=lmdb REM set BACKEND=leveldb echo "Creating %BACKEND%..." rd /s /q "mnist_train_%BACKEND%" rd /s /q "mnist_test_%BACKEND%" "%TOOLS%/convert_mnist_data.exe" %DATA%/train-images-idx3-ubyte %DATA%/train-labels-idx1-ubyte mnist_train_%BACKEND% --backend=%BACKEND% "%TOOLS%/convert_mnist_data.exe" %DATA%/t10k-images-idx3-ubyte %DATA%/t10k-labels-idx1-ubyte mnist_test_%BACKEND% --backend=%BACKEND% echo "Done." pause
train_lenet.sh.bat
cd ../../ "Build/x64/Release/caffe.exe" train --solver=examples/mnist/lenet_solver.prototxt pause
测试结果
python支持
1.安装anaconda
2.cmd运行pip install protobuf
3.修改CommonSettings.props然后生成pycaffe项目
<PythonSupport>true</PythonSupport>
<PythonDir>相应路径</PythonDir>
4.添加环境变量,“PythonPath” 指向相应路径Buildx64Releasepycaffe
5.import caffe无报错即通过
matlab支持
1.安装matlab
2.修改CommonSettings.props然后生成matcaffe项目
<MatlabSupport>true</MatlabSupport>
<MatlabDir>相应路径</MatlabDir>
3.将相应路径Buildx64Release添加到path环境变量
4.把相应路径Buildx64Releasematcaffe添加到matlab的search path中
5.运行classification_demo.m
>> classification_demo
using caffe/examples/images/cat.jpg as input image
Elapsed time is 0.078070 seconds.
Elapsed time is 0.381840 seconds.
Cleared 0 solvers and 1 stand-alone nets