Deep Learning (PyTorch)
CNNs, transformers, training — modern perception & policies.
Prerequisites
Why it matters in robotics
Modern robotics perception (object detection, segmentation, depth) and learned policies (imitation and RL, visuomotor and language-conditioned control) are built on layered neural networks trained on large datasets. The training loop — forward pass, loss, backpropagation, optimizer step — together with the failure modes of divergence and overfitting, and how these networks learn to extract spatial and sequential structure directly from images and sequences, are what make these models work. Deep learning is now the default toolkit for perception and, increasingly, for control.
What to study
- ✓CNN building blocks: convolution, pooling, receptive fields, and classic backbones (ResNet) for perception
- ✓Transformers and self-attention: Q/K/V, multi-head attention, positional encodings; intuition for ViT and policy transformers
- ✓The training loop and optimization: autograd, loss functions, SGD/Adam, learning-rate schedules, batch norm
- ✓Generalization and debugging: overfitting vs underfitting, regularization, data augmentation, and transfer learning / fine-tuning
Where to study
Cheatsheet
Symbols used below
Conv output size
For an input of width , kernel size , stride , padding :
Stacking layers grows the receptive field, letting deeper layers respond to larger regions of the input image.
Scaled dot-product attention
Each output position is a weighted average of value vectors, with weights set by query-key similarity. The scaling keeps dot products from growing too large and saturating the softmax. Multi-head attention runs several of these in parallel subspaces and concatenates the results.
Training loop
Forward pass computes predictions and loss; backpropagation applies the chain rule to get for every parameter; the optimizer (SGD, Adam) updates weights using those gradients and a learning rate .
Autograd handles the backward pass automatically by tracking the computation graph built during the forward pass.
Optimizers: SGD vs Adam
Plain SGD: , often with momentum to smooth out noisy gradients.
Adam adapts the effective step size per-parameter using running estimates of the gradient's mean and variance, which usually converges faster and needs less learning-rate tuning.
Generalization tools
Batch normalization rescales activations per mini-batch, stabilizing and speeding up training.
Data augmentation (crops, flips, color jitter) and dropout reduce overfitting by preventing the network from memorizing exact pixels or co-adapting units. Transfer learning fine-tunes a model pretrained on a large dataset, needing far less task-specific data.
Divergence and vanishing/exploding gradients
Very deep networks or too-high learning rates can make gradients blow up (loss goes to NaN) or shrink toward zero (early layers stop learning).
Residual (skip) connections, careful initialization, batch norm, and learning-rate warmup/schedules are the standard fixes.
Application focus
Practice questions (15)
- Diagnosing and fixing exploding gradients in a deep recurrent/Transformer training runhard
- Counting parameters in a 2D convolution layer (with bias)hard
- Focal lossInterviewhard
- Voxels — advantages and disadvantagesInterviewmedium
- What are PointPillars?Interviewhard
- The VGG architectureInterviewmedium
- Convolution and output dimensionsInterviewmedium
- Optimizers and how Adam worksInterviewmedium
- Vanishing gradients — what and how to identifyInterviewmedium
- Upgrading a detector from YOLO-small to YOLO-mediumInterviewmedium
- Detecting small bounding boxesInterviewhard
- Metrics for small-bounding-box detection when IoU is unreliableInterviewhard
- Fusing RGB and thermal images for detection (wildfire example)Interviewhard
- Loss function for pose (position + orientation)Interviewhard
- Choosing a YOLO model variant (small vs medium vs large)Interviewmedium