High-precision purple spot soybean detection method based on improved YOLOv8-ECCI algorithm
By improving the YOLOv8-ECCI algorithm, the problems of small sample overfitting, spectral interference, and occlusion-induced missed detection in soybean grain disease detection have been solved, achieving higher detection accuracy and recall, especially performing well under complex conditions.
Patent Information
- Application Number
- CN202510910670.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-02
- Publication Date
- 2025-11-25
AI Technical Summary
Existing technologies for detecting soybean diseases suffer from problems such as overfitting in small samples, interference from complex spectra, and missed detection due to dense occlusion, especially in laboratory settings where the detection effect on stacked soybean samples is poor.
An improved YOLOv8-ECCI algorithm was adopted, and the model was optimized to improve detection performance by introducing the C2f_DCVv3 module, EIEStem module, CARAFE module and Wise-IoU loss function.
It improved the accuracy and recall of soybean disease detection, enhanced the model's detection performance on small sample sets and under complex spectral conditions, and demonstrated good generalization ability.
Smart Images

Figure CN121010972A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of soybean detection, specifically involving a high-precision method for detecting purple-spotted soybeans using an improved YOLOv8-ECCI algorithm. Background Technology
[0002] As a globally important food crop, soybean disease detection is crucial for ensuring food security and agricultural production. Currently, patents related to soybean disease identification mainly focus on leaf lesion detection. For example, the ResNet50V2 model achieved a training accuracy of 97% and a validation accuracy of 96% in soybean leaf disease classification tasks; the VGG16 and VGG19 algorithms achieved accuracies of 99% and 98%, respectively, in soybean disease image classification. Models combining federated learning and CNNs demonstrate high accuracy in classifying soybean leaf diseases, averaging around 93%, while also exhibiting good generalization ability and robustness. Some patents employ methods such as Gray-Level Co-occurrence Matrix (GLCM) to extract image texture features and combine them with Whale Optimization (WOA) algorithms to optimize and classify these features, improving the model's classification accuracy, sensitivity, and specificity. Other patents also focus on analyzing and classifying the severity of diseases, providing more targeted solutions for precision agriculture and disease management. In addition, patents based on the YOLO algorithm have also made progress. For example, the YOLOv5 algorithm is used to detect soybean leaf diseases. By improving the YOLOv5 model, high-precision identification of soybean leaf diseases has been achieved.
[0003] However, there is currently a lack of patents specifically for detecting diseases in soybean grains, and related reports and reference patents are scarce. In particular, the detection of diseases in stacked soybean samples under laboratory conditions still faces the following core challenges: Risk of overfitting with small samples: Labeled data on soybean diseases are scarce, while traditional models (such as Faster R-CNN) rely on large-scale datasets and are prone to overfitting with a small number of samples.
[0004] Complex spectral interference: Stacking of beans leads to uneven light reflection and mixed colors between lesions and healthy areas, making traditional spectral analysis methods insufficiently robust.
[0005] Missed detection due to dense occlusion: In the scenario of stacked beans, the proportion of diseased areas is high. Existing models have limited ability to capture local features, and patents report that the missed detection rate in dense scenarios exceeds 30%. Summary of the Invention
[0006] The purpose of this invention is to propose a high-precision method for detecting purple-spotted soybeans using an improved YOLOv8-ECCI algorithm, in order to solve one or more technical problems existing in the prior art, and at least provide a beneficial option or create conditions.
[0007] To address the problems of model overfitting, missed detection, and low detection accuracy in current soybean disease detection methods, this patent proposes a high-precision soybean disease detection method based on YOLOv8. The method is optimized and improved in the following four aspects to achieve higher detection performance and lower computational cost.
[0008] First, to address the overfitting problem, DCNv3 convolution in the C2f_DCVv3 module is introduced to effectively handle deformed targets in the image and extract the required features more accurately. Meanwhile, the structural design of the Bottleneck module helps to alleviate the gradient explosion problem and fully preserve feature information, thereby improving the model's recognition performance and efficiency for soybeans with purple spot disease.
[0009] Secondly, to enhance the avoidance of missed detections, the EIEStem module is introduced to capture rich information in the image. Its core Sobel operator has a certain suppression effect on noise and can effectively reduce noise interference caused by uneven lighting or surface texture.
[0010] Then, to improve the model's detection accuracy, the upper and lower patent information is aggregated within a large receptive domain. The large receptive field of the CARAFE module enables the aggregation of more upper and lower patent information, better capturing subtle disease features on soybeans and improving recognition accuracy. Its lightweight design ensures the model's high efficiency, facilitating the processing of large-scale soybean image data. Content-aware processing capabilities allow the upsampling kernel to be dynamically generated based on the specific characteristics of soybeans, further improving recognition accuracy.
[0011] Finally, to improve the bounding box regression performance of the network model, the Wise-IoU loss function was introduced, which helps the model to more accurately identify soybeans with purple blotch when soybeans are dense and similar in color, thus improving the detection accuracy and the robustness of the model.
[0012] A high-precision method for detecting purple-spotted soybeans using an improved YOLOv8-ECCI algorithm, the method comprising the following steps: Step 1: Data collection, which includes data collection and data annotation. Data collection involves collecting or creating an image dataset containing the target object. Data annotation involves using the annotation tool LabelImg to annotate the images in the dataset. Step 2: Data preprocessing. Perform necessary preprocessing on the images, including adjusting image size and normalizing pixel values, to ensure that they meet the input requirements of the YOLOv8-ECCI model. Step 3: Environment deployment, configure YOLOv8-ECCI parameters, including the number of categories and anchor box size; Step 4: YOLOv8-ECCI model training.
[0013] Furthermore, the data collection involves acquiring a soybean population image dataset based on a target object, which is soybeans, and ensuring that the dataset is diverse, including different angles, lighting conditions, and backgrounds. The data preprocessing also includes data partitioning and data augmentation; Data partitioning: Divide the dataset into training set, validation set, and test set; Data augmentation: To improve the generalization ability of the model, data augmentation can be performed on the training set, including random cropping, rotation, flipping, and color transformation.
[0014] Furthermore, in the training of the YOLOv8-ECCI model, the EIEStem module performs initial feature extraction and edge enhancement on the soybean population image dataset: the initial feature extraction and edge enhancement takes the soybean population image dataset as input, and through Sobel edge detection, the input soybean population image dataset is passed through a zero-fill layer and a max pooling layer, and outputs a multi-channel feature map that integrates lesion edge information and basic spatial features.
[0015] Furthermore, the multi-channel feature map that integrates lesion edge information and basic spatial features is input into a deformable convolutional network. The deformable convolutional network includes the core DCNv3 convolutional layer of the C2f-DCNv3 module. The DCNv3 convolutional layer includes data on the diverse morphology, location, and size of soybean purple spot lesions on soybean grains. This diverse morphology, location, and size data of soybean purple spot lesions on soybean grains is difficult to adapt to such complex geometric deformation data. The deformable convolutional network learns to predict a set of dynamic offsets. Based on the predicted offsets, the convolutional kernels perform irregular, content-adaptive sampling on the feature map. This allows the model to flexibly focus on lesion regions, regardless of their irregular shape or changing position, thereby extracting the deep semantic features of lesions more accurately. The inductive bias of the convolutional layers in DCNv3 makes it more efficient when training data is limited. The output data of the DCNv3 convolutional layer is input into the C2f structure, which contains several Bottleneck-j modules. The Bottleneck-j modules are divided into two types: Bottleneck-1 modules and Bottleneck-2 modules. The Bottleneck-1 module optimizes the backbone information flow by introducing residual connections, alleviates the gradient explosion or vanishing problem, and ensures stable training of deep networks. The Bottleneck-2 module uses a serial connection for feature transfer and fusion, retaining and fusing feature information from different levels or paths; By outputting a set of deep feature maps in the C2f module, which contain semantic information about soybean lesions, the geometric deformation and scale changes of the lesions are adapted through the DCNv3 and C2f structures.
[0016] Furthermore, the deep feature map is input into the CARAFE module, where features from the shallow and deep layers of the backbone network are fused to detect lesions of different sizes. The deep feature map is upsampled, and the CARAFE module performs the following tasks: Content-aware kernel prediction dynamically predicts an upsampling kernel based on the local semantic content of the input deep feature map; The CARAFE module utilizes a large receptive field to generate an upsampling kernel and perform weighted aggregation, aggregating relevant contextual information of tiny lesions in densely stacked beans, thereby increasing the probability of identifying tiny lesions in densely stacked beans or vague lesions that can only be identified by combining information from the surrounding area. The CARAFE module is designed with a lightweight approach and outputs feature maps after upsampling.
[0017] Furthermore, the multi-scale feature map, after being upsampled by the CARAFE module, is input into the target detection head, which then performs bounding box prediction: the target detection head slides on the fused feature map to predict whether a bean exists at each potential location, the type of bean, and the location of the bean's bounding box. Outlier assessment: A dynamic term is introduced to calculate the outlier of each predicted box based on the ratio β of the anchor box loss to the average loss. The outlier is a measure of the degree to which a box is a low-quality outlier. Dynamic non-monotonic focusing: A dynamic focusing coefficient r is constructed using outlier. This coefficient automatically reduces the loss weight of low-quality outlier samples without over-penalizing high-quality samples, allowing the model to focus more on learning the majority of samples with average quality. The final output of the detection results includes the location, category label, and confidence score of each identified bean in the image.
[0018] The beneficial effects of this invention are as follows: Compared with the YOLOv8n baseline model, the improved YOLOv8-ECCI model achieves a 3.0% improvement in precision, a 3.6% improvement in recall, and a 1.5% and 0.7% improvement in mean precision (mAP@0.5) and mean precision (mAP@0.5~0.95), respectively. In the model generalization test, the improved model shows improvements of 6.0%, 2.9%, and 2.1% in precision, mean precision (mAP@0.5), and mean precision (mAP@0.5~0.95), respectively, compared with the baseline model. The results indicate that the YOLOv8-ECCI model proposed in this patent outperforms other current comparative target detection algorithms and can effectively improve the accuracy of detecting purple spot disease in soybeans at the grain level. Attached Figure Description
[0019] The above and other features of the present invention will become more apparent from the detailed description of the embodiments shown in conjunction with the accompanying drawings. In the accompanying drawings, the same reference numerals denote the same or similar elements. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without any creative effort. In the drawings: Figure 1 The image shown is an edge detection map of the Sobel operator for a high-precision method for detecting purple-spotted soybeans using an improved YOLOv8-ECCI algorithm. Figure 2 The diagram shown is a DCNv3 structure diagram of a high-precision detection method for purple-spotted soybeans based on an improved YOLOv8-ECCI algorithm. Figure 3 The diagram shows a deformable convolution kernel for a high-precision detection method for purple-spotted soybeans using an improved YOLOv8-ECCI algorithm. Figure 4 The diagram shows the structure of C2f-DCNv3, a high-precision detection method for purple-spotted soybeans based on the improved YOLOv8-ECCI algorithm. Figure 5 The figure shown is a confidence score line graph of a high-precision detection method for purple-spotted soybeans using an improved YOLOv8-ECCI algorithm. Figure 6 The figure shows a confidence score line graph of a high-precision method for detecting purple-spotted soybeans using an improved YOLOv8-ECCI algorithm, compared to YOLOv8n data. Detailed Implementation
[0020] The following will provide a clear and complete description of the concept, specific structure, and technical effects of the present invention in conjunction with the embodiments and accompanying drawings, so as to fully understand the purpose, solution, and effects of the present invention. It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other.
[0021] Preferably, in the YOLOv8-ECCI model training, the EIEStem module performs initial feature extraction and edge enhancement on the soybean population image dataset: the initial feature extraction and edge enhancement are performed by inputting the soybean population image dataset, such as... Figure 1 As shown, Sobel edge detection passes the input soybean population image dataset through a zero-fill layer and a max-pooling layer, outputting a multi-channel feature map that integrates lesion edge information and basic spatial features.
[0022] Based on the YOLOv8n model, the two traditional Conv modules are replaced with EIEStem modules. By concatenating the output of the SobelConv layer with the output of another sequence consisting of zero-filling layers and max-pooling layers in the channel dimension, a more complex feature representation is constructed, which integrates rich edge information and spatial information, thereby improving the accuracy of identifying purple-spotted beans and healthy beans. Furthermore, the multi-channel feature map that integrates lesion edge information and basic spatial features is input into a deformable convolutional network. The deformable convolutional network includes the core DCNv3 convolutional layer of the C2f-DCNv3 module. The DCNv3 convolutional layer includes data on the diverse morphology, location, and size of soybean purple spot lesions on soybean grains. This diverse morphology, location, and size data of soybean purple spot lesions on soybean grains is difficult to adapt to such complex geometric deformation data. Adding DCNv3 convolutional layers effectively handles deformable targets in images, improving the model's adaptability to complex target shape and scale variations. The CARAFE upsampling detection algorithm reduces model parameters and floating-point computations while improving model accuracy. The DCNv3 convolutional layers process deformable targets in images such as... Figure 2 As shown, the input information is calculated in the DCNv3 convolutional layer based on the offset (x, y) of the bean and the weighting coefficient (Δm). The Deformable convolution v3 is a DCNv3 convolutional layer, and the output is output. The comparison between the conv and the DCNv3 convolutional layer is as follows: Figure 3 As shown.
[0023] The deformable convolutional network learns to predict a set of dynamic offsets. Based on the predicted offsets, the convolutional kernels perform irregular, content-adaptive sampling on the feature map. This allows the model to flexibly focus on lesion regions, regardless of their irregular shape or changing position, thereby extracting the deep semantic features of lesions more accurately. The inductive bias of the convolutional layers in DCNv3 makes it more efficient when training data is limited. The output data of the DCNv3 convolutional layer is input into the C2f structure, which contains several Bottleneck-j modules. The Bottleneck-j modules are divided into two types: Bottleneck-1 modules and Bottleneck-2 modules. The Bottleneck-1 module optimizes the backbone information flow by introducing residual connections, alleviates the gradient explosion or vanishing problem, and ensures stable training of deep networks. The Bottleneck-2 module uses a serial connection for feature transfer and fusion, retaining and fusing feature information from different levels or paths; By outputting a set of deep feature maps in the C2f module, which contain semantic information about soybean lesions, and adapting to geometric deformation and scale changes of the lesions through the DCNv3 and C2f structures, the structure of the C2f-DCNv3 is as follows: Figure 5 As shown.
[0024] Furthermore, the deep feature map is input into the CARAFE module, where features from the shallow and deep layers of the backbone network are fused to detect lesions of different sizes. The deep feature map is upsampled, and the CARAFE module performs the following tasks: Content-aware kernel prediction dynamically predicts an upsampling kernel based on the local semantic content of the input deep feature map; The CARAFE module utilizes a large receptive field to generate an upsampling kernel and perform weighted aggregation, aggregating relevant contextual information of tiny lesions in densely stacked beans, thereby increasing the probability of identifying tiny lesions in densely stacked beans or vague lesions that can only be identified by combining information from the surrounding area. The CARAFE module is designed with a lightweight approach and outputs feature maps after upsampling.
[0025] Furthermore, the multi-scale feature map, after being upsampled by the CARAFE module, is input into the target detection head, which then performs bounding box prediction: the target detection head slides on the fused feature map to predict whether a bean exists at each potential location, the type of bean, and the location of the bean's bounding box. Outlier assessment: A dynamic term is introduced to calculate the outlier of each predicted box based on the ratio β of the anchor box loss to the average loss. The outlier is a measure of the degree to which a box is a low-quality outlier. Dynamic non-monotonic focusing: A dynamic focusing coefficient r is constructed using outlier. This coefficient automatically reduces the loss weight of low-quality outlier samples without over-penalizing high-quality samples, allowing the model to focus more on learning the majority of samples with average quality. The final output of the detection results includes the location, category label, and confidence score of each identified bean in the image.
[0026] Adding DCN (Variable Convolutional Network) effectively handles deformable targets in images, improving the model's adaptability to complex target shape and scale variations. The CARAFE upsampling detection algorithm reduces model parameters and floating-point computations while improving accuracy. Introducing the Wise-IoU loss function effectively solves the gradient vanishing problem, improving the network model's bounding box regression performance and further enhancing target detection performance in complex scenes. Experimental results show that the improved YOLOv8-ECCI model not only performs admirably in accuracy and recall but also exhibits excellent generalization ability, especially in handling challenges such as small sample sets, diverse spectral features, and soybean occlusion, meeting expectations. Comparative analysis of the experimental results leads to the following conclusions: Under the same experimental conditions, the improved YOLOv8-ECCI, compared with models such as YOLOv5, YOLOv7, YOLOv7-tiny, YOLOv8s, and YOLOv8n, achieved superior experimental results on the soybean disease dataset. Compared with the original YOLOv8n baseline network model, the accuracy, mAP@0.5, and mAP@0.5~0.95 were improved by 3.0, 1.5, and 0.7 percentage points, respectively, while the number of parameters decreased slightly by 1 percentage point. The improved model's accuracy and other metrics are superior to the comparison algorithms, while the number of model parameters and model size are the lowest, providing methodological support for rapid detection of soybean diseases. Specific data are as follows: Figure 5 and Figure 6 As shown.
[0027] To verify the detection performance of the improved YOLOv8-ECCI network model, this patent uses publicly available datasets for visual comparative analysis. The results show that the improved YOLOv8-ECCI consistently outperforms the original YOLOv8n, demonstrating superior performance in handling occlusion, spectral diversity, and the recognition of densely packed small objects, providing a reference for further identification of more complex disease scenarios.
[0028] The main contribution of this patent lies in constructing the first disease detection dataset for densely stacked soybean grains, filling a gap in the field. It proposes an organic combination of edge detection based on YOLOv8 and dynamic offset adjustment convolution operations, coupled with a large field-of-view upsampling operator and high-performance regression bounding boxes, providing a feasible reference for small-sample agricultural detection methods. Currently, the model established by this patent has only achieved relatively ideal results in the soybean purple blotch disease identification task. However, soybean diseases are diverse, and the model does not consider interference from foreign objects during the identification process, nor does it address the overfitting problem caused by the large variety of diseases. Future patent work will enrich the soybean disease sample and supplement sample information that may contain foreign objects, enabling further identification and real-time detection.
[0029] Although the invention has been described in considerable detail and particularly with regard to several of the described embodiments, it is not intended to limit itself to any of these details or embodiments or any particular embodiment, thereby effectively covering the intended scope of the invention. Furthermore, the invention has been described above with respect to embodiments foreseeable by the inventors in order to provide a useful description, and non-substantial modifications to the invention that have not yet been foreseen may still represent equivalent modifications.
Claims
1. A high-precision method for detecting purple-spotted soybeans using an improved YOLOv8-ECCI algorithm, characterized in that, The method includes the following steps: Step 1: Data collection, which includes data collection and data annotation. Data collection involves collecting or creating an image dataset containing the target object. Data annotation involves using the annotation tool LabelImg to annotate the images in the dataset. Step 2: Data preprocessing. Perform necessary preprocessing on the images, including adjusting image size and normalizing pixel values, to ensure that they meet the input requirements of the YOLOv8-ECCI model. Step 3: Environment deployment, configure YOLOv8-ECCI parameters, including the number of categories and anchor box size; Step 4: YOLOv8-ECCI model training.
2. The high-precision method for detecting purple-spotted soybeans using the improved YOLOv8-ECCI algorithm according to claim 1, characterized in that, The data collection involves acquiring a soybean population image dataset based on a target object, which is soybeans, and ensuring that the dataset is diverse, including different angles, lighting conditions, and backgrounds. The data preprocessing also includes data partitioning and data augmentation; Data partitioning: Divide the dataset into training set, validation set, and test set; Data augmentation: To improve the generalization ability of the model, data augmentation can be performed on the training set, including random cropping, rotation, flipping, and color transformation.
3. The high-precision method for detecting purple-spotted soybeans using the improved YOLOv8-ECCI algorithm according to claim 1, characterized in that, In the training of the YOLOv8-ECCI model, the EIEStem module performs initial feature extraction and edge enhancement on the soybean population image dataset: the initial feature extraction and edge enhancement takes the soybean population image dataset as input, and through Sobel edge detection, the input soybean population image dataset is passed through a zero-fill layer and a max pooling layer, and outputs a multi-channel feature map that integrates lesion edge information and basic spatial features.
4. The high-precision method for detecting purple-spotted soybeans using the improved YOLOv8-ECCI algorithm according to claim 3, characterized in that, The multi-channel feature map, which integrates lesion edge information and basic spatial features, is input into a deformable convolutional network. The deformable convolutional network includes the core DCNv3 convolutional layer of the C2f-DCNv3 module. The DCNv3 convolutional layer includes data on the diverse morphology, location, and size of soybean purple spot lesions on soybean grains. This diverse morphology, location, and size data of soybean purple spot lesions on soybean grains is difficult to adapt to such complex geometric deformation data. The deformable convolutional network learns to predict a set of dynamic offsets. Based on the predicted offsets, the convolutional kernels perform irregular, content-adaptive sampling on the feature map. This allows the model to flexibly focus on lesion regions, regardless of their irregular shape or changing position, thereby extracting the deep semantic features of lesions more accurately. The inductive bias of the convolutional layers in DCNv3 makes it more efficient when training data is limited. The output data of the DCNv3 convolutional layer is input into the C2f structure, which contains several Bottleneck-j modules. The Bottleneck-j modules are divided into two types: Bottleneck-1 modules and Bottleneck-2 modules. The Bottleneck-1 module optimizes the backbone information flow by introducing residual connections, alleviates the gradient explosion or vanishing problem, and ensures stable training of deep networks. The Bottleneck-2 module uses a serial connection for feature transfer and fusion, retaining and fusing feature information from different levels or paths; By outputting a set of deep feature maps in the C2f module, which contain semantic information about soybean lesions, the geometric deformation and scale changes of the lesions are adapted through the DCNv3 and C2f structures.
5. A high-precision method for detecting purple-spotted soybeans using an improved YOLOv8-ECCI algorithm according to claim 4, characterized in that, The deep feature map is input into the CARAFE module, which fuses features from the shallow and deep layers of the backbone network to detect lesions of different sizes. The deep feature map is upsampled, and the CARAFE module performs the following tasks: Content-aware kernel prediction dynamically predicts an upsampling kernel based on the local semantic content of the input deep feature map; The CARAFE module utilizes a large receptive field to generate an upsampling kernel and perform weighted aggregation, aggregating relevant contextual information of tiny lesions in densely stacked beans, thereby increasing the probability of identifying tiny lesions in densely stacked beans or vague lesions that can only be identified by combining information from the surrounding area. The CARAFE module is designed with a lightweight approach and outputs feature maps after upsampling.
6. A high-precision method for detecting purple-spotted soybeans using an improved YOLOv8-ECCI algorithm according to claim 5, characterized in that, After upsampling by the CARAFE module, the fused multi-scale feature map is input into the target detection head, which then performs bounding box prediction: the target detection head slides on the fused feature map to predict whether a bean exists at each potential location, the type of bean, and the location of the bean's bounding box. Outlier assessment: A dynamic term is introduced to calculate the outlier of each predicted box based on the ratio β of the anchor box loss to the average loss. The outlier is a measure of the degree to which a box is a low-quality outlier. Dynamic non-monotonic focusing: A dynamic focusing coefficient r is constructed using outlier. This coefficient automatically reduces the loss weight of low-quality outlier samples without over-penalizing high-quality samples, allowing the model to focus more on learning the majority of samples with average quality. The final output of the detection results includes the location, category label, and confidence score of each identified bean in the image.