Lemon maturity and quality double-index detection method and system based on YOLOv8-CGD

By improving the YOLOv8-CGD model, combining data expansion and specific network modules, the accuracy of lemon maturity and quality detection is solved, and efficient and accurate detection is achieved in complex environments, and suitable for automated picking.

CN120599601APending Publication Date: 2025-09-05FUJIAN ACADEMY OF AGRI SCI SUBTROPICAL AGRI RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510659628.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-21
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

The prior art is difficult to accurately detect the maturity and quality of lemons at the same time, and lacks large-scale data sets, making it difficult to meet the needs of real agricultural scenarios.

Method used

Using the improved YOLOv8-CGD model, through data expansion and image enhancement, combined with the ConvNeXt V2 module, GatherExcite attention mechanism and DIoU loss function, a double-index detection model of lemon maturity and quality is constructed to achieve accurate detection of lemon maturity and quality.

Benefits of technology

It significantly improves the accuracy and generalization ability of lemon maturity and quality detection, can effectively deal with the impact of occlusion, multi-objective and lighting in complex scenarios, reduces false detection and missed detection, and is suitable for automated picking robots.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120599601A_ABST
    Figure CN120599601A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of lemon maturity and quality detection, and particularly discloses a lemon maturity and quality double-index detection method and system based on YOLOv8-CGD. The method comprises the following steps: acquiring a lemon image to be detected; and based on the YOLOv8 model, maturity and quality condition identification is carried out on the to-be-detected lemon image, and a detection result is obtained. According to the scheme of the invention, ConvNeXtV2 is used as a trunk feature extraction network, a GatherExcite attention mechanism module is inserted, and DIOU is introduced as a boundary regression loss function, so that the operation speed, feature extraction capability and detection precision of the model in a complex field environment are effectively improved; accurate and reliable technical support is provided for lemon maturity and quality detection, technical guarantee is provided for efficient and accurate picking of an automatic picking robot, and the method has important application value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of lemon maturity and quality detection, and in particular to a lemon maturity and quality dual-index detection method and system based on YOLOv8-CGD. Background Art

