← Back to Projects

Computer Vision Preprocessing Pipeline

Turns 60,000 raw images into clean, class-balanced training data, with visual checks that catch bad inputs before training.

Fifteen sample CIFAR-10 images from the pipeline's preview output, each titled with its label number and class name, such as 6: frog, 8: ship and 0: airplane.

Project Overview

This project applies data engineering practices to computer vision. The pipeline securely extracts CIFAR-10, transforms raw batch files into model-ready RGB tensors, creates reproducible train and validation splits, and checks the result before training.

CIFAR-10 has 60,000 color images (32x32) in 10 classes: airplane, automobile, bird, cat, deer, dog, frog, horse, ship, and truck. 50,000 are training images, split into train and validation, and 10,000 are test images.

How It Works

  • Secure extraction. The archive is unpacked with path traversal protection, so a malformed archive can't write outside the target folder.
  • Loading and reshaping. Raw binary batches become image tensors of shape (N, 32, 32, 3).
  • Reproducible, class-balanced splits. Training data is split into train and validation with a fixed seed, preserving the class balance (20% validation by default).
  • Class names from metadata. Label numbers are mapped to class names automatically, with fallback handling.
  • Headless mode. A --no-plot flag lets it run in terminal-only or automated environments.

Quality Checks

Each run prints the train, validation, and test array shapes, the class labels found in the training split, and a True/False check confirming all ten labels (0 to 9) are present. It also saves a preview grid of labeled sample images, like the one above, so a person can confirm at a glance that images and labels line up.

Scope & Tech Stack

The pipeline covers extraction, loading, splitting, and verification. Model training, data augmentation, and experiment tracking are out of scope.

Tech stack: Python, NumPy, scikit-learn, Matplotlib