# A Comprehensive Analysis of Real-Time Car Safety Belt Detection Using the YOLOv7 Algorithm
## 4 Performance and Experimental Results
### Model Performance Metrics  
The metrics frequently employed in the field of object detection include precision recall, intersection over union (IOU), average precision (AP), and mean average precision (mAP) values. The IOU metric is employed to quantify the extent of intersection between the bounding box predicted by the system and the ground truth bounding box in the original image. The calculation involves determining the intersection and concatenation ratios between the Detection Result and the Ground Truth. \[\text{IOU}=\frac{\text{area of overlap }\left(\text{B}_{\text{P}}\cap\text{B}_{ \text{gt}}\right)}{\text{area of union }\left(\text{B}_{\text{P}}\cup\text{B}_{\text{gt}}\right)} \tag{1}\]  
The experiment involved the establishment of a threshold value of 0.5 for IOU. The Detection Result was classified as a True Positive (TP) when the IOU value, calculated between the Detection Result and the Ground Truth, exceeded the specified threshold value. This indicates the successful and accurate identification of targets. On the other hand, the Detection Result was classified as a False Positive (FP) if the IOU value was below the specified threshold, indicating an incorrect identification. The quantity of unobserved targets, known as False Negatives (FN), was computed as the count of Ground Truth occurrences that did not have a corresponding Detection Result. Precision is a metric that quantifies the ratio of correctly identified positive instances (True Positives) to the total number of instances identified as positive (True Positives + False Positives), represented as a percentage. \[\text{Precision}=\frac{\text{TP}}{\text{TP}+\text{FP}} \tag{2}\]  
The recall metric represents the ratio of correctly identified target samples to all positive samples in the test set. \[\text{Recall}=\frac{\text{TP}}{\text{TP}+\text{FN}} \tag{3}\]  
The Precision-Recall (PR) curve is a graphical representation that showcases precision on the vertical axis and recall on the horizontal axis. This visualization effectively demonstrates the relationship between the classifier's accuracy in correctly identifying positive instances and its capability to capture all positive instances. The average precision (AP) serves as a scalar measure that quantifies the area enclosed by the Precision-Recall (PR) curve. A higher AP value signifies the classifier's enhanced performance. \[\text{AP}=\int_{0}^{1}\text{Precision}(\text{Recall})\text{dRecall} \tag{4}\]The mAP is a quantitative metric utilized to evaluate the accuracy of object detection models across all categories in a specific dataset. The mathematical representation of this phenomenon can be expressed as:  
\[\text{mAP}=\frac{1}{\text{N}}\underset{\text{i=1}}{\sum}\text{N}\text{AP}_{\text {i}} \tag{5}\]  
where \(\text{AP}_{\text{i}}\) is the number of APs and N is the sum of the predicted classes. The F1 score is a metric that combines precision and recall in an optimal manner. It is the harmonic mean of precision and recall [28]. Mathematically, the F1 score can be expressed as:  
\[\text{F1}-\text{score}=2\times\left(\frac{\text{Precision}\times\text{Recall} }{\text{Recall}+\text{Precision}}\right) \tag{6}\]  
Throughout the training and testing phases, we evaluated the efficacy of our model by employing a range of metrics, encompassing precision, recall, confusion matrix, F1 score, recall, precision, and mAP. The aforementioned measurements were utilized as quantitative indicators for the purpose of assessing the efficacy of the model. The confusion matrix is a widely employed tabular representation that effectively summarizes the predictions generated by a trained model. The classification framework comprises four key components: TP, FP, TN, and FN. Experimental Results and Analysis of the Collected Dataset  
The detection performance of the proposed YOLOv7 object detection was assessed through the experimental evaluation of the collected dataset.