[0002] lemon( C Citrus limon (L.Burm) is a small evergreen tree in the genus Citrus in the Rutaceae family. It is prized for its tart flavor and unique, refreshing aroma, making it a common ingredient in cooking, seasoning, and beverage preparation. Lemons are rich in vitamin C, citric acid, and high in potassium, all of which provide important benefits to human health. Lemons also possess certain medicinal properties. Lemons are a widely cultivated subtropical fruit, but picking is the most time-consuming and labor-intensive task in lemon production. Traditional manual picking can no longer meet the basic needs of the lemon industry, and the development of automated picking robot technology is urgently needed. Accurately determining the maturity and quality of fruit is a fundamental and critical technology for automated picking robots to achieve efficient and precise operations.

[0003] Traditional automated harvesting systems rely on simple color and size recognition to determine fruit maturity and quality. For example, Yamamoto et al. proposed an algorithm based on color threshold segmentation to separate strawberry targets. Hayashi et al. designed a strawberry harvesting robot that also used a color threshold segmentation algorithm for strawberry detection and maturity estimation. Kaur et al. used external quality features such as color, texture, and size to detect the maturity of plums.

[0004] Deep learning technology can effectively extract deep features from images by automatically learning the inherent connections and patterns within annotated datasets. This is particularly true for object detection and classification in complex scenes, demonstrating high accuracy and rapid recognition. In recent years, deep learning technology has been applied to various agricultural research projects, and fruit maturity detection in complex scenes has also seen rapid development. Among existing technologies, Li Guojin et al. proposed an improved lemon detection method (Lemon-YOLO) with an average accuracy of 96.28% and a detection speed of 106 FPS. Kazama et al. used an improved YOLOv8 model to detect and classify coffee fruit maturity, achieving an average accuracy of 74.20% at a confidence threshold of 0.50. Xu Tingting et al. proposed a dual-metric method for detecting dragon fruit quality and maturity, achieving an accuracy of 97.4% and a FSP of 74 f / s.

[0005] At present, although fruit maturity detection methods based on deep learning have made rapid progress, there are few studies that can simultaneously detect multiple performance indicators of fruits. In addition, the detection methods in existing technologies lack large-scale data sets, which makes it difficult to meet the needs of real agricultural scenarios and has limitations in practical applications.

[0006] To this end, this application provides a lemon maturity and quality dual-index detection method and system based on YOLOv8-CGD to solve the above problems. Summary of the Invention

[0007] The purpose of the present invention is to solve the technical problems raised in the above-mentioned background technology and provide a dual-index detection method and system for lemon maturity and quality based on YOLOv8-CGD. The detection method and system of the present invention provide accurate and reliable technical support for the detection of lemon maturity and quality, and also provide technical guarantee for automated picking robots to achieve efficient and accurate picking, and have important application value.

[0008] The above-mentioned purpose of the present invention is achieved like this:

[0009] The present invention provides a method for detecting lemon maturity and quality based on YOLOv8-CGD, comprising the following steps:

[0010] S1. Collect lemon images to be tested as a data set;

[0011] S2, perform data expansion and image enhancement on the dataset;

[0012] S3. Classify and label the expanded data set based on the growth and development of lemons, fruit color changes, and health conditions;

[0013] S4. Divide the labeled data set into training set and test set;

[0014] S5. Build a lemon maturity and quality dual-index detection model, i.e., a YOLOv8-CGD network model, which includes four parts: an input end, a backbone network module, a neck network module, and a detection head module. The backbone network module, the neck network module, and the detection head module are connected in sequence.

[0015] S6, feature fusion: input the lemon image into the backbone network through the input end to obtain middle layer, middle lower layer and bottom layer features; and input the middle layer, middle lower layer and bottom layer features into the neck network module for centralized fusion to obtain fused features;

[0016] S7, inputting the fused features into the detection head module to obtain a prediction result;

[0017] S8. Training the lemon maturity and quality dual-index detection model based on the prediction result, the loss function, and the training set;

[0018] S9. Input the lemon image into the trained lemon maturity and quality dual-index detection model to obtain the location, category, and confidence information of the lemon, thereby realizing lemon maturity and quality dual-index detection.

[0019] Furthermore, the annotation in step S3 is to label the maturity and quality of the lemons in the dataset, including 6 grades.

[0020] Furthermore, before labeling the data set in step S3, the data set is also preprocessed, including denoising the lemon image and uniformly processing the denoised lemon image to obtain a preprocessed data set.

[0021] Furthermore, the YOLOv8-CGD network model is:

[0022] The C2f modules in the 5th and 7th layers of Backbone in the YOLOv8 model are replaced with ConvNeXt V2 modules, the GatherExcite attention mechanism is added to the SPPF layer, and the DIoU loss function is used to replace the original CIoU loss function.

[0023] Furthermore, the ConvNeXtV2 module consists of a sparse convolutional ConvNeXt encoder and a lightweight ConvNeXt decoder; the encoder uses sparse convolution to process input containing only the visible part and allows the model to use the remaining context information to predict the missing part;

[0024] The GRN layer is introduced into the convolutional network to enhance feature competition between channels.

[0025] Furthermore, the image enhancement in step S2 includes performing random combination processing of mirror flipping, brightness adjustment, Gaussian blurring, contrast adjustment, and random translation on the lemon image.

[0026] Furthermore, the GatherExcite attention mechanism is an attention mechanism that adopts an incentive mechanism and consists of two core components: aggregation and excitation.

[0027] On the other hand, the solution of the present invention also provides a lemon maturity and quality dual-index detection system based on YOLOv8-CGD, the system comprising:

[0028] An image acquisition module, used to obtain image data of lemons;

[0029] Feature extraction module, which extracts key features from image data through the YOLOv8-CGD network model;

[0030] Maturity assessment module, which assesses the maturity of lemons based on the extracted features;

[0031] The quality analysis module further analyzes and evaluates the quality of lemons based on the extracted features.

[0032] Compared with the prior art, the present invention has the following beneficial effects:

[0033] 1. In the method of the present invention, by classifying and labeling the maturity and quality of lemon fruits, it is convenient to establish a detailed lemon fruit image dataset, thereby ensuring the detection accuracy of subsequent lemon maturity and quality dual index detection;

[0034] 2. In the solution of the present invention, the YOLOv8-CGD network model is innovatively designed as a dual-index detection model for lemon maturity and quality. By improving the C2f module of the backbone network of the YOLO v8 model to a ConvNeXt V2 module, the expressiveness and generalization ability of the detection model are significantly improved, thereby significantly improving the detection accuracy of adjacent fruits and occluded fruits.

[0035] 3. In the solution of the present invention, by adding the GatherExcite attention mechanism to the SPPF layer in the innovatively designed YOLOv8-CGD network model, the recognition effect of the model is significantly enhanced.

[0036] 4. In the solution of the present invention, DIoU is used as the bounding box loss function in the innovatively designed YOLOv8-CGD network model, which can more comprehensively evaluate the bounding box matching degree compared with the existing technology model.

[0037] In summary, the method and system of the present invention can extract fine-grained features of the phenotypic shape of lemon fruits through the designed YOLOv8-CGD model to achieve accurate detection of different maturity and quality, and have good detection effects on small targets, multiple targets, branch and leaf occlusion, heavy fruit, and light influence. The method and system of the present invention can reduce common problems in agricultural production applications, significantly improve the accuracy of fruit positioning and identification, and have broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 It is the YOLOv8-CGD model network structure in the embodiment of the present invention;

[0039] Figure 2 is a fully convolutional masked autoencoder (FCMAE) framework in an embodiment of the present invention;

[0040] Figure 3 is the ConvNeXtV2 module in an embodiment of the present invention;

[0041] Figure 4 It is the GatherExcite attention structure in the embodiment of the present invention;

[0042] Figure 5 Schematic diagram of the DIoU loss function in an embodiment of the present invention;

[0043] Figure 6 This is an example diagram of model detection in an embodiment of the present invention;

[0044] Figure 7 These are lemon maturity and quality detection images of different models in the embodiments of the present invention. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0046] The implementation of the present invention is described in detail below with reference to specific embodiments.

