Skip to product information
PyTorch Deep Learning Master
PyTorch Deep Learning Master
Description
Book Introduction
Written directly by the core developers of PyTorch, this book will give you the feeling of having a top practitioner sit right next to you, guiding you step-by-step through everything from the fundamentals of deep learning to its practical application in real-world projects, including model performance evaluation and improvement strategies! It covers the entire deep learning workflow, from the concepts and principles of deep learning data structures like tensors and neural networks to building and deploying fully functional deep learning services using PyTorch and medical data.

This book teaches you how to create neural networks and deep learning systems using PyTorch.
It is full of practical content that teaches you from the ground up how to build a real-world example of a tumor image classifier.
At the same time, it covers best practices for the entire deep learning pipeline, including PyTorch Tensor API, data loading in Python, training monitoring, and result visualization.
  • You can preview some of the book's contents.
    Preview

index
[Part 1] PyTorch Core

Chapter 1: Introduction to Deep Learning and the PyTorch Library
__1.1 Deep Learning Revolution
__1.2 PyTorch for Deep Learning
__1.3 Why PyTorch?
____1.3.1 Deep Learning Competitive Landscape
__1.4 PyTorch Deep Learning Project Overview
__1.5 Hardware and Software Requirements
____1.5.1 Jupyter Notebook
__1.6 Practice Problems
__1.7 Key Summary

Chapter 2 Pre-trained neural networks
__2.1 Pre-trained neural network for image recognition
____2.1.1 Importing a pre-trained neural network for image recognition
____2.1.2 Alexnet
____2.1.3 ResNet
____2.1.4 Preparation, before we begin...just a moment
____2.1.5 Run!
____2.2 Pre-trained model to create fake images
____2.2.1 GAN Game
____2.2.2 CycleGAN
____2.2.3 Neural network that turns horses into zebras
__2.3 Pre-trained neural network to describe scenes
____2.3.1 Neural Talk 2
__2.4 Torch Hub
__2.5 Conclusion
__2.6 Practice Problems
__2.7 Key Summary

Chapter 3 Tensor Structure
__3.1 The World of Floating Point Numbers
__3.2 Tensor: Multidimensional Arrays
____3.2.1 From Python lists to PyTorch tensors
____3.2.2 Creating Your First Tensor
____3.2.3 The Core of Tensors
__3.3 Tensor Indexing
__3.4 Named Tensors
__3.5 Tensor element types
____3.5.1 Specifying numeric types with dtype
____3.5.2 dtype used in all cases
____3.5.3 Managing dtype attributes of tensors
__3.6 Tensor API
__3.7 Visualizing Tensors from a Storage Perspective
____3.7.1 Storage Space Indexing
____3.7.2 Modifying Stored Values: Internal Tensor Operations
__3.8 Tensor metadata: size, offset, stride
____3.8.1 Creating a view into the storage of another tensor
____3.8.2 Transposing a tensor without copying
____3.8.3 Transpose operations in higher dimensions
____3.8.4 Adjacent Tensors
__3.9 Moving Tensors to the GPU
____3.9.1 Managing Tensor Device Properties
__3.10 NumPy compatible
__3.11 Generalized tensors are also tensors
__3.12 Tensor serialization
____3.12.1 Parallelizing HDF5 with h5py
__3.13 Conclusion
__3.14 Practice Problems
__3.15 Key Summary

Chapter 4: Representing Real Data as Tensors
__4.1 Handling Images
____4.1.1 Adding Color Channels
____4.1.2 Loading Image Files
____4.1.3 Changing the layout
____4.1.4 Data Normalization
__4.2 3D Images: Volume Data
____4.2.1 Loading Special Formats
__4.3 Representing table data
____4.3.1 Using Real-World Datasets
____4.3.2 Reading wine data as a tensor
____4.3.3 Expressing scores
____4.3.4 One-Hot Encoding
____4.3.5 When to categorize
____4.3.6 Finding by threshold
__4.4 Handling Time Series Data
____4.4.1 Adding a Time Dimension
____4.4.2 Creating data by hour
____4.4.3 Training Preparation
__4.5 Representing Text
____4.5.1 Converting text to numbers
____4.5.2 Character One-Hot Encoding
____4.5.3 One-hot encoding all words
____4.5.4 Text Embedding
____4.5.5 Text Embedding as a Blueprint
__4.6 Conclusion
__4.7 Practice Problems
__4.8 Key Summary

