## 3 Results
### Performance Analysis of the Improved Faster R-CNN Model  
In order to evaluate the recognition capability of the improved Faster R-CNN model for internal defects in walnuts more intuitively, the discrimination effect of the model on 155 images of the testing set were further analyzed with a confusion matrix. There are a total of 525 walnut samples in the test image set, among which there are 525 sound walnuts is 207, 145 shriveled walnuts, and 173 empty-shell walnuts. As shown in Table 3, the discrimination accuracy of the constructed model for shriveled walnuts is the lowest (91.72%). There are 12 misjudgments among 145 shriveled walnut samples, of which 8 shriveled walnuts are misjudged as empty-shell samples, and 4 shriveled walnuts are misjudged as sound samples. For the empty-shell walnuts, 9 samples are wrongly discriminated with an error rate of 5.2%, obtaining a slightly higher discrimination accuracy of 94.8%. This may be because the feature information of sample images is not complete, caused by various shooting angles using X-ray radiography. Additionally, different shriveled degrees occurred in in-shell walnuts, and it is likely that this is also the reason why the shriveled walnuts and empty-shell walnuts are wrongly discriminated against each other. Significantly, it is found that the improved Faster R-CNN model obtains a discrimination accuracy of 96.14% for sound walnut samples, and only 8 sound walnuts are wrongly discriminated with an error rate of 3.9%. In general, 496 walnuts of 525 discrimination samples are correctly recognized and the overall discrimination accuracy reaches 94.22%. It is believed that the improved Faster R-CNN model proposed by this work can effectively discriminate the internal defects in intact walnuts with shells.  
Examples of the recognition results of the improved Faster R-CNN model for sound, shriveled, and empty-shell walnut samples are depicted in Figure 8. The red, purple, and yellow boxes were used for labeling the empty-shell, shriveled, and sound walnuts. As shown, the confidence levels for individual walnuts with complete image information are between 92% and 95%, and the overall confidence level is relatively close to the _mAP_ value from the testing set. Although the confidence level of a single empty-shell walnut sample with incomplete information is lower than that of the other two types of walnut samples, there are not wrong detection or missed detection caused by incomplete information of the walnut images.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Model Framework** & _mAP (\%)_ & **F\({}_{1}\)-Value (\%)** \\ \hline Faster R-CNN & 89.71 & 87.94 \\ Faster R-CNN + FPN & 91.33 & 89.07 \\ Faster R-CNN +FPN + ROI Align & 93.06 & 91.43 \\ Faster R-CNN + FPN + ROI Align + Softer-NMS & 95.57 & 93.59 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Performance comparison of different improvement points.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**Actual Class**} & \multicolumn{4}{c}{**Predicted Class**} & \multirow{2}{*}{\
\begin{tabular}{c} **Discrimination** \\ **Accuracy (\%)** \\ \end{tabular} } & \multirow{2}{*}{
\begin{tabular}{c} **Overall** \\ **Accuracy (\%)** \\ \end{tabular} } \\  & **Walnut** & & & **Walnut** \\ \hline Empty-shell walnut (173) & 164 & 8 & 1 & 94.80\% \\ Shriveled walnut (145) & 8 & 133 & 4 & 91.72\% \\ Sound walnut (207) & 2 & 6 & 199 & 96.14\% \\ \hline \hline \end{tabular}
\end{table}
Table 3: The discrimination results of the improved Faster R-CNN model.