Platform Environment: WIN10 64-bit caffe-master vs2013 matlab2016a
The first step:
Open a Commonsettings.props file under \caffe-master\windows,
Change the Matlabsupport to True (that is, the MATLAB interface is supported).
Step Two:
Change the path of MATLAB,
Step Three:
Add a path to the Includepath, and if not, the following error will appear at compile time: gpu/mxgpuarray.h "not Found
Copy this code:
<includepath>$ (Matlabdir) \extern\include;$ (matlabdir) \toolbox\distcomp\gpu\extern\include;$ (IncludePath) </IncludePath>
Fourth Step:
Open Caffe-master\windows under the Caffe.sln, find Matcaffe, select released (Do not use Debug), and then right-click Matcaffe, tap Generate.
PS: I don't know what the cause is wrong
Error 1 Error:nuget error:unable to find version ' 2.4.10 ' of the package ' opencv.overlay-x64_v120_release '. D:\NugetPackages\OpenCV.2.4.10\build\native\OpenCV.targets 772 5 Libcaffe
Select Regenerate to resolve. Of course, the students who did not make mistakes are ignored.
After the build is complete, there will be files under Caffe-master\build\x64\release\matcaffe\+caffe\private: Caffe_.mexw64
Fifth Step:
Open matlab, add path
Sixth step:
Add the system environment variable and put the. \caffe-master\build\x64\release is added to the system environment variable,
The following error occurs when running DEMO.M:
Invalid mex-file ' d:\caffe-master\build\x64\release\matcaffe\+caffe\private\caffe_.mexw64 ': The specified module could not be found.
Error CAFFE.SET_MODE_CPU (line 5)
Caffe_ (' set_mode_cpu ');
Error Classification_demo (line 71)
Caffe.set_mode_cpu ();
Seventh Step:
Copy all DLL files in Caffe-master\build\x64\debug to Caffe-master\matlab\+caffe\private
Eighth Step:
Download the model file (Bvlc_reference_caffenet.caffemodel) into the Caffe-master\models\bvlc_reference_caffenet folder
Link: http://pan.baidu.com/s/1geUv01l Password: yp9p (source: http://blog.csdn.net/zb1165048017/article/details/51702686)
Nineth Step:
Download tag file: Synset_words.txt, placed in the same folder as CLASSIFICATION_DEMO.M
Link: Http://pan.baidu.com/s/1c24ty6W Password: 3z7y (source: http://blog.csdn.net/zb1165048017/article/details/51702686)
Tenth step:
Open CLASSIFICATION_DEMO.M, run. If it appears
No function or variable ' caffe_ ' is defined.
Error CAFFE.SET_MODE_CPU (line 5)
Caffe_ (' set_mode_cpu ');
Error Classification_demo (line 71)
Caffe.set_mode_cpu ();
Please modify the second statement
Addpath ('.. /.. /build/x64/release/matcaffe ');
11th Step:
Running a test file test_mat.m, File source (source: http://blog.csdn.net/zb1165048017/article/details/51702686)
Download Link: Http://pan.baidu.com/s/1nvtwoBJ Password: t71u
stored in the same folder as CLASSIFICATION_DEMO.M
TEST_MAT.M source code is as follows:
- % Reference http://www.aichengxu.com/view/2422137
- Clear
- Clc
- im = Imread ('.. /.. /examples/images/cat.jpg ');% read picture
- Figure;imshow (IM);% Display Picture
- [Scores, Maxlabel] = Classification_demo (IM, 0);% get score the second parameter 0 is cpu,1 for the GPU
- Maxlabel% View Max tags yes who
- Figure;plot (scores);% draw a scoring situation
- Axis ([0, 999,-0.1, 0.5]),% axis range
- Grid on% with mesh
- FID = fopen (' synset_words.txt ', ' R ');
- i=0;
- While ~feof (FID)
- i=i+1;
- Lin = Fgetl (FID);
- Lin = Strtrim (Lin);
- if (I==maxlabel)
- fprintf (' The label of%d is%s\n ', I,lin)
- Break
- End
. end
Run results
"Caffe-windows" Caffe-master matlab interface configuration