Numerics
3D images
data representation using tensors 75-76
loading 76
7-Zip website 252
A
ablation studies 367
activation functions 143, 145
capping output range 146
choosing 148-149
compressing output range 146-147
actual nodules 372
Adam optimizer 388
add_figure 431
add_scalar method 314
advanced indexing 85
affine_grid 347, 385
AlexNet 19-22
align_as method 49
Android Studio IDE 472
annotations.csv file 258
app.loop.call_at 452
app.loop.run_in_executor 454
argmax 179
argument unpacking 122
arithmetic mean 329
array dimensions 265
arXiV public preprint repository 7
ASCII (American Standard Code for Information Interchange) 94-95
assetFilePath method 474
async method 452
asynchronous function generators 449
asyncio module 452
asyncio.Lock 452
aten operators 456
AUC (area under the ROC curve) 420
augmentation
abstract 435
regularization and 435
augmentation_dict 352, 380
augmenting datasets 190, 346
autograd component 123-138
computing gradient automatically 123-127
accumulating grad functions 125-127
applying autograd 123-124
grad attribute 124
evaluating training loss132-133
generalizing to validation set 133-134
optimizers 127-131
gradient descent optimizers 128-130
testing optimizers 130-131
splitting datasets 134-136
switching off 137-138
average pooling 203
B
backpropagation 148, 225
bad_indexes tensor 85
--balanced 342
batch direction 76
batch normalization25, 222-223, 227
batch_tup 289
--batch-size 283
batching requests 449
bias parameter 200
bikes tensor 89
bikes.stride() method 90
birds vs. airplanes challenge 172-191,196-207
building dataset 173-174
detecting features 200-202
downsampling 203-204
fully connected model174-175
limits of 189-191
output of classifier 175-176
padding boundary 198-200
pooling 203-204
representing output as probabilities 176-180
training the classifier 182-189
BLAS (Basic Linear Algebra Subprograms) 53
blocks 290
bool tensors 51
Bottleneck modules 23
bounding boxes 372-375
boundingBox_a 373
boxed numeric values 43
boxing 50
broadcasting 47, 111, 155
buffer protocol 64
_build2dTransformMatrix function 386
byte pair encoding method 97
C
C++
C++ API 468-472
LibTorch 465-472
running JITed models from C++ 465-468
__call__ method 152-153
cancer detector project
classification model training
disconnect 315-316
evaluating the model308-309
first-pass neural network design 289-295
foundational model and training loop 280-282
graphing training metrics 309-314
main entry point for application 282-284
outputting performance metrics 300-304
pretraining setup and initialization 284-289
running training script 304-307
training and validating the model 295-300
CT scans 238-241
data augmentation 346-354
improvement from352-354
techniques 347-352
data loading
loading individual CT scans 262-265
locating nodules 265-271
parsing LUNA's annotation data 256-262
raw CT data files 256
deployment
enterprise serving of PyTorch models 476
exporting models 455-458
interacting with PyTorch JIT 458-465
LibTorch 465-472
mobile 472-476
serving PyTorch models 446-454
difficulty of 245-247
end-to-end analysis 405-407
bridging CT segmentation and nodule candidate classification 408-416
diagnosis script 432-434
independence of validation set 407-408
predicting malignancy 417-431
quantitative validation416-417
training, validation, and test sets 433-434
false positives and false negatives 320-322
high-level plan for improvement 319-320
LUNA Grand Challenge data source
downloading 251-252
overview 251
metrics
graphing positives and negatives 322-333
nodules 249-250
overview 236-237
preparing for large-scale projects 237-238
second model 358-360
segmentation
semantic segmentation 361-366
types of 360-361
updating dataset for369-386
updating model for366-369
updating training script for 386-399
structure of 241-252
candidate_count 412
candidateInfo_list 381, 414
CandidateInfoTuple data structure 377
candidateLabel_a array 411
center_crop 464
center_index - index_radius 373
center_index + index_radius 373
chain rule 123
ChainDataset 174
channel dimension 76
channels 197
CIFAR-10 dataset 165-173
data transforms 168-170
Dataset class 166-167
downloading 166
normalizing data 170-172
CIFAR-100 166
cifar2 object 174
class balancing 339-341
class_index 180
classification
classifying by diameter419-422
to reduce false positives412-416
classification model training
disconnect 315-316
evaluating the model308-309
first-pass neural network design 289-295
converting from convolution to linear 294-295
core convolutions 290-292
full model 293-295
initialization 295
foundational model and training loop 280-282
graphing training metrics 309-314
adding TensorBoard support to the metrics logging function 313-314
running TensorBoard309-313
writing scalars to TensorBoard 314
main entry point for application 282-284
classification model training (continued)
outputting performance metrics 300-304
constructing masks302-304
logMetrics function301-304
pretraining setup and initialization 284-289
care and feeding of data loaders 287-289
initializing model and optimizer 285-287
running training script304-307
enumerateWithEstimate function 306-307
needed data for training 305-306
training and validating the model 295-300
computeBatchLoss function 297-299
validation loop 299-300
classification threshold 323
classificationThreshold 302
classificationThreshold_float324
classifyCandidates method 410
clean_a 411
clean_words tensor 96
clear() method 452
CMake 468
CMakeLists.txt 472
Coco 166
col_radius 373
comparison ops 53
computeBatchLoss function 297-300, 390, 392
ConcatDataset 174
contextSlices_count parameter 380
contiguous block 467
contiguous method 61
contiguous tensors 60
contrastive learning 437
conv.weight 198
conv.weight.one_() method 200
convolutional layers 370
convolutions 194-229
birds vs. airplanes challenge 196-207
as nn module 208-209
detecting features 200-202
downsampling 203-204
padding boundary 198-200
pooling 203-204
function of 194-196
model design 217-229
comparing designs228-229
depth of network 223-228
outdated 229
regularization 219-223
width of network 218-219
subclassing nn module207-212
training 212-217
measuring accuracy 214
on GPU 215-217
saving and loading 214-215
ConvTransposed2d 469
copying 449
coroutines 449
Cortex 476
cost function 109
cpu method 64
create_dataset function 67
creation ops 53
CrossEntropyLoss 297
csv module 78
CT (computed tomography) scans 75, 240
Ct class 256, 262, 264, 271,280, 289
CT scans 238-241
bridging CT segmentation and nodule candidate classification 408-416
classification to reduce false positives 412-416
grouping voxels intonodule candidates411-412
segmentation 410-411
caching chunks of mask in addition to CT 376
calling mask creation during CT initialization 375
extracting nodules from270-271
Hounsfield units 264-265
loading individual 262-265
scan shape and voxel sizes 267-268
ct_a values 264
ct_chunk function 348
ct_mhd.GetDirections() method 268
ct_mhd.GetSpacing() method 268
ct_ndx 381
ct_t 382, 394
Ct.getRawCandidate function 274, 376
ct.positive_mask 383
cuda method 64
cuDNN library 460
CycleGAN 29-30, 452, 458,464, 468
cyclegan-cpp-api 472
D
data augmentation 346-354
improvement from 352-354
on GPU 384-386
techniques 347-352
mirroring 348-349
noise 350
rotating 350
scaling 349
shifting 349
data augmentation strategy 191
data loading
loading individual CT scans 262-265
locating nodules 265-271
converting between millimeters and voxel addresses 268-270
CT scan shape and voxel sizes 267-268
extracting nodules from CT scans 270-271
patient coordinate system 265-267
parsing LUNA's annotation data 256-262
training and validation sets 258-259
unifying annotation and candidate data 259-262
raw CT data files 256
caching candidate arrays 274
data loading (continued)
constructing dataset in LunaDataset.__init__ 275
rendering data 277
segregation betweentraining and validation sets 275-276
data representation usingtensors
images 71-75
3D images 75-76
adding color channels 72
loading image files 72-73
normalizing data 74-75
tabular data 77-87
categorization 83-84
one-hot encoding 81-83
real-world dataset 77-78
representing scores 81
thresholds 84-87
text 93-101
converting text to numbers 94
one-hot encoding whole words 96-98
text embeddings 98-100
text embeddings as blueprint 100-101
time series 87-93
adding time dimensions 88-89
shaping data by time period 89-90
training 90-93
Data Science Bowl 2017 438
data tensor 85
data.CIFAR10 dataset 167
DataLoader class 11, 280, 284, 288, 381, 414
DataParallel 286, 387
dataset argument 418
Dataset class 11, 166-167
Dataset subclass 173, 256,271-273, 275, 279, 284,339, 378, 414
dataset.CIFAR10 169
datasets module 166
deep learning
exercises 15
hardware and software requirements 13-15
paradigm shift from 4-6
PyTorch for 6-9
how supports deep learning projects 10-13
reasons for using 7-9
def __len__ method 272
dense tensors 65
DenseNet 226
deployment
enterprise serving of PyTorch models 476
exporting models 455-458
ONNX 455-456
tracing 456-458
interacting with PyTorch JIT 458-465
dual nature of PyTorch as interface and backend 460
expectations 458-460
scripting gaps of traceability 464-465
TorchScript 461-464
LibTorch 465-472
C++ API 468-472
running JITed models from C++ 465-468
mobile 472-476
serving PyTorch models446-454
Flask server 446-448
goals of deployment448-449
request batching 449-454
depth of network 223-228
building very deep models 226-228
initialization 228
skip connections 223-226
device argument 64
device attribute 63-64
device variable 215
diameter_mm 258
Dice loss 389-392
collecting metrics 392
loss weighting 391
diceLoss_g 391
DICOM (Digital Imaging and Communications in Medicine) 76, 256, 267
DICOM UID 264
Dirac distribution 187
discrete convolution 195
discrete cross-correlations 195
discriminator network 28
diskcache library 274, 384
dispatching mechanism 65
DistilBERT 475
distillation 475
doTraining function296, 301, 314
doValidation function301, 393, 397
downsampling 203-204
dropout 25, 220-222
Dropout module 221
DSB (Data Science Bowl) 438
dtype argument 64
precision levels 51
specifying numeric types with 50-51
dtype torch.float 65
dull batches 367
E
edge detection kernel 201
einsum function 48
embedding text
as blueprint 100-101
data representation with tensors 98-100
embeddings 96, 99
end-to-end analysis 405-407
bridging CT segmentation and nodule candidate classification 408-416
classification to reduce false positives 412-416
grouping voxels intonodule candidates411-412
segmentation 410-411
diagnosis script 432-434
independence of validation set 407-408
predicting malignancy 417-431
classifying by diameter 419-422
reusing preexisting weights 422-427
TensorBoard 428-431
end-to-end analysis (continued)
quantitative validation416-417
training, validation, and test sets 433-434
English Corpora 94
ensembling 435-436
enterprise serving 476
enumerateWithEstimate function 297, 306-307
epoch_ndx 301
error function 144-145
eval mode 25
F
F1 score
updating logging output to include 332
face-to-age prediction model 345-346
false negatives 324, 395
false positives 321-322, 326, 329, 395, 401
falsePos_count 333
falsifying images, pretrainednetworks for 27-33
CycleGAN 29-30
GAN game 28
generating images 30-33
Fashion-MNIST 166
Fast R-CNN 246
feature engineering 256
feature extractor 423
fine-tuning 101, 422
FishNet 246
Flask 446-448
flip augmentation 352
float array 466
float method 52
float32 type 169
float32 values 274
floating-point numbers 40-42, 50, 77
fnLoss_g 391
for batch_tup in self.train_dl 289
for loop 226, 464
forward function 152, 207,218, 225
forward method 294, 368, 385
forward pass 22
FPRED (False positive reduction) 251
from_blob 466
fullCt_bool 380
function docstring 307
G
GAN (generative adversarialnetwork) game 17, 28
generalized classes 345
generalized tensors 65-66
generator network 28
geometric mean 331
get_pretrained_model 458
getattr function 418
getCandidateInfoDict function 375
getCandidateInfoList function 259, 275, 373,375, 377
getCt value 274
getCtRawCandidate function 274, 376, 383
getCtRawNodule function 272
__getitem__ method 272-274, 351, 381
_getitem__ method 272
getitem method 166
getItem_fullSlice method 382
getItem_trainingCrop 383
getRawNodule function 271
ghost pixels 199
GIL (global interpreter lock) 449
global_step parameter 314, 428
Google OAuth 252
GPUs (graphical processing units) 41
moving tensors to 62-64
training networks on 215-217
grad attribute 124-125
grad_fn 179
gradient descent algorithm 113-122
applying derivatives to model 115
computing derivatives 115
data visualization 122
decreasing loss 113-114
defining gradient function 116
Iterating to fit model 116-119
overtraining 118-119
training loop 116-117
normalizing inputs 119-121
grid_sample function347, 349, 385
grouping 247, 406, 408, 413
groupSegmentationOutput method 410
H
h5py library, serializing tensors to HDF5 with 67-68
HardTanh 440
Hardtanh function 148
hardware for deep learning13-15
harmonic mean 329
hasAnnotation_bool flag 378
HDF5, serializing tensors to67-68
head_linear module 423
--help command 282
hidden layer 158
histograms 311, 428-431
HU (Hounsfield units)264-265, 293
hyperparameter search 287
hyperparameter tuning 118
hyperparameters 184
I
identity mapping 225
IDRI (Image Database Resource Initiative) 377
ILSVRC (ImageNet LargeScale Visual Recognition Challenge) 18, 20
image data representation 71-75
3D images
data representation 75-76
loading 76
adding color channels 72
loading image files 72-73
normalizing data 74-75
Image object 268
image recognition
CIFAR-10 dataset 165-172
data transforms 168-170
Dataset class 166-167
downloading 166
normalizing data 170-172
image recognition (continued)
example network 172-191
building dataset 173-174
fully connected model 174-175
limits of 189-191
output of classifier 175-176
representing output as probabilities 176-180
training the classifier182-189
image_a 394
image.size() method 466
imageio module 72-73, 76
ImageNet 17, 423
ImageView 472
img array 73
img_t tensor 47
in-place operations 55
indexing ops 53
indexing tensors
into storages 54-55
list indexing in Python vs. 42
range indexing 46
inference 25-27
__init__ constructor 470
init constructor 156
__init__ method 264, 283, 385
init parameter 218
_init_weights function 295
input object 22
input voxels 292
instance segmentation 360
ÌnstanceNorm2d 469
_irc suffix 268
_irc variable 256
isMal_bool flag 378
isValSet_bool parameter 275
IterableDataset 166
J
Java App 472
JAX 9
JNI (Java Native Interface) 472
joining ops 53
Jupyter notebooks 14
K
Kepler’s laws 105
kernel trick 209
kernels 195, 459
L
L2 regularization 219
label function 411
label smoothing 435
label_g 390
labeling images, pretrainednetworks for 33-35
LAPACK operations 53
last_points tensor 68
layers 23
leaks 408
LeakyReLU function 148
__len__ method 272, 340
len method 166
LibTorch 465-472
C++ API 468-472
running JITed models from C++ 465-468
LIDAR (light detection and ranging) 239
LIDC (Lung Image Database Consortium) 377-378
LIDC-IDRI (Lung Image Database Consortium image collection) 377, 417
linear model 153-157
batching inputs 154
comparing to 161-162
optimizing batches 155-157
replacing 158-159
list indexing 42
lists 50
load_state_dict method 31
log_dir 313
log.info method 303
--logdir argument 310
logdir parameter 353
logits 187, 294
logMetrics function 297, 313, 393
implementing precision and recall in 327-328
overview 301-304
loss tensor 124
loss.backward() method124, 126, 212
lottery ticket hypothesis 197
LPS (left-posterior-superior)266
LSTM (long short-term memory) 217, 459-460
LUNA (LUng Nodule Analysis) 251, 256, 263, 337, 378, 417, 438
LUNA Grand Challenge data source
contrasting training withbalanced LUNA Dataset to previous runs 341-343
downloading 251-252
LUNA papers 439
overview 251
parsing annotation data256-262
training and validation sets 258-259
unifying annotation and candidate data259-262
Luna2dSegmentationDataset378-382
Luna2dSegmentationDataset .__init__ method 380
LunaDataset class 271, 274,280, 284, 287-288, 305,320, 339-340
LunaDataset.__init__,constructing dataset in 275
LunaModel 285, 447
M
machine learning
autograd component123-138
computing gradient automatically 123-127
evaluating training loss 132-133
generalizing to validation set 133-134
optimizers 127-131
splitting datasets 134-136
switching off 137-138
gradient descent algorithm 113-122
applying derivatives to model 115
machine learning: gradient descent (continued)
computing derivatives 115
data visualization 122
decreasing loss 113-114
defining gradient function 116
Iterating to fit model116-119
normalizing inputs119-121
modeling 104-106
parameter estimation106-109
choosing linear model 108-109
data gathering 107-108
data visualization 108
example problem 107
main method 283, 471
malignancy classification 407
malignancy model 407
--malignancy-path argument 432
MalignancyLunaDataset class 418
malignant classification 413
map_location keyword argument 217
Mask R-CNN 246
Mask R-CNN models 465
masks
caching chunks of mask in addition to CT 376
calling mask creation during CT initialization 375
constructing 302-304
math ops 53
Matplotlib 172, 247, 431
max function 26
max pooling 203
mean square loss 111
memory bandwidth 384
Mercator projection map 267
metadata, tensor 55-62
contiguous tensors 60-62
transposing in higher dimensions 60
transposing without copying 58-59
views of another tensor’s storage 56-58
MetaIO format 263
metrics
graphing positives and negatives 322-333
performance 332-333
precision 326-328, 332
recall 324, 327-328, 332
class balancing 339-341
contrasting training with balanced LUNADataset to previous runs 341-343
making data look less like the actual and more like the ideal 336-341
samplers 338-339
metrics_dict 303, 314
METRICS_PRED_NDX values 302
metrics_t tensor 428
millimeter-based coordinate system 265
minibatches 129, 184-185
mirroring 348-349
MIT license 367
mixed-precision training 475
mixup 435
MLflow 476
MNIST dataset 165-166
mobile deployment 472-476
mode_str argument 301
model design 217-229
comparing designs 228-229
depth of network 223-228
building very deep models 226-228
initialization 228
skip connections 223-226
outdated 229
regularization 219-223
batch normalization222-223
dropout 220-222
weight penalties 219-220
width of network 218-219
model function 131, 142
Model Runner function450-451
model_runner function453-454
model.backward() method 159
Model.load method 474
model.parameters() method 159
model.state_dict() function 397
model.train() method 223
ModelRunner class 452
models module 22
modules 151
MS COCO dataset 35
MSE (Mean Square Error)157, 180, 182
MSELoss 175
multichannel images 197
multidimensional arrays,tensors as 42
multitask learning 436
mutating ops 53
N
N dimension 89
named tensors 46, 48-49
named_parameters method 159
names argument 48
NDET (Nodule detection) 251
ndx integer 272
needs_processing event452, 454
needs_processing. ModelRunner 452
neg_list 418
neg_ndx 340
negPred_mask 302
netG model 30
neural networks
__call__ method 152-153
activation functions 145-149
capping output range 146
choosing 148-149
compressing output range 146-147
composing multilayer networks 144
error function 144-145
first-pass, for cancer detector 289-295
converting from convolution to linear 294-295
core convolutions 290-292
full model 293-295
initialization 295
neural networks (continued)
linear model 153-157
batching inputs 154
comparing to 161-162
optimizing batches155-157
replacing 158-159
nn module 151-157
what learning means for149-151
NeuralTalk2 model 33-35
neurons 143
NLL (negative log likelihood) 180-181
NLP (natural language processing) 93
nn module 151-157, 207-212
nn.BatchNorm1D module 222
nn.BatchNorm2D module 222
nn.BatchNorm3D module 222
nn.BCELoss function 176
nn.BCELossWithLogits 176
nn.Conv2d 196, 205
nn.ConvTranspose2d 388
nn.CrossEntropyLoss 187, 273, 295, 336
nn.DataParallel class 286
nn.Dropout module 221
nn.Flatten layer 207
nn.functional.linear function 210
nn.HardTanh module 211
nn.KLDivLoss 435
nn.Linear 152-153, 155, 174, 194
nn.LogSoftmax 181, 187
nn.MaxPool2d module204-205, 210
nn.Module class 151-152,154, 159, 207, 209, 293,385-386, 470
nn.ModuleDict 152, 209
nn.ModuleList 152, 209
nn.NLLLoss class 181, 187
nn.ReLU layers 292
nn.ReLU module 211
nn.Sequential model159, 207-208
nn.Sigmoid activation 176
nn.Sigmoid layer 368
nn.Softmax 177-178, 181,293-294
nn.Tanh module 210
nodule classification 406
nodule_t output 273
noduleInfo_list 262
NoduleInfoTuple 260
nodules 249-250
finding through segmentation
semantic segmentation 361-366
types of 360-361
updating dataset for369-386
updating model for366-369
updating training script for 386-399
locating 265-271
converting betweenmillimeters and voxel addresses 268-270
CT scan shape and voxel sizes 267-268
extracting nodules from CT scans 270-271
patient coordinate system 265-267
NoGradGuard 471
noise 350
noise-augmented model 354
non-nodule values 304
--num-workers 283
NumPy arrays 41, 78
NumPy, tensors and 64-65
numpy.frombuffer 447
nvidia-smi 305
O
object detection 360
object recognition, pretrained networks for 17-27
AlexNet 20-22
obtaining 19-20
ResNet 22-27
offset argument 385
offset parameter 349
Omniglot 166
onActivityResult 474
one-hot encoding 91-92
tabular data 81-83
text data
whole words 96-98
ONNX (Open Neural Network Exchange) 446, 455-456
onnxruntime-gpu 456
OpenNMT’s original CTranslate 475
optim module 129
optim.SGD 156
optimizer.step() method156, 159
gradient descent optimizers 128-130
testing optimizers 130-131
options argument 470
ordered tabular data 71
OrderedDict 160
org.pytorch namespace 473
org.pytorch.torchvision.TensorImageUtils class 473
OS-level process 283
Other operations 53
out tensor 26
overfitting 132, 134, 136,345-346, 434-437
abstract augmentation 435
classic regularization and augmentation 435
ensembling 435-436
face-to-age prediction model 345-346
generalizing what we ask the network to learn 436-437
preventing with data augmentation 346-354
improvement from352-354
mirroring 348-349
noise 350
rotating 350
scaling 349
shifting by a random offset 349
P
p2_run_everything notebook 408
p7zip-full package 252
padded convolutions 292
padding 362
padding flag 370
pandas library 41, 78, 377
parallelism 53
parameter estimation 106-109
choosing linear model108-109
data gathering 107-108
data visualization 108
example problem 107
parameter groups 427
parameters 120, 145, 160, 188, 196, 225, 397
parameters() method156, 188, 210
params tensor 124, 126, 129
parser.add_argument 352
patient coordinate system266-267
converting betweenmillimeters and voxel addresses 268-270
CT scan shape and voxel sizes 267-268
extracting nodules from CT scans 270-271
overview 265-267
penalization terms 134
permute method 73, 170
pickle library 397
pin_memory option 216
points tensor 46, 57, 64
points_gpu tensor 64
pointwise ops 53
pooling 203-204
pos_list 383, 418
pos_ndx 340
pos_t 382
positive loss 344
positive_mask 376
POST route 447
PR (Precision-Recall) Curves 311
precision 326
implementing in logMetrics 327-328
updating logging output to include 332
predict method 209
prediction images 393
prediction_a 394
prediction_devtensor 390
prepcache script 376, 440
preprocess function 23
pretext tasks 436
pretrained keyword argument 36
pretrained networks 423
describing content of images 33-35
fabricating false images from real images 27-33
CycleGAN 29-30
GAN game 28
generating images 30-33
recognizing subject of images 17-27
AlexNet 20-22
inference 25-27
obtaining 19-20
ResNet 22-27
Torch Hub 35-37
principled augmentation 222
Project Gutenberg 94
PyLIDC library 417-418
pyplot.figure 431
Python, list indexing in 42
PyTorch 6
functional API 210-212
how supports deep learning projects 10-13
keeping track of parameters and submodules 209-210
reasons for using 7-9
PyTorch JIT 458-465
dual nature of PyTorch as interface and backend 460
expectations 458-460
scripting gaps of traceability 464-465
TorchScript 461-464
PyTorch models
enterprise serving of 476
exporting 455-458
ONNX 455-456
tracing 456-458
serving 446-454
Flask server 446-448
goals of deployment448-449
request batching 449-454
PyTorch Serving 476
pytorch_android library 473
pytorch_android_torchvision473
Q
quantization 475-476
quantized tensors 65
queue_lock 452
R
random sampling 53
random_float function 349
random.random() function 307
randperm function 134
range indexing 46
ratio_int 339-340
recall 324
implementing in logMetrics 327-328
updating logging output to include 332
recurrent neural network 34
RedisAI 476
reduced training 475
reduction ops 53
refine_names method 48
regression problems 107
regularization 219-223
augmentation and 435
batch normalization 222-223
dropout 220-222
weight penalties 219-220
ReLU (rectified linear unit) 147, 224
rename method 48
request batching 449-454
from request to queue452-453
implementation 451-452
running batches from queue 453-454
RequestProcessor 450, 452
requireOnDisk_bool parameter 260
requires_grad attribute 138
requires_grad-True argument 124
residual networks 224
ResNet 19, 225
creating network instance 22
details about structure of22-25
inference 25-27
resnet variable 23
resnet101 function 22
resnet18 function 36
ResNetGenerator class 30
ResNets 224-226, 366
REST endpoint 455
Retina U-Net 246
return statement 376
ROC (receiver operating characteristic) 420-421, 428, 433
ROC curves 431
ROC/AUC metrics 407
rotating 350
row_radius 373
--run-validation variant 432
S
samplers 338-339
Sanic framework 449
scalar values 314, 329
scalars 311
scale invariant 177
scaling 349
scatter_ method 82
Scikit-learn 41
SciPy 41
scipy.ndimage.measurements .center_of_mass 411
scipy.ndimage.measurements .label 411
scipy.ndimage.morphology 410
scripting 461
bridging CT segmentation and nodule candidate classification 408-416
classification to reduce false positives 412-416
grouping voxels intonodule candidates411-412
segmentation 410-411
semantic segmentation361-366
types of 360-361
updating dataset for 369-386
augmenting on GPU384-386
designing training and validation data 382-383
ground truth data 371-378
input size requirements 370
Luna2dSegmentation-Dataset 378-382
TrainingLuna2dSegmentationDataset 383-384
U-Net trade-offs for 3D vs. 2D data 370-371
updating model for 366-369
updating training script for 386-399
Adam optimizer 388
Dice loss 389-392
getting images into TensorBoard 392-396
initializing segmentation and augmentation models 387-388
saving model 397-399
updating metrics logging 396-397
segmentCt method 410
self-supervised learning 436
self.block4 294
self.candidateInfo_list 272, 275
self.cli_args.dataset 418
self.diceLoss 390
self.model.to(device) 286
self.pos_list 340
self.use_cuda 286
semantic segmentation 360-366
semi-supervised learning 436
sensitivity 324
SentencePiece libraries 97
Sequential 160
serialization 53
serializing tensors 66-68
series instance UID 263
series_uid 245, 256, 260-261, 275, 375, 381, 410
seriesuid column 258
set_grad_enabled 138
set() method 452
SGD (stochastic gradient descent) 129-130, 135, 156, 184, 220, 286
shifting by a random offset 349
show method 24
Sigmoid function 148
SimpleITK 263, 268
singleton dimension 83
sitk routines 264
Size class 56
skip connections 223-226
slicing ops 53
soft Dice 390
softmax 176-177, 181, 293
Softplus function 147
software requirements fordeep learning 13-15
sort function 26
spectral ops 53
Spitfire 190
step. zero_grad method 128
stochastic weight averaging 436
storages 53-55
in-place operations 55
indexing into 54-55
strided convolution 203
strided tensors 65
submodules 207
subword-nmt 97
SummaryWriter class313, 392, 431
SVHN 166
sys.argv 398
T
t_c values 108-109
t_p value 109-110
t_u values 108
tabular data representation77-87
categorization 83-84
one-hot encoding 81-83
real-world dataset 77-78
representing scores 81
thresholds 84-87
Tanh function 143, 147, 149, 158
target tensor 81, 84
temperature variable 92
Tensor.to method 215
TensorBoard 284, 309-314, 343, 428-431
adding support to metricslogging function 313-314
getting images into 392-396
histograms 428-431
ROC and other curves 431
running 309-313
writing scalars to 314
tensorboard program 309
TensorFlow 9
tensorflow package 309
tensors
API 52-53
as multidimensional arrays 42
constructing 43
data representation
images 71-75
tabular data 77-87
text 93-101
time series 87-93
element types
standard 50
essence of 43-46
floating-point numbers 40-42
generalized 65-66
indexing
list indexing in Python vs. 42
range indexing 46
metadata 55-62
contiguous tensors 60-62
transposing in higher dimensions 60
transposing without copying 58-59
views of another tensor’s storage 56-58
moving to GPU 62-64
named 46-49
NumPy interoperability64-65
serializing 66-68
storages 53-55
in-place operations 55
indexing into 54-55
test set 433
text data representation 93-101
converting text to numbers 94
one-hot encoding
whole words 96-98
text embeddings as blueprint 100-101
time series data representation 87-93
adding time dimensions88-89
shaping data by time period 89-90
training 90-93
time.time() method 453
to method 51, 64
top-level attributes 152, 209
Torch Hub 35-37
torch module 43, 52, 127
TORCH_MODULE macro 470
torch.bool type 85
torch.cuda.is_available 215
torch.from_numpy function68, 447
torch.jit.script 463
@torch.jit.script decorator 464
torch.jit.trace function456-457, 463
torch.linspace 421
torch.max module 179
torch.nn module 151, 196
torch.nn.functional 210-211
torch.nn.functional.pad function 199
torch.nn.functional.softmax 26
torch.nn.Hardtanh function 146
torch.nn.Sigmoid 146
torch.onnx.export function 455
torch.optim.Adam 287
torch.optim.SGD 287
torch.save 397
torch.sort 89
torch.Tensor class 19
torch.utils.data module 185
torch.utils.data.Dataset 166
torch.utils.data.dataset.Dataset 173
torch.utils.data.Subset class 174
torch.utils.tensorboard module 313
torch.utils.tensorboard .SummaryWriter class 314
TorchScript 12, 460-464
TorchVision library 465
torchvision module 165, 228
TorchVision project 19
torchvision.models 20
torchvision.resnet101 function 31
torchvision.transforms 168, 191
totalTrainingSamples_count variable 314
ToTensor 169, 171
TPR (true positive rate)419-421
TPUs (tensor processing units) 63, 65
tracing 456-458
scripting gaps of traceability 464-465
server with traced model 458
train property 221
train_dl data loader 297
train_loss.backward() method 138
training and validation sets
parsing annotation data258-259
segregation between 275-276
training set 433
training_loss.backward() method 156
TrainingLuna2dSegmentation-Dataset 383-384
transfer learning 422
transform_t 386
TransformIndexToPhysicalPoint method 268
TransformPhysicalPointTo-Index method 268
transforms.Compose 170
transforms.Normalize 171
translation-invariant 190, 194
transpose function 52
trnMetrics_g tensor 297, 300
true negatives 322
true positives 321, 324, 327,389, 392
trueNeg_count 328
truePos_count 333
tuples 259, 406
two-layer networks 149
U
U-Net architecture364-367, 388
input size requirements 370
trade-offs for 3D vs. 2D data 370-371
UIDs (unique identifiers) 263
un-augmented model 354
unboxed numeric values 43
UNetWrapper class 368, 387
up.shape 464
upsampling 364
V
val_loss tensor 138
val_neg loss 308
val_pos loss 308
val_stride parameter 275
validate function 216
validation 383, 409
validation loop 299-300
validation set 132, 433
validation_cadence 393
validation_dl 289
validation_ds 289
valMetrics_g 300
vanilla gradient descent 127
vanilla model 367
view function 294
volread function 76
volumetric data
data representation using tensors 75-76
loading 76
voxel-address-based coordinate system 265
converting betweenmillimeters and voxel addresses 268-270
grouping voxels into nodule candidates 411-412
voxel sizes 267-268
W
weight decay 220
weight parameter 200
weight penalties 219-220
weighted loss 391
WeightedRandomSampler 339
weights 106
weights argument 339
whole-slice training 383
width of network 218-219
Wine Quality dataset 77
with statement 126
with torch.no_grad() method 299, 447, 457, 471
word2index_dict 96
WordNet 17
writer.add_histogram 428
writer.add_scalar method314, 396
X
Xavier initializations 228
_xyz suffix 268
xyz2irc function 269
Y
YOLOv3 paper 360
Z
zero_grad method 128
zeros function 50, 55, 125