Caffe2 Quick Start Guide
eBook - ePub

Caffe2 Quick Start Guide

Modular and scalable deep learning made easy

Ashwin Nanjappa

  1. 136 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Caffe2 Quick Start Guide

Modular and scalable deep learning made easy

Ashwin Nanjappa

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

Build and train scalable neural network models on various platforms by leveraging the power of Caffe2

Key Features

  • Migrate models trained with other deep learning frameworks on Caffe2
  • Integrate Caffe2 with Android or iOS and implement deep learning models for mobile devices
  • Leverage the distributed capabilities of Caffe2 to build models that scale easily

Book Description

Caffe2 is a popular deep learning library used for fast and scalable training and inference of deep learning models on various platforms. This book introduces you to the Caffe2 framework and shows how you can leverage its power to build, train, and deploy efficient neural network models at scale.

It will cover the topics of installing Caffe2, composing networks using its operators, training models, and deploying models to different architectures. It will also show how to import models from Caffe and from other frameworks using the ONNX interchange format. It covers the topic of deep learning accelerators such as CPU and GPU and shows how to deploy Caffe2 models for inference on accelerators using inference engines. Caffe2 is built for deployment to a diverse set of hardware, using containers on the cloud and resource constrained hardware such as Raspberry Pi, which will be demonstrated.

By the end of this book, you will be able to not only compose and train popular neural network models with Caffe2, but also be able to deploy them on accelerators, to the cloud and on resource constrained platforms such as mobile and embedded hardware.

What you will learn

  • Build and install Caffe2
  • Compose neural networks
  • Train neural network on CPU or GPU
  • Import a neural network from Caffe
  • Import deep learning models from other frameworks
  • Deploy models on CPU or GPU accelerators using inference engines
  • Deploy models at the edge and in the cloud

Who this book is for

Data scientists and machine learning engineers who wish to create fast and scalable deep learning models in Caffe2 will find this book to be very useful. Some understanding of the basic machine learning concepts and prior exposure to programming languages like C++ and Python will be useful.

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Caffe2 Quick Start Guide als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Caffe2 Quick Start Guide von Ashwin Nanjappa im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Informatica & Reti neurali. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2019
ISBN
9781789138269
Auflage
1

Training Networks

In Chapter 2, Composing Networks, we learned how to create Caffe2 operators and how we can compose networks from them. In this chapter, the focus is on training neural networks. We will learn how to create a network that is intended for training and how to train it using Caffe2. We will continue to use the MNIST dataset as an example. However, instead of the MLP network we built in the previous chapter, we will create a popular network named LeNet.
This chapter will cover the following topics:
  • Introduction to training a neural network
  • Building the training network for LeNet
  • Training and monitoring the LeNet network

Introduction to training

In this section, we provide a brief overview of how a neural network is trained. This will help us to understand the later sections where we use Caffe2 to actually train a network.

Components of a neural network

We employ neural networks to solve a particular type of problem for which devising a computer algorithm would be onerous or difficult. For example, in the MNIST problem (introduced in Chapter 2, Composing Networks), handcrafting a complicated algorithm to detect the common stroke patterns for each digit, and thereby determining each digit, would be tedious. Instead, it is easier to design a neural network suited to this problem and then train it (as shown later in this chapter) using a lot of data to do the same. If the training data is diverse and the training is done carefully, such a network would also be far more robust to variations in the input data than any deterministic handcrafted algorithm would.
A neural network has two main components: its structure and its weights. We typically design the network structure and then use a training algorithm and training data to determine the weights. After it is trained, the network structure, with its embedded weights, can be used for inference on new unseen data, as shown in the following diagram:
Figure 3.1: Structure and weights of a network used for inference

Structure of a neural network

The structure of a network is the series of its layers, their types, and their configurations. The structure is typically devised by a researcher or a practitioner familiar with the problem that the neural network is being designed to solve. For example, to solve image classification problems, computer vision researchers might typically use a series of convolution layers in the network. (We will learn about the convolution layer later in this chapter.) Various configuration parameters of each layer also need to be determined beforehand, such as the size and number of the convolution filters in a convolution layer. There is a huge amount of interest in using deep learning itself to ascertain the structure of a network suited to a particular problem. However, discussion of this meta-learning topic is beyond the scope of this book.

Weights of a neural network

The second component of a network is its weights and biases. We generally refer to them together as weights, or sometimes as parameters. These are the floating point values that are the parameters of every layer in the network. How the weights of a layer are used is determined by the type of layer. For example, in a fully connected layer, a bigger weight value might signify a stronger correlation between an input signal and the network's output. In a convolution layer, the weights of a convolution filter might signify what type of pattern or shape in the input it is looking for.
In summary, we sit down and devise the structure of a network to solve a particular problem. Our choices in this process will be limited by our understanding of the problem space, the types of layers available in the DL framework, the hardware constraints of the accelerator we are using, and how much training time we are prepared to put up with. For example, the memory available in a GPU or CPU might limit the number of weights we might use in a layer or the number of layers we might use in the network. The amount of training time we are willing to spend also limits the number of weights and layers we can use in a network, because the more of these we employ, the longer it may take for the network to converge and train.

Training process

Once we have a network structure fleshed out, we can then use a DL framework such as Caffe2 to describe that structure. We then apply one of the many training algorithms available in the framework on our training data. This trains the network and learns the weights of the layers that would best amplify the signal and dampen the noise. This process is depicted in Figure 3.2:
Figure 3.2: Training is the process of learning the weights of a neural network using a training algorithm and data
Neural networks are typically trained using a gradient-based optimization algorithm. To do this, we first define an objective function or loss function for the network. This function computes a loss or error value by comparing the output of the network on a given input to the ground truth result of that input. The training process iteratively picks training data and computes its loss, and then uses the optimization algorithm to update the weights so that the error is reduced. This process is repeated until we see no further improvement in the accuracy of the network:
Figure 3.3: Three stages of an iteration in training
A single iteration of the training process is depicted in Figure 3.3. We can see that it has three distinct stages. The first stage is a Forward pass, where we essentially perform inference of the network with its current weights to obtain t...

Inhaltsverzeichnis

  1. Title Page
  2. Copyright and Credits
  3. About Packt
  4. Contributors
  5. Preface
  6. Introduction and Installation
  7. Composing Networks
  8. Training Networks
  9. Working with Caffe
  10. Working with Other Frameworks
  11. Deploying Models to Accelerators for Inference
  12. Caffe2 at the Edge and in the cloud
  13. Other Books You May Enjoy
Zitierstile für Caffe2 Quick Start Guide

APA 6 Citation

Nanjappa, A. (2019). Caffe2 Quick Start Guide (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/969852/caffe2-quick-start-guide-modular-and-scalable-deep-learning-made-easy-pdf (Original work published 2019)

Chicago Citation

Nanjappa, Ashwin. (2019) 2019. Caffe2 Quick Start Guide. 1st ed. Packt Publishing. https://www.perlego.com/book/969852/caffe2-quick-start-guide-modular-and-scalable-deep-learning-made-easy-pdf.

Harvard Citation

Nanjappa, A. (2019) Caffe2 Quick Start Guide. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/969852/caffe2-quick-start-guide-modular-and-scalable-deep-learning-made-easy-pdf (Accessed: 14 October 2022).

MLA 7 Citation

Nanjappa, Ashwin. Caffe2 Quick Start Guide. 1st ed. Packt Publishing, 2019. Web. 14 Oct. 2022.