# Instance Segmentation and Number Counting of Grape Berry Images Based on Deep Learning
## 3 Results and Discussion
### Experimental Results
#### 3.4.2 Improving the Experimental Results  
Table 3 shows the results of grape images in natural, laboratory, and mixed scenarios using the Mask R-CNN model and the Soft-MRBS model, individually. Due to the more complex background of grape images in natural scenes, the results of grape images in natural scenes are lower than those in laboratory scenes. It can be seen that the results of the Soft-MRBS model are better than those of the Mask R-CNN model for natural, laboratory, and mixed grape images. The results of the Soft-MRBS model show that the _mloU_, _AP\({}_{0.50}\)_, _AP\({}_{0.75}\)_, and _mAP_ of laboratory scenes are 3.96%, 5.96%, 4.11%, and 7.27% higher than those of natural scenes, individually.  
The mixed scenarios show the performance comparison between the Mask R-CNN model and the Soft-MRBS model. The _AP\({}_{0.50}\)_, _AP\({}_{0.75}\)_, and the _mAP_ of the Mask R-CNN model were 88.08%, 82.04%, and 69.93%, individually, and the segmentation accuracy _mloU_ was 85.98%. In addition, the _AP\({}_{0.50}\)_, _AP\({}_{0.75}\)_, and _mAP_ of the soft-NMS-based soft-MRBS model were 90.06%, 84.76%, and 74.23%, individually, and the _mloU_ was 89.53%.  
Figure 12: Orchard natural scene test results. The second line is an enlarged view of area 1. The third line is an enlarged view of area 2. The fourth line is an enlarged view of area 3.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & **Model** & _mloU (\%)_ & _AP\({}_{0.50}\) (\%)_ & _AP\({}_{0.75}\) (\%)_ & _mAP (\%)_ \\ \hline Automated & Mask R-CNN & 88.12 & 88.85 & 83.09 & 71.10 \\ device scenario & Soft-MRBS & 90.20 & 90.91 & 86.53 & 79.62 \\ \hline Orchard & Mask R-CNN & 85.25 & 84.89 & 78.12 & 68.29 \\ natural scene & Soft-MRBS & 86.24 & 84.95 & 78.98 & 72.35 \\ \hline \multirow{2}{*}{Total} & Mask R-CNN & 85.98 & 88.08 & 82.04 & 69.93 \\  & Soft-MRBS & 89.53 & 90.06 & 84.76 & 74.23 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Segmentation performance comparison of red globe grape based on Mask R-CNN and Soft-MRBS models.  
The model \(AP_{0.50}\) was improved by 1.98%, the \(AP_{0.75}\) was improved by 2.72%, the \(mAP\) was improved by 4.30%, and the \(mIoU\) was improved by 3.55%, achieving a relatively high accuracy of grape berry segmentation. The \(AP_{0.75}\) is an important metric in instance segmentation because it reflects the ability to segment closely overlapping objects. The significant improvement in the \(AP_{0.75}\) showed that the Soft-MRBS was good at detecting objects that were highly overlapping with the ground truth, which proved the effectiveness of the Soft-MRBS model for solving the problem of fruit occlusion.  
The experimental results showed that the Mask R-CNN model had high segmentation accuracy and high segmentation quality for the grape berry edges, especially for the masked grape berry edges, which reflected the possibility and potential of the model to solve the grape berry segmentation problem, but there were still some problems. Most of the missed detection problems existed in areas where the grape berries were obscured by a large area, and the obscured grape berries were prone to missed detection. Grapes, as a spiky fruit, have many overlapping berries, i.e., single berries are obscured by one or more berries. By observing Figures 13 and 14, the segmentation results of the Mask R-CNN and Soft-MRBS models on the same test images are shown, and it is clear from the comparison of the results that the missed berries were identified.  
Figure 13: Comparison of the Mask R-CNN and Soft-MRBS results for automated device scenarios. The second line is an enlarged view of area 1. The third line is an enlarged view of area 2.