# Road Event Detection and Classification Algorithm Using Vibration and Acceleration Data
## 3 The Proposed Algorithm
### Data Preprocessing  
To process the vibration and acceleration data for event classification, we first segment the raw sensor data into smaller, meaningful time windows. Each time window represents a distinct observation that is then used for feature extraction. This ensures that we focus on the most relevant data for event detection while minimizing computational complexity. The process begins by collecting vibration and acceleration data from the three axes (x, y, z). The raw data are then preprocessed to remove noise and normalize the signals, ensuring that the features extracted from the data are on a comparable scale. This preprocessing step is crucial to achieving accurate and reliable classification results. The pre-processing steps include:  
* Noise Removal: The raw sensor data are filtered using a low-pass filter to remove high-frequency noise. This is achieved by applying a Butterworth low-pass filter, which is preferred due to its maximally flat frequency response in the passband and a smooth transition to the stopband. This helps eliminate unwanted high-frequency signal components that may interfere with the classification process. The equation for the Butterworth filter is given by \[H(s)=\frac{1}{1+(s/\omega_{c})^{2n}}\] (1) where \(\omega_{c}\) is the cutoff frequency, \(n\) is the filter order, and \(s\) is the complex frequency. The filter removes components of the signal above the cutoff frequency, effectively reducing high-frequency noise. * Normalization: The signals are normalized to a range between 0 and 1 to ensure consistency and prevent any bias caused by different magnitudes in the raw data. Normalization ensures that all features contribute equally to the classification process. Normalization is performed using Min-Max scaling, which is defined as \[S_{\text{normalized}}=\frac{S-\text{min}(S)}{\text{max}(S)-\text{min}(S)}\] (2) where \(S\) is the raw signal and \(S_{\text{normalized}}\) is the scaled signal. Min-Max scaling is chosen because it preserves the original distribution of the vibration and acceleration data while ensuring that all features are within a fixed range. Unlike Z-score normalization, which assumes a Gaussian distribution, Min-Max scaling is more suitable for this dataset, where sensor values exhibit skewed distributions due to road anomalies and sudden accelerations. This approach prevents large-magnitude signals from dominating the model while maintaining interpretability across different sensor readings. Algorithm 1 illustrates the steps involved in the preprocessing process. This ensures that the data are cleaned, normalized, and segmented appropriately before proceeding to the feature extraction phase. ```
1:Input: Raw vibration and acceleration dataset \(D\)
2:Output: Processed feature vectors \(F_{k}\) for each time window \(W_{k}\)
3: Preprocess the raw data \(D\)
4: 1. Apply low-pass filter to remove high-frequency noise:
5: For each signal \((vibration_{x},vibration_{y},vibration_{z},acceleration_{x},acceleration_{y},acceleration _{z})\):
6: Apply a Butterworth low-pass filter with a cutoff frequency of 20 Hz
7: Use filter equation:
8: Filtered signal = butter_filter(raw_signal, cutoff_frequency = 20)
9: 2. Normalize the signals:
10: For each signal \(S_{i}\) in \(D\) (where \(S_{i}\) represents vibration or acceleration data):
11: Normalize the signal using Min-Max scaling: \[\text{Normalized signal}=\frac{S_{i}-\min(S_{i})}{\max(S_{i})-\min(S_{i})}\]
12: 3. Segment the data into time windows \(W_{k}\) for \(k=1,2,\dots,K\):
13: Define window size: \(window\_size=1\) second
14: For each signal \(S_{i}\), segment into \(W_{k}\) (overlapping windows or non-overlapping depending on the use case):
15: For each window \(W_{k}\) of \(S_{i}\):
16: Store the segmented data as \(W_{k}\)
17: 4. Return the set of time windows \(W_{k}\) for further processing.