# The Fruit Recognition and Evaluation Method Based on Multi-Model Collaboration
## 3 Experiments and Results
### Evaluation Index  
#### 3.2.1 Evaluation Index of YOLOv8 Detection Model  
To validate the effectiveness of the improved models, Precision (P), Recall (R), mAP50 (mean Average Precision with IoU = 0.5), and mAP50-95 (mAP with IoU thresholds from  
\begin{table}
\begin{tabular}{l l} \hline \hline
**Parameter** & **Setting** \\ \hline Batch Size & 32 \\ Learning Rate & 0.0001 \\ Epochs & 100 \\ Pretrained Weights & Yes \\ Dataset Split & 80\% training, 20\% test \\ Optimizer & AdamW \\ Weight Decay & 5E-2 \\ Device & CUDA \\ Workers & 8 \\ Fine-tuning Layers & Fine-tuned all layers \\ \hline \hline \end{tabular}
\end{table}
Table 4: Swin Transformer detection model training parameters.  
\begin{table}
\begin{tabular}{l l} \hline \hline
**Configuration Name** & **Environmental Parameter** \\ \hline CPU & 13 th Gen Intel(R) Core(TM) i9-13900 KF \\ GPU & NVIDIA GeForce RTX 4080, 16375 MiB \\ Memory & 128 G \\ Python & 3.7.16 \\ Torch & 1.13.1 \\ CUDA & 11.6 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Experimental environment configuration.  
\begin{table}
\begin{tabular}{l l} \hline \hline
**Parameter** & **Setting** \\ \hline Batch Size & 64 \\ Learning Rate & 0.002 \\ Epochs & 100 \\ Pretrained Weights & No (Training from scratch) \\ Dataset Split & 80\% training, 20\% test \\ Momentum & 0.9 \\ Data Caching & Yes \\ Optimizer & AdamW \\ Device & CUDA \\ Workers & 8 \\ \hline \hline \end{tabular}
\end{table}
Table 3: YOLOv8 detection model training parameters.  
0.5 to 0.95) were utilized. IoU is used to measure the overlap between the candidate boxes generated by the model and the ground truth boxes. A higher IoU value indicates greater similarity between the boxes. Precision measures the accuracy of fruit detections, ensuring that identified objects are indeed fruits. Recall assesses how well the model detects all instances of fruits present in the images.  
\[\text{P}=\frac{TP}{TP+FP} \tag{2}\]  
\[\text{R}=\frac{TP}{TP+FN} \tag{3}\]  
where TP represents the number of correctly predicted positive samples; FP is the number of false positive samples. FN represents the number of mispredicted negative class samples.  
\[\text{AP}=\frac{1}{\text{m}}\sum_{r=1}^{m}\left(P(r)\Delta R(r)\right)=\int_{ 0}^{1}P(R)dR \tag{4}\]  
where m is the number of positive samples, P(r) is the proportion of positive samples in the first r retrieval processes, \(\Delta R(r)\) is the change in Recall with respect to r in the first r retrieval results, and P(R) represents the Precision (P) under feature recall (R).  
\[\text{m}AP=\frac{1}{n}\sum_{i=1}^{n}AP_{i} \tag{5}\]  
Here, n is the total number of categories and AP\({}_{i}\) represents the AP value of the ith class.  
mAP50 evaluates the Average Precision (AP) of each class based on candidate boxes generated by the model that have an IoU (Intersection over Union) of 0.5 or greater with the ground truth boxes. It calculates the AP for each class and then averages these values to obtain mAP50.  
mAP50-95 extends this evaluation by considering a series of confidence thresholds (typically from 0.5 to 0.95, with a 0.05 interval). For each confidence threshold, it computes the AP for each class, where predictions with IoU greater than or equal to that threshold are considered correct predictions. Finally, it averages the AP values across all classes and thresholds to derive mAP50-95.