Chapter 5 Learning Techniques
__5.1 Timeless Modeling Learning
__5.2 Learning is just parameter estimation
____5.2.1 Temperature Issues
____5.2.2 Data Collection
____5.2.3 Data Visualization
____5.2.4 First, try choosing a linear model.
__5.3 Measures to reduce losses
____5.3.1 Solving a Problem with PyTorch
__5.4 Going down the slope
____5.4.1 Reducing Losses
____5.4.2 Analysis
____5.4.3 Iterations for model fitting
____5.4.4 Input Normalization
____5.4.5 (Revisiting) Visualization
__5.5 Automatic Differentiation in PyTorch: Backpropagating Everything
____5.5.1 Automatic slope calculation
____5.5.2 Selective Optimizer
____5.5.3 Training, Validation, and Overfitting
____5.5.4 Notes on automatic differentiation and turning off automatic differentiation
__5.6 Conclusion
__5.7 Practice Problems
__5.8 Key Summary

Chapter 6: Data Fitting Using Neural Networks
__6.1 Artificial Neuron
____6.1.1 Synthesizing Multilayer Neural Networks
____6.1.2 Error function
____6.1.3 What we need is an activation function
____6.1.4 Other active functions
____6.1.5 Choosing the optimal activation function
____6.1.6 The Meaning of Learning in Neural Networks
__6.2 PyTorch nn module
____6.2.1 Using __call__ instead of forward
____6.2.2 Back to the linear model
__6.3 Finally, the neural network
____6.3.1 Replacing Linear Models
____6.3.2 Examining the Parameters
____6.3.3 Comparison with linear models
__6.4 Conclusion
__6.5 Practice Problems
__6.6 Key Summary

Chapter 7: Distinguishing Birds from Planes: Image Learning
__7.1 A dataset of small images
____7.1.1 CIFAR-10 Download
____7.1.2 Dataset Class
____7.1.3 Data Conversion
____7.1.4 Data Normalization
__7.2 Distinguishing between birds and airplanes
____7.2.1 Building the Dataset
____7.2.2 Fully Connected Model
____7.2.3 Output of the classifier
____7.2.4 Expressing Output as Probability
____7.2.5 Loss values ​​for classification
____7.2.6 Classifier Training
____7.2.7 Limitations of Full Connectivity
__7.3 Conclusion
__7.4 Practice Problems
__7.5 Key Summary

Chapter 8 Generalization Using Convolution
__8.1 Convolution
____8.1.1 The Role of Convolution
__8.2 Trying out convolution
____8.2.1 Border padding
____8.2.2 Finding Features with Convolution
____8.2.3 Taking Recognition One Step Further with Depth and Pooling
____8.2.4 Applying it to our neural network
__8.3 Subclassing nn.Module
____8.3.1 Our neural network defined with nn.Module
____8.3.2 How PyTorch Maintains Parameters and Submodules
____8.3.3 Functional API
__8.4 Training the convolutional neural network we created
____8.4.1 Accuracy Measurement
____8.4.2 Saving and Loading Models
____8.4.3 Training on GPUs
__8.5 Model Design
____8.5.1 Increasing memory capacity: width
____8.5.2 How to Help Models Converge and Generalize: Regularization
____8.5.3 Digging deeper to learn more complex structures: Depth
____8.5.4 Performance Comparison of Models
____8.5.5 Already old way
__8.6 Conclusion
__8.7 Practice Problems
__8.8 Key Summary

[Part 2] Practical Image Learning: Early Diagnosis of Lung Cancer

Chapter 9: Using PyTorch to Fight and Win Against Cancer
__9.1 Introduction to Use Cases
__9.2 Preparing for a large-scale project
__9.3 What is a CT scan?
__9.4 Project: End-to-End Lung Cancer Diagnostic Device
____9.4.1 Why you can't just throw data at a neural network until it starts working
____9.4.2 What is a nodule?
____9.4.3 Data source: LUNA Grand Challenge
____9.4.4 LUNA Data Download
__9.5 Conclusion
__9.6 Key Summary

