Recall & Review
beginner
What is a pre-trained model in torchvision?
A pre-trained model in torchvision is a neural network model that has already been trained on a large dataset like ImageNet. It can be used directly or fine-tuned for new tasks, saving time and resources.
Click to reveal answer
beginner
Name two popular pre-trained models available in torchvision.
Two popular pre-trained models in torchvision are ResNet (e.g., ResNet-50) and VGG (e.g., VGG-16). Both are widely used for image classification tasks.
Click to reveal answer
beginner
How do you load a pre-trained ResNet-18 model in PyTorch using torchvision?
You can load it with: <pre>import torchvision.models as models
model = models.resnet18(weights=models.ResNet18_Weights.DEFAULT)</pre> This downloads the weights trained on ImageNet.Click to reveal answer
intermediate
Why might you want to fine-tune a pre-trained model instead of training from scratch?
Fine-tuning uses the learned features from a large dataset and adapts them to your specific task. It requires less data and training time, and often improves performance on small datasets.
Click to reveal answer
beginner
What is the role of the
pretrained=True argument when loading models in torchvision?The
pretrained=True argument tells torchvision to load the model with weights trained on a large dataset (usually ImageNet). Without it, the model has random weights.Click to reveal answer
What dataset are torchvision pre-trained models commonly trained on?
✗ Incorrect
Most torchvision pre-trained models are trained on ImageNet, a large dataset with millions of labeled images.
Which of the following is NOT a torchvision pre-trained model?
✗ Incorrect
BERT is a language model, not an image model, so it is not part of torchvision pre-trained models.
What does setting
pretrained=True do when loading a model?✗ Incorrect
It loads the model with weights trained on a large dataset like ImageNet.
Why is fine-tuning useful?
✗ Incorrect
Fine-tuning adapts pre-trained features to new tasks, saving time and improving performance.
Which PyTorch module provides access to pre-trained models?
✗ Incorrect
The torchvision.models module contains pre-trained models for computer vision.
Explain what a torchvision pre-trained model is and why it is useful.
Think about how using a model trained on many images helps with new tasks.
You got /4 concepts.
Describe the steps to load and use a pre-trained ResNet model in PyTorch.
Focus on the code and what pretrained=True means.
You got /3 concepts.