How to be quick and rough and snap to compile Caffe under Windows and use its MATLAB and Python interfaces __python

Source: Internet
Author: User
Tags wrapper
0. Recent Updates

The contents of this blog are all obsolete and need to be installed by Caffe Windows version of the official tutorial (https://github.com/BVLC/caffe/tree/windows) directly. can also follow my GitHub (https://github.com/happynear/caffe-windows) in the instructions to install, the future updates will be on the GitHub, this blog will not be updated, please understand. First, prepare

Need to use the things I have to help everyone ready, there are February 4, 2016 just from Caffe official Master Branch fork over the source code: Https://www.github.com/happynear/caffe-windows. Have my own hand-made Third-party library http://pan.baidu.com/s/1bSzvKa, in the root directory of the source code to create a 3rdparty folder, the file can be unzipped.
  after the decompression is done, add the 3rdparty/bin folder to the path of the environment variable so that the program can find the DLL for those third-party libraries.
Finally, the Cuda and Mkl, MKL is optional, you can go to the Intel official application, if not CPU mode does not matter, in the third party library I also provided the Openblas library files.
I am using the Cuda 7.5 version and recommend that you install this version as well.
   Second, compiling

The compilation is very simple and is divided into the following steps:
1. Double-click the./src/caffe/proto/extract_proto.bat batch file to generate Caffe.pb.h and caffe.pb.cc two C + + files, and caffe_pb2.py the file used by this python.
2, open./buildvs2013/mainbuilder.sln, switch the compile mode to release X64 mode after opening. If the load failed to display after opening, perhaps your cuda version and my inconsistency, my Cuda version 7.5, this time to use Notepad to open. vcxproj files in each folder under/buildvs2013 directory, search Cuda 7.5, replace this 7.5 with your own CUDA version, you can open it normally.
Also, if your video card is older or does not have a video card, use the./build_cpu_only/mainbuilder.sln.
3. Click the green triangle in the top toolbar to compile it. It may take about half an hour to compile, please wait patiently.
  
If you want to use the Matlab wrapper to extract features, observe the weight of training good, just want to Matcaffe project inside the MATLAB directory to modify into your own, and then compile, you can from matlab/+caffe/ Private folder inside find a file called Caffe_.mexw64.
Python's wrapper is similar to changing the Python directory in the Pycaffe project to your own (I'm using anaconda) to generate _caffe.pyd python DLL files in the Python/caffe folder. third, testing

To Http://pan.baidu.com/s/1mgl9ndu download the LEVELDB data file of the converted mnist, extract it into the./examples/mnist folder, and then run the Run_ under the root directory Mnist.bat can start training, the training log will be stored in the./log folder, starting with info, in TXT-formatted log file.

PS: If you compile successfully, don't forget to Point star to my GitHub project.
iv. Old update log

2015/02/25 Microsoft produced a caffe Windows version, they are more professional, made out of the solution easier to maintain, the Third-party library is completely managed by NuGet, almost no need to configure what things, suggest everyone to try: https:// Github.com/microsoft/caffe.
2015/12/09 I summed up some of the more common questions, written in https://github.com/happynear/caffe-windows/blob/master/FAQ.md, and will continue to be updated in the future, If you encounter a problem, please check out this FAQ list first.
2015/09/14 Caffe now supports a stand-alone multiple GPU, which can be trained using multiple GPU directly after the Caffe command plus--gpu=all or--gpu=0,1.
If you are using multiple GPU training, do not directly point to the CMD window x, it is best to use CTRL + C to terminate the program, otherwise the graphics driver will sometimes crash.
And if you want to save a snapshot in the middle of your training, you can use Ctrl+break.
Therefore, a normal termination training operation is:
First Ctrl+break Save the current working state, then CTRL + C terminates the training.

The

2015/08/18 Lmdb can now be used, but the disk must be in NTFS format. If necessary, please go to Http://pan.baidu.com/s/1dDHbbgP to download and overwrite the file with the same name in 3rdparty/lib, then right-click the project-> only for projects-> link only, no need to regenerate.
2015/08/08 A lot of people reported (including myself) that CUDNN V3 was much slower than V2, so the master branch was rolled back to the V2 version, and luckily Cudnn backwards-compatible, so there was no need to download the Third-party library again.
2015/08/06 New Caffe-windows online, because the vs2012 compilation speed is too slow, starting from this version, no longer provide support for vs2012.
2015/07/07 Now Caffe also supports VS2013, and third party libraries are all updated to the latest version. Please download and replace the original build folder from Http://pan.baidu.com/s/1sj3IvzZ Http://pan.baidu.com/s/1i390tZB, and the other steps are consistent with previous versions. If you find a bug, please feedback to me, leave a message or mention issue on GitHub.
2015/06/07 Add Insanity Layer (that is, randomized leaky rectified linear), I do not know why is called units. The paper says the effect is better than prelu.
2015/06/05 to update the Caffe version to the master branch of June 5, the biggest difference with the previous version is that the Matlab interface is richer, CUDNN update to the V2 version, so to download the Third-party library. The
2015/06/05 Batch Normalization is updated to the new edition, and the default Mnist test file is now a version that uses the Batch normalization layer.
2015/05/29 found that the previous version of the lmdb.lib using someone else in the vs2013 compiled version, is changed to vs2012 version;
2015/05/29 added a MATLAB interface to extract any layer features, using the method:

OUTPUT = Caffe (' Get_features ', INPUT, ' layername1,layername2 ... ');

For example: F = Caffe (' Get_features ', H, ' conv51,pool5 '); The returned F is the cell type of 2*1, which records the name of the layer and the characteristics of that layer.
There is now a better way to get each layer of features, and the function is no longer updated. Please refer to the new MATLAB interface.

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.