1. Learn
  2. /
  3. Courses
  4. /
  5. Deep Learning for Images with PyTorch

Connected

Exercise

Loading a pre-trained model

You are building an application to label images from the social media. This task requires high accuracy and speed. You are going to use a pre-trained ResNet18 model to infer image classes.

Instructions

100 XP
  • Import resnet18 and ResNet18_Weights from torchvision.models.
  • Instantiate the model using resnet18(), setting the weights parameter to weights.
  • Set model to the evaluation mode.
  • Initialize the input transforms and assign them to transform.