Official implementation of CBANet, accepted at IJCNN 2026.
Paper: CBANet: A Compact Attention-Based CNN–BiLSTM Network for Aggressive Driving Event Detection
Authors: Hanadi Alhamdan · Ghadah Alosaimi · Amir Atapour-Abarghouei · Farshad Arvin
Affiliations: Durham University, UK · Princess Nourah bint Abdulrahman University, Saudi Arabia · Imam Mohammad Ibn Saud Islamic University, Saudi Arabia
Aggressive driving is a major cause of traffic accidents and poses a serious threat to road safety. Although deep learning methods have shown promising results in detecting risky driving behaviours from vehicle sensor data, their performance in real-world conditions is often limited by severe data imbalance, large variability between drivers, and the lack of physically interpretable vehicle dynamics representations. In this paper, we propose an enhanced deep learning framework for aggressive driving detection using multivariate vehicle dynamics signals. Instead of relying solely on raw measurements, the proposed approach constructs engineered dynamic features that capture steering, acceleration, and braking behaviour. To address the extreme rarity of aggressive events in naturalistic driving data, we introduce a stable training strategy that combines controlled SMOTE-based oversampling with a class-weighted loss formulation, and evaluates focal loss variants for imbalance handling. Furthermore, a safety-oriented decision strategy based on class-specific threshold calibration is adopted to better reflect the asymmetric risks of missed detections and false alarms in real-world applications. The proposed framework is evaluated on a newly collected naturalistic driving dataset. Extensive experiments show that the proposed method consistently outperforms standard deep learning baselines with significant improvements in minority-class recall and safety-critical F-score metrics while maintaining practical computational efficiency.
CBANet classifies continuous vehicle telemetry into four driving behaviour categories:
| Class | Label |
|---|---|
| 0 | Normal driving |
| 1 | Harsh Acceleration |
| 2 | Harsh Braking |
| 3 | Harsh Turning |
The pipeline combines 25 physics-inspired features engineered from 7 raw OBD/IMU signals, harsh-priority sliding-window labelling, SMOTE oversampling with class-weighted loss, and per-class decision threshold calibration at inference time.
| Model | Accuracy | ROC-AUC | F2 (Weighted) |
|---|---|---|---|
| SVM | 0.9225 | 0.9854 | 0.9230 |
| K-NN | 0.8806 | 0.9682 | 0.8824 |
| CNN | 0.9386 | 0.9899 | 0.9385 |
| LSTM | 0.9413 | 0.9893 | 0.9413 |
| GRU | 0.9416 | 0.9907 | 0.9414 |
| RGAT (GAT + GRU) | 0.8947 | 0.9781 | 0.8947 |
| CBANet | 0.9585 | 0.9928 | 0.9584 |
| Setting | Accuracy | F2 (Weighted) | F2 (Macro) | ROC-AUC |
|---|---|---|---|---|
| Session-Level | 0.9446 | 0.9446 | 0.8791 | 0.9929 |
| Driver-Level | 0.9521 | 0.9519 | 0.8790 | 0.9934 |
Model size: 180,325 parameters · 0.76 MB · 1.43 ms/sample inference (NVIDIA RTX A6000)
Requirements: Python 3.9–3.11. A CUDA-capable GPU is recommended but not required.
git clone https://github.com/halhamdan/CBANet.git
cd CBANet
pip install -r requirements.txtPlace your pre-labeled CSV files under ./LABELED/. Each file represents one recording session. The column names below must appear exactly as written in the CSV header:
| Column | Units |
|---|---|
Longitudinal acceleration (g) |
g-force |
Lateral acceleration (g) |
g-force |
Speed (km/h) |
km/h |
Accelerator_Pedal_Position (%) |
% |
Brake_Pedal_Position (%) |
% |
Engine_Speed (rpm) |
rpm |
Gradient (%) |
% |
Label |
Normal / Harsh Acceleration / Harsh Braking / Harsh Turning |
Data is expected at 25 Hz sampling rate. Labels must be pre-assigned before running the pipeline; the labelling thresholds used in this work are described in Section IV-B of the paper (θ_brake = −0.35g, θ_accel = 0.38g, θ_turn = 0.55g).
File naming: the filename stem is used to identify sessions and drivers in the evaluation reports. Use the convention DriverID_SessionID.csv (e.g., Driver1_Session2.csv) so that per-driver metrics are grouped correctly.
python train.pyOverride any hyperparameter from the command line:
python train.py --data "./mydata/*.csv" --epochs 200 --batch-size 32 --seed 0Key hyperparameters (edit config.yaml):
| Parameter | Value | Description |
|---|---|---|
window_size |
100 | Samples per window (4 s @ 25 Hz) |
step |
25 | Stride (75% overlap) |
| Batch size | 64 | Mini-batch size |
| Optimizer | AdamW | lr=5e-4, weight_decay=1e-4 |
| Loss | Class-weighted CE (γ=0) | Best per ablation study (Table IV) |
Outputs are saved to ./saved_models/ (model + scaler + thresholds), ./plots/ (figures), and ./results/ (per-session and per-driver CSV reports).
CBANet/
train.py # Main entry point
config.yaml # All hyperparameters (CLI-overridable)
requirements.txt
src/
config.py # Constants and YAML config loader
data_loading.py # CSV loading with session/driver tagging
preprocessing/
feature_engineering.py # 25 physics-inspired features from 7 raw signals
windowing.py # Per-session sliding-window segmentation
preprocessing.py # SMOTE augmentation, normalisation, class weights
model/
model.py # CBANet architecture + focal loss
evaluation/
thresholds.py # Per-class threshold calibration
aggregated.py # Overall test-set metrics
by_session.py # Per-session performance breakdown
by_driver.py # Per-driver performance breakdown
plotting.py # Confusion matrix, ROC, loss/accuracy curves
@inproceedings{alhamdan2026cbanet,
title = {{CBANet}: A Compact Attention-Based {CNN}--{BiLSTM} Network for Aggressive Driving Event Detection},
author = {Alhamdan, Hanadi and Alosaimi, Ghadah and Atapour-Abarghouei, Amir and Arvin, Farshad},
booktitle = {Proceedings of the International Joint Conference on Neural Networks (IJCNN)},
year = {2026}
}This project is released under the MIT License.
