Machine Learning module for the AI-Based Smart Riding Helmet system. This module analyzes rider behavior using alcohol detection and drowsiness monitoring data to classify rider safety risk levels.
The Smart Riding Helmet uses sensor data collected from the MQ3 Alcohol Sensor and Eye Blink Sensor to evaluate rider safety. A Support Vector Machine (SVM) model is trained to classify riders into different risk categories based on their behavior and sensor readings.
The trained model can be integrated with the ESP32-based monitoring system and dashboard to provide intelligent safety recommendations and alerts.
The objective of this module is to:
- Detect unsafe riding conditions.
- Analyze alcohol consumption levels.
- Monitor drowsiness indicators.
- Classify rider risk levels.
- Support real-time rider safety monitoring.
The dataset contains rider behavior and sensor readings collected during testing.
| Feature | Description |
|---|---|
| alcohol_level | MQ3 sensor alcohol reading |
| blink_rate | Number of eye blinks per minute |
| eye_closure_duration | Eye closure duration in milliseconds |
| speed | Vehicle speed during monitoring |
| risk_status | Target label |
| Class | Description |
|---|---|
| Safe | Normal riding condition |
| Caution | Moderate risk detected |
| Danger | High-risk riding condition |
The preprocessing pipeline performs:
- Duplicate removal
- Missing value handling
- Drowsiness score calculation
- Alcohol risk categorization
- Speed risk categorization
- Combined risk score generation
- Target label encoding
Generated Features:
- drowsiness_score
- alcohol_risk
- speed_risk
- combined_risk
- risk_status_encoded
Support Vector Machine was selected because it performs well on structured sensor data and provides reliable classification for rider safety prediction.
SVC(
kernel='rbf',
C=1.0,
gamma='scale',
probability=True,
random_state=42
)model_training/
│
├── rider_dataset.csv
├── processed_dataset.csv
├── feature_engineering.py
├── svm_training.ipynb
├── train_svm.py
├── svm_model.pkl
├── scaler.pkl
├── confusion_matrix.png
├── accuracy_curve.png
├── requirements.txt
└── README.md- Python
- Pandas
- NumPy
- Scikit-Learn
- Support Vector Machine (SVM)
- Matplotlib
- Joblib
- Jupyter Notebook
Install required packages:
pip install -r requirements.txtpython feature_engineering.pyOutput:
processed_dataset.csvpython train_svm.pyOutputs:
svm_model.pkl
scaler.pkl
confusion_matrix.png
accuracy_curve.pngThe model is evaluated using:
- Accuracy
- Precision
- Recall
- F1 Score
- Confusion Matrix
Generated visualizations:
- confusion_matrix.png
- accuracy_curve.png
MQ3 Alcohol Sensor
+
Eye Blink Sensor
+
Vehicle Speed
↓
Feature Engineering
↓
SVM Classifier
↓
Risk Prediction
↓
Safe / Caution / DangerThe trained SVM model can be integrated with:
- ESP32 Controller
- Smart Riding Helmet Dashboard
- Rider Alert System
- GPS Tracking Module
to provide intelligent rider safety monitoring and decision support.
- Real-time model inference
- Larger rider dataset
- GPS-aware risk prediction
- Deep learning-based drowsiness detection
- Mobile application integration
- Cloud-based analytics dashboard
This project is developed for educational, research, and portfolio purposes.
Janani V
Machine Learning | IoT | Embedded Systems
GitHub: https://github.com/Janviswa
LinkedIn: https://www.linkedin.com/in/jananiv05/