Caffe installation (CPU only) and initial training under Ubuntu

After installing Ubuntu, it took one and a half days to adjust the various parameters of Ubuntu to the installation of caffe. At the last moment, I typed Enter and watched the continuous flow of output. Hhhh
, I briefly sorted out the tutorial websites that were referenced in the process. Sure enough, if you really want to debug it well, you still need the expertise of Bo Baijia.

A _ubuntu 16.04 installation:

Refer to Zhihu
link : https://www.zhihu.com/question/20565314

Some problems during installation:

1. Some computers will find that they cannot be partitioned when partitioning. The reason may be that there are already 4 partitions. Because the E drive is all data, I created a new folder called E in the adjacent disk, and after moving it, I wrote a script to use the subst command to map the E folder to the virtual disk E every time I boot up: use it like this There is no problem (but the exe file/exe installation file cannot be opened in the virtual disk, and the absolute path must be used)

2. The installation speed of Ubuntu is very fast. After installation, it will ask to restart. If there is no response after a period of time, go to restart and just shut down and restart. There will be no problem.

3. It may be necessary to set the bootloader of Ubuntu and win10. It is recommended to boot win10 with Ubuntu, because there seems to be a lot of problems with win10 booting, and then change the default startup items under Ubuntu. Refer to the first method of this
https://zhidao.baidu .com/question/432965828.html The
main thing is to change the value of GRUB_DEFAULT (start from 0, don't count it wrong)
Don't stick to the form, use gedit because vim is very painful for beginners, and even the level will not be closed...

4. It is very difficult to install qq and tim under ubuntu. I tried for a long time and did not install it (wine always prompts that there is a serious problem and cannot open the installation package, maybe there is something else to install), but you can install WeChat (although it is not official) , you can install NetEase Cloud, Sogou input method (install it by operation, although it is a bit troublesome), smplayer (it is said that it is a very useful player, inherited from mplayer, it should have video acceleration function, I am going for this), ss-qt (scientific Internet access, graphical interface version, pure command line is a bit less good...), chrome (a proxy plug-in is installed on chrome, which can be very convenient for scientific Internet access)


2. Environment

python, pip, git: refer to Baidu, python uses 2.7, and pip is updated to the latest version. Although it is ok if it is not updated, it is always annoying to report warnings... This step is very simple, and there will be basically no mistakes like crazy, so No longer


3. Installation of dependent libraries and setting environment variables

Link: http://www.linuxidc.com/Linux/2016-09/135034.htm

Some questions:

1. Permission problem: IOError: chmod r+a+w <directory>: add read and write permissions

2. There is no make command: go to Baidu to search for ubuntu make, follow the prompts to install make, note that the make directory is in the caffe main directory, other directories will report an error

3. Pay attention to the path! Pay attention to the path! Pay attention to the path! The path required in the article may be different from the corresponding path after you install the system, be sure to pay attention to the path!

4. Until all make is successful, import caffe under python does not report an error, indicating that caffe is completely installed.


4. Set up the caffe training/test set (build from scratch, where the image data comes from mnist)

1. Data source: mnist, go to the official website to download four data packages

2. Data conversion: Convert the package to a picture:
http://blog.csdn.net/u014046170/article/details/47445919

3. Data Formatting: Convert pictures into database IMDB:

Follow the steps one, two, three and four of
http://blog.csdn.net/qq_27923041/article/details/54139887

pay attention:

a. In step 2, there is a resize_width/height = 256, which can be removed, because the image of mnist is only 28*28, but a data will need to be changed later

b. For all errors, first check the path, if the relative path is unskilled, replace it with an absolute path

c. After changing the path, you need to have a certain understanding of the cut in the script in step 2, -f 4-5, the bold part needs to be debugged

d. The script will ask to change 3 4 5 6 7. For the data in mnist, change it to ( ( i-7)) and the like to output in the specified format (located in sed "s/ / i/”)

4. Training: Step 5 of the above website

It is recommended to first understand the actual meaning of each parameter in prototxt. The value will vary depending on the picture.

If an error is reported, first delete all the comments of the two prototxt, it seems that the Chinese comment will report an error even if it is commented out

Check all relevant paths in the two prototxt, including the end of the folder directory need to add /

ps1: Just in time for the editor revision. . Markdown is not very good

ps2: mnist actually has an example in caffe. . It's just that when I built it from scratch, the image data was very difficult to find. It takes five days to reply to the image-net website to apply for an account... =_=

just sauce

Guess you like

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