# Weed Detection in Wheat Crops Using Image Analysis and Artificial Intelligence (AI)
## 4 Experiments and Results  
### The Performance of CNNs within the Pytorch Framework  
In the context of PyTorch, the result outcomes are summarized in Table 5. The table shows that all the YOLOv5m, YOLOv5s, and YOLOv5l all models performed well, and the range of results was obtained from the same scale. However, the YOLOv5l results were better and more accurate compared to those of the other two models. The precision value of YOLOv5l was 0.842, which was comparatively higher than the value provided by both the other models. The remaining two models provided the following values: YOLOv5m (0.66) and YOLOv5s (0.53), as presented in Table 5 and Figure 3.  
All three models, YOLOv5s, YOLOv5m, and YOLOv5l were used to train the weed dataset using the Pytorch framework. In terms of accuracy, for the weed datasets, YOLOv5l provided relatively better results compared with the other models. The inference speed of YOLOv5l was slightly higher than both YOLOv5s and YOLOv5m. In comparing the YOLOv3, YOLOv4, and YOLOv5 given in (Table 3), it was observed that the YOLOv4 performed better overall because of its accuracy, as presented in Figures 4-6; however, the YOLOv5 is more flexible, and has a model with four networks [27]. In comparison to SSD, Faster R-CNN, and the original YOLOv3, the improved YOLOv3 CNN can recognize tomato diseases and pests in real time with greater speed and accuracy, and in less time [28]. In the end, YOLOv4-tiny and YOLOv3-tiny were compared to identify what improvements YOLOv4-tiny brings.  
YOLO-based detection results were recorded for all models, as shown in (Table 5), with precision values of 0.59, 0.67, and 0.84 for YOLOv5s, YOLOv5m, and YOLOv5l, respectively for weed. The accuracy, recall, and F1-score values for the weed datasets (using these models' statistical significance indicators) are mentioned in Table 6.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Network Model** & **Precision** & **Recall** & **[EMAIL_ADDRESS]** & **Detection Time** & **GFLOPs** \\ \hline YOLOv5s & 0.59 & 0.44 & 0.49 & 0.020 s & 16.3 \\ YOLOv5m & 0.67 & 0.49 & 0.53 & 0.021 s & 50.3 \\ YOLOv5l & 0.84 & 0.39 & 0.51 & 0.025 s & 114.1 \\ \hline \hline \end{tabular}
\end{table}
Table 5: Comparison of different YOLOv5 models for accuracy rate.  
Figure 7 demonstrates the results of evaluating two different neural network models, YOLOv5s and YOLOv5l, on a classification task using five different batch sizes (42, 32, 16, 8, and 4). The evaluation metric used in the figure is the F1-score. In general, the results in Figure 7 show that the YOLOv5l model tends to have a higher F1-score compared to the YOLOv5s model, especially when using larger batch sizes (32). Further, the performance of the model is reduced if the batch size used in the model training is bigger than 32. Furthermore, using a smaller batch size can lead to less stable training, and may result in the ideal overfitting to the preparation records, resulting in a lesser performance.  
Figure 3: \(Cont.\)  
In the above figures, we show that the highest F1-score is achieved by the model using the batch size of 64. However, if we increase the batch size more than 64 the performance of the model drops. Furthermore, using smaller batch size results into the lower performance in terms of F1-score.  
Figure 3: Process image of _Crisium arvene_, and healthy wheat plants for YOLOv5l, m, s.