[0047] The solution of this invention improves and innovates the YOLO v8 network and constructs a detection model called YOLOv8-CGD to achieve dual-index detection of lemon maturity and quality. The specific structure diagram is shown in Figure 1As shown in the figure, the network consists of four parts: input, backbone, neck, and detection head. The input pre-processes the input image to effectively extract features that are helpful for detection, thereby accurately identifying the dual indicators of lemon maturity and quality. The backbone network is used to extract features of the input image, thereby reducing the computational complexity of the model. It is mainly composed of a convolution module, a C2f (cross-stage partial bottleneck with two convolutions) module, and a spatial pyramid pooling module (SPPF). The neck network is composed of a combination of FPN (feature pyramid network) and PAN (path aggregation network) to perform multi-scale feature fusion. As the decision-making part of the model, the head layer is used to generate the final result. It adopts a decoupled head structure (Decoupled-Head) and an anchor-free strategy to implement image classification and detection tasks. To further improve the accuracy, recall, and other performance of the lemon ripeness and quality detection model, we proposed an improved YOLOv8-CGD network structure based on the YOLOv8 model. The C2f modules in layers 5 and 7 of the Backbone model were replaced with ConvNeXt V2 modules. The GatherExcite attention mechanism was added to the SPPF layer, and the DIoU loss function was used instead of the original CIoU loss function.

[0048] Reference Figure 1-Figure 7 The figure shows a preferred embodiment of the present invention.

