1. Learn
  2. /
  3. Courses
  4. /
  5. Multi-Modal Models with Hugging Face

Connected

Exercise

CV fine-tuning: model classes

In this exercise, you will load the pretrained model, and adapt the output to accommodate a new classification of car model types from the Stanford Cars dataset instead of the 1000 classes used for the original ImageNet training. The dataset contains labelled images of cars.

The dataset has been loaded (dataset), as has AutoModelForImageClassification from transformers. The dataset has been filtered so that three model types are included.

Instructions

100 XP
  • Obtain the new label names from the dataset
  • Add the new id2label mapping while loading the model.
  • Add the corresponding label2id mapping.
  • Add the required flag to change the number of classes.