I’m doing some image classification, and for each image, I’ve a single boolean meta-feature.
How should I encode the meta-feature to my dataset so that I could access it during the training
when I fetch a batch from the dataloader? I’ll not pass this feature to the network that I’m training, but rather reweight the instance btw.
I think making
Dataset instance to return a batch of metadata with images (and targets) is a way if the meta-features can be represented in
For example, if we use the dataset defined below, in each iteration a
DataLoader will generate a tuple of (image, target, metas), where each item is a
def __init__(self, inputs, targets, metas):
self.inputs = inputs
self.targets = targets
self.metas = metas
def __getitem__(self, index):
return (self.inputs[index], self.targets[index], self.metas[index])
Perfect. Just one thing though: I believe it needs to inherit from torch.utils.data.Dataset, i.e.,