[0049] Example: The solution of the embodiment of the present invention provides a lemon maturity and quality dual-index detection method based on YOLOv8-CGD, which specifically includes the following steps:

[0050] Step 1: Collect a dataset, which is lemon images.

[0051] The samples in this example were obtained from the Institute of Subtropical Agriculture, Fujian Academy of Agricultural Sciences. National Fujian and Taiwan Characteristic Works thing Germplasm Resource Garden (117°E, 24°N). The image samples collected fall into two main categories: one captures lemons still hanging on the trees, and the other captures lemons after they've been picked. The images were captured using smartphones and Sony cameras. To account for the varying number, size, and health of lemons hanging on the trees, as well as the overlapping occlusion between leaves and fruit, images of lemons with varying numbers and degrees of occlusion were taken to increase image diversity.

[0052] The collected lemon samples were quality screened to remove invalid images such as highly blurred, severely exposed, repeated images, and images without fruit.

[0053] Step 2: Perform data expansion and image enhancement on the collected lemon image dataset.

[0054] To enhance the effectiveness of network training and improve the generalization of the model, data augmentation is required for the collected data. This example uses a random combination of data augmentation methods such as mirror flipping, brightness adjustment, Gaussian blurring, contrast adjustment, and random translation to effectively expand the size of the dataset.

[0055] Step 3: Divide and label the dataset according to lemon maturity and quality indicators.

[0056] (1) Lemon maturity and quality are divided into 6 levels according to the growth and development of lemons, fruit color changes and health conditions. Level 1 is the unripe and healthy stage, characterized by bright green, firm and smooth surface of the fruit; Level 2 is the unripe and unhealthy stage, characterized by uneven green color of the fruit with blemishes or spots; Level 3 is the semi-ripe and healthy stage, characterized by yellow-green color of the fruit, beginning to soften and smooth surface; Level 4 is the semi-ripe and unhealthy stage, characterized by uneven color of the fruit, with green or yellow spots and uneven texture; Level 5 is the mature and healthy stage, characterized by bright and uniform yellow color of the fruit, soft texture and smooth surface; Level 6 is the mature and unhealthy stage, characterized by mature yellow color of the fruit with brown spots or dry areas.

[0057] (2) Use the Labeling tool to annotate the lemon image. The annotation rules are as follows: ① Use the minimum bounding rectangle of the target as the annotation box, ensuring that the target is completely within the box and the distance between the boundary and the target is small; ② Each target is annotated with an independent target box, and multiple targets are not allowed to share the same box; ③ Fruits in the image that occlude each other but do not affect manual judgment of maturity level are annotated separately. ④ Fruits that are severely occluded or blurred, making it difficult for humans to distinguish the maturity and quality level, are not annotated. The annotation results are saved in a txt file in YOLO format.

[0058] Step 4: Build a dual-index detection model for lemon maturity and quality, namely the YOLOv8-CGD model.

[0059] To further improve the accuracy, recall, and other performance of the lemon maturity and quality detection model, the YOLOv8-CGD model in this embodiment is an innovatively designed YOLOv8-CGD network structure based on the YOLOv8 model. The C2f modules on the 5th and 7th layers of Backbone are designed as ConvNeXtV2 modules, the GatherExcite attention mechanism is added to the SPPF layer, and the DIoU loss function is used to replace the original CIoU loss function.

[0060] (1) About the ConvNeXtV2 module

[0061] ConvNeXt V2 is a new convolutional neural network architecture that uses a fully convolutional masked autoencoder (FCMEA). Figure 2 As shown in the figure, it consists of a sparse convolutional ConvNeXt encoder and a lightweight ConvNeXt decoder. The encoder processes unmasked pixels, while the decoder reconstructs the image based on the encoded pixels and mask information. After pre-training, the decoder is deactivated, while the encoder continues to be used to extract features for image recognition. This not only reduces the computational cost of pre-training, but also enables the model to use the remaining contextual information to predict the missing parts, thereby improving the ability to understand visual data. In the process of lemon maturity and quality index detection, ConvNeXt V2 randomly masks parts of the lemon image. After sparse convolution processing, the masked area is predicted to capture the details of the lemon image, which improves the accuracy of the detection model in this embodiment to capture features and reduces the computational cost without sacrificing the performance of the detection model.

