# Green Sweet Pepper Fruit and Peduncle Detection Using Mask R-CNN in Greenhouses
## 4 Conclusions  
In this paper, a method for detection of the fruit and peduncle of sweet pepper, focused on green sweet pepper, this being the most complicated color variety due to its resemblance to the background, based on Mask R-CNN, capable of working in real-time in a real production environment with good metrics for the fruit, average for the peduncle, and a segmentation metric value not previously reported for 2D simultaneous detection models of the fruit and peduncle of the green sweet pepper was obtained. The results of this work are summarized as follows:  
1. A Mask R-CNN model which can automatically detect sweet pepper peduncles and fruits was trained in this paper, capable of obtaining bounding boxes and instance segmentation masks in an unmodified production environment under occlusion, overlap, and light variation conditions with performance metrics within the medium-high range. The results of the detection of the fruit and peduncle of 100 test images show, in general, that the precision, recall, and F1-score rates were 78.16%, 66.86%, and 71.89%, respectively. 2. The proposed implementation manages to obtain a mean average precision (_mAP_) rate of 0.726, not previously reported for simultaneous 2D detection models of peduncles and fruits of green sweet pepper. 3. More specifically, the results for the fruit class were the following: 84.53%, 79.01%, and 81.67% for precision, recall, and F1-score rates. The trained model is particularly effective for detecting green sweet pepper fruits, the most difficult color variety due to background resemblance, in occluded, overlapping scenarios, and a real production environment. 4. The results for the peduncle class were as follows: 71.78%, 54.72%, and 62.10% for precision, recall, and F1-score rates. These metrics fall in the average range. In addition, the values obtained can be explained due to the number of peduncle-type objects, and individual areas existing in the dataset, in contrast to those of the fruit-type objects. 5. The model achieves an average inference time of 1.18 s per image. The model manages to approach the real-time requirement for autonomous sweet pepper harvesting, drastically surpassing the times obtained by previously reported green sweet pepper peduncle and fruit detection models. At present, the method used in this paper can perform real-time fruit and peduncle detection of the most common color varieties of sweet pepper (red, green, yellow, and orange), focusing on green sweet pepper, within a medium-high range in general, good for the fruit, and regular for the peduncle, due to the existing imbalance in the number of class objects, in addition to the unchangeable difference in area per class object. In future research, due to the results obtained, the following points will be sought to address:  
1. Improvement of model hyperparameters: time is key in model improvement, experimentation with different backbones, number of epochs, learning rates, and the type of optimizer are crucial to improving overall results. 2. Integration into a complete sweet pepper harvesting framework: the generation of this sweet pepper detection method always aimed to integrate it into a complete functional implementation. 3. Dataset growth: it is widely known that the more examples of an object we have, the easier it will be to recognize the characteristics that distinguish it from its environment. 4. Improvement of image quality: despite the fact we use high-resolution images, the complexity of environments where it is necessary to capture specific features to be able to differentiate the targets from the background (overlapping of fruits, peduncles, leaves and stems of the main crop, variation light intensity, shadows, among others)typically benefits from a greater focus on image quality, so various methods to improve the quality of the input image [42; 43; 44; 45] could be of great help to obtain better results in the accuracy of future implementations.