# Green Sweet Pepper Fruit and Peduncle Detection Using Mask R-CNN in Greenhouses
###### Abstract
The main reason is that machine vision algorithms are no longer sufficient, as they suffer considerable decreases in accuracy when the ambient lighting changes, generating shadows, and other types of effects [13]. Additionally, in occluded scenarios and where there is overlapping of objects, machine vision algorithms have complications in finding a general solution for the detection of certain crop fruits, and other parts of them [13], for example, the peduncle in sweet peppers in greenhouse cultivation scenarios. The difficulty in the task of detecting sweet pepper fruits and peduncles lies in the fact that it is even difficult for a human to be able to identify targets in variable light conditions, of variable sizes and colors (very small to medium), with the background similar to the targets, and occlusion caused by other targets or leaves as shown in Figure 1.  
Figure 1: Fruits and peduncles of green sweet peppers in a greenhouse with variable light conditions and the presence of occlusion by other crops and leaves. Thus, in the field of sweet pepper peduncle detection, there is relevant research conducted to solve this difficult task; however, it is still scarcer than for sweet pepper fruit. Ref. [14] proposes a 3D detection system for red and green sweet pepper peduncles, based on color and shape information, and in conjunction with an SVM achieving an area-under-the-curve (AUC) of 0.71 for point level segmentation. Ref. [14] generates a dataset of manually annotated 3D images of the fruits and peduncles of sweet peppers, specifically, a total of 72 sweet peppers (61 red, two mixed (red-green), and only nine green sweet peppers). This implementation uses a 79/21 dataset split methodology; ergo, 79% of the images are for training, and 21% for testing. Based on these conditions, for training, ref. [14] uses 50 red sweet peppers, only five green sweet peppers, and two mixed sweet peppers. For testing, ref. [14] uses 11 red sweet peppers and only four green sweet peppers. In this way, the value of the metric reported (AUC) by [14] is an average of two tests with different amounts of green, red, and mixed sweet peppers. The first test contains in total, from training and testing, only 28 red sweet peppers, without any other sweet pepper color variety. The second test contains 33 red sweet peppers, two mixed sweet peppers, and only nine green sweet peppers. Ref. [14] shows that for the first test, it obtains the best results of the reported metric, in this case, an AUC of 0.74, demonstrating the ease in comparison for the detection of sweet pepper fruits and peduncles in its red variety. Ref. [14] shows that for the second test where objects of mixed and green sweet peppers are added the AUC value is 0.67, thus demonstrating the comparative difficulty in the detection of the peduncle of the mixed and green color varieties of sweet pepper. Furthermore, ref. [14] reports times to process only the input data of around 10 s, which, adding the internal processing time to obtain the total processing time per image, shows us that the real-time performance of the proposed algorithm needs to be improved. In addition, ref. [15] similarly proposes a 3D detection method for green and red pepper peduncles, based on shape and color information as inputs for a partial least squares discriminant analysis (PLSDA), which achieves an average classification accuracy of 87.88%. Ref. [15] uses the dataset generated by [14] to conduct training and testing, considering 70 samples of red, green, and mixed (red-green) sweet peppers (main dataset of [15]). Ref. [15] uses two classification models and two subsets with different numbers of sweet pepper color varieties to measure the impact on detection metrics (does not split the main dataset, but randomly forms two subsets with samples that can be repeated in one or the other subset). Both groups use 42 samples for training and 12 for testing. Group A uses an unbalanced dataset, where 24 samples are red sweet peppers, 12 mixed, and six green for training.