# A Deep Learning-Based System for Automatic License Plate Recognition Using YOLOv12 and PaddleOCR
## 4 Detection and Classification Method
### Evaluation Metrics  
To understand and quantify the performance of an object detection model like YOLOv12, it is essential to use a standardized set of metrics that reflect how well the model detects and classifies objects present in an image. In this project, the YOLOv12 model was trained exclusively for license plate detection, while vehicle type detection was performed using the YOLOv12 model pretrained on the COCO dataset. The extraction of the license plate number was carried out using the PaddleOCR library. The most relevant metrics used in this context are presented below. These metrics are calculated after each training epoch and are useful both for tracking performance progress over time and for identifying potential issues such as overfitting or class imbalance. **Precision**[27]--out of all the license plates \"detected\" by the model, this represents how many are actually correct. The formula for precision is given by  
\[\text{Precision}=\frac{TP}{TP+FP} \tag{3}\]  
where  
* \(TP\) is the number of True Positives--license plates correctly detected by the model (predictions that sufficiently overlap with a ground-truth plate, typically with an Intersection over Union (IoU) threshold of at least 0.5);
* \(FP\) is the number of False Positives--predictions made by the model that do not correspond to any actual license plate (insufficient overlap or non-existent object). **Recall (True Positive Rate or TPR)**[27]--out of all the license plates that actually exist in the image, this represents how many were correctly found by the model. The formula for recall is given by \[\text{Recall}=\frac{TP}{TP+FN}\] (4) where
* \(TP\) is the number of True Positives, as defined above;
* \(FN\) is the number of False Negatives, meaning the real license plates present in the image that the model failed to detect (i.e., there is no prediction with sufficient overlap for those plates). **F1 score [28]--the harmonic mean of precision and recall; it provides a balanced evaluation, especially when there is an imbalance between the number of detected license plates and the actual ones. **  
The formula for F1 score is given by  
\[\text{F1 Score}=2\cdot\frac{\text{Precision}\cdot\text{Recall}}{\text{Precision} +\text{Recall}} \tag{5}\]  
**mAP--mean Average Precision [29]--mAP represents the average of the Average Precision (AP) values across all classes. In the context of YOLO, the following are commonly used:**  
* **[EMAIL_ADDRESS] [29]--IoU threshold of 0.5, indicating correct detections when the overlap between the model's prediction and the actual license plate is at least 50%. **
* **[EMAIL_ADDRESS] [29]--average across IoU thresholds from 0.5 to 0.95, with a step size of 0.05; this is typically used as the standard in the COCO benchmark. **  
The formula for [EMAIL_ADDRESS] is given by  
\[\[EMAIL_ADDRESS]}=\frac{1}{C}\sum_{c=1}^{C}\text{AP}_{c}^{\text{IoU}=0.5} \tag{6}\]  
where  
* \(C\) is the total number of classes (in this work, \(C=1\), since only the license plate class is being detected);
* \(\text{AP}_{c}^{\text{IoU}=0.5}\) is the Average Precision for class \(c\), computed at an IoU threshold of 0.5 (i.e., a prediction is considered correct if it overlaps with the ground truth by at least 50%). The formula for [EMAIL_ADDRESS]:0.95 is given by \[\[EMAIL_ADDRESS]:0.95}=\frac{1}{10C}\sum_{c=1}^{C}\sum_{k=0}^{9}\text{AP}_{c}^{ \text{IoU}=0.5+0.05k}\] (7)  
where  
* 10 IoU thresholds are used (ranging from 0.5 to 0.95, in steps of 0.05), and the AP is calculated for each threshold;
* \(\text{AP}_{c}^{\text{IoU}=x}\) is the Average Precision for class \(c\) at the IoU threshold \(x\). **Loss Evolution--box_loss, cls_loss, dfl_loss (for both train and val):**
* **Box Loss:** This measures the error in localizing the license plates (predicting the bounding box coordinates for each plate). A low loss indicates that the model accurately localizes the license plates, with precise predictions of their positions in the image.