4.2. Ablation Experiments
The ablation experiment focused on analyzing the value of each of the components in the improved method, and was conducted on the self-made dataset constructed in this study. The experimental results for the improved model are shown in
Table 4.
By replacing the lightweight model, reconstructing the neck, and introducing knowledge distillation enhancement in the YOLOv5s baseline network, the AP of the improved network was able to meet the detection requirements. At the same time, the precision, recall, and AP values of the model all declined. To compensate for the loss of accuracy caused by replacing the backbone network, we reconstructed the neck network to pass useful information from the redundant feature layer to the neck network for fusion, where the size of the passion fruit targets in the dataset was also taken into account. This approach fuses the low-level semantic information of passion fruit targets with the high-level location information to obtain more useful feature layers, leading to an increase in AP from 93.10% to 93.60%, an improvement of about 0.5%. Finally, using the knowledge distillation learning approach, in which the teacher model passes rich information about the passion fruit features on to the student model, led to a substantial improvement in the average accuracy of the model. Compared to the original YOLOv5s model, the improved model had a mean average precision improvement of 1.00% and a size reduction of 50.42%.
4.4. Comparison with State-of-the-Art Models
To compare the performance of the improved model with current mainstream target detection models, we tested SSD, Faster R-CNN, RetinaNet, YOLOv5s, YOLOv5x, YOLOv6, YOLOv7-tiny, and YOLOv8s on the Jetson Nano. The comparison involved indicators such as floating point operations per second (FLOPs), number of parameters, frames per second (FPS), precision, recall, average precision (AP), and model size, all on the same self-made dataset. Additionally, we compared the method proposed in this article with recent research focused on passion fruit detection. It is important to note that focusing solely on a single evaluation indicator on different datasets and platforms is unfair; thus, we discuss similar research methods with the same research targets. The relevant performance indicators are presented in
Table 5, which is incomplete, as some data were not provided.
Due to the instability of the frame rate during real-time detection with the Jetson Nano platform, the frame rate in this experiment was the average of 100 detected frame rates. The improved AP for the G-YOLO-NK model was 96.40%, which was higher by 15.41%, 6.50%, 1.51%, 1.00%, 0.30%, 7.13%, 6.20%, and 1.00%, respectively, compared to the SSD, Faster R-CNN, RetinaNet, YOLOv5s, YOLOv5x, YOLOv6s, YOLOv7-tiny, and YOLOv8s models. Obviously, the G-YOLO-NK model had better Average Precision (AP), indicating that the model is capable of detecting passion fruits in complex environments. In terms of real-time detection speed, the G-YOLO-NK model had better real-time detection rate on both the PC and Jetson Nano, with 125.00 f/s and 11.23 f/s, respectively. Compared to the various YOLOv5, YOLOv6, YOLOv7-tiny, and YOLOv8s models, it achieved average frame rate improvements ranging from 3.30 to 10.95 f/s on the Jetson Nano. The size, FLOPs, and number of parameters of improved model were 7.14 MB, 6.60 G, and 3.51 M, respectively, representing reductions of 50.42%, 59.51%, and 50.56% with respect to the YOLOv5s model, further proving the effectiveness and superiority of the improved network. In summary, the G-YOLO-NK model outperformed the extant models for detecting passion fruit in all metrics and presented good overall performance, making it the most promising model for high-performance real-time passion fruit detection.
Comparing the existing methods presented in
Table 5, Wu et al. [
44] and Tang et al. [
45] improved the detection accuracy of YOLOv3 by integrating DenseNet and reducing multiscale prediction. Tu et al. [
46] enhanced the network’s extraction ability by incorporating an FPN into Faster R-CNN. Furthermore, Tu et al. [
47] fused RGB and depth color spaces in an improved Faster R-CNN to improve the model’s recognition rate. However, these studies did not address the need for light model weight and comprehensive deployment capability on mobile devices. Luo et al. [
48] replaced the backbone network with MobileNet and integrated an attention mechanism to make the YOLOv5s network lighter; however, the average accuracy was low. Ou et al. [
49] used ShuffleOne as the backbone network of YOLOv7 to reduce the number of network parameters and added a SimSPPF network at the neck to enhance the model’s fusion ability; however, the approach required a significant amount of time. Comparing the results of the above methods, G-YOLO-NK achieves higher AP and FPS than YOLOv3 proposed by Wu et al. (2020) [
44]. The improved model proposed by Tang et al. (2020) [
45] had an average accuracy 1.1% higher than that of G-YOLO-NK, but the detection speed of G-YOLO-NK was more than three times that of YOLOv3. Overall, G-YOLO-NK is a smaller model than the Faster R-CNN models proposed by Tu et al. (2020) [
46] and Tu et al. (2020) [
47]. Furthermore, when comparing detection frame rates on the PC, G-YOLO-NK demonstrated higher detection speeds than the other recent models.
To compare the generalization ability of the proposed model, we evaluated its performance on the COCO128 and VOC2012 datasets. Both datasets were randomly divided into training and testing sets using an 8:2 ratio. The results on the testing sets are shown in
Table 6. On the COCO128 dataset, G-YOLO-NK improved the precision by 0.2%, recall by 0.9%, and average precision by 0.8% compared to YOLOv5. On the VOC2012 dataset, it improved recall by 0.8% and average precision by 0.5%, compared to YOLOv5 while reducing precision by 0.2%. This lower precision may be due to the lack of an accurate learning rate setting; however, this does not affect the overall model evaluation. In summary, the comparison between the two datasets demonstrates that G-YOLO-NK has high generalization ability and strong robustness.
AI approaches require efficient computing power to process large amounts of data. GPUs play a crucial role in this process due to their numerous cores, high-speed memory, and parallel computing capabilities, which significantly alleviate computational bottlenecks and make deep learning algorithms practical. GPU utilization serves as an indicator of resource utilization on the GPU. Excessive GPU usage can lead to freezing and crashes during real-time target detection on devices such as the Jetson Nano. Prolonged high GPU usage can also impact the performance and lifespan of the system. Therefore, visualizing GPU occupancy is essential. When running the YOLOv5s and G-YOLO-NK models on the Jetson Nano for real-time passion fruit detection, we observed how GPU usage changed over time to ensure optimal performance and longevity of the device. The visualization results for the two models are shown in
Figure 12.
As can be seen from
Figure 12, the GPU occupancy rates of the two models running on the Jetson Nano differ. Greater network complexityis indicated by a denser blue color in the bar graph, indicating higher demand for GPU resources on the embedded device. The G-YOLO-NK model requires the least computation for real-time detection on the Jetson Nano, underscoring the importance of lightweight model design and improved efficiency.
4.5. Comparison of Recognition Effect before and after Improvement
To verify the detection performance of the G-YOLO-NK model, passion fruit images captured in complex environments, including dense, shaded, sunny, and rainy conditions, were selected for comparison testing against the original model. A confidence threshold of 0.7 and an IoU threshold of 0.5 were chosen. The detection results of the YOLOv5s and G-YOLO-NK models on embedded devices are shown in
Figure 13.
In the figure, the blue rectangular boxes are predicted target boxes and the red rectangular boxes are missed targets. Both types of models correctly detected the passion fruit targets in backlit, overcast, and rainy weather scenes. The YOLOv5s model missed passion fruit detections in both dense and shaded situations, while the G-YOLO-NK model correctly plotted the predicted boxes. The YOLOv5s model missed two passion fruits in the sunny image, while G-YOLO-NK missed one passion fruit, as the targets were too small. In terms of confidence, G-YOLO-NK had a higher confidence level than the YOLOv5s model, indicating the good detection effect of the improved model and the effectiveness of the improved method. In summary, it can be concluded from the recognition results that the G-YOLO-NK model provides improved detection performance under complex environmental conditions, showing good robustness and generalization ability.
Visualizing the feature layer illustrates the performance of model feature extraction and the distribution of contributions to the predicted output, providing a more representative analysis. Using the shaded passion fruit image as an example, the overall feature maps for the deep convolutional layers of YOLOv5s, YOLOv7 tiny, and YOLOv8s were compared against that of the proposed model, with the results shown in
Figure 14. It can be seen that the feature maps of YOLOv5s, YOLOv7 tiny, and YOLOv8s each include six highlighted areas, while that of G-YOLO-NK has eight highlighted areas. Each highlight corresponds to a passion fruit in the original image. This indicates that the G-YOLO-NK model has superior feature extraction ability and more accurate prediction ability.