Caffe2 Quick Start Guide
eBook - ePub

Caffe2 Quick Start Guide

Modular and scalable deep learning made easy

Ashwin Nanjappa

  1. 136 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Caffe2 Quick Start Guide

Modular and scalable deep learning made easy

Ashwin Nanjappa

Detalles del libro
Vista previa del libro
Índice
Citas

Información del 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.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Caffe2 Quick Start Guide un PDF/ePUB en línea?
Sí, puedes acceder a Caffe2 Quick Start Guide de Ashwin Nanjappa en formato PDF o ePUB, así como a otros libros populares de Informatica y Reti neurali. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2019
ISBN
9781789138269
Edición
1
Categoría
Informatica
Categoría
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...

Índice

  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
Estilos de citas para 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.