Book Image

Caffe2 Quick Start Guide

By : Ashwin Nanjappa
Book Image

Caffe2 Quick Start Guide

By: Ashwin Nanjappa

Overview of this book

Caffe2 is a popular deep learning library used for fast and scalable training, and inference of deep learning models on different platforms. This book introduces you to the Caffe2 framework and demonstrates how you can leverage its power to build, train, and deploy efficient neural network models at scale. The Caffe 2 Quick Start Guide will help you in installing Caffe2, composing networks using its operators, training models, and deploying models to different architectures. The book will also guide you on how to import models from Caffe and other frameworks using the ONNX interchange format. You will then cover deep learning accelerators such as CPU and GPU and learn how to deploy Caffe2 models for inference on accelerators using inference engines. Finally, you'll understand how to deploy Caffe2 to a diverse set of hardware, using containers on the cloud and resource-constrained hardware such as Raspberry Pi. By the end of this book, you will not only be able to compose and train popular neural network models with Caffe2, but also deploy them on accelerators, to the cloud and on resource-constrained platforms such as mobile and embedded hardware.
Table of Contents (9 chapters)

Introduction to AlexNet

We mentioned AlexNet in the earlier section that introduced Caffe. AlexNet was a seminal network structure because of the large number of layers it employed for the first time, and for showing how such a deep neural network could be trained in a reasonable time by utilizing GPUs.

Figure 4.1 shows the network structure of AlexNet generated by Caffe's network visualization tool, draw_net.py . This tool uses the GraphViz library to render the graph layout:

Figure 4.1: Network structure of AlexNet using the GraphViz layout

In this visualization, layers are drawn as rectangles and data tensors between layers are drawn as elongated octagons. For example, the first layer rectangle after the input layer depicts a convolution layer named conv1. It uses kernels of size , a stride of 4, and a padding of 0.

Examining the AlexNet structure in Figure 4.1 we can...