[0062] In order to further enhance the competitiveness between features, the above detection model of this embodiment also introduces a global response normalization (GRN) layer, such as Figure 3 As shown, this layer enhances feature contrast and selectivity through global feature aggregation, normalization, and calibration, preventing feature collapse and improving the detection model's expressiveness and generalization capabilities. In this paper, the introduction of the GRN layer helps the detection model better distinguish subtle differences in lemon maturity and quality, thereby improving its recognition accuracy.

[0063] (2) About the GatherExcite attention mechanism

[0064] GatherExcite (GE) is an attention mechanism that uses an excitation mechanism. It computes feature information for each channel of a feature map and uses this information to adjust the weights at each location in the feature map. It is a lightweight framework that enhances the use of feature context in convolutional neural networks through aggregation and excitation operators. The GE attention mechanism consists of two core components: Gather and Excite. The Gather component collects feature information from a wide range of spatial regions, while the Excite component remaps this feature information back to its original scale.

[0065] In order to make better use of contextual information, the GE attention mechanism collects feature information between different layers of the convolutional neural network and activates important features in each layer, thereby improving the performance of the network. Figure 4 As shown in Figure 1, where H, W, and C represent the height, width, and number of channels of the feature map, respectively, and ξG represents an aggregation operator that aggregates the feature responses of each spatial neighborhood. This process is achieved through one or more pooling operations, in which the convolution kernel and stride can be freely selected. The purpose of the pooling operation is to extract contextual information from the feature map and integrate this information into a feature map with a new spatial dimension (H'×W'×C). The excitation operator ξE enhances the quality of feature representation and the adaptability of the model by collecting contextual features, rescaling and distributing the signal, and producing an output that matches the input.

[0066] About the attention mechanism calculation formula:

[0067]

[0068]

[0069] Where: ⊙ represents the Hadamard product, which means the product of corresponding elements of two matrices of the same size. It represents interpolation, which means using the nearest neighbor interpolation method to adjust the pooled features to the original input size.

[0070] (3) About DIoU loss function

[0071] When the predicted box and the true box do not intersect, the direct distance between the two boxes can be optimized, which has a faster convergence speed. When the predicted box and the true box have an inclusion relationship, DIOU can still iterate quickly to improve the training effect and detection accuracy of the model. Figure 5 As shown, the DIoU loss function formula is as follows:

[0072] L DIoU =1-IOU+R(B,B gt );

[0073]

[0074]

[0075]

[0076] Among them, L DIoU Represents the value of the loss function, R(B, B gt ) is a penalty term, which is used to optimize the predicted bounding box B and the true bounding box B gt In the DIoU loss function, this penalty term is the normalized distance between the center points of the two bounding boxes. Where: b and b gt are the center point coordinates of the predicted box and the real box respectively; ρ(b, b gt ) represents the predicted box b and the real box b gt Euclidean distance between center points, ρ 2 (b,b gt ) is the square of the distance between the two center points. c 2 Is the square of the diagonal length of the minimum circumscribed rectangle of the two boxes. w, h represent the width and height of the predicted box; w gt , h gt is the width and height of the real box, and c is the diagonal length of the minimum circumscribed rectangle that can cover the two boxes.

[0077] Step 5: Model evaluation metrics.

[0078] When testing lemon fruit maturity and quality in complex natural environments, the accuracy and performance of the detection network must be considered. For model detection accuracy, precision (P), recall (R), and F1 score were used as evaluation metrics. For model detection performance, mAP50 (mean average precision, %) was selected as the evaluation metric. The formula is as follows:

