Deep Learning with PyTorch
FREEYou can see any available part of this book for free.
Click the table of contents to start reading.
Every other day we hear about new ways to put deep learning to good use: improved medical imaging, accurate credit card fraud detection, long range weather forecasting, and more. PyTorch puts these superpowers in your hands, providing a comfortable Python experience that gets you started quickly and then grows with you as you—and your deep learning skills—become more sophisticated. Deep Learning with PyTorch will make that journey engaging and fun.
Perfectly motivating and practical without being shallow.
Table of Contents takes you straight to the bookdetailed table of contents
Part 1: Core PyTorch
1 Introducing Deep Learning and the PyTorch Library
1.1 What is PyTorch?
1.2 What is this book?
1.3 Why PyTorch
1.3.1 The Deep Learning Revolution
1.3.2 Immediate vs. deferred execution
1.3.3 The deep learning competitive landscape
1.4 PyTorch has the batteries included
1.4.1 Hardware for deep learning
1.4.2 Using Jupyter notebooks
2 Pre-Trained Networks
2.1 A pre-trained network that recognizes the subject of an image
2.1.1 Obtaining a pre-trained network for image recognition
2.1.4 Ready, set, almost run
2.2 A pre-trained model that fakes it until it makes it
2.2.1 The GAN game
2.2.3 A network that turns horses into zebras
2.3 A pre-trained network that describes scenes
2.4 Torch Hub
3 It Starts with a Tensor
3.1 Tensors Fundamentals
3.2 Tensors and Storages
3.3 Size, offset, stride
3.4 Numeric Types
3.5 Indexing Tensors
3.6 NumPy interoperability
3.7 Serializing tensors
3.8 Moving tensors to the GPU
3.9 The tensor API
4 Real-World Data Representation Using Tensors
4.1 Tabular Data
4.2 Time Series
4.3.1 Text embeddings
4.5 Volumetric Data
5 The Mechanics of Learning
5.1 Learning is just parameter estimation
5.1.1 A Hot Problem
5.1.2 Choosing a linear model as a first try
5.1.3 Less loss is what we want
5.1.4 From Problem to PyTorch
5.1.5 Down Along the Gradient
5.1.6 Getting Analytical
5.1.7 The Training Loop
5.2 PyTorch’s Autograd: Back-propagate all things
5.2.1 Optimizers a-la Carte
5.2.2 Training, Validation, and Overfitting
5.2.3 Autograd Nits and Switching it Off
6 Using A Neural Network To Fit Our Data
6.1 Artificial Neurons
6.1.1 All We Need is Activation
6.1.2 What learning means for a neural network
6.2 The PyTorch
6.2.1 Finally a Neural Network
6.3 Subclassing nn.Module
6.3.1 The Functional API
7 Telling Birds from Airplanes - Learning from Images
7.1 A dataset of tiny images
7.1.1 Downloading CIFAR10
7.1.2 The Dataset class
7.1.3 Dataset transforms
7.1.4 Normalizing data
7.2 Distinguishing birds from airplanes
7.2.1 Building the dataset
7.2.2 A fully connected classifier
7.2.3 A loss for classifying
7.2.4 Training the classifier
7.2.5 The limits of going fully connected
8 Using Convolutions To Generalize
8.1 The case for convolutions
8.2 Convolutions in action
8.2.1 Looking further with depth and pooling
8.3 Subclassing nn.Module
8.3.1 The Functional API
8.4 Training our Convnet
Part 2: Learning from Images in the Real-World: Early Detection of Lung Cancer
9 How Can PyTorch Be Used To Fight Cancer?
9.1 What is a CT scan, exactly?
9.2 The project: an end-to-end malignancy detector for lung cancer
9.2.1 Why can’t we just throw data at a neural network until it works?
9.3 This chapter: loading our CT data and providing a dataset implementation
9.3.1 What is a nodule?
9.3.2 The LUNA Grand Challenge
9.3.3 How to get the data
9.4 Parsing LUNA’s annotation data
9.5 Loading individual CT scans
9.5.1 Hounsfield Units
9.6 Locating a nodule using the patient coordinate system
9.6.1 Extracting a nodule from a CT scan
9.7 A straightforward Dataset implementation
9.7.1 The getCtRawNodule function
9.7.3 A Test / Train Split
9.7.4 Rendering the data
10 Classifying Suspected Tumors
10.1 Setting up the main training application
10.1.1 Initalizing the model and optimizer
10.1.2 Care and feeding of DataLoaders
10.2 Our first-pass neural network design
10.2.1 The Core Convolutions
10.3 Training and testing the model
10.3.2 Deleting the loss variable
10.3.3 The testing loop is similar
10.5 Running the training script
10.5.1 Needed data for training
10.5.2 Interlude: the
10.6 Getting 99.7% correct means we’re done, right?
10.6.1 Why is this happening?
11 Monitoring Metrics: Precision, Recall, and Pretty Pictures
11.1 Good dogs versus bad guys: false positives and false negatives
11.2 Graphing the positives and negatives
11.2.3 Implementing precision and recall in
11.2.4 Our ultimate performance metric: the F1 score
11.2.5 How does our model perform with our new metrics?
11.3 What does an ideal data set look like
11.3.1 Making the data look less like the actual, and more like the ideal?
11.3.2 Changes to training.py, dset.py to balance benign and malignant samples
11.3.3 Contrasting training with a balanced
LunaDataset to previous runs
11.4 Graphing training metrics with TensorBoard
11.4.1 Running TensorBoard
11.4.2 Implementing metrics and tensorboard in code
11.5 Revisiting the problem of over-fitting
11.5.1 An over-fit face-to-age prediction model
11.5.2 Detecting over-fitting
11.6 Data Augmentation
11.6.1 Specific Data Augmentation Techniques
11.6.2 Seeing the improvement from data augmentation
11.7 Visdom, a TensorBoard alternative
12 Segmenting, Clustering, and Diagnosing Suspected Nodules
13 Taking Our Prototype To Production
About the TechnologyPyTorch is a machine learning framework with a strong focus on deep neural networks. Because it emphasizes GPU-based acceleration, PyTorch performs exceptionally well on readily-available hardware and scales easily to larger systems. Plus it’s Pythonic! Thanks to its define-by-run computation graph model, PyTorch plays nicely with the Python data science ecosystem. It’s instantly familiar if you’re using Numpy, Pandas, or other similar tools.
It’s easy to get started with PyTorch. It minimizes cognitive overhead without sacrificing the access to advanced features, meaning you can focus on what matters the most - building and training the latest and greatest deep learning models and contribute to making a dent in the world. PyTorch is also a snap to scale and extend, and it partners well with other Python tooling. PyTorch has been adopted by hundreds of deep learning practitioners and several first-class players like FAIR, OpenAI, FastAI and Purdue.
About the bookDeep Learning with PyTorch teaches you how to implement deep learning algorithms with Python and PyTorch. This book takes you into a fascinating case study: building an algorithm capable of detecting malignant lung tumors using CT scans. As the authors guide you through this real example, you'll discover just how effective and fun PyTorch can be. After a quick introduction to the deep learning landscape, you'll explore the use of pre-trained networks and start sharpening your skills on working with tensors. You'll find out how to represent the most common types of data with tensors and how to build and train neural networks from scratch on practical examples, focusing on images and sequences.
After covering the basics, the book will take you on a journey through larger projects. The centerpiece of the book is a neural network designed for cancer detection. You'll discover ways for training networks with limited inputs and start processing data to get some results. You'll sift through the unreliable initial results and focus on how to diagnose and fix the problems in your neural network. Finally, you'll look at ways to improve your results by training with augmented data, make improvements to the model architecture, and perform other fine tuning.
- Using the PyTorch tensor API
- Understanding automatic differentiation in PyTorch
- Training deep neural networks
- Monitoring training and visualizing results
- Implementing modules and loss functions
- Loading data in Python for PyTorch
- Interoperability with NumPy
- Deploying a PyTorch model for inference
About the readerWritten for developers with some knowledge of Python as well as basic linear algebra skills. Some understanding of deep learning will be helpful, however no experience with PyTorch or other deep learning frameworks is required.
About the authorEli Stevens has worked in Silicon Valley for the past 15 years as a software engineer, and the past 7 years as Chief Technical Officer of a startup making medical device software. Luca Antiga is co-founder and CEO of an AI engineering company located in Bergamo, Italy, and a regular contributor to PyTorch.
Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
placing your order...Don't refresh or navigate away from the page.
customers also bought