Fashion-MNIST is a clothing-image dataset used as a more challenging alternative to MNIST while retaining the same size and shape, making experiments practical. section 5.1.3
A typical PyTorch setup treats Fashion-MNIST as a ten-class, single-channel image-classification task:
- Load training and test splits with torchvision.datasets.FashionMNIST and convert images using transforms.ToTensor(). section 5.1.3
- Use 28×28 images, one input channel, and ten output classes; batch them with DataLoader. section 6.0
- Compare fully connected and convolutional networks as baseline models before evaluating later training or architecture changes. section 6.0
Baseline training
Flattened 28×28 inputs can feed a multilayer fully connected network, while a CNN can apply convolution, pooling, flattening, and a ten-class linear output. Cross-entropy loss and test accuracy provide the comparison. section 5.1.3 section 6.0
epochs = 50 #1
B = 256 #2
train_data = torchvision.datasets.FashionMNIST("./data", train=True,
transform=transforms.ToTensor(), download=True)
test_data = torchvision.datasets.FashionMNIST("./data", train=False,
transform=transforms.ToTensor(), download=True)
train_loader = DataLoader(train_data, batch_size=B, shuffle=True) test_loader = DataLoader(test_data, batch_size=B)
The listing shows the dataset, transforms, batch size, shuffling, and train/test loader construction. section 5.1.3
