Optimizing YOLOv7 Versus YOLOv8: A Comparative Study on Fruit Detection Performance
摘要
Currently, single-stage object detection methods, such as YOLO (You Only Look Once), are highly effective for detecting and classifying objects. This study focuses on YOLOv7 and YOLOv8 to enhance accuracy and reduce training time for fruits detection, specifically apples, blueberries, and watermelons. By applying transfer learning techniques and freezing network layers, the goal is to improve the performance of these models in real-time agricultural applications, where timely and accurate detection is crucial. Datasets from Roboflow Universe were divided into training, validation, and testing sets. Both YOLOv7 and YOLOv8 models were trained for 100 epochs, with network layers frozen at 50 and 75% to optimize performance. The models were evaluated using Precision, Recall, F1-Score, mAP@0.5, and mAP@0.5:0.95. The results showed that YOLOv8m with 75% of network layers frozen achieved the best performance metrics for the apple dataset, while YOLOv8m with 50% frozen layers demonstrated balanced performance for the blueberry dataset. YOLOv7 excelled in Recall and mAP@0.5 for the watermelon dataset. Additionally, YOLOv8m exhibited shorter detection times and smaller model sizes compared to YOLOv7, highlighting its efficiency in real-time detection tasks. Overall, YOLOv8, especially the YOLOv8m variant with optimized layer freezing, offers superior accuracy, speed, and model size, making it the preferred choice for efficient fruit detection in agricultural contexts.