## 3 Materials and Methods
### Training and Evaluating SSD Models
Darknet had no available validation sessions, so it was not considered. The literature refers to many different evaluation metrics [52; 62]. During the training process, we used the default pipeline metrics. However, as the COCO dataset and OID use different measures to evaluate the performance of the models, an additional common evaluation metrics pipeline was needed. For better benchmark SSD models, we preferred the metrics used by the Pascal VOC challenge [52] (precision \(\times\) recall curve and mean average precision), as implemented by [PERSON] et al. [62], and complemented this evaluation with additional metrics:  
1. total recall;
2. total precision;
3. F1-score. Recall (1) is the ability of the model to detect all the relevant objects, i.e., the ability of the model to detect all the detected bounding boxes of the validation set. Precision (2) is the ability of the model to identify only the relevant objects. F1-score (3) is the first harmonic mean between recall and precision. True Positives (TPs) are the correct detections of the ground truths. False Positives (FPs) are the objects that were improperly detected. False Negatives (FNs) are the undetected objects. The number of ground truths can be computed by the sum of the TPs and FNs (\(\text{TP}+\text{FN}\)), and the number of detections is the sum of the TPs and FPs (\(\text{TP}+\text{FP}\)). The detections are normally validated using the Intersection Over Union (IOU) metric [62] considering only the detections with an IOU \(\geq t\). For the current benchmark, we considered \(t=50\%\). \[\text{Recall}=\frac{\text{TP}}{\text{TP}+\text{FN}} \tag{1}\]  
\[\text{Precision}=\frac{\text{TP}}{\text{TP}+\text{FP}} \tag{2}\]  
\[\text{F}_{1}=2\cdot\frac{\text{Precision}\times\text{Recall}}{\text{Precision}+\text{Recall}} \tag{3}\]  
At the end of the training pipeline, all the models still had a free parameter: the confidence rate. The confidence rate is a value that features the certainty in the performed prediction. A prediction with a confidence rate of 50% determines that the network is 50% sure of the detected or classified object. Robust ANN tends to detect better and with higher confidences, but lower confidences can still have true positives. Therefore, optimising the confidence score is essential to optimise the network performance. The cross-validation technique is a useful technique to optimise this value. In the validation set, we removed all the augmentations and computed the F1-score for all the confidence thresholds from 0 % to 100 %, into steps of 1%. A confidence threshold considers all the confidence rates bigger \begin{table}
\begin{tabular}{l c} \hline \hline
**SSD Model** & **Batch Size** \\ \hline SSD MobileNet v2 & 24 \\ SSD Inception v2 & 32 \\ SSD ResNet 50 & 8 \\ SSD ResNet 101 & 8 \\ YOLOv4 Tiny & 64 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Training batch size for each model. than or equal to the stated one. The confidence threshold that optimises the F1-score is selected for the model's normal operation. We evaluated the four trained models to identify tomatoes using the test set. The whole inference process occurred on the Google Colab server, using a Tesla T4 GPU with a computation capability of 7.5.