Skip to main content

Vision drift monitoring with Great Expectations + Evidently + MLflow (Milestone A: DQ gates).

Project description

๐Ÿ›ฐ๏ธ DriftRadar-Vision

ML-Driven Drift Detection, Auto-Retraining, and Promotion System for Vision Models
Built with Evidently, Great Expectations, MLflow, Hydra, and GitHub Actions


๐ŸŒŒ Overview

DriftRadar-Vision is an advanced, production-ready drift monitoring and adaptive retraining pipeline for vision models. It automatically detects dataset, embedding, and prediction drifts using Evidently and Great Expectations โ€” then decides, retrains, stages, and promotes models via GitHub Actions and MLflow.

๐Ÿš€ Designed for autonomous ML lifecycle management, vision model governance, and drift accountability.


๐Ÿงฑ Core Architecture

               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
               โ”‚    data_prod.py        โ”‚
               โ”‚   (Simulate batches)   โ”‚
               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
               โ”‚    drift_check.py      โ”‚
               โ”‚ (Evidently + embedding)โ”‚
               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚ summary.json
               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
               โ”‚    dq_validate.py      โ”‚
               โ”‚ (Great Expectations)   โ”‚
               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
               โ”‚     retrain.py         โ”‚
               โ”‚  (Policy-based trigger)โ”‚
               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
             โ”‚    train.py / eval.py      โ”‚
             โ”‚  (MLflow + ONNX export)    โ”‚
             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚   drift_cron.yml + retrain_smokeโ”‚
         โ”‚  (GitHub Actions automation)    โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงฉ Features

Category Description
๐Ÿง  Detection Dataset drift, embedding drift (PSI), and prediction confidence drift
๐Ÿ” Validation Great Expectations quality checks on input batches
โš™๏ธ Retraining Automatic retrain trigger from policy thresholds
๐Ÿงพ Reporting Evidently + GE HTML reports stored under artifacts/reports/
๐Ÿš€ Automation Full CI/CD loop via GitHub Actions: Drift โ†’ PR โ†’ Smoke โ†’ Promote
๐Ÿงฎ Backtesting Historical drift replay simulation with backtest.py
๐Ÿ“Š Dashboard Streamlit dashboard with 5 pages for QA, drift, metrics, backtests
๐Ÿงฑ MLOps MLflow registry, Hydra configs, ONNX export, reproducible runs

โš™๏ธ Quick Start

1๏ธโƒฃ Create environment

conda create -n driftradar python=3.11
conda activate driftradar
pip install -r requirements.txt

2๏ธโƒฃ Run initial training

python -m driftradar_vision.train --config-path configs --config-name model.yaml

3๏ธโƒฃ Evaluate and export ONNX

python -m driftradar_vision.eval --config-path configs --config-name eval.yaml --model-config-path configs --model-config-name model.yaml

4๏ธโƒฃ Drift check (Evidently)

python -m driftradar_vision.drift_check --config-path configs --config-name drift.yaml --data-config-path configs --data-config-name data.yaml

5๏ธโƒฃ Policy-based retrain

python -m driftradar_vision.retrain --config-path configs --config-name policy.yaml

6๏ธโƒฃ Backtest thresholds

python -m driftradar_vision.backtest --mode simulate --days 10 --clean-days 3 --drift-days 7

7๏ธโƒฃ Compare metrics (PR body)

python -m driftradar_vision.artifacts --what metrics-delta

๐Ÿง  Example Decision Output

{
  "retrain_triggered": true,
  "reason": "conf_drop(56.1%)>=thr(10.0%)",
  "embedding_top5_psi_mean": 15.29,
  "psi_threshold": 0.2,
  "run_id": "63a1a44c58b14e55b3e8e0b2d56f3bff",
  "staging_version": 7,
  "onnx_staging_path": "artifacts/runs/onnx/staging.onnx"
}

๐Ÿ”„ GitHub Actions CI/CD

Workflow Trigger Purpose
ci.yml Push / PR Lint, build, pytest
drift_cron.yml Schedule Run drift_check + auto PR
retrain_smoke.yml Pull Request Mini retrain + GE + ONNX check
promote.yml /promote comment Promote Staging โ†’ Production

๐Ÿ“ˆ Dashboard Pages

Page Description
Overview Summary of latest production metrics and versions
Data Quality Great Expectations blockers and warnings
Drift Monitor Evidently HTML + PSI statistics
Model Metrics MLflow metrics, latency, ECE, size
Backtest Historical FPR/FNR, replayed days, threshold tuning

๐Ÿงช Backtest Result Example

