class CustomDataset(Dataset):
    def __init__(self, some_args):
        # We can do anything here. For example:
        # 1. list files
        # 2. load all data (not recommended for big data)
        # 3. define transforms
        # ... 
    
    def __getitem__(self, item):
        # load one sample, apply transforms, return image, and label 

    def __len__(self):
        # return len(data)

Here are some examples:
  
      

      GitHub
  

  
    

GitHub - utkuozbulak/pytorch-custom-dataset-examples: Some custom dataset... 3

  Some custom dataset examples for PyTorch. Contribute to utkuozbulak/pytorch-custom-dataset-examples development by creating an account on GitHub.