Skip to content

hrcHarry/edge-perception-pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Edge-ready Perception Pipeline

PyTorch → ONNX → FastAPI → Docker. FER2013 baseline + robustness + Kalman smoothing + ONNXRuntime API.

A modular perception pipeline designed for robust inference under noisy conditions. The project demonstrates end-to-end ML deployment workflows, from ONNX model inference to containerized API services, with Kalman-based post-processing for stability.

Features

  • Model Inference

    • Exported PyTorch model to ONNX and executed inference via ONNX Runtime.
    • Simulated noisy inputs (Gaussian blur, occlusion, variance shifts).
  • Post-processing

    • Applied Kalman smoothing to stabilize predictions under degraded conditions.
    • Quantified robustness improvements with spectral/variance analysis and condition number regularization.
  • Deployment

    • Containerized services with Docker (CPU/GPU modes).
    • Lightweight REST API using FastAPI for easy evaluation.
  • Profiling & Stability

    • Latency and resource profiling for inference pipelines.
    • Robust accuracy curves under varying noise levels.

Robustness Evaluation

We tested the baseline CNN model under several perturbations. Dataset: FER2013 (or FakeData for pipeline validation).

Scenario Accuracy
clean 0.51
gaussian_0.10 0.40
blur_k5 0.45
occlusion_25 0.30
bright_1.4 0.49

Robustness Results

Kalman Smoothing

Applied a simple 1D Kalman filter on the class probability sequence.

  • Raw accuracy: 0.51
  • Smoothed accuracy: 0.74

Kalman smoothing trace

ONNX Export

Exported PyTorch model to ONNX:

  • File: models/fer2013_cnn.onnx
  • Verified with onnxruntime (max error < 1e-5)

Test inference results saved in:

  • results/infer_onnx.csv

Quick Start

pip install -r requirements.txt
uvicorn src.train.infer_api:app --host 0.0.0.0 --port 8080
# curl -F "file=@/path/to/img.jpg" http://127.0.0.1:8080/infer_form

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published