win10+VS2015+CPU-Only install and configure Caffe

Recently, I am configuring Caffe. Since my computer graphics card is not NVIDIA, I can't use cuda, so I can only configure CPU-ONLY. There are many tutorials about configuration online, but the specific problems everyone encounters are different. Let's try to make a more complete summary:

First open the project Caffe for windows on github , which provides a relatively complete tutorial (of course, it does not tell you what pits...), to install it, you must have these things in the computer, as follows:
write picture description here

Let's analyze it bit by bit:

  1. First, VS2013 or VS2015 must be installed, because the underlying code of Caffe is mainly C++.
  2. CMake must be installed and the version must be >=3.4. About cmake download, cmake download , the latest version has reached 3.9. It has been downloaded, you can open cmd and try it out, as follows:
cmake -version

write picture description here

It shows that my cmake version is 3.4, which just meets the minimum requirements. It should be noted that this cmake must have been added to your system path , because when the script is executed later, it must be used directly. Check as follows:

write picture description here

The following are optional, because mine does not support gpu, so 3 and 4 are ignored. If you want to use Caffe in python, you need to install python (Anaconda is recommended, as for the version, only 2.7 and 3.5 are supported, you can download the corresponding ones on the official website, Anaconda download ), it should be noted that python also needs In the environment variables , check the following:

write picture description here

write picture description here

If you need to use Caffe in matlab, you must install matlab.

So make sure of these, you can continue to go down:

write picture description here

Execute according to the following code (according to your own file directory, not necessarily according to it):

C:\Projects> git clone https://github.com/BVLC/caffe.git
C:\Projects> cd caffe
C:\Projects\caffe> git checkout windows
C:\Projects\caffe> scripts\build_win.cmd

Generally, there is no problem in the first 3 steps. The file structure looks like this:

write picture description here

My Caffe path is there. At E:\DeepLearning\caffethis time, there is no build folder in it, which is generated by cmake later.

Then open scripts\build_win.cmdthis file (such as using Notepad++) and change some of the configurations in it (since APPVEYOR is not used, so look directly behind the else):

write picture description here

The main changes that need to be made are as follows:
1. Change the VS version number according to your own VS version
2. Set Ninja to 0, because it is not needed here
3. Set CPU_ONLY to 1, because the GPU is not used here
4. According to own python version, change the version number

After changing it and then executing scripts\build_win.cmdit, I encountered such a problem: Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (minimum required is "3.5"), I clearly configured the python path, and it can also be run directly in cmd. After searching for a long time, I still can't solve it, and then I suddenly saw this code:

write picture description here

Although it didn't run, it manually wrote out the python path, so I also put it in the else section, as follows:

write picture description here

Then I solved the problem, and then executed it again scripts\build_win.cmd, and found that it still reported an error, and a named libraries_v140_x64_py35_1.1.0.tar.bz2dependency package could not be downloaded successfully. So open the ...\caffe\cmake\WindowsDownloadPrebuiltDependencies.cmakefile and see its download address (the specific path needs to be added later, such as mine (https://github.com/willyd/caffe-builder/releases/download/v1.1.0/libraries_v140_x64_py35_1.1.0.tar.bz2):

write picture description here

The download address is this. So I manually went to this address to download the package, and it was downloaded many times at that time. At the beginning, the network speed was very slow (10KB/s. . . )
Put the downloaded files in ...(你的c盘当前用户目录)\.caffe\dependencies\downloadthis directory. Then open ...\caffe\cmake\WindowsDownloadPrebuiltDependencies.cmakethe file and comment out the download section (inside the red circle):

write picture description here

And open the ...\caffe\scripts\download_prebuilt_dependencies.pyfile, comment out the download section:

write picture description here

Then run it again build_win.cmd, and you can proceed smoothly. It will decompress the compressed package just downloaded, and then compile it slowly. . .

write picture description here

It took about 7 minutes to complete:

write picture description here

I smiled happily when I saw this scene. . . After tossing for a day, it was finally configured. So I started to configure the python interface again:

write picture description here
There are not many pits here, because Anaconda is installed, the installation package is very convenient (of course, it depends on the mood of the network speed), but some do not need to be installed, such as cmake, ninja, graphviz, according to the above picture, it is ok . Finally, you can import caffe in the python environment!

write picture description here

Next time I will talk about the mnist test.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325721339&siteId=291194637