## 4 Results and Discussion
### Experimental Platform and Evaluation  
This study utilized the Ubuntu 20.04.5 operating system, NVIDIA GeForce RTX3060 GPU, CUDA 11.1, Python 3.8.8, and PyTorch 1.8.0. The dataset was randomly divided into training and testing data in an 8:2 ratio. The SGD training optimizer was employed with a batch size of 24, an initial learning rate of 0.01, 200 training epochs, and an input image size of 640 \(\times\) 640. For the batch size, we started with a smaller batch size and then determined the optimal value based on the model's performance, resource constraints, and multiple experiments. For the initial learning rate, we began testing with 0.1 and gradually decreased the learning rate during training until we achieved the desired result. Regarding the number of epochs, we conducted extensive experiments, allowing the training to stop when the model's performance on the validation set no longer improved or began to decline, ultimately determining the optimal number of epochs. For the input image size, we chose 640 \(\times\) 640, which provided more details and helped the model learn complex features. Selecting these parameters required extensive experimentation to evaluate the model's performance under different parameter combinations. Additionally, we referenced several studies, to guide our choices [53].  
The Intersection over Union (IoU) [54] is a standard for dividing positive and negative samples in object detection tasks. Precision and recall are two standard metrics for evaluating model performance [55]. These three metrics are calculated by Equations (5)-(7). In Equation (5), the numerator represents the overlap area between the predicted and ground truth boxes. In contrast, the denominator represents the total area of the predicted box and the ground truth box. In Equations (6) and (7), \(T\) or \(F\) indicates whether the sample is correctly classified, and \(P\) or \(N\) indicates whether the sample is predicted as positive or negative. Specifically, \(TP\) (true positive) means tomatoes are successfully identified and correctly classified, \(TN\) (true negative) represents the correct classification of the background, \(FP\) (false positive) means the background is incorrectly classified as tomatoes, and \(FN\) (false negative) means tomatoes are incorrectly classified as background. However, the choice of confidence threshold limits the evaluation of individual metrics. Fortunately, the mean average precision (\(mAP\)) has been proven to be a more accurate measure [56; 57] and is used in experiments. \(AP\) and \(mAP\) are calculated by Equations (8) and (9), respectively.  
The commonly used metric, \(F_{1}\) score, was employed to measure the accuracy of classification. The \(F_{1}\) score is a comprehensive performance indicator of precision and recall and can be calculated by Equation (10).  
\[IoU=\frac{area\ of\ overlap}{area\ of\ union} \tag{5}\]  
\[Precision=\frac{TP}{TP+FP} \tag{6}\]  
\[Recall=\frac{TP}{TP+FN} \tag{7}\]  
\[AP=\frac{1}{11}\sum_{r\in 0,0.1,0.2,\ldots,1.0}Precision(r) \tag{8}\]  
\[mAP=\frac{1}{N_{class}}\sum AP \tag{9}\]  
\[F_{1}=2\times\frac{Precision\times Recall}{Precision+Recall} \tag{10}\]