--- { "id": "B-001", "title": "Data Pipeline and Preprocessing", "slug": "data-pipeline-and-preprocessing", "dir": "blocks/B-001-data-pipeline-and-preprocessing", "status": "implemented", "depends_on": [], "related_blocks": [ "B-002", "B-003" ], "source_plan_refs": [ "Goal", "System Requirements", "Data Handling", "Inference" ], "paper_ids": [ "P-001", "P-002" ], "created_at": "2026-07-21T17:57:47.887Z", "updated_at": "2026-07-22T23:40:40.183Z", "source_excerpt": "Goal: build a handwritten digit classifier from MNIST.\nSystem Requirements: load MNIST, preprocess images, train, evaluate, and provide inference.\nData Handling: download/load images and labels, use train/test split, normalize pixels, reshape images.\nInference: preprocess new single images the same way as training data." } --- # Data Pipeline and Preprocessing ## Purpose Load MNIST, normalize it, split it, and prepare tensors/images in the exact shape required by the classifier. ## Source From Original Plan Goal: build a handwritten digit classifier from MNIST. System Requirements: load MNIST, preprocess images, train, evaluate, and provide inference. Data Handling: download/load images and labels, use train/test split, normalize pixels, reshape images. Inference: preprocess new single images the same way as training data. ## Responsibilities - Download or load MNIST images and labels. - Use the dataset's train/test split correctly. - Normalize pixel values for model training and inference. - Handle grayscale image shape consistently. - Format labels for the chosen loss function. - Provide reusable preprocessing for both training and inference. ## Inputs - MNIST images and labels. - Raw single-image input for inference preprocessing. ## Outputs - Training dataset. - Test dataset. - Normalized image tensors. - Encoded labels. - Shared preprocessing function. ## Dependencies TBD ## Related Blocks - [B-002](../../blocks/B-002-cnn-model-training/block.md) - [B-003](../../blocks/B-003-evaluation-inference-and-run-instructions/block.md) ## Research Questions - What is the standard normalization used for MNIST CNN baselines? - What input tensor shape should the selected framework use for 28x28 grayscale images? - Is data augmentation useful or unnecessary for a simple MNIST baseline? ## Implementation Criteria - Data loads reliably from the selected framework or dataset source. - Pixel values are normalized consistently. - Model receives 28x28x1 images or the framework-equivalent channel format. - Training and inference share the same preprocessing logic. ## Open Questions TBD