# Application of Various YOLO Models for Computer Vision-Based Real-Time Pothole Detection
## 4 Methodology  
The images in training subset were converted to a format size of 416 \(\times\) 416 pixels to meet the input requirement for the chosen architecture. The images were reconstructed multiple times to improve the training performance of the model. The object detection model was trained using a desktop computer with access to the Google Colab virtual machine, which allows performing computations on the Tesla K80 GPU with 12 GB of memory. Figure 5 shows the sequence of actions to perform tasks in order to detect potholes in the road surface. In the first step, a pothole dataset was collected from the previous research and the various YOLO models were reconstructed to be suitable for the tasks of pothole detection. Next, the models were trained and validated until the loss function reached a steady-state line, which the average loss insignificant changed. The quality of object detection, which requires to draw a bounding box around each detected object in  
Figure 4: Typical pothole images on road surfaces of the testing subset. the image, was confirmed by evaluating the performance of an object detector using three metrics (i.e., precision, recall, and mAP) as shown in Equations (1)-(3) [15]. \[\text{precision}=\frac{\text{TP}}{\text{TP}+\text{FP}} \tag{1}\]  
\[\text{recall}=\frac{\text{TP}}{\text{TP}+\text{FN}} \tag{2}\]  
\[\text{mAP}=\frac{1}{\text{N}}\sum_{\text{i=1}}^{\text{N}}\text{AP}_{\text{i}} \tag{3}\]  
As shown in Table 1, True Positive (TP) is the correct detection of an object that exists in the image; False Positive (FP) is incorrect object detection, i.e., the network marks an object that is not in the image; False Negative (FN) is an object that exists in the image but is not detected by the network; and True Negative (TN) is the correct detection of an object that do not exists in the image. The precision is defined as the ratio of the number of true positives (TP) among those classified as positive (TP + FP), recall is the ratio of true positives (TP) out of those that are actually positive (TP + FN). Mathematically, the precision and recall parameters are two fractions having the same numerator and different denominators. Additionally, both the precision and recall are non-negative numbers and less than or equal to one. High \begin{table}
\begin{tabular}{c c c} \hline \hline
**Actual** & **Prediction** & **Predicted as Positive** & **Predicted as Negative** \\ \hline Positive & True Positive (TP) & False Negative (FN) \\ \hline Negative & False Positive (FP) & True Negative (TN) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Unnormalized confusion matrix. Figure 5: Flowchart of pothole detection using different YOLO architectures. precision means that the accuracy of the objects found is high. High recall means high True Positive Rate, which is the rate of missing positive objects is low. The model is evaluated by changing a threshold and observing the values of precision and recall. For the precision and recall calculations, N thresholds are assumed and each threshold is a pair of precision (P\({}_{\text{n}}\)) and recall (R\({}_{\text{n}}\)) (n = 1, 2,..., N). Average precision (AP) is defined by Equation (4). \[\text{AP}=\sum_{\text{n=1}}^{\text{N}}\left(\text{R}_{\text{n}}-\text{ R}_{\text{n-1}}\right)\text{P}_{\text{n}} \tag{4}\]  
The mAP is set to 0.5 for comparing the performance of three models. The YOLOv4 and YOLOv4-tiny models are implemented using TensorFlow; the YOLOv5 model (YOLOv5s) using PyTorch. The maturity of model training was evaluated by stages while alternating between iterations and image resolution. The intersection over union (IoU), which measures the overlapping area between the predicted bounding box and the ground truth bounding box of an actual object, is compared to a threshold in order to classify if a detection is correct or incorrect. The threshold should be specified because the value of average precision (AP) metric depends on the threshold. The threshold is set to 0.3 in this study.