Hi guys,
I’m loading my image dataset (3 classes) with datasets.ImageFolder(), unfortunately the labels are then integers. So for the first class the label is 0, for the second it is 1 and for the last it is 2. I’d like the labels to be one hot encoded tho. Is there a way I can do this with the target_transform property when loading the data?
I’ve tried nn.functinal.one_hot() for example but I always need an input for this functions but I don’t know what to use as an input.
I also tried to use torch.eye(3)[i] where i is the label (0, 1 or 2) but again, i need the target as an input.
Is there a way to do this?
Thank you