{
  "mode": "simulate",
  "n_days": 10,
  "counts": {"tp": 6, "fp": 1, "tn": 3, "fn": 0},
  "rates": {"precision": 0.857, "recall": 1.0, "fpr": 0.25, "fnr": 0.0, "accuracy": 0.9}
}

๐Ÿงฐ Stack

  • ๐Ÿง  PyTorch 2.3 โ€” vision model backbone (ResNet-18)
  • โš™๏ธ Hydra โ€” configuration management
  • ๐Ÿ“ˆ Evidently โ€” dataset & embedding drift
  • ๐Ÿงฎ Great Expectations โ€” data quality validation
  • ๐Ÿ“Š MLflow โ€” experiment tracking & model registry
  • ๐Ÿงฐ ONNX Runtime โ€” inference validation
  • ๐Ÿ’พ GitHub Actions โ€” CI/CD orchestration
  • ๐ŸŒ Streamlit โ€” dashboard visualization

๐Ÿงช MLflow Registry Example

Stage Version Accuracy ECE Size (MB)
Production 6 92.8% 0.031 88.7
Staging 7 93.1% 0.028 89.1
ฮ” (Stagingโ€“Prod) +0.3 โˆ’0.003 +0.4

๐Ÿงญ Configuration Files

File Purpose
configs/model.yaml Main training hyperparameters
configs/data.yaml Dataset paths and augmentations
configs/drift.yaml Evidently and embedding drift settings
configs/policy.yaml Retraining & threshold policy
configs/eval.yaml Evaluation and ONNX export
configs/model-ci.yaml Fast smoke test variant

๐Ÿค– Automated Promotion

Once drift_cron.yml detects drift:

  1. A Pull Request opens โ†’ with needs-review + reports attached.
  2. retrain_smoke.yml validates ONNX + GE expectations.
  3. Maintainer comments /promote to approve.
  4. promote.yml transitions model to Production and updates dashboard.

๐Ÿ“œ Citation

If you use DriftRadar-Vision in your work, please cite:

@software{mutlu2025driftradar,
  author = {Abdulvahap Mutlu},
  title  = {DriftRadar-Vision: Autonomous Drift Detection and Retraining Pipeline for Vision Models},
  year   = {2025},
  url    = {https://github.com/abdulvahapmutlu/driftradar-vision}
}

๐Ÿ‘ค Author

Abdulvahap Mutlu M.Sc. in Artificial Intelligence | Deep Learning Engineer & Researcher ๐Ÿ”— Website ยท ๐Ÿ™ GitHub ยท ๐Ÿ’ผ LinkedIn


๐Ÿงฉ Related Projects

Repository Description
๐Ÿง  Sherpa-ML ML project scaffolding CLI with CI/CD & Docker
๐Ÿงฌ ReproKit-ML Deterministic reproducibility toolkit
โš™๏ธ QuantLab-8bit Quantization lab for PTQ vs QAT
๐Ÿšฆ EdgeServe-AB A/B model router for ONNX Runtime
๐Ÿงฎ Orbit-Boost Novel boosting method for tree ensembles

โญ Contributing

git clone https://github.com/abdulvahapmutlu/driftradar-vision
cd driftradar-vision
pip install -r requirements.txt
pytest -v

Contributions, ideas, and benchmarks are always welcome โ€” feel free to open a pull request!


๐Ÿชช License

Released under the MIT License โ€” see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

driftradar_vision-0.1.0.tar.gz (40.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

driftradar_vision-0.1.0-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

Details for the file driftradar_vision-0.1.0.tar.gz.

File metadata

  • Download URL: driftradar_vision-0.1.0.tar.gz
  • Upload date:
  • Size: 40.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for driftradar_vision-0.1.0.tar.gz
Algorithm Hash digest
SHA256 675c7f964622829ce35f94a35bb1c1a9da05dc5726416d93bff2057e2360f8c4
MD5 8fde0a4ab89dd91abe55d4b4803645fb
BLAKE2b-256 aaa206314f369ea053922300beb7d7debf21165de0fe1fd16d830f0c9c6006ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for driftradar_vision-0.1.0.tar.gz:

Publisher: release.yml on abdulvahapmutlu/driftradar-vision

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file driftradar_vision-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for driftradar_vision-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f45ae6352b91d53788b63894f38db0cc9a4560dc75f777b65654583779e23a0b
MD5 e2057d580a5e1769f47cd056f946a0a1
BLAKE2b-256 b694b5f00ff4f6ea7dc882d0b72279c01b4588302f1dcfc6fe42a3d1ac51da2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for driftradar_vision-0.1.0-py3-none-any.whl:

Publisher: release.yml on abdulvahapmutlu/driftradar-vision

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page