## 2 Related Work  
In natural environments, tomato growth conditions are complex, and the accuracy of tomato detection is affected by factors such as leaf and branch occlusion, varying ripeness, overlapping clusters [16], different densities, and loss of tomato characteristics due to natural lighting changes [17]. Therefore, improving the accuracy and robustness of tomato detection in natural environments is a critical technical challenge. Over the years, the development of computer vision systems for intelligent fruit and vegetable detection, akin to human capabilities, has undergone several stages [18; 19]. [PERSON] et al. [20] utilized brightness and RGB color difference models for color-based segmentation to identify apples, while [PERSON] et al. [21] experimented with color indices for segmenting apples from their surroundings. [PERSON] et al. [22] utilized the L\"a\"b\" color space to extract features of ripe tomatoes, and [PERSON] et al. [23] employed color-based segmentation methods to extract fruits from their backgrounds. However, selecting the optimal color model for real-life scenarios remains challenging due to the reliance of fruit detection on the effectiveness of the color space used. Additionally, [PERSON] et al. [24] achieved a detection accuracy of 75% for green oranges in natural outdoor conditions by combining circular Gabor texture features and several fixed threshold features. Changes in lighting conditions significantly affect the classification of green apples and the classifier based on color and texture information between detected circles and [PERSON]'s heuristic model [25]. [PERSON] et al. 's improved algorithm [26] for mango crop yield estimation based on color and texture was restricted by artificial lighting, and [PERSON] et al. [27] pointed out the influence of lighting and leaves on the obtained results regarding ripe apple localization. [PERSON] et al. [28] segmented ripe tomatoes from the background using the optimal threshold with fused image features, achieving an accuracy of 93%, albeit susceptible to lighting conditions. Looking ahead, researchers have attempted to use various sensors for fruit detection to overcome lighting variations and occlusion issues [29; 30; 31]. Machine learning has been incorporated into computer vision tasks in agriculture to promote growth and development. Early fruit recognition relied on machine learning [32], necessitating the design of human-customized features, a highly complex process. Some methods utilized combined techniques such as [16] limited contrast adaptive histogram equalization (CLAHE), red-blue mapping, OTSU thresholding, and morphological operations for image segmentation. These methods were applied to fruits of different ripeness levels but needed more detection accuracy and real-time performance. Traditional digital image detection methods were based on color extraction and analysis [33; 34], shape [5; 35], and texture [36; 37]. For instance, [PERSON] et al. [38] achieved an accuracy of 92.4% in identifying fruits and branches in natural scenes using a support vector machine trained solely on the RGB color space but were susceptible to lighting effects. Various classifiers such as AdaBoost and Haar-like features were used for tomato detection in greenhouse scenarios [6], albeit with relatively poor real-time performance and low speed. Support vector machine (SVM) [39; 40] and K-means clustering algorithms [41; 42] were used to remove image backgrounds based on RGB color channel components and detect red tomatoes using region-growing methods. [PERSON] et al. [43] employed support vector machine neural networks with different classifiers to detect immature peaches. Thus far, improving traditional machine learning in computer vision has significantly succeeded. In recent years, the limitations of machine learning have been addressed with the introduction of deep learning into computer vision tasks.