Chapter 10: Combining Multiple Data Sources into a Unified Dataset
__10.1 Original CT data file
__10.2 Parsing LUNA Annotation Data
____10.2.1 Training and validation sets
____10.2.2 Merging annotation data and candidate data
__10.3 Loading Individual CT Scans
____10.3.1 Hounsfield Units
__10.4 Determining the location of the nodule using the patient coordinate system
____10.4.1 Patient Coordinate System
____10.4.2 CT scan morphology and voxel size
____10.4.3 Converting millimeters to voxel addresses
____10.4.4 Extracting Nodules from CT Scans
__10.5 Implementing a Simple Dataset
____10.5.1 Caching candidate arrays with the getCtRawCandidate function
____10.5.2 Creating a dataset with LunaDataset.__init__
____10.5.3 Training/Validation Separation
____10.5.4 Data Rendering
__10.6 Conclusion
__10.7 Practice Problems
__10.8 Key Summary

Chapter 11: Training a Classification Model for Tumor Detection
__11.1 Base Model and Training Loop
__11.2 The main entry point of the application
__11.3 Pre-training setup and initialization
____11.3.1 Initializing the Model and Optimizer
____11.3.2 Data Loader Management and Data Supply
__11.4 Designing the First Path Neural Network
____11.4.1 Core Convolution
____11.4.2 Full Model
__11.5 Model Training and Validation
____11.5.1 computeBatchLoss function
____11.5.2 Validation loop similar to training
__11.6 Performance Metrics Output
____11.6.1 logMetrics function
__11.7 Running the training script
____11.7.1 Data required for training
____11.7.2 Learn the enumerateWithEstimate function using the intermission
__11.8 Model Evaluation: Is 99.7% Accuracy Good?
__11.9 Plotting Training-Related Metrics with TensorBoard
____11.9.1 Running TensorBoard
____11.9.2 Making the metrics logging function support TensorBoard
__11.10 Why the model can't learn to detect nodules
__11.11 Conclusion
__11.12 Practice Problems
__11.13 Key Summary

Chapter 12: Improving Training with Metrics and Augmentation
__12.1 High-Level Plan for Improvement
__12.2 Good Dogs and Bad Guys: False Positives and False Negatives
__12.3 Diagramming the positive and negative cases
____12.3.1 The advantage of Roxy, who barks at anyone, is the reproducibility.
____12.3.2 Preston, who sleeps a lot but catches thieves well, has a specialty of precision.
____12.3.3 Obtaining Precision and Recall with logMetrics
____12.3.4 The Ultimate Metric: F1 Score
____12.3.5 Verifying that the model works well with the new metric
__12.4 What an ideal dataset looks like
____12.4.1 Making data closer to the 'ideal' than the actual
____12.4.2 Differences in results trained with balanced LunaDataset
____12.4.3 Recognizing Overfitting Symptoms
__12.5 Revisiting the Overfitting Problem
____12.5.1 Overfitting Face-Age Prediction Model
__12.6 Preventing Overfitting with Data Augmentation
____12.6.1 Special Data Augmentation Technology
____12.6.2 Checking the Data Augmentation Effect
__12.7 Conclusion
__12.8 Practice Problems
__12.9 Key Summary

Chapter 13: Suspicious Nodule Detection Using Segmentation
__13.1 Adding a Second Model to the Project
__13.2 Various segmentation types
__13.3 Semantic Segmentation: Pixel-Wise Classification
____13.3.1 UNET Architecture
__13.4 Updating the Model for Segmentation
____13.4.1 Applying a Ready-Made Model to a Project
__13.5 Updating the Dataset for Segmentation
____13.5.1 UNET with very limited input size
____13.5.2 Advantages and Disadvantages of Using UNET for 2D vs. 3D Data
____13.5.3 Creating Real-World Data
____13.5.4 Luna2dSegmentationDataset implementation
____13.5.5 Designing Training and Validation Data
____13.5.6 TrainingLuna2dSegmentationDataset Implementation
____13.5.7 Augmented running on GPU
__13.6 Updated training script for segmentation
____13.6.1 Segmentation and Augmentation Model Initialization
____13.6.2 Using the Adam Optimizer
____13.6.3 Dice Loss
____13.6.4 Putting an image into TensorBoard
____13.6.5 Metrics Logging Update
____13.6.6 Saving the model
__13.7 Results
__13.8 Conclusion
__13.9 Practice Problems
__13.10 Key Summary