[0079]

[0080]

[0081]

[0082]

[0083]

[0084] Among them, TP is the number of samples correctly classified as positive, FP is the number of samples incorrectly classified as positive, and FN is the number of samples incorrectly classified as negative.

[0085] Step 6: Experimental platform and parameter settings.

[0086] The training and testing of the model of the present invention are performed on a computer equipped with an Intel Coro i7-13700K CPU, 3.4GHz operating frequency, 32G operating memory and Windows 10 (64-bit) operating system, and is accelerated by a GeForce RTX4070Ti GPU equipped with 12G video memory. The programming language uses Python 3.8.10, the deep learning framework uses PyTorch 1.2.0, and the OpenCV version is 4.8. The initial learning rate is set to 0.001 to balance the convergence speed and learning efficiency of the model and avoid instability caused by too fast convergence. In addition, a momentum decay strategy is adopted, and its value is set to 0.937 to accelerate the learning process and avoid falling into local minima. Finally, in order to enhance the generalization ability of the model, a weight decay of 0.0005 is set, which helps to reduce the risk of overfitting.

[0087] Step 7: Ablation Experiment and Comparative experiments of different models.

[0088] (1) Ablation experiment: In order to verify the effectiveness of data augmentation, an ablation experiment was conducted based on the same dataset and experimental environment, and the YOLOv8-CGD algorithm of the present invention was compared with the initial YOLOv8 algorithm. The experimental results are shown in Table 1.

[0089] Combining the ConvNeXtV2 module, the GatherExcite attention mechanism, and the DIOU loss function achieves precision, recall, mAP50, and F1 scores of 94.40%, 92.80%, 97.20%, and 93.59%, respectively. These improvements represent 4.9%, 4.3%, 2.3%, and 4.59%, respectively, compared to the original YOLOv8 model. Ablation experiments demonstrate the effectiveness and feasibility of incorporating the ConvNeXtV2 module, the GatherExcite attention mechanism, and the DIOU loss function.

[0090] Table 2 Ablation experiment results

[0091]

[0092] Note: × indicates that the improved method is not used; √ indicates that the improved method is used.

[0093] The YOLOv8-CGD algorithm in the embodiment of the present invention can extract fine-grained features of the phenotypic shape of lemon fruits to achieve accurate detection of different maturity and quality. Figure 6 It can be seen from the figure that the algorithm can accurately detect lemons of different maturity and quality in lemon images with single target, multiple targets, branches and leaves occlusion, and heavy fruits. Figure 6 As can be seen in Figures c and d, even heavily occluded lemons can be accurately identified. In summary, the improved YOLOv8-CGD algorithm can accurately detect the ripeness and quality of lemons, and performs well in detecting small objects, multiple objects, objects obscured by branches and leaves, heavy fruit, and light effects.

[0094] (2) Comparative experiments of different models

[0095] like Figure 7 As shown in the figure, it is the detection effect of some models. The results show that the YOLOv8-CGD model is significantly better than other models in accurately identifying targets and reducing false detections and missed detections. Yolov11s, Yolov10s and Yolov9s have missed detections and false detections, and lemon leaves are identified as fruits. When applied to automated picking robot systems, it is likely that wrong grasping or empty grasping will occur, which is not conducive to actual production use. The Yolov3-tiny and Yolov9t models also have the problem of repeated detection. Repeated detection not only affects the accuracy of the model but also increases the detection time. In general, the YOLOv8-CGD model proposed in the present invention performs better in overall performance, can reduce common problems in agricultural production applications, and effectively improves the accuracy of fruit positioning and identification.

