## 2 Materials and Methods
### YOLO Models  
The work utilizes pre-trained models from the YOLO11 family developed by Ultralytrics [13]. This family of models is designed to address typical computer vision problems, including object detection, image segmentation and classification. YOLO models have consistently demonstrated their effectiveness in applied research within the agricultural industry, tackling tasks such as disease detection, plant variety identification and fruit detection [14; 15; 16; 17; 18; 19]. Some studies have focused on enhancing the architecture of YOLO models to improve their performance in meeting end-user requirements. Developers have shown particular interest in modernizing detector models by incorporating attention mechanisms [17; 19]. The introduction of attention mechanisms enhances the quality of fruit detection against the backdrop of other plant parts by amplifying the frequently repeated combinations of visual features that the model identifies during the learning process while diminishing the influence of elements in the images unrelated to the detected objects. However, achieving this effect necessitates the creation of sufficiently large and diverse training datasets. The architecture of the YOLO11 model comprises blocks with similar functions that enhance important spatial features and image channels. These include the C2 PSA, CPPF and C3k2 units (Figure 1), where C2 PSA stands for Convolutional block with Parallel Spatial Attention, SPPF refers to Spatial Pyramid Pooling--Fast, and C3k2 denotes Cross Stage Partial with a kernel size of 2 [20]. We examined the YOLO11 model without altering its architecture, allowing us to utilize a ready-made model from the developer's library and facilitating the seamless transfer of the completed model to applications developed by others. At the same time, we achieved the desired quality results by fine-tuning the model with specialized and custom datasets. In our work, we employed the YOLO11n model, which is pre-trained on the COCO dataset from the Ultralytics package and contains 2.6 million parameters. This model is the smallest detection model in the series in terms of the number of parameters and  
Figure 1: Simplified YOLO11 architecture (blocks that perform functions similar to attention mechanisms are indicated). operations performed. According to the manufacturer's documentation, the prediction accuracy of the pre-trained YOLO11n model is slightly lower than that of larger-scale YOLO11 variants such as YOLO11s, YOLO11m, YOLO11l and YOLO11x [20]. However, it is particularly suitable for use in user software applications, especially in scenarios with limited computing resources, which may arise when implemented in greenhouses. Table 1 presents a comparative analysis of this model alongside other popular and widely used models of similar size, such as YOLOv5 and YOLOv8 [20]. The developers' data indicates that YOLO11 is a lighter and faster version compared to models from previous series, achieving higher detection accuracy metrics (mAP) on benchmarks [13; 20]. We specifically used YOLO11n to test its capabilities to achieve accuracy values that would be commensurate with the results of similar studies on other models. To assess the quality and performance of the trained models, we used the well-known mean average precision (mAP) metrics--mAP@50, mAP@75, mAP@50-95, which are used by researchers and manufacturers of detecting models for their comparison and validation [21]. We also evaluated accuracy indicators such as Precision and Recall, which are of particular interest for the task of counting the number of tomatoes. The following formulas are used to calculate these metrics in detection tasks [19]:  
\[\text{Precision}=\text{TP}/(\text{TP}+\text{FP}), \tag{1}\]  
where TP is the number of objects of the class (tomatoes) correctly highlighted in the image, and FP is the number of objects that are mistakenly assigned to the \"tomato\" class.