"Caffe-windows" Caffe-master matlab interface configuration

Source: Internet
Author: User

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:

  1. % Reference http://www.aichengxu.com/view/2422137
  2. Clear
  3. Clc
  4. im = Imread ('.. /.. /examples/images/cat.jpg ');% read picture
  5. Figure;imshow (IM);% Display Picture
  6. [Scores, Maxlabel] = Classification_demo (IM, 0);% get score the second parameter 0 is cpu,1 for the GPU
  7. Maxlabel% View Max tags yes who
  8. Figure;plot (scores);% draw a scoring situation
  9. Axis ([0, 999,-0.1, 0.5]),% axis range
  10. Grid on% with mesh
  11. FID = fopen (' synset_words.txt ', ' R ');
  12. i=0;
  13. While ~feof (FID)
  14. i=i+1;
  15. Lin = Fgetl (FID);
  16. Lin = Strtrim (Lin);
  17. if (I==maxlabel)
  18. fprintf (' The label of%d is%s\n ', I,lin)
  19. Break
  20. End

. end

Run results

"Caffe-windows" Caffe-master matlab interface configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.