data = ImageFolder('.data/',transform=transform)
data_target = [sample[1] for sample in data.imgs]

dataset = torch.utils.data.Subset(data, train_idx)

I have splitted data as ‘train_idx’ and I want to extract the ‘target’ as in ImageFolder.
However, as mentioned in the Subset’ documentation, there seems to be no other way.
Is there a way to extract the ‘target’ using a Subset or some other way?