Caffe Study Notes (i)--windows Caffe installation and configuration

Source: Internet
Author: User

This article mainly introduces: After some trouble, in the Windows7 64-bit system successfully configured Caffe, the following summarizes the basic configuration process, as well as the configuration process encountered problems.

Configuration environment: Windows7 X64 + CUDA7.0 + VS2013 + matlab2014a

1. Installing Cuda

1.1. Version Selection
As for the version selection, install the 7.5, 7.0 and 6.5 versions are available, the installation package is visible all over the Web, sharing a version of their own installed: Http://pan.baidu.com/s/1i5AmAZb

1.2 Installation process
The Cuda installation process and the VS associated process reference:
Http://wenku.baidu.com/link?url= Idoyy01i7q-4d6gjqzjocilfyibwpdbr3n3fgh4qxdpfjtkebm6diijbdhpinrl7mpuov7d1lwawzofmicvxvt_p5dtmidvngt7os_z_9_a
(VS2013 Association Process is the same as VS2012)
1.3 Updating the graphics driver
After installation, run Gefroce Experience, click "Driver", "Detect updates"

2. Configure Caffe

2.1. Download Caffe and third-party libraries
File See: http://blog.csdn.net/happynear/article/details/45372231, you can refer to the blog "one, Ready." (In the blog "Two, compile" is not clear enough, and follow the process of the blog to compile, you will encounter some problems, specific issues described below.) )

2.2. Compiling
(1) 1. Double-click the Caffe-windows-master/src/caffe/proto/extract_proto.bat batch file to generate three files: Caffe.pb.h, caffe.pb.cc, and Caffe_ pb2.py, the first two C + + files, and the last is a Python file;
(2) Open Caffe-windows-master/buildvs2013/mainbuilder.sln, switch the compilation mode to release X64 mode after opening. If the load fails after opening, your Cuda version may be inconsistent with the project, and the project is Cuda 7.5, which will be opened with Notepad caffe-windows-master/ The. vcxproj file in each folder in the buildVS2013 directory, search cuda 7.5, change this 7.5 to your own Cuda version, you can open it normally.
(3) To view the version of GPU CUDA capability for graphics, method:
Step1: Right-click Computer, properties, Device Manager, display adapter,

Step2: Depending on the graphics card model, see the CUDA capability version in Https://developer.nvidia.com/cuda-gpus:

The reason to view the video card CUDA Capability version is because: buildVS2013 project is turned on by default CUDNN, and CUDNN requires GPU CUDA Capability not less than 3.0 if CUDA Capability Version is less than 3.0, a similar problem occurs when the CUDNN is not closed during compilation:
Http://www.aiuxian.com/article/p-2150379.html
http://blog.csdn.net/eagelangel/article/details/50562065
(4) Modify the project pre-compile, close CUDNN
If the GPU CUDA Capability is no less than 3.0, skip the procedure below to do the following:
To turn off CUDNN by modifying precompilation, click Caffe Project, right-click Properties to open the Properties page,
Delete the USE_CUDNN in the preprocessor definition, and the other items in the work are also deleted USE_CUDNN
(5) Modify Matcaffe, Pycaffe engineering related properties
Caffe interface can be python, or MATLAB, I use MATLAB, so the MainBuilder.sln process of the Pycaffe process removed, introduced the Matcaffe modification process, Pycaffe project similar:
Step1: Open the Matcaffe Project Properties page, add the include path and the Lib path to Matlab:

Step2: Add additional directories to the connector:

(to be added according to your MATLAB path)
(6) The preparation has been completed, click "Generate" to compile, the editing process will take a long time.
When the compilation is complete, the Caffe_.mexw64 file is generated in "Caffe-windows-master\matlab+caffe\private".
3. Testing

3.1 Configuration
Step1: Add the folder ***caffe-windows-master\3rdparty\bin to the system environment variable, or you can copy these DLL files directly to "C:\Windows\System32" and "C:\Windows\ SysWOW64 "in;
Step2: Copy the DLL file in the 3rdparty\bin to "caffe-windows-master\matlab+caffe\private";

3.2 Testing
Step1:matlab Open
"CAFFE-WINDOWS-MASTER\MATLAB\DEMO\CLASSIFICATION_DEMO.M", CLASSIFICATION_DEMO.M requires a file Bvlc_reference_ Caffenet.caffemodel, you can go to
http://dl.caffe.berkeleyvision.org/
Download, download and put into "models/bvlc_reference_caffenet/";

Step2: Run [scores, Maxlabel] = Classification_demo ();
Operation Result:

4. Problems encountered and solutions
The original configuration process reference is: http://blog.csdn.net/happynear/article/details/45372231, the compilation process encountered some problems, and now summarize.

4.1 Compile-time, Matcaffe and Pycaffe compilation failed
Workaround: The reason is that when compiling, need some matlab and python some header files and library files, the process is not added, you need to add the process, see this article 2.2 (5)

4.2 Compilation succeeded, error occurred while testing CLASSIFICATION_DEMO.M: Invalid mex-file "... caffe_.mexw64" could not find the specified module
Such as:

Workaround: Configure by the 3.1 procedure. (originally used matlab2013a, compile successfully, but still have the problem, finally uninstall matlab2013a, switch to 2014a, if the 3.1 configuration cannot be resolved, you can consider the method)

4.3 caffe.net (Net_model, net_weights, Phase) function problem: Glog check error, please check log and clear Mex
The problem is not, the general tip is:

checkchecklog31)        self84)net = caffe.Net(net_model, net_weights, phase);

After the error will generate some files, log errors, open the folder "Caffe-windows-master\matlab\demo", you will find a few more files:

When you open the error file, you see the cause of the error:

The issue "Check failed:status = = cudnn_status_success (6 vs. 0) Cudnn_status_arch_mismatch" is because: the GPU CUDA Capability version is less than 3.0, the solution See Law 2.2 (3), (4)

Caffe Study Notes (i)--windows Caffe installation and 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.