February 2018
Intermediate to advanced
262 pages
6h 59m
English
We have already seen how to create a PyTorch dataset. It should be a subclass of the torch.utils.data dataset class and should implement the __getitem__(self, index) and __len__(self) methods, which return the length of the data in the dataset. In the following code, we implement a custom dataset for the pre-convoluted features:
class FeaturesDataset(Dataset): def __init__(self,featlst,labellst): self.featlst = featlst self.labellst = labellst def __getitem__(self,index): return (self.featlst[index],self.labellst[index]) def __len__(self): return len(self.labellst)
Once the custom dataset class is created, creating a data loader for the pre-convoluted features ...