Using Caffe with the Intel *
Deep Learning Model Optimizer for Caffe* requires the Caffe framework to be installed on the client machine with all relevant dependencies. Caffe should be dynamically compiled and linked. A shared library named libcaffe.so
should be available in the CAFFE_HOME/build/lib directory
.
For ease of reference, the Caffe* installation folder is referred to as <CAFFE_HOME>
and the Model Optimizer installation folder is referred to as <MO_DIR>
.
The installation path to the Model Optimizer depends on whether you use the Intel® CV SDK or Deep Learning Deployment Toolkit. For example, if you are installing with sudo, the default <MO_DIR>
directory is:
/opt/intel/deeplearning_deploymenttoolkit_<version>/deployment_tools/model_optimizer
- In case of using Deep Learning Deployment Toolkit/opt/intel/computer_vision_sdk_<version>/mo
- In case of Intel CV SDK installation.
Installing Caffe
To install Caffe, complete the following steps:
- For convenience, set the following environment variables:
export MO_DIR=<PATH_TO_MO_INSTALL_DIR> export CAFFE_HOME=<PATH_TO_YOUR_CAFFE_DIR>
- Go to the Model Optimizer folder:
cd $MO_DIR/model_optimizer_caffe/
- For easiness of the installation procedure, you can find two additional scripts in the
$MO_DIR/model_optimizer_caffe/install_prerequisites
folder:- install_Caffe_dependencies.sh - Installs the required dependencies like Git*, CMake*, GCC*, etc.
- clone_patch_build_Caffe.sh - Installs the Caffe* distribution on your machine and patches it with the required adapters from the Model Optimizer.
- Go to the helper scripts folder and install all the required dependencies:
cd install_prerequisites/ ./install_Caffe_dependencies.sh
- Install Caffe* distribution. By default it installs the BVLC Caffe* from the master branch of the official repository. If you want to install other version of Caffe*, you can slightly edit the content of the clone_patch_build_Caffe.sh script. In particular, the following lines:
CAFFE_REPO=https://github.com/BVLC/caffe.git # link to the repository with Caffe* distribution CAFFE_BRANCH=master # branch to be taken from the repository CAFFE_FOLDER=`pwd`/caffe # where to clone the repository on your local machine CAFFE_BUILD_SUBFOLDER=build # name of the folder required for building Caffe*
To launch installation, just run the following command:./clone_patch_build_Caffe.sh
NOTE: In case of problem with the hdf5 library while building Caffe on Ubuntu* 16.04, see the following fix.
Once you have configured Caffe* framework on your machine, you need to configure Model Optimizer for Caffe* to properly work with it. For that, please refer to the Configure Model Optimizer for Caffe* page.