# Grading Algorithm for Orah Sorting Line Based on Improved ShuffleNet V2
## 3 Results and Discussion
### Visualization Analysis Results  
To further evaluate the model in this study, a confusion matrix visualization was employed. The confusion matrix for the model on the test set is shown in Figure 14. In the confusion matrix, all correct predictions are located on the diagonal, while all incorrect predictions are off the diagonal. The deeper the color, the higher the prediction accuracy for the corresponding category. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Attention Mechanisms** & **Accuracy** & **Precision** & **Recall** & **F1** & **Parameters/10\({}^{6}\)** & **FLOPs/10\({}^{6}\)** \\ \hline CBAM & 0.8642 & 0.8632 & 0.8642 & 0.8636 & 1.67 & 152.0 \\ SE & 0.8763 & 0.8756 & 0.8763 & 0.8759 & 1.53 & 151.8 \\ FCA & 0.8724 & 0.8716 & 0.8724 & 0.8718 & 1.53 & 151.8 \\ ECA & 0.8765 & 0.8764 & 0.8765 & 0.8764 & 1.26 & 149.8 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Attention mechanisms comparison results. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Model** & **ECA** & **TL** & **Mish** & **Accuracy** & **F1 Score** & **Par/10\({}^{6}\)** & **FLOPs/10\({}^{6}\)** & **MS/MB** \\ \hline \multirow{8}{*}{ShuffleNet V2-\(\times\)1.0} & - & - & 0.8720 & 0.8726 & 1.26 & 149.6 & 4.96 \\  & \(\surd\) & - & - & 0.8765 & 0.8764 & 1.26 & 149.8 & 4.96 \\ \cline{1-1}  & - & \(\surd\) & - & 0.8987 & 0.8979 & 1.26 & 149.6 & 4.96 \\ \cline{1-1}  & - & - & \(\surd\) & 0.8735 & 0.8733 & 1.26 & 148.0 & 4.97 \\ \cline{1-1}  & - & \(\surd\) & \(\surd\) & 0.9065 & 0.9055 & 1.26 & 148.0 & 4.97 \\ \cline{1-1}  & \(\surd\) & \(\surd\) & - & 0.9055 & 0.9058 & 1.26 & 149.8 & 4.96 \\ \hline ShuffleNet\_wogan & \(\surd\) & \(\surd\) & \(\surd\) & 0.9112 & 0.9107 & 1.26 & 149.8 & 4.96 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Ablation experiments comparison results. As shown in Figure 14, 1196 out of 1265 Grade A samples were correctly identified, achieving an accuracy of 94.5%. Among the 1020 Grade B samples, 95 were misgraded as Grade A, and 141 were misgraded as Grade C, resulting in an accuracy of 76.9%. Out of 1712 Grade C samples, 7 were misgraded as Grade A, and 158 were misgraded as Grade B, achieving an accuracy of 91.2%. All 1127 empty fruit cup samples were correctly identified. Misclassified images from the validation set were selected for further analysis. Misclassifications in Grade A primarily occurred for the following reasons:  
1. Fruit stems were not neatly trimmed or exhibited white cores, causing them to resemble defects and be incorrectly classified as Grade B or C, accounting for 45.0% of misclassified images (Figure 15a). 2. Minor surface defects that still fell within the Grade A category but were incorrectly classified as Grade B or C (Figure 15b), accounting for 55.0%. Figure 14: Confusion matrix for ShuffleNet_wogan model. Figure 15: Misclassifications in Grade A. (**a**) Untrimmed stem or white core misclassified as defect; (**b**) Minor surface defects misclassified as lower grade. Misclassifications in Grade B primarily occurred for the following reasons:  
1. Small scars were not recognized, leading to misclassification as Grade A, accounting for 41.5%. These minor defects would typically be acceptable as Grade A in traditional manual sorting due to slight differences in standards among workers, thus not significantly impacting practical sorting. However, they were still treated as misclassifications in this study (Figure 16a). 2. Foreign objects appearing in images, causing misclassification as Grade C, accounting for 7.5% (Figure 16b). 3. Improperly trimmed fruit stems resulting in misclassification as Grade C, accounting for 11.9% (Figure 16c). 4. Misclassification due to limitations in model accuracy, accounting for 39% (Figure 16d). The primary reason for misclassification in Grade C is insufficient model accuracy, resulting in ineffective feature extraction (Figure 17). The error analysis results indicate that various features may appear across all three grades, making classification inherently challenging.