## 2 Materials and Methods
### Incorporated Quality Control System Using Computer Vision
#### 2.5.4 Performance Assessment  
Standard performance metrics for object detection in images or video sequences derived from a confusion matrix are used to evaluate YOLOv8 n, s, m, l, and x and YOLOv9 m, c, t, s and e models. This matrix has a significant role within the evaluation framework, presenting a comprehensive dissection of the model's prognostications. It encapsulates four fundamental components: true negatives (TN), denoting accurately predicted negatives; false positives (FP), signifying erroneously identified positives; false negatives (FN), indicating misclassifications of true positives; and true positives (TP), representing correct identifications of positives. Through its meticulous delineation, this matrix furnishes essential insights into the discriminative capacity and performance of the model under scrutiny. In the context of the YOLOv8 n, s, m, l, and x and YOLOv9 m, c, t, s and e models, the following metrics were computed:  
* Precision (\(p\)): In predictive analytics, precision is a litmus test for the model's efficacy in discerning positive instances. It quantifies the fidelity of positive predictions by assessing the ratio of true positive identifications to the aggregate of all positive prognostications. Thus, precision elucidates the model's discerning prowess in accurately pinpointing instances of interest amidst the broader dataset: \[p=\frac{\textit{True Positives}}{\textit{True Positives}+\textit{False Positives}}\]
* Recall (r): Serves as a critical barometer of the model's proficiency in correctly identifying positive instances within the dataset. This metric is derived by dividing the count of true positive predictions by the sum of true positives and false negatives. In essence, recall provides a nuanced evaluation of the model's ability to capture all relevant instances of interest, thus illuminating its sensitivity to positive phenomena. \[r=\frac{\textit{True Positives}}{\textit{True Positives}+\textit{False Negatives}}\]
* Average precision (AP): This frequently used measure assesses object detection accuracy. AP calculates the average precision for different evaluation thresholds and then computes the mean of those precisions. \[AP=\sum_{N}(r_{n+1}-r_{n})^{max}_{\widetilde{r}:\widetilde{r}}\sum_{r_{n+1} \widetilde{(r)}}\]
* Mean average precision (mAP): This is the average of AP values across all object classes. It is used to gain an overall insight into the performance of object detectors. \[mAP=\frac{1}{N}{\sum_{i=1}^{N}AP_{i}}\]
* Mean average precision 50-95 (mAP50-95): This is the mean of the AP values calculated at each Intersection over Union (IoU) thresholds from 0.50 to 0.95. Sum all the AP values and divide by the number of IoU thresholds used. \[mAP50-90=\frac{1}{10}{\sum_{i=1}^{10}AP_{0.50+i\times 0.05}}\]
* F1 score: This metric serves as a harmonious amalgamation, delicately balancing the evaluation of the model's precision and recall performance. By encapsulating both precision and recall into a single metric, the F1 score furnishes a comprehensive assessment of the model's ability to simultaneously achieve high precision in positive predictions while maintaining a robust recall rate, thus elucidating its overall efficacy in classification tasks. \[F1\ Score=\frac{2\times p\times r}{p+r}\]
* Layers refer to the number of distinct layers within a neural network model. In the context of the provided values, each model variant (YOLOv8 and YOLOv9) has different layers, indicating the network's depth and complexity. A higher number of layers typically allows the model to learn more intricate features and representations from the data, potentially improving its performance on complex tasks. However, increasing the number of layers can also lead to more significant computational requirements, longer training times, and challenges related to training stability and convergence. * Params (M), or the number of parameters in a model expressed in millions, represents the total count of trainable weights and biases in a neural network.