1. Learn
  2. /
  3. Courses
  4. /
  5. Efficient AI Model Training with PyTorch

Connected

Exercise

Preprocess image datasets

You're developing a precision agriculture system to help farmers monitor crop health, using a pre-trained transformer model, which you can later fine-tune on agricultural imagery. Preprocess the dataset using AutoImageProcessor to prepare for training!

Some data has been pre-loaded:

  • The AutoImageProcessor class has been imported from transformers
  • model is equal to microsoft/swin-tiny-patch4-window7-224
  • A sample dataset has been defined, with a sample image loaded into the variable image

Instructions

100 XP
  • Load a pre-trained image processor from the pre-defined model.
  • Map the image_processor to the entire dataset.