## 5 Conclusions and Discussion  
On-plant detection and segmentation of tomatoes is an important process of harvesting robots; current studies mainly include two kinds of methods, i.e., pixel-wise semantic segmentation deep learning algorithms and classical color-based segmentation. [PERSON] et al. use user-collected RGB images and Mask R-CNN with ResNet-101-FPN backbone network to realize detection and segmentation of cherry tomatoes, and the average accuracy of 20 test images is 98.00% [31]. [PERSON] et al. use four RealSense cameras mounted on a trolley moving along the heating pipes to realize automatic image collection, the sensors need to be close to the fruit, with a distance roughly at 0.5 m [32]. However, in order to minimize the effects of lighting conditions, all images are collected at night. The Mask-RCNN with RestNext-101 backbone network is used to realize detection and segmentation of both red and green tomatoes, with F1-Score being 0.93 and 0.94 for these two types of fruits. [PERSON] et al. use an RGB camera coupled to a pipe rail trolley to automatically collect images of cherry tomato clusters, where the distance between the camera and the fruits is around 1 m [33]. Then, the MobileNetV1 CNN is used to detect cherry tomato clusters, with an accuracy of 95.98%, after that, the improved color space segmentation works better for red tomato clusters, while not so accurate for some mixed and green clusters. [PERSON] et al. use an RGB camera located perpendicular to the soil face and with a distance of 20-30 cm from the plant to collect images of beef and cluster tomatoes [34]. The Sobel operator is used to detect the tomato edge, then color-based and size-based segmentation, and finally realize the detection of ripe tomatoes and their peduncles in the foreground (not occluded) and segmentation from the rest of the image elements. In this study, in order to maximum simulate the working condition of harvesting robots, images are automatically collected by an RGB camera mounted on a mobile robot, which could traverse along the greenhouse day and night. The Mask R-CNN with RestNext-50-FPN backbone network is used to detect and segment mature green tomatoes, with F1-Score being 0.9284. Table 3 shows the detailed comparison with existing studies. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{3}{*}{**Samples**} & \multicolumn{2}{c}{**Number of Matter Green Tomatoes by**} & \multicolumn{3}{c}{**Number of Matter Green Tomatoes**} & \multirow{3}{*}{**Recognition**} \\  & \multicolumn{2}{c}{**Manual**} & & & **Identified by Mask R-CNN** & & \\ \cline{2-6}  & **Unshaded/Lightly** & **Shaded More** & & **Unshaded/Lightly** & **Shaded More** & & **Accuracy/\%** \\  & **Shaded** & **Than 50\%** & & **Shaded** & **Than 50\%** & & \\ \hline
1 & 6 & 1 & 7 & 6 & 1 & 7 & 100 \\
2 & 3 & 0 & 3 & 3 & 0 & 3 & 100 \\
3 & 7 & 2 & 9 & 7 & 1 & 8 & 88.9 \\
4 & 7 & 1 & 8 & 7 & 1 & 8 & 100 \\
5 & 9 & 3 & 12 & 9 & 2 & 11 & 91.7 \\
6 & 4 & 0 & 4 & 4 & 0 & 4 & 100 \\
7 & 5 & 1 & 6 & 5 & 0 & 5 & 83.3 \\
8 & 3 & 0 & 3 & 3 & 0 & 3 & 100 \\
9 & 8 & 2 & 10 & 8 & 1 & 9 & 90 \\
10 & 6 & 2 & 8 & 6 & 2 & 8 & 100 \\
11 & 10 & 3 & 13 & 9 & 3 & 12 & 92.3 \\
12 & 9 & 2 & 11 & 9 & 1 & 10 & 90.9 \\
13 & 7 & 1 & 8 & 6 & 1 & 7 & 87.5 \\
14 & 6 & 0 & 6 & 6 & 0 & 6 & 100 \\
15 & 11 & 3 & 14 & 10 & 2 & 12 & 92.9 \\ \hline Total & 101 & 21 & 122 & 98 & 15 & 113 & 92.6 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Recognition performance comparison between the trained Mask R-CNN model and manual detection. In deep learning, the identification performance increases logarithmically with the increase of training and validation set number [35; 36]; therefore, we also use other partitioning between training (training set and validation set) and testing number. Results show that only when the ratio of training is larger than 70% (i.e., the training set number is larger than 1272), the F1-Score of bounding box could reach 0.834, which is relatively satisfactory.