Chapter 14: End-to-End Node Analysis and the Challenges Remaining
__14.1 Towards the finish line
__14.2 Verification set independence
__14.3 Linking CT segmentation and nodule candidate classification
____14.3.1 Segmentation
____14.3.2 Grouping voxels to create nodule candidates
____14.3.3 Did you find a nodule? Classification to reduce false positives
__14.4 Quantitative Verification
__14.5 Malicious Prediction
____14.5.1 Acquisition of malicious information
____14.5.2 AUC Baseline: Classifying by Diameter
____14.5.3 Reusing Previous Weights: Fine-Tuning
____14.5.4 More Output in TensorBoard
__14.6 What you see through diagnosis
____14.6.1 Training set, validation set, and test set
__14.7 What's next? We need more data and inspiration.
____14.7.1 Preventing Overfitting: Better Regularization
____14.7.2 Refined training data
____14.7.3 Comparison of Results and Research Papers
__14.8 Conclusion
____14.8.1 Behind the Curtain
__14.9 Practice Problems
__14.10 Key Summary

[Part 3] Finally, distribution

Chapter 15 Distributing as a Product
__15.1 PyTorch Model Serving
____15.1.1 Model in flask
____15.1.2 What I want when deploying
____15.1.3 Batch Request
__15.2 Exporting the model
____15.2.1 Ensuring compatibility beyond PyTorch with ONNX
____15.2.2 Exporting to PyTorch: Tracing
____15.2.3 Server built with tracked models
__15.3 PyTorch JIT Operation
____15.3.1 Going beyond traditional Python/PyTorch
____15.3.2 PyTorch from an Interface and Backend Perspective
____15.3.3 TorchScript
____15.3.4 Making it traceable with TorchScript
__15.4 LibTorch: C++ PyTorch
____15.4.1 Executing a JIT-processed model in C++
____15.4.2 C++ from the Start: The C++ API
__15.5 Mobile
____15.5.1 Improving Efficiency: Model Design and Quantization
__15.6 Recent Technology: PyTorch Model Enterprise Serving
__15.7 Conclusion
__15.8 Practice Problems
__15.9 Key Summary

Publisher's Review
| What this book covers |

- Deep neural network training
- Implementation of modules and loss functions
- Utilize pre-trained models from PyTorch Hub
- Exploring Jupyter Notebook Code Samples
- Analysis, evaluation, and improvement of deep learning model performance
An end-to-end simulated cancer diagnosis project, from model analysis to serving, utilizing lung tumor CT image data.

| Structure of this book |

Part 1, 'PyTorch Core', covers the basic skills needed to understand PyTorch projects and begins creating your own.
We'll then explore some of the hidden features that make PyTorch a library, along with the PyTorch API, and train our initial classification model.
After Part 1, you'll be ready to tackle a real project.
Chapter 1, "Introducing Deep Learning and the PyTorch Library," introduces PyTorch's role as a library in the deep learning revolution and discusses what differentiates it from other deep learning frameworks.
Chapter 2, 'Pre-trained Neural Networks', demonstrates PyTorch in action by running a pre-trained example neural network.
This tutorial explains how to download and run a model from PyTorch Hub.
Chapter 3, "Tensor Structures," introduces tensors, the basic building blocks of PyTorch, and shows the hidden parts of the tensor API and the detailed implementation.
Chapter 4, "Expressing Real-World Data as Tensors," explores how diverse data can be expressed with tensors and explains how to create tensors for deep learning models.
Chapter 5, "Learning Techniques," follows the learning mechanism through gradient descent and explores how PyTorch enables gradient descent with automatic differentiation.
Chapter 6, "Data Fitting with Neural Networks," demonstrates the process of creating and training a neural network model for regression in PyTorch using the nn and optim modules.
Chapter 7, "Distinguishing Birds from Planes: Image Learning," builds on what you learned in previous chapters by building a fully connected model for image classification and expanding your knowledge of the PyTorch API.
Chapter 8, "Generalization with Convolution," introduces convolutional neural networks and covers advanced concepts for implementing neural network models in PyTorch.