[0096] In addition, the solution of the embodiment of the present invention also provides a lemon maturity and quality dual-index detection system based on YOLOv8-CGD. The detection system is used to implement the above-mentioned detection method. The system includes an image acquisition module, a feature extraction module, a maturity assessment module, and a quality analysis module. Among them, the image acquisition module is used to obtain image data of lemons; the feature extraction module uses the YOLOv8-CGD algorithm to extract key features about the maturity and quality of lemons from the image data; the maturity assessment module assesses the maturity of lemons based on the extracted features; and the quality analysis module further analyzes the quality indicators of lemons. Based on the description of the above-mentioned detection method of the embodiment of the present invention, the system of the present invention can realize rapid and accurate detection of lemon maturity and quality, and has broad application prospects.

[0097] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A dual-index detection method for lemon maturity and quality based on YOLOv8-CGD, characterized in that: The method comprises the following steps: S1. Collect lemon images to be tested as a data set; S2, perform data expansion and image enhancement on the dataset; S3. Classify and label the expanded data set based on the growth and development of lemons, fruit color changes, and health conditions; S4. Divide the labeled data set into training set and test set; S5. Build a lemon maturity and quality dual-index detection model, i.e., a YOLOv8-CGD network model, which includes four parts: an input end, a backbone network module, a neck network module, and a detection head module. The backbone network module, the neck network module, and the detection head module are connected in sequence. S6, feature fusion: input the lemon image into the backbone network through the input end to obtain middle layer, middle lower layer and bottom layer features; and input the middle layer, middle lower layer and bottom layer features into the neck network module for centralized fusion to obtain fused features; S7, inputting the fused features into the detection head module to obtain a prediction result; S8. Training the lemon maturity and quality dual-index detection model based on the prediction result, the loss function, and the training set; S9. Input the lemon image into the trained lemon maturity and quality dual-index detection model to obtain the location, category, and confidence information of the lemon, thereby realizing lemon maturity and quality dual-index detection.

2. The lemon maturity and quality dual-index detection method based on YOLOv8-CGD according to claim 1 is characterized in that, The annotation in step S3 is to label the maturity and quality of the lemons in the dataset, including 6 grades.

3. The lemon maturity and quality dual-index detection method based on YOLOv8-CGD according to claim 1 is characterized in that, Before labeling the data set in step S3, the data set is also preprocessed, including denoising the lemon image and uniformly processing the denoised lemon image to obtain a preprocessed data set.

4. The lemon maturity and quality dual-index detection method based on YOLOv8-CGD according to claim 1 is characterized in that, The YOLOv8-CGD network model is: The C2f modules in the 5th and 7th layers of Backbone in the YOLOv8 model are replaced with ConvNeXt V2 modules, the GatherExcite attention mechanism is added to the SPPF layer, and the DIoU loss function is used to replace the original CIoU loss function.

5. The lemon maturity and quality dual-index detection method based on YOLOv8-CGD according to claim 4 is characterized in that, The ConvNeXt V2 module consists of a sparse convolutional ConvNeXt encoder and a lightweight ConvNeXt decoder; the encoder part uses sparse convolution to process input containing only the visible part and allows the model to use the remaining context information to predict the missing part; The GRN layer is introduced into the convolutional network to enhance feature competition between channels.

6. The lemon maturity and quality dual-index detection method based on YOLOv8-CGD according to claim 1 is characterized in that, The image enhancement in step S2 includes performing a random combination of mirror flipping, brightness adjustment, Gaussian blurring, contrast adjustment, and random translation on the lemon image.

7. The lemon maturity and quality dual-index detection method based on YOLOv8-CGD according to claim 4 is characterized in that, The GatherExcite attention mechanism is an attention mechanism that adopts an incentive mechanism and consists of two core components: aggregation and excitation.

8. A lemon maturity and quality dual-index detection system based on YOLOv8-CGD, characterized in that: The system comprises: An image acquisition module, used to obtain image data of lemons; Feature extraction module, which extracts key features from image data through the YOLOv8-CGD network model; Maturity assessment module, which assesses the maturity of lemons based on the extracted features; The quality analysis module further analyzes and evaluates the quality of lemons based on the extracted features.