Caffe2 Quick Start Guide
eBook - ePub

Caffe2 Quick Start Guide

Modular and scalable deep learning made easy

Ashwin Nanjappa

  1. 136 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Caffe2 Quick Start Guide

Modular and scalable deep learning made easy

Ashwin Nanjappa

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

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.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Caffe2 Quick Start Guide è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Caffe2 Quick Start Guide di Ashwin Nanjappa in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatica e Reti neurali. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2019
ISBN
9781789138269
Edizione
1
Argomento
Informatica
Categoria
Reti neurali

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...

Indice dei contenuti

  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
Stili delle citazioni per 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.