Abstract:
Accurate grading of flower shape and diameter is often required to determine the quality of hydrangea cut flowers. Currently, the prevailing manual grading has suffered from low efficiency and human subjectivity. Furthermore, conventional visual detection models cannot fully meet the requirements of the complex spherical cluster morphology and densely packed petals of hydrangeas in feature extraction. It is also challenging for standard algorithms to concurrently balance accurate morphological recognition, diameter measurement, and lightweight deployment. In this study, highly efficient and precise grading was proposed using the improved YOLOv8n-DSG target detection. Systematic structural optimizations were implemented on the baseline YOLOv8n architecture from three aspects. (1) The depthwise separable convolution (DWConv) was introduced to replace partial standard convolutions within the backbone network. The DWConv explicitly decoupled spatial and channel-wise convolution, thereby reducing the parameter volume and computational cost of the network for feature representation. (2) The squeeze-and-excitation (SE) channel attention mechanism was incorporated into the feature extraction network. Channel-wise feature responses were adaptively recalibrated using global information. SE module significantly enhanced the model’s sensitivity to critical structural features of complex flower contours, effectively suppressing irrelevant background interference. (3) Standard convolution in the Bottleneck structure of the C2f module was substituted with the Ghost convolution (GhostConv) module. A cost-effective linear method was employed to generate abundant feature maps. GhostConv fully exploited the redundancy within neural networks, which further compressed the model volume without sacrificing detection accuracy. Experimental results indicated that the customized YOLOv8n-DSG model achieved an optimal balance between detection efficacy and model complexity. On the dataset, the best performance was achieved with a precision of 96.6%, a recall of 96.7%, and a mean average precision (mAP
0.5) of 98.9%. The overall parameters, model weights size, and computational complexity (FLOPs) were substantially minimized to 2.16 M, 4.6 MB, and 6.1 G, respectively, in the integrated lightweight modules. Evaluations demonstrated that the precision of the model was improved by 3.7, 2.9, 2.3, and 3.1 percentage points, respectively, compared with the conventional YOLOv3, YOLOv5n, YOLOv8n, and YOLOv11n models. The mAP
0.5 metric experienced increases of 1.2, 1.0, 0.5, and 1.1 percentage points, respectively. An inference speed of 30.1 FPS was achieved with TensorRT acceleration on the Jetson Orin Nano platform. Furthermore, the practical feasibility of the algorithm was verified in agricultural scenarios. A validation test was conducted using 40 fresh samples of hydrangea cut flowers. The absolute error was within ±1.0 cm between the model-predicted flower diameter and the manual measurement value. Concurrently, the shape recognition and the overall grading accuracy achieved 90% and 95%, fully meeting the requirements of actual grading. Effective grading of hydrangea cut flowers was realized to provide a highly reliable algorithm and technical support for the grading equipment.