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

Exercise

Two-input dataset

Building a multi-input model starts with crafting a custom dataset that can supply all the inputs to the model. In this exercise, you will build the Omniglot dataset that serves triplets consisting of:

  • The image of a character to be classified,
  • The one-hot encoded alphabet vector of length 30, with zeros everywhere but for a single one denoting the ID of the alphabet the character comes from,
  • The target label, an integer between 0 and 963.

You are provided with train_samples, a list of 3-tuples comprising an image's file path, its alphabet vector, and the target label. Also, the following imports have already been done for you, so let's get to it!

from PIL import Image
from torch.utils.data import DataLoader, Dataset
from torchvision import transforms

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Assign transform and samples to class attributes with the same names.