Windows 10 under Caffe + Matlab deployment

Source: Internet
Author: User
Tags windows support

Deploying Caffe under Windows 10 takes a lot of time to tune in, recording the key node for subsequent queries:

First, install the software:

1. Install Microsoft Virtual Studio 2013/matlab 2015a/cuda 7.5:

Note that VS2013 needs to be installed first to facilitate Matlab to identify vs path, CUDA binding content; VS2013 first installation is required;

Among them, VS2013 SP5 is a necessary version, according to Happynear [Csdn,github] Description, Caffe in VS2012 under the compilation speed is very slow (self-test VS2013 about half an hour, i7 6700HQ/64G/970M/3G+SSD);

CUDA test version 7.5, other versions do not know whether to modify the relevant content;

Matlab test using 2015A, before the previous reset system is 2015b, there seems to be no exception, there are welcome message feedback other versions;

2, installation CuDNN:

CuDNN improved the weakness of Caffe native roll base (see Zhao Ko/Reveals's masterpiece "deep learning-21 days Combat Caffe" a book P356 the convolution Network performance comparison), the author downloads The branch that Microsoft has developed for Windows Support CuDNN V3/v4, the latest version for V5,caffe has not yet official (branch) support, if you want to support please refer to the guidance of Mr. Reveals; If you do not have an NVIDIA account, you need to register an account to download CuDNN (online search can get network disk and other resources);

In addition, it is recommended that CuDNN be installed separately in a directory, independent of CUDA, easy to change the version (delete on the line);

3. Install the Direct X SDK [not required]:

The Direct X SDK is not necessary, Caffe's Demo compiler prompts a routine to require a d3d9.h file (not accurate, then the summary can not find the specific file, welcome message feedback), download this version is good;

4. Install Miniconda deployment [not required]:

In order to compile the Python version of Caffe, you need to install Miniconda;

Second, compile Caffe Windows branch:

There are many versions of Caffe's Windows branch, and the test uses Windows edition, which requires less content to modify (Happynear version tried, too complex for small white), or Microsoft version Microsoft/caffe easier, The records are as follows:

1. Download or Git source code:

Address: Portal;

2. Copy the. \windows\commonsettings.props.example file and rename it to. \windows\commonsettings.props;

3. Modification cuDNN enable option, decide whether to use CuDNN;

3, when installing CuDNN, if there is no decompression CuDNN in the CUDA directory, need to modify the CuDNN path;

4. Modify the Matlab path to the actual path:

5, you can open Caffe.sln and ready to compile:

The Windows edition relies on the third-party libraries that NuGet provides, so it's essential that the computer is able to surf the internet, and that the network is good (damn Great Wall broadband/damn Great Wall broadband/damn Great Wall broadband);

Compilation may encounter a heap of errors, it does not matter, check the past is good;

Among the tests encountered are:

Hint D3dx9.h file not found--install DirectX SDK;

Hint ALT_SSTREAM_IMPL.HPP file has a problem, simply press Ctrl + S to save;

Other may also encounter errors, please FQ or Baidu (message can also, small white I may not be able to solve);

It is important to note that if you need to run Matlab, you need to run Matlabprebuild.cmd before compiling, run matlabpostbuild.cmd after compiling;

Solve the inevitable compilation errors, happily generated all the Windows version of the file;

Third, run the Matlab version of the test:

1. Download the basic data:

You can download the required Bvlc_reference_caffenet.caffemodel files on GitHub, or find other resources such as a network disk, and then unzip to the. \models\bvlc_reference_caffenet directory when downloading is complete;

2. Prepare environment variables:

Add the compiled. \build\x64\release folder to the path of the environment variable, and if it does not succeed remember to reboot the system again (it is weird that the environment variable will be seen when the test is restarted);

3, start Matlab, point to the. \matlab\demo directory;

Add the path. \build\x64\release\matcaffe to Matlab Path, and then run the following command:

im = Imread ('.. /.. /examples/images/cat.jpg '); scores = Classification_demo (IM, 1); [Score, class] = max (scores);

Get output:

Elapsed time is 0.073357 seconds. Elapsed time is 0.153671 seconds. Cleared 0 Solvers and 1 stand-alone Nets

As can be seen, get the maximum possible label for 282,0.2985.

Run the following code to see more details of the classification results:

Figure;plot (scores); axis ([0, 999, -0.1, 0.5]); grid on

After a hard attempt, Caffe's Windows edition and FASTER-RCNN have been overcome, marking the resolution process for subsequent searches.

In addition, the more common error is "Invalid mex-file ' ... \caffe.mexw64 ': Cannot find the specified module", this error needs to be resolved in two steps, the first step is to add an environment variable, the directory is. \build\x64\release, and the second step is to Matcaffe added to the directory of MATLAB (may not have to, not add also successful);

When modifying the system environment variable, the test fails, but the reboot is OK, so adding the variable is not recommended to restart the system try; if not, copy all files generated under. \build\x64\release to. \matlab\+caffe\private, restart Matlab retry, should be able to resolve.

Windows 10 under Caffe + Matlab deployment

Related Article

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.