# An Enhanced YOLOv5 Model for Greenhouse Cucumber Fruit Recognition Based on Color Space Features
## 1 Introduction  
Cucumber is one of the most popular greenhouse vegetables worldwide, which is widely cultivated and comparatively productive. However, the workload during harvest is considerable, which also increases the labor cost [1]. Therefore, it is necessary to develop intelligent and automated cucumber-picking equipment to reduce the labor input. To date, using automatic identification to assist automatic picking has been realized in tomato [2], citrus [3], lithci [4], apple [5], strawberry [6], mango [7], etc. The colors of these rip fruits are greatly different from the surrounding environment and are easy to identify. However, the color of harvestable cucumber fruit is green, which is similar to its surrounding environment. In addition, occlusion between fruits and leaves poses a challenge to the identification of cucumber fruits using an object detection model under natural conditions. Therefore, it is of great significance to improve the recognition precision of the model in the detection of cucumber fruits in complex near-color backgrounds. Compared with the industrial field, it is more difficult to realize recognition based on machine vision in agricultural cultivation processes, mainly for the following reasons: (1) The growth environment of the object to be detected is more complicated due to the messy background and inconspicuous object; (2) various light conditions and camera orientations affect the consistency of image parameters such as saturation and brightness; and (3) the occlusion issues, together with the shape and color of fruits such as cucumbers, raise the difficulty in fruit recognition. In previous studies, machine learning has been used to manually extract features and train classifiers from shallow features such as shape, surface texture and color, so as to detect and identify fruits. [PERSON] et al. [8] used the combined threshold method to remove the background in the \(HSV\) color space to segment mature red tomato fruit. However, in a near-color background, this method could filter out the green immature tomato along with the leaves, resulting in missing detections. To solve this problem, [PERSON] et al. [9] proposed a method based on color and shape features to detect immature green apples, using super-pixel segmentation and the Hough transform to perform ellipse fitting on apple fruits. However, the Hough transform is no longer applicable for cylindrical fruits such as cucumbers. In this case, [PERSON] et al. [10] converted \(RGB\) images to other color space images to classify and segment the cucumber fruit. As previously stated, most of the recognition methods based on machine learning enhanced the extraction of image color features from the color space conversion [11; 12]. However, they achieved good accuracy at the cost of efficiency. For instance, feature selection was conducted manually, which is a time-consuming and heuristic method that highly relies on experience. Convolutional neural network based on deep learning have a strong ability to express and extract features of images. They make use of the image itself to promote the self-optimization learning of the relationship between features and expression, which is fast and accurate. In order to improve the accuracy of deep learning object detection models, researchers are currently thinking about combining the deep learning method with color space conversion [13]. [PERSON] et al. [14] converted an original potato \(RGB\) image to the \(HSL\), \(HSV\), \(Lab\), \(XYZ\), and \(YCrCb\) color spaces and then created Mask R-CNN models for each color space to detect will plaque on leaves. However, the Mask R-CNN model requires datasets with pixel-level annotation, which are difficult to construct. However, cucumber fruit recognition only requires the positioning information. [PERSON] et al. [15] expanded the color space for training images by generating composite images with modified color value distributions, improving deep learning neural networks' ability to identify cassava diseases in low-quality images.