Fashion MNIST is a dataset of 70,000 grayscale images of clothing items, including shirts, shoes, and bags. It provides a compact training task for learning diffusion models and generating new clothing images from noise. section 5.0
A typical PyTorch preprocessing pipeline performs these steps:
- Resizes each image from one 28×28 channel to one 32×32 channel so it matches the off-the-shelf U-Net input. section 5.3.2
- Converts pixel data from integer images into floating-point PyTorch tensors with values between 0.0 and 1.0. section 5.3.2
- Normalizes tensor values to [−1, 1] to support faster training convergence. section 5.3.2
- Groups shuffled examples into batches so CPUs and GPUs can update model weights more efficiently. section 5.3.2
Labeled clothing classes
The ten numerical labels map to t-shirt, trouser, pullover, dress, coat, sandal, shirt, sneaker, bag, and ankle boot. Visualizing labeled samples makes the grayscale training data easier to inspect. section 5.3.2
from torchvision import transforms torch.manual_seed(42) #1 tf = transforms.Compose( [transforms.Resize((32,32)),transforms.ToTensor(), transforms.Lambda(lambda x: 2*(x-0.5)),] #2 )
Inspect the transformation pipeline that resizes, tensorizes, and normalizes Fashion MNIST images. section 5.3.2