Part 2, "Practical Image Learning: Early Lung Cancer Diagnosis," brings us closer to a comprehensive solution for automated lung cancer diagnosis.
These challenging problems serve as a catalyst for demonstrating real-world approaches to solving broad problems such as cancer detection.
It's a large-scale project that focuses on clean engineering, troubleshooting, and problem solving.
Chapter 9, "Using PyTorch to Fight and Win Against Cancer," describes an end-to-end strategy for classifying lung tumors starting from CT images.
Chapter 10, "Combining Multiple Data Sources into a Unified Dataset," uses standard PyTorch APIs to read human-labeled annotation data from CT scan images, transform the information into the required format, and convert it into a tensor.
Chapter 11, "Training a Classification Model for Tumor Detection," introduces the first classification model using the training data introduced in Chapter 10.
Train the model and collect basic performance metrics.
At the same time, we introduce TensorBoard for training monitoring.
Chapter 12, "Improving Training with Metrics and Augmentation," explores and implements standard performance metrics and uses them to identify weaknesses in previous training.
To overcome these weaknesses, we then use data balancing and augmentation to create an improved training set.
Chapter 13, "Detecting Suspicious Nodules Using Segmentation," describes segmentation and a pixel-to-pixel model architecture for creating a heatmap that identifies tumor locations across the entire CT scan.
This heatmap can be used to find lung nodules in CT scans in the absence of human-labeled annotation data.
Chapter 14, "End-to-End Node Analysis and Remaining Challenges," implements the final end-to-end project.
Diagnose cancer patients using a new segmentation model created based on classification.

Part 3, 'Finally, Distribution', consists of one chapter dealing with distribution.

Chapter 15, "Deploying to Production," explores how to deploy PyTorch models as simple web servers, embedded in C++ programs, or embedded on smartphones.

| Target audience for this book |

This book is intended for developers who want to apply deep learning in practice or become proficient in PyTorch.
We assume that readers are likely working computer science majors, data scientists, software engineers, or undergraduate students in related fields.
Since we assume the reader has no prior knowledge of deep learning, we will reiterate concepts that even experienced practitioners already know.
I hope that readers who are beyond the beginner level will find it helpful to read the parts that explain the topic from a slightly different perspective, even if it is a topic they are already familiar with.
Readers of this book are assumed to already have basic knowledge of imperative programming and object-oriented programming.
This book uses Python, so readers should be familiar with its basic syntax and operating environment.
You should have some prior knowledge of how to install Python packages or how to run scripts on your platform.
If you have experience with languages ​​like C++, Java, JavaScript, or Ruby, you won't have much difficulty, but if you don't know much about it, you will need to invest some extra time to acquire knowledge.
Familiarity with NumPy is helpful, but not required.
It would also be good to have some basic linear algebra knowledge, such as knowing what a matrix, vector, or dot product is.

| Hardware and Software Requirements |

- GPU with 8GB of RAM
- At least 200 GB of disk space
- Python 3.6 or higher

