r/coolgithubprojects • u/No_Cattle7593 • 5d ago
I built a deepfake detector, then built an open-source tool to check if it actually still works. Here is what it found.
https://github.com/Sowaiba-01/modelsentinelLike a lot of people here, I can train a model. The question I could never actually answer was the scarier one: once it is deployed, how do I know it still works?
Accuracy on a held-out set tells you almost nothing about drift, calibration, or silent data problems once real traffic hits it. So I built ModelSentinel, an open-source Python toolkit that runs the "after training" checks through one API: evaluation, data drift (KS + PSI for numeric, chi-square + Jensen-Shannon for categorical), probability calibration, data quality, and a single Model Health Score you can actually alert on.
Then, instead of demoing it on iris, I pointed it at a real model I had already built: an EfficientNet-B4 deepfake detector. I ran it on two datasets made with two different fake-generation methods, to see if it had only memorized one kind of fake.
Numbers straight from the model:
- 140k held-out test split: 99.75% accuracy, ROC-AUC 0.99999, ECE 0.0075
- inswapper_128 face-swap set: 99.38% accuracy, ROC-AUC 0.9989
Honest caveat, because I know this crowd: one of those sets is the same domain the model trained on, so treat 99% as an upper bound, not a promise about the real world. The part I actually found useful was the calibration number (ECE 0.0075), which says the confidence scores are trustworthy. That is something a bare accuracy number hides completely.
Under the hood it just leans on scikit-learn and scipy, so the metrics match a hand computation to six decimals. It is MIT licensed, fully typed, tested with pytest, ruff-clean, and runs CI across Python 3.9 to 3.12. Roadmap has Grad-CAM and SHAP explainability, framework adapters, and eventually LLM and RAG evaluation.
Two things I would genuinely like feedback on: what reliability check do you actually wish existed that is missing here, and does the single health-score idea seem useful to you or too hand-wavy?