# Green Sweet Pepper Fruit and Peduncle Detection Using Mask R-CNN in Greenhouses
## 3 Results and Discussion
### Experiment and Evaluation of Sweet Pepper Fruit and Peduncle Detection  
The detection performance evaluation of the Mask R-CNN model for sweet pepper fruits and peduncles is shown in Figure 10, and the confusion matrix of the detection results for the 100 sample images is listed in Table 2. The results of the 100 test images showed that the overall precision, recall, and F1-score rates were 78.16%, 66.86%, and 71.89%, respectively. In addition, it achieved an average inference time of 1.18 s per image. In Table 3, we see the detailed results for each class of the trained Mask R-CNN model. From Table 2, it is concluded that the detection of the fruit performs better than peduncles. In this case, if we evaluate the classes as individual models, we realize that the sweet pepper fruit detection metrics are good and stable, reporting a precision rate of 84.53%, a recall rate of 79.01%, and an F1-score of 81.67%, which are considered good values, in short, a good detection in quality and quantity of sweet pepper fruit. \begin{table}
\begin{tabular}{c c c c} \hline
**Ground Truth** & **Predicted Class** & & \\ \hline  & **Fruit** & **Peduncle** & **Background** \\ \hline Fruit & 907 & 0 & 241 \\ Peduncle & 0 & 145 & 120 \\ Background & 166 & 57 & / \\ \hline \end{tabular}
\end{table} 
Table 2: Confusion matrix of the Mask R-CNN sweet pepper fruit and peduncle model. \begin{table}
\begin{tabular}{c c c c} \hline
**Evaluation Parameter** & **Fruit** & **Peduncle** & **Overall** \\ \hline Precision rate \% & 84.53 & 71.78 & 78.16 \\ Recall rate \% & 79.01 & 54.72 & 66.86 \\ F1-score \% & 81.67 & 62.10 & 71.89 \\ \hline \end{tabular}
\end{table} 
Table 3: Precision rate, recall rate, and F1-score of the trained Mask R-CNN sweet pepper fruit and peduncle model. Figure 9: Loss graphs for Mask R-CNN model: (**a**) RPN bounding box loss; (**b**) RPN anchor classifier loss. Now, regarding the sweet pepper peduncles, if we again consider it an isolated model with a precision rate of 71.78%, a recall rate of 54.72%, and an F1-score of 62.10%, and compare them with the results of previously reported sweet pepper peduncle detection models, ref. [15] is the only one that reports better values, but with a smaller dataset, which leads to less reliable results, and also uses another type of technology. In this case, the models previously reported for the detection of sweet pepper peduncles do not use 2D information but 3D, which categorically separates the results obtained by technologies. Furthermore, even if the results of previously reported 3D detection methods for sweet pepper peduncles were reliable enough, the detection times do not even come close to those of 2D technologies. A clear example is the time only to process the input data of the classification model of [14], which is around 10 s compared to the 1.18 s obtained for the entire process in our implementation. That is why, frequently, we find a greater number of  
Figure 10: Sweet pepper fruits and peduncles detection and instance segmentation masks display: (a,c,e) Original images; (b,d,f) Images with resulting detections. detection implementations in 2D, with the simple objective of bringing the implementation close to one second or less (real-time). Furthermore, previously reported models do not focus on simultaneous fruit and peduncle recognition, while our implementation does. On the other hand, there is the fact that our implementation focuses on the recognition of the peduncle and fruit of the green sweet pepper, the most complicated color variety, as confirmed by the results of [14; 15]. Our dataset includes more than 14,600 objects belonging to the fruit and peduncle of the green sweet pepper, which corresponds to about 85% of the objects in our complete dataset. The general results and main errors can be explained by analyzing the results by class, the dataset, and the complicated environments where the objects of interest are found. The results of the sweet pepper fruit class give us positive, stable metrics, and within a good range.