## 4 Model Training and Results
### Evaluation Metrics and Model Training  
Precision, recall, average precision, and F1 score are commonly used for statistical analysis to evaluate the effectiveness of a detection model. Below are the equations adopted to evaluate precision, recall, and F1 score.  
\[Precision=\frac{\text{True\ Positives}}{\text{True\ Positives}+\text{False\ Positives}} \tag{5}\]  
\[Recall=\frac{\text{True\ Positives}}{\text{True\ Positives}+\text{False\ Negatives}} \tag{6}\]  
The number of correctly detected objects refers to true positives; false positives are wrongly identified as targets, and false negatives are the number of undetected objects. If the predicted bounding box of an object differs from the ground truth, this is not evidence that the detection is incorrect; therefore, intersection over union (IoU) is a frequent approach, where intersection over union is the ratio of the detected bounding box over the ground truth (bounding box). If the value of the IoU is higher than the set threshold, the detection is accurate (true positive); else, it is incorrect (false positive).  
We derived the F1 Score assuming a harmonic mean of recall and precision upon calculating the precision and recall scores for each class. The F1 Score allows us to understand how the model becomes confused while providing predictions. Equation (7) is often used to compute the F1 Score for all classes.  
\[F1\ Score=\frac{2\times Precision\text{-}Recall}{Precision+Recall} \tag{7}\]  
The precision-recall curve represents a curve where the x-coordinate is the recall rate, and the y-coordinate is the accuracy. The total area under precision-recall curve is referred to as the average precision (AP), and it can be calculated using Equation (8).  
\[Average\ Precision=\int\limits_{0}^{1}Precision(Recall)dRecall \tag{8}\]  
mAP indicates the average across all APs to evaluate the model's performance.  
\[mAP=\sum\limits_{n}\frac{1}{n}Average\ Precision \tag{9}\]  
We trained our proposed model using both SGD and ADAM optimizers along with the Yolov5l, Yolov5x, Yolov7, and Yolov8 models on the Stanford car training data set. The training results after every epoch are displayed in Figure 5. We observed that during the first 100 epochs, all eight models' precision increased gradually, while the recall dropped and fluctuated until the 50 th epoch. However, the mAP@50 and mAP@50:95 remained stable and were gradually increasing, which shows that the instability during the initial stage of the training did not affect the performance of the models. Our proposed models' accuracy peaked at 0.934 on the 220 th epoch followed by the Yolov8 at 0.919, while both models maintained high recall at 0.89 and 0.88, respectively, considering stable training where the model was improving at every epoch. Consequently, we let the models train until the 300 th epoch, where no such improvement in accuracy and recall was seen.  
Table 2 demonstrates the overall training results of all six models, where we can better analyze the models' performance during training. Our proposed model with the transformer encoder block performed relatively well during training with higher accuracy and recall.