0
0
PyTorchml~5 mins

torchvision pre-trained models in PyTorch - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
ACIFAR-10
BImageNet
CMNIST
DCOCO
Which of the following is NOT a torchvision pre-trained model?
ABERT
BVGG
CResNet
DAlexNet
What does setting pretrained=True do when loading a model?
ALoads random weights
BChanges model architecture
CLoads weights trained on a large dataset
DDisables training
Why is fine-tuning useful?
AIt increases model size
BIt trains a model from scratch
CIt removes all pre-trained weights
DIt uses learned features to adapt to new tasks quickly
Which PyTorch module provides access to pre-trained models?
Atorchvision.models
Btorch.nn
Ctorch.optim
Dtorch.utils.data
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.