Computer Vision & Deep Learning

Evolution of Image Classification

From handcrafted features to convolutional neural networks: an experimental comparison of traditional machine learning and deep learning approaches across MNIST and CIFAR-10.

Python PyTorch scikit-learn Computer Vision CNNs GPU Computing

Project Overview

This project investigates how image representation and model architecture affect classification performance as visual complexity increases. I developed and evaluated five classification pipelines on two datasets: MNIST, containing handwritten digits, and CIFAR-10, containing natural color images.

The study progresses from raw-pixel linear classifiers through handcrafted Histogram of Oriented Gradients (HOG) features to fully connected neural networks and convolutional neural networks (CNNs).

Classical machine learning pipelines were implemented using scikit-learn, while neural networks were developed using PyTorch and trained on a Google Colab T4 GPU. Controlled experiments evaluated classification accuracy, feature representations, hyperparameters, generalization, and overfitting.

Classification Approaches

Five approaches were evaluated on both datasets, producing ten classification pipelines. The experiments were designed to distinguish improvements from better image representations from those resulting from changes in the classifier itself.

Raw Pixels + Logistic Regression

Flattened images into numerical feature vectors and trained multiclass logistic regression models to establish linear classification baselines.

HOG + Logistic Regression

Extracted local edge orientation and shape information using HOG features. Compared orientation-bin settings to evaluate the impact of handcrafted representations.

HOG + Linear SVM

Reused the selected HOG representations with a linear support vector machine, isolating the effect of changing the classification algorithm.

Fully Connected Neural Network

Developed PyTorch neural networks using dense layers and ReLU activations. Investigated learning rates, training duration, and generalization behavior.

Convolutional Neural Network

Built CNNs with convolutional layers, ReLU activations, and max pooling to learn spatial image features directly from the original image tensors.

Experimental Methodology

Each dataset was divided into fixed training and validation subsets using an 80/20 stratified split. The official test datasets remained separate during model selection.

Classical models used standardized features, while neural networks were trained with mini-batch optimization using Adam and cross-entropy loss. Hyperparameters were evaluated using validation accuracy before final test performance was recorded.

The experiments also examined training and validation accuracy curves, confusion matrices, and individual misclassified images to understand where each approach succeeded or struggled.

Experimental Results

Convolutional neural networks achieved the highest final test accuracy on both datasets. The advantage was particularly significant on CIFAR-10, where learning spatial image features improved performance over fully connected networks and classical classifiers.

99.02%

MNIST CNN Accuracy

The convolutional neural network achieved 99.02% test accuracy on handwritten digit classification, outperforming all four alternative pipelines.

67.28%

CIFAR-10 CNN Accuracy

The CNN achieved 67.28% test accuracy on natural images, compared with 53.96% for the fully connected neural network.

+14.29

HOG Feature Improvement

Handcrafted HOG features improved CIFAR-10 logistic-regression test accuracy by 14.29 percentage points over the raw-pixel baseline.

Key Findings

Feature representation mattered more than the choice between linear classifiers. Switching from raw pixels to HOG improved classification substantially, particularly on CIFAR-10. However, switching from logistic regression to a linear SVM while holding HOG features constant produced almost no accuracy improvement.

CNNs were more effective on visually complex images. Convolutional filters and pooling allowed the network to learn local spatial relationships rather than relying on fixed pixel positions. On CIFAR-10, the CNN exceeded the fully connected network by 13.32 percentage points in final test accuracy.

Model complexity introduced overfitting. The CIFAR-10 CNN reached 99.28% training accuracy, but only 67.28% final test accuracy. Validation accuracy peaked earlier in training, suggesting that techniques such as early stopping and checkpoint selection could improve generalization.

Source Code & Full Report

The GitHub repository contains the Google Colab notebook, supporting Python files, project documentation, and the complete experimental report with training curves, confusion matrices, and detailed results.