/caffe

This fork of BVLC/Caffe is dedicated to supporting Cambricon deep learning processor and improving performance of this deep learning framework when running on Machine Learning Unit(MLU).

Primary LanguageC++OtherNOASSERTION

Cambricon Caffe

To support Cambricon deep learning processor, the open source deep learning programming framework BVLC-Caffe has been modified. New functions such as off-line multi-core inference, online fusion mode, support of multiple cards and others are developed. Cambricon Caffe focus on inference, it is dedicated to improving BVLC-Caffe performance when running on Machine Learning Unit(MLU).

Cambricon Caffe Version

Cambricon Caffe supports several Cambricon Machine Learning Unit, please see below for more details.

  • For serials of MLU100:

You need to switch to the release_v1.0.0 branch first, and see below for how to use it.

  • For serials of MLU270:

You need to switch to the master branch first, and see below for how to use it.

Prerequisites

Cambricon Caffe has several dependencies as same as BVLC-Caffe does, please refer to caffe.berkeleyvision.org for details.

Building

You need to firstly clone Cambricon Caffe, and then go to scripts folder to compile Cambricon Caffe:

  • For serials of MLU100:
git clone git@github.com:Cambricon/caffe.git
cd caffe
git checkout release_v1.0.0
cd scripts

To build Cambricon Caffe, you could use build_cambriconcaffe.sh, which is in the scripts folder. It has three options:

  • -debug: build Cambricon Caffe with debug information.
  • -release: build Cambricon Caffe for production environment. This is the default build type.
  • -platform: specify platform argument. Supported arguments are x86, arm32, arm64. Default platform is x86.

x86

./build_cambriconcaffe.sh -platform x86

arm32

Please download cross toolchain, e.g. arm-linux-gnueabihf-4.8.3-201404, and set CROSS_TOOLCHAIN_PATH environment to point to the tool chain downloaded:

export CROSS_TOOLCHAIN_PATH=your_toolchain_path/bin  // please replace your_toolchain_path with your actual path

There is another dependent library set arm32_linux_lib, which is necessary for the compiling of Cambricon Caffe. It has been pre-compiled and is available for downloading on Cambricon's FTP site. Please clone caffe_boost, then run download_dependency.sh. The script will help download it.

The download_dependency.sh script needs one argument. The argument meaning is listed below:

  • 1: download arm32_linux_lib.
  • 2: download android_lib_r17b.

Firstly, download the library set.

git clone git@github.com:Cambricon/caffe_boost.git
cd caffe_boost/scripts
./download_dependency.sh 1

Then set ARM32_LINUX_LIB_ROOT environment variable for arm32_linux_lib:

export ARM32_LINUX_LIB_ROOT=your_lib_path  // please replace your_lib_path with your actual path

Once you have set up above two environment variables, you are ready to compile Cambricon Caffe for arm32 platform.

./build_cambriconcaffe.sh -platform arm32

arm64

For arm64, please download android-ndk-r17b firstly, it can be downloaded from NDK's official website. Then place it in /opt/shared/Android/Ndk/ directory(if not exists, please create one) and set ARM64_R17_NDK_ROOT environment as follows:

export ARM64_R17_NDK_ROOT=/opt/shared/Android/Ndk/android-ndk-r17b

There is another dependent library set android_lib_r17b. It also has been pre-compiled and is available for downloading on Cambricon's FTP site. Please input parameter 2 for download_dependency.sh.

git clone git@github.com:Cambricon/caffe_boost.git
cd caffe_boost/scripts
./download_dependency.sh 2

Finally, set ARM64_R17_ANDROID_LIB_ROOT environment variable for android_lib_r17b:

export ARM64_R17_ANDROID_LIB_ROOT=your_android_lib_path  // please replace your_android_lib_path with your actual path

Once you have finished setting the environment variables, you could compile Cambricon Caffe for arm64 platform:

./build_cambriconcaffe.sh -platform arm64
  • For serials of MLU270:
git clone git@github.com:Cambricon/caffe.git
cd caffe/scripts

To build Cambricon Caffe, you could use build_cambriconcaffe.sh, which is in the scripts folder. It has three options:

  • -debug: build Cambricon Caffe with debug information.
  • -release: build Cambricon Caffe for production environment. This is the default build type.
  • -platform: specify platform argument. Default platform is x86.
./build_cambriconcaffe.sh

License and Citation

Caffe is released under the BSD 2-Clause license. The BVLC reference models are released for unrestricted use.

Please cite Caffe in your publications if it helps your research:

@article{jia2014caffe,
  Author = {Jia, Yangqing and Shelhamer, Evan and Donahue, Jeff and Karayev, Sergey and Long, Jonathan and Girshick, Ross and Guadarrama, Sergio and Darrell, Trevor},
  Journal = {arXiv preprint arXiv:1408.5093},
  Title = {Caffe: Convolutional Architecture for Fast Feature Embedding},
  Year = {2014}
}

*Other names and brands may be claimed as the property of others

SSD: Single Shot MultiBox Detector

This repository contains merged code issued as pull request to BVLC caffe written by: Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, Alexander C. Berg.

Original branch can be found at https://github.com/weiliu89/caffe/tree/ssd.

Read our wiki page for more details.

Darknet

If you use Darknet in your research please cite it!

@misc{darknet13,
  author =   {Joseph Redmon},
  title =    {Darknet: Open Source Neural Networks in C},
  howpublished = {\url{http://pjreddie.com/darknet/}},
  year = {2013--2016}
}

YOLOv2

If you use YOLOv2 in your work please cite it!

@article{redmon2016yolo9000,
  title={YOLO9000: Better, Faster, Stronger},
  author={Redmon, Joseph and Farhadi, Ali},
  journal={arXiv preprint arXiv:1612.08242},
  year={2016}
}

YOLOv3

If you use YOLOv3 in your work please cite it!

@article{yolov3,
  title={YOLOv3: An Incremental Improvement},
  author={Redmon, Joseph and Farhadi, Ali},
  journal = {arXiv},
  year={2018}
}

R-FCN

If you use R-FCN in your work please cite it!

@article{dai16rfcn,
  title={{R-FCN}: Object Detection via Region-based Fully Convolution Networks},
  author={Jifeng Dai, Yi Li, Kaiming He, Jian Sun},
  journal = {arXiv preprint arXiv:1605.06409},
  year={2016}
}