[Author's Note]

When we were all kids in 1980, Ellie took his first steps into the world of computers with a Commodore VIC 20, Luca with a Sinclair Spectrum 48K, and Thomas with a Commodore C16.
We've watched the dawn of the personal computer, learned to write code and algorithms on increasingly fast computers, and dreamed of where computers would take us in the future.
At that time, we all rolled our eyes and watched the scene where the protagonist of a spy movie said, “Computer, zoom in,” but we also painfully realized the gap between the computer in the movie and the actual computer function.
Later in their professional careers, Ellie and Luca each struggled to analyze medical imaging images and faced the challenge of writing algorithms to account for the diversity of the human body.
There have been various heuristics on how to optimally mix several algorithms to shorten the period and make it run somehow.
By the turn of the 21st century, Thomas had earned a PhD in mathematics, studying neural networks and pattern recognition, as well as modeling.

Deep learning, which emerged in the computer vision field in the early 2010s, began to be used in medical image analysis to recognize lesions and structures in medical images.
It wasn't until the mid-2010s that deep learning began to surface on our individual radar screens.
It took some time to realize that deep learning was offering a completely new way to approach software writing.
A new system called a general-purpose algorithm that learns on its own how to handle complex tasks just by observing data.
From the perspective of the 1980s nomads, it was a moment when, overnight, the possibilities of computers expanded beyond the brains of skilled programmers to encompass data, neural network architectures, and training processes.
Immediately after this realization, we decided to try it ourselves.
Luca chose the venerable Torch 7 (http://torch.ch).
Torch7 was fast, lightweight, and easily accessible with source code written in Lua and C, and it also had the support of a long-standing community.
At first sight, Luca fell in love with Torch7.
However, Torch 7 had a downside: it was moving away from the rapidly growing Python data science ecosystem.
Conversely, at that time, other frameworks were being derived from Python.
Ellie has been interested in AI since her college days.
But his career was going in a different direction, and early deep learning frameworks were too much work for him to pursue as a hobby.

That's why we were all very excited when the first PyTorch was released on January 18, 2017.
Luca contributed as a core developer, while Ellie was an early member of the community, fixing odd bugs, adding features, and updating documentation.
Thomas contributed numerous features and bug fixes, eventually becoming one of the core contributors.
Something big was starting to happen, requiring just the right level of complexity and minimal cognitive load.
It inherits the lean design lessons learned in Torch 7 and adds cutting-edge features such as automatic differentiation, dynamic computational graphs, and NumPy integration.

After enthusiastically working on projects and conducting several PyTorch workshops, writing a book felt like a natural next step.
Our authors set a goal of writing a book that would be compelling to those of us who started using PyTorch a few years ago.
As expected, we started with a grand idea.
I tried to explain the best and latest models of PyTorch by teaching the basics and following the end-to-end project.
But I quickly realized that one book would not be enough to cover all of this.
So I decided to focus on my initial goals and spend some time and depth on covering the core concepts underlying PyTorch.
It is written so that readers can follow the entire project even with little prior knowledge of deep learning.
For our practical project, we chose medical image analysis, which is our specialty.

[Translator's Note]

If I had the chance to ask artificial general intelligence (AGI) a question, I would ask it: Would you have learned GPU-powered learning, detected objects from images, and existed today if Andrew Ng hadn't happened to meet Jeff Dean in the company kitchen about a decade before this book was published?
As the author himself mentions several times in the book, the advancements in deep learning over the past decade have been tremendous and have occurred very quickly.
For those of us who majored in computer engineering and make a living doing it, it was a burden to have so much to study, but on the other hand, it was a joy to live in the excitement of seeing the imagination we only saw in movies become a reality that is quite close to home.
It was 2015.
It's been a few years since deep learning emerged, so I thought there should be some well-organized books by now, so I looked through books here and there and even looked through the original books on online bookstore sites, but it was still difficult to find useful content, and there were many cases where I bought books because they were thin and ended up skimming through them so poorly that the expression "reading them in a jiffy" is not enough.
When people ask, "Where should I start studying deep learning?", I always have to recommend Stanford lectures and Coursera.
As for books, I couldn't think of any that I could recommend, and Ian Goodfellow's book on deep learning lived up to its reputation and was full of valuable information, but to be honest, for me, it was more of a collection than a read, like Knuth's "The Art of Computer Programming."


Meanwhile, deep learning frameworks have gone through the Warring States period and are being divided into TensorFlow and PyTorch, and as they should have, they have evolved beyond just showing off great models and training results for demos to the commercialization stage where they are used in actual services and businesses.
Around that time, I also followed suit and built an end-to-end platform for practical application and commercialization, but it was difficult to find books or materials about PyTorch, which came into the light a little later than TensorFlow, outside of the official website.
At that time, a publisher asked me to translate this book, so how could I refuse?
I am so proud that the book, which has been a hot topic among domestic expert groups, has finally been published in Korean, and that I am participating in the publication process as a translator.


Unlike other deep learning books that I regretted buying because they were fooled by the title or tempted by the thinness of the book, I have no doubt that this book will quench the thirst of readers who are thirsty for artificial intelligence development, from the authors who were core members of PyTorch to the detailed content covered in the book.
This book is based on the author's efforts to provide long-lasting knowledge based on the rapidly evolving field of deep learning. It covers everything from a basic understanding of deep learning to explanations of various terms, techniques and tools for practical application, and even evaluation.
Although you may need to study some technical terms separately, please do not give up and read to the end to gain a lot of knowledge and help in your artificial intelligence research.

- Hyun Dong-seok
GOODS SPECIFICS
- Date of issue: June 30, 2022
- Page count, weight, size: 604 pages | 1,116g | 185*240*35mm
- ISBN13: 9791189909413
- ISBN10: 1189909413

You may also like

카테고리