liveBook · Manning

Pretraining

As explained in Inside Deep Learning: Math, Algorithms, Models

A strategy of training a model on a source dataset before adapting it to a downstream task.

Pretraining initializes a model with weights learned on a source dataset before adapting it to a downstream task. In image classification, pretrained convolutional filters provide a stronger starting point than random weights, while a replacement output layer is learned for the new labels. section 13.2.1

A practical pretraining workflow is:

  • Load a model trained on a large source dataset such as ImageNet. section 13.2.1
  • Replace the final fully connected layer so its output matches the downstream classes; the new layer starts with random weights. section 13.2.1
  • Train the adapted model with warm or frozen pretrained weights, depending on the available target data. section 13.2.3 section 13.6

Adapting ResNet-18

Load a pretrained ResNet-18, then replace its output layer with a two-class linear layer for cat-versus-dog classification. Earlier convolutional filters retain features such as edges and color changes, while training adapts the network to the target data. section 13.2.1

How Inside Deep Learning: Math, Algorithms, Models covers it

How deep it goes
Explains model surgery, weight initialization, feature intuition, and warm or frozen training, but stops short of formal guarantees.
Examples
Uses ImageNet-trained ResNet-18, cat-versus-dog classification, replaced linear heads, and visualized convolutional filters.
What it assumes
Assumes basic gradient-descent training and convolutional networks, while teaching why learned image features can transfer across tasks.
What you can do after
Apply it via torchvision.models by loading pretrained weights, replacing the task-specific head, and training with warm or frozen parameters.
How it connects
Connects pretraining to transfer learning, convolutional neural networks, fine-tuning, warm starts, and transformer models.

Also explained in

Compare how 14 books explain pretraining →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Inside Deep Learning: Math, Algorithms, Models. The section links point to the parts of the book it draws on.