Configure Caffe under Mac

Source: Internet
Author: User
Tags git clone

STEP1: Installing homebrew

If there is a computer, temporarily do not install. However, if you still get an error after adding sudo to step2 (or any other situation that requires brew), you will need to reinstall homebrew. Enter the following command in the terminal:

Ruby-e "$ (Curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/intall)" to install.

(reference URL: http://blog.csdn.net/yanzi1225627/article/details/42113661)

STEP2: Installing CMake

After installing the homebrew, enter the brew install CMake in the terminal, then follow the prompts to install the line (if the system prompts for no permissions, add a sudo before the brew, the following with the brew installation software is so, if there is no permission, the front plus sudo)

STEP3: Installing OPENCV

In OpenCV's official website (http://opencv.org) Download the Mac version OpenCV source files (version 2.x, do not lower 3.x version, incompatible with Caffe), unzip. Then enter the following three statements, respectively:

sudo cmake G "Unix makefiles"

sudo make-j8

sudo make install

STEP4: Installing Cuda

Even if the GPU acceleration is not used (or the computer does not use GPU acceleration), it should be cuda, otherwise it will error. In the CUDA official website (https://developer.nvidia.com/cuda-downloads) Download the latest version cuda, follow the step by step installation can be installed, you need to set environment variables.

Enter Vim/etc/profile at the terminal and add it at the end of the file

Export Path=/developer/nvidia/cuda-7.0/bin: $PATH

Export Dyld_library_path=/developer/nvid-ia/cuda-7.0/lib: $DYLD _library_path

If Cuda is not version 7.0, the corresponding environment variable is to be modified.

STEP5: Installing various dependencies

Enter the following command at the terminal:

For x in snappy leveldb gflags glog szip hdf5 lmdb Homebrew/science/opencv;

Do

sudo brew uninstall $x;

sudo install--FRESH-VD $x;

Done

This time there will be error generation, if the error is prompted to find one of the above several dependencies, can not be ignored, this is by the brew uninstall reported wrong. If it's another mistake, you need to check it out.

Then continue to enter:

sudo brew uninstall--force protobuf;

sudo brew install--with-python--FRESH-VD prototype

Likewise, as long as the uninstall is wrong, it can be ignored directly.

Then enter:

sudo brew uninstall boost Boost-python;

sudo brew install--FRESH-VD boost Boost-python

Why add a uninstall, this is because Caffe on the dependencies of the version is required (details see Caffe official website), if you do not want so cumbersome to operate, you can check the computer in each of the existing dependencies of the version, meet the requirements of the need to unload load.

STEP6: Download Caffe and modify configuration

Straight up and down from Git. In terminal input: Git clone https://github.com/BVLC/caffe.git

When the download is complete, enter

CD Caffe

CP Makefile.config.example Makefile.config

If you do not want to run GPU acceleration mode, you can choose Cpu_only mode. You need to modify the configuration file before and after CMake. First, find the Makefile.config in the Caffe folder, and remove the Comments (#) from the front of the #cpu_only:=1.

STEP7: Installation

In terminal input (the current folder is Caffe):

mkdir Build

CD Build

CMake.

If it doesn't matter whether you use CUDA, the following paragraph can be skipped. If you do not want to turn on GPU acceleration, open the CMakeCache.txt in Caffe/build, assign Cpu_only:bool to ON, and open Caffeconfig.cmake, set (Cpu_only,off) Switch to ON. This will not open cuda.

Then, start the installation.

Make all

STEP8: Test whether the installation was successful

Enter make Runtest at the command line, and if all layers show "RUN OK" and all test samples are paseed, the Caffe build succeeds

Reference URL:

http://blog.csdn.net/surgewong/article/details/43708339

Http://caffe.berkeleyvision.org/installation.html

Http://www.bubuko.com/infodetail-847860.html

Configure Caffe under Mac

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.