Dataset is a PyTorch base class for representing indexed collections of training examples and labels. A model-training pipeline uses it to turn stored receipts, images, audio files, or extracted features into samples that can be retrieved by index. section 6.3 section 8.1.3
A custom Dataset typically provides:
- __init__ to store file locations, annotations, transforms, class definitions, and the sample index. section 6.3.1 section 8.1.3
- __len__ to report how many examples are available for iteration. section 6.3.1 section 8.1.3
- __getitem__ to load one indexed example, process it, and return model inputs with the corresponding label. section 6.3.1 section 8.1.3
The dataset supplies individual samples; DataLoader supplies batching, shuffling, and parallel loading. Separate Dataset objects can represent training, validation, and test splits before model training and evaluation. section 6.3 section 8.1.3
Receipt forgery segmentation
A SegmentationDataset reads a receipt image, creates a binary mask from forgery bounding boxes, resizes the image and mask, converts the mask to an integer tensor, and returns both. DeepLabV3 can then classify each pixel as genuine or forged. section 6.3.1 section 6.3
Real-versus-fake audio
An AudioDataset indexes WAV files under real and fake directories. For a requested index, it loads the waveform, extracts MFCC features through a transform, converts the class name to an integer, and returns the feature-label pair. section 8.1.3

