Releases: ReverendBayes/BMW-MHD-Log-Anomaly-Detector
Releases · ReverendBayes/BMW-MHD-Log-Anomaly-Detector
AFR & Throttle Anomaly Detection for BMW MHD Logs
This release provides a fully functional anomaly detection tool for analyzing MHD log files from BMW platforms (e.g., N54/N55/S55). The model uses an Isolation Forest trained on real-world driving data and is tailored to detect high-impact engine behavior anomalies—AFR spikes, throttle lag, hesitation zones, and logging artifacts.
Key design goal: prioritize real-time usability and clear diagnostic output to assist enthusiasts, tuners, and techs reviewing logs from MHD or similar tools.
What It Detects
- AFR spikes (lean conditions, sensor faults, invalid data)
- Throttle mismatch (pedal vs. throttle lag—e.g., torque intervention or hardware delay)
- RPM hesitation in the 1600–1800 band (common for airflow or tuning lag)
- Idle AFR instability (misfire, fueling imbalance, or IACV behavior)
- MHD logging artifacts (repeating 235.19 AFR values from sensor dropout or ECU noise)
Included in This Release
analyze_log.py: Main script to parse and flag anomalies in .csv logsmodels/train_model.py: Pipeline for training the Isolation Forestplugins/anomaly_detector.py: Modular inference engine for flagging and formattingsample_log.csv: Realistic example to test pipeline- Clear printout format with timestamps and feature flags
- All dependencies listed in
requirements.txt
Training Summary
Model trained on engineered binary features extracted from real logs:
AFR_spike,TPS_bug,Pedal_Throttle_Mismatch,RPM_idle,RPM_hesitation- IsolationForest (contamination=0.05) with sklearn 1.3.0
- Saved model weights included (
models/anomaly_model.pkl)
Use Cases
- Quick triage of log health before tuning review
- Detection of soft misfires or airflow instabilities
- Early diagnosis of sensor failure or ECU behavior issues
- Log quality checks (sensor dropout, logging corruption)
Next Goals
- Add log visualization tools (e.g., AFR over time, throttle overlays)
- UI interface for easier usage by non-technical users (e.g. Streamlit)
- Group anomaly sequences into meaningful diagnostic chains
- Boost logic for WOT log validation and ignition timing analysis
This tool is fully usable as-is. Output is human-readable, explainable, and tailored to real-world BMW diagnostics—not abstract ML outputs.
