# A Road Defect Detection System Using Smartphones
## 3 A Proposed Road Defect Detection System
### An Automatic Data Collection Mechanism for Road Defect Classification
#### 3.1.2 Data Preprocessing  
The data collected from the raw data collection step are preprocessed to generate deep learning analyses. The data preprocessing step first extracts the raw data collected to identify segments indicative of road defects. This is achieved through a threshold-based classification technique, where significant fluctuations in acceleration sensor readings suggest potential road defects. The threshold values used for this determination are established through experimental methods.  
If the acceleration value of the raw data exceeds the threshold, both the acceleration values and dashcam video segments are trimmed to lengths that contain road defect information. This trimming, or \"data slicing\", leverages the temporal data captured by the acceleration sensors and dashcam footage to ensure precise segmentation. The extent of each data slice is calculated based on the vehicle's speed and the estimated length of the road defect, aiming to cover the entire duration a vehicle traverses a defect. Utilizing the  
Figure 2: Acceleration X\(-\)axis, Y\(-\)axis, Z\(-\)axis, and RMS values: (**a**) when the vehicle passes the speed bump, (**b**) when the vehicle passes the manhole, and (**c**) when the vehicle passes the pothole.  
maximum known speed bump length of 3.6 m [39] and a minimal vehicle speed of 5 km/h (or 0.277 m/s), the slicing length is determined to be approximately 3 s to accommodate the defect passage duration:  
\[L_{slice}=\frac{L_{defects}}{S_{min}}=\frac{3.6\text{ m}}{0.277\text{ m/s}}=2.60869 \text{ s}\cong 3\text{ s} \tag{2}\]  
This procedure ensures a uniform dataset, with each slice containing 300 data points, given the 100 Hz sampling rate of the sensor. For video data, only the initial second of footage, prior to encountering a road defect, is utilized for labeling, resulting in 30 video frames per event for analysis.  
Addressing the model training aspect, while unsupervised learning offers the benefit of identifying patterns without labeled data, it often lacks the interpretability and accuracy of supervised learning models, which rely on high-quality labeled data. The challenge lies in the labor-intensive and costly process of acquiring accurately labeled data. To mitigate this, our approach incorporates automatic labeling of sensor data using dashcam footage, significantly reducing the cost and effort compared to traditional manual labeling techniques.  
For precise defect labeling, we employ the YOLOv5m [40] model, which specializes in image classification, to analyze dashcam images synchronized with sensor data. The preliminary step in developing a robust road defect classification model with YOLOv5m involves the acquisition of accurately labeled images. While obtaining these labeled images is crucial, it is notably less challenging and resource-intensive compared to the process of collecting and labeling sensor data. We have successfully developed a YOLOv5m model that demonstrates over 90% accuracy in identifying specific road conditions such as speed bumps, manholes, and potholes. To mitigate this risk, we employ a stringent data validation approach. During a second of video capture, 30 dashcam images are extracted and individually assessed using the YOLOv5m model. Only when at least 90% of these images yield consistent classification results is the data considered high-quality and retained for further processing. This method ensures that only data of the highest integrity are used for training our model, effectively enhancing the model's reliability and performance by excluding low-quality or ambiguous data points. Through this rigorous label quality verifier, we are able to generate a high-quality dataset for the training of our deep learning model.