At this year’s F8 Developer Conference, Facebook officially announced the open sourcing of its new deep learning framework Caffe2. According to the official Caffe2 blog, this framework can be used to train and deploy models on iOS, Android, and Raspberry Pi; moreover, Facebook has partnered with companies such as NVIDIA, Qualcomm, Intel, Amazon, and Microsoft to optimize it for mobile platforms. Machine Heart provides an introduction to this open-source project.
To effectively train and deploy artificial intelligence models, we often rely on large data centers or supercomputers. The computational power required to process, create, and enhance various types of information (images, videos, text, and audio) on a large scale is not to be underestimated. If we want to deploy these models on mobile devices, they must be very fast and lightweight, which is also quite challenging. To overcome these difficulties, we need a robust, flexible, and portable deep learning framework.
Facebook has been collaborating with other developers in the open-source community to build such a framework. Today, Facebook announced the open-source release of the first production-ready version of Caffe2, a lightweight and modular deep learning framework that emphasizes portability while maintaining scalability and performance.
We are committed to providing the community with high-performance machine learning tools so that everyone can create intelligent applications and services. Along with Caffe2, several tutorials and case studies have been released, including large-scale learning using multiple GPUs on a single machine and large-scale learning using one or more GPUs across multiple machines, as well as training and deploying models on iOS, Android, and Raspberry Pi. Additionally, you can call pre-trained models from the Caffe2 Model Zoo with just a few lines of code.
Caffe2 is deployed within Facebook to assist developers in training large machine learning models and to provide mobile users with a good experience powered by artificial intelligence. Now, developers can access many of the same tools that allow them to run large-scale distributed training schemes and create mobile machine learning applications. We have closely collaborated with NVIDIA, Qualcomm, Intel, Amazon, and Microsoft to optimize Caffe2 for both cloud and mobile platforms. These partnerships will enable the machine learning community to quickly experiment with more complex models and deploy the next generation of AI-enhanced applications and services.
You can check the Caffe2 documentation and tutorials at caffe2.ai, and view the source code on GitHub. If you are considering using Caffe2, we would love to learn about your specific needs. Please participate in our survey. We will send you information about new releases and special developer events/webinars.
-
Homepage: http://caffe2.ai
-
GitHub: https://github.com/caffe2/caffe2
-
Survey: https://www.surveymonkey.com/r/caffe2
Below is an introduction to the Caffe2 open-source project on GitHub:
Caffe2 is a deep learning framework that combines expressiveness, speed, and modularity, and is an experimental re-architecture of Caffe, allowing for a more flexible organization of computations.
License Caffe2 release license: https://github.com/Yangqing/caffe2/blob/master/LICENSE
Building Caffe2 Detailed build matrix: 
| 12 | sudo git clone --recursive https://github.com/caffe2/caffe2.gitcd caffe2 |
OS X
| 1234 | brew install automake protobufmkdir build && cd buildcmake ..make |
Ubuntu Supported versions:
-
Ubuntu 14.04
-
Ubuntu 16.06
Required dependencies
| 1234567891011 | sudo apt-get updatesudo apt-get install -y --no-install-recommendsbuild-essentialcmakegitlibgoogle-glog-devlibprotobuf-devprotobuf-compilerpython-devpython-pipsudo pip install numpy protobuf |
Optional GPU support If you plan to use a GPU, rather than just a CPU, then you should install NVIDIA CUDA and cuDNN, a GPU acceleration library for deep neural networks. NVIDIA provides detailed installation guides on their official blog, or you can try the quick installation instructions below. First, be sure to upgrade your graphics drivers! Otherwise, you may face significant difficulties in diagnosing errors.
Installing on Ubuntu 14.04
| 12345 |
|
Installing on Ubuntu 16.04
| 12345 |
|
Installing cuDNN (all are Ubuntu versions)
| 1234 |
|
Optional dependencies Note, Ubuntu 14.04 uses libgflags2. Ubuntu 16.04 uses libgflags-dev.
| 12345678910111213141516 | # for Ubuntu 14.04sudo apt-get install -y --no-install-recommends libgflags2# for Ubuntu 16.04sudo apt-get install -y --no-install-recommends libgflags-dev# for both Ubuntu 14.04 and 16.04sudo apt-get install -y --no-installlibgtest-devlibiomp-devlibleveldb-devliblmdb-devlibopencv-devlibopenmpi-devlibsnappy-devopenmpi-binopenmpi-docpython-pydot |
Check the Python section below and install the optional packages before building Caffe2.
| 123 | mkdir build && cd buildcmake ..make |
Android and iOS We build the raw binaries using CMake’s Android and iOS ports, and then integrate them into Android or XCode projects. Check the scripts /build_android.sh and /build_ios.sh for specific information. For Android, we can build Caffe2 directly through Android Studio using gradle. Here is a sample project: https://github.com/bwasti/AICamera. Note that you may need to configure Android Studio so that the SDK and NDK versions you write code with will be correct.
Raspberry Pi For Raspbian, simply run the script /build_raspbian.sh on the Raspberry Pi.
Tegra X1 To install Caffe2 on NVIDIA’s Tegra X1 platform, you need to use the NVidia JetPack installer to simply install the latest version of the system, and then run the script /build_tegra_x1.sh on the Tegra device.
Python Support To follow the tutorials below, the Python environment needs to have ipython-notebooks and matplotlib installed, which can be done on OS X using the following:
| 12 | brew install matplotlib --with-python3pip install ipython notebook |
You will find that the following Python libraries are also required in specific tutorials and case studies, so you can run the following command line to install all required libraries at once:
| 12345678910111213 | sudo pip installflaskgraphvizhypothesisjupytermatplotlibpydot python-nvd3pyyamlrequestsscikit-imagescipysetuptoolstornado |
Build Environment (Known to Work)
