Skip to content
All projects

Ensemble Facial Recognition & ONNX Pipeline

A heterogeneous Machine Learning pipeline that aggregates SVM, Random Forest, and CNN architectures via soft-voting to classify facial datasets, featuring automated ONNX graph serialization.

Tech stack

Languages
Frameworks & libraries

Performance & metrics

  • Significantly reduces spatial overfitting by aggregating high-bias traditional classifiers with deep spatial feature extractors
  • ONNX serialization eliminates the heavy TensorFlow runtime requirement for downstream inference applications

Why I built it

This pipeline was explicitly designed as the downstream classification engine for the facial datasets extracted by my OpenCV-Face-Features-Toolkit-For-ML-cpp project. Relying on a single ML architecture for facial recognition often leads to spatial overfitting or variance issues. I engineered this ensemble approach to mitigate individual model biases by mathematically aggregating predictions from both traditional statistical models (SVM/RF) and deep spatial feature extractors (CNN).

Architecture & decisions

The ingestion layer normalizes input matrices to 100x100 grayscale arrays. Because Scikit-Learn and TensorFlow expect different tensor geometries (1D flattened arrays vs. 2D spatial tensors), I implemented a custom KerasClassifierWrapper inheriting from BaseEstimator and ClassifierMixin. This seamlessly injects the TF/Keras computational graph into a Scikit-Learn VotingClassifier. The ensemble computes probability distributions (predict_proba) via a soft-voting mechanism. Finally, the models are serialized into ONNX format (opsets 9 and 11) to entirely decouple the inference engine from the Python/TensorFlow runtime for potential C++ edge deployment.

Key features

  1. 01Direct ingestion and classification of normalized datasets generated by the OpenCV-Face-Features-Toolkit-For-ML-cpp utility
  2. 02Custom BaseEstimator bridging layer to orchestrate TensorFlow CNNs within Scikit-Learn ensemble pipelines
  3. 03Soft-voting ensemble classifier calculating maximum likelihood across SVM, Random Forest, and CNN probability distributions
  4. 04Automated ONNX graph serialization pipeline for cross-platform, runtime-agnostic inference