Soybean bacterial spot disease course identification method, system, equipment and medium
Through the combination of sliding window segmentation algorithm and Swin Transformer model, the problem of insufficient data in the identification of soybean bacterial spot disease is solved, efficient and low-cost automated diagnosis is achieved, and identification accuracy and robustness are improved.
Patent Information
- Application Number
- CN202510523769.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-07-25
AI Technical Summary
The prior art has the problem of insufficient data volume in the identification of soybean bacterial spot disease, which leads to low model prediction accuracy, and the existing methods are costly and are not suitable for large-scale promotion.
The sliding window segmentation algorithm is used to obtain the local area pictures of soybean leaf images, and the leaf images of different disease course stages are screened as data sets, and the Swin Transformer model is used for training to obtain the disease course recognition model, and automated diagnosis is achieved through segmentation and classification.
It improves the accuracy and robustness of the diagnosis of soybean bacterial spot disease, reduces manual investment, realizes the automated prevention and treatment of soybean bacterial spot disease, and reduces costs.
Smart Images

Figure CN120375088A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of crop control, and particularly relates to a method, system, device and medium for identifying the course of soybean bacterial blight. Background Art
[0002] Soybean is an important food crop, the main component of livestock and poultry protein feed, and also an important industrial raw material, playing a crucial role in China's agricultural production and social and economic life. Bacterial blight harms soybean seedlings, leaves and pods, resulting in a decrease in soybean yield and quality. Therefore, accurately judging the occurrence period of soybean bacterial blight is of great significance for timely prevention and control. The identification of bacterial blight usually requires the on-site participation of experts to analyze the crops and make a diagnosis from the initial symptoms, but this method is costly and not suitable for large-scale promotion.
[0003] In recent years, computer vision technology has made great progress, and deep learning based on neural network technology has shown great potential in image classification, object detection and image segmentation. The task of object detection is to find all objects of interest in an image and determine their categories and locations. Nowadays, object detection and recognition are often based on deep learning, and the extraction and recognition of crop phenotypes are realized through models such as convolutional neural network (CNN), VGG16, Resnet50, VIT, and Swin Transformer in neural networks, which helps to improve the classification accuracy of images and shorten the training time of models. Convolutional neural networks have been widely used in crop phenotype research and crop disease identification fields due to their advantages such as low cost, high efficiency, and simple operation, and have shown good performance in crops such as soybeans, rice, and wheat. However, at present, the research on plant diseases using neural networks still stays in the stage of plant disease identification, and usually faces the problem of low model prediction accuracy due to insufficient data volume in plant disease identification and course diagnosis. Summary of the Invention
[0004] To solve the problem of disease identification of soybean bacterial blight, the present invention provides a method, system, device and medium for identifying the course of soybean bacterial blight.
[0005] To achieve the above object, the present invention provides the following technical solutions:
[0006] A method for identifying the course of soybean bacterial blight, comprising the following steps:
[0007] Obtain soybean leaf images, and use a sliding window segmentation algorithm to obtain local region pictures of the soybean leaf images as a basic segmentation data set; screen the basic segmentation data set according to the course of the disease to obtain leaf images at different disease course stages as a data set;
[0008] Train the Swin Transformer model using the data in the dataset to obtain a disease course recognition model;
[0009] Obtain and segment the soybean leaf image to be detected, and input the segmented image into the disease course recognition model to obtain the local disease course recognition result in the soybean leaf image to be detected;
[0010] Classify the local disease course recognition results to obtain the disease course recognition result of the soybean leaf to be detected.
[0011] Preferably, the local region pictures of the soybean leaf image are obtained using the sliding window segmentation algorithm as the basic segmentation dataset. Specifically, the local region pictures of a specified size are obtained through the sliding window in the python compiler using the sliding window segmentation algorithm, which specifically includes the following steps:
[0012] Use the sliding window to obtain local region pictures of the same size as the sliding window from left to right and from top to bottom in sequence;
[0013] For the cropping of the last row or the last column that does not meet the window size, obtain the local region pictures of the soybean leaf image by taking pixel rows or columns upward or leftward.
[0014] Preferably, during the model training process, the optimizer selects the Stochastic Gradient Descent (SGD) optimization algorithm to update the parameters, specifically through the following formula:
[0015]
[0016] where, is the number of iterations, α>0 is the learning rate, θ is the parameter vector, E(θ) is the loss function, and γ determines the contribution of the previous gradient step to the current iteration.
[0017] Preferably, the different disease course stages are specifically the early stage of the disease, the middle stage of the disease, the late stage of the disease, and the normal stage.
[0018] Preferably, classifying the local disease course recognition results to obtain the disease course recognition result of the soybean leaf to be detected is specifically:
[0019] If one of the prediction results of all the segmented pictures of the leaf picture to be detected is the late stage of the disease, then the leaf is in the late stage of bacterial leaf spot disease;
[0020] If at least one of the prediction results of all the segmented pictures of the leaf picture to be detected is the middle stage of the disease and does not contain the late stage of the disease, then the leaf is in the middle stage of bacterial leaf spot disease;
[0021] If at least one of the prediction results of all the segmented pictures of the leaf picture to be detected is in the early stage of the disease and does not contain the late stage and the middle stage of the disease, then the leaf is in the early stage of bacterial leaf spot disease;
[0022] If all the prediction results of all the segmented pictures of the leaf picture to be detected do not contain the early stage, the middle stage and the late stage of the disease, then the leaf is in the normal stage.
[0023] The present invention also provides a system for identifying the course of soybean bacterial leaf spot disease, specifically including:
[0024] A data module, configured to obtain soybean leaf images, and use a sliding window segmentation algorithm to obtain local region pictures of the soybean leaf images as a basic segmentation data set; screen the basic segmentation data set according to the course of the disease to obtain leaf images in different course stages as the data set.
[0025] A model training module, configured to train a Swin Transformer model using the data in the data set to obtain a course recognition model.
[0026] A local recognition module, configured to obtain and segment a soybean leaf image to be detected, and input the segmented image into the course recognition model to obtain a local course recognition result in the soybean leaf image to be detected.
[0027] A leaf course recognition result, configured to classify the local course recognition result to obtain a course recognition result of the soybean leaf to be detected.
[0028] The present invention also provides a computer device, including a memory, a processor, and a computer program stored on the memory, and the processor executes the computer program to implement the steps in the method for identifying the course of soybean bacterial leaf spot disease.
[0029] The present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is loaded by a processor, it can execute the steps in the method for identifying the course of soybean bacterial leaf spot disease.
[0030] The method for identifying the course of soybean bacterial leaf spot disease provided by the present invention has the following beneficial effects:
[0031] After obtaining the soybean leaf image, the present invention uses a sliding window to segment the soybean leaf image to obtain a local region picture dataset, so as to expand the dataset for subsequent combination with a deep learning model, screen and classify the local region picture dataset according to the disease course, and reduce the impact of insufficient data samples on the diagnosis accuracy. The data is input into the Swin Transformer model for training to obtain a disease course recognition model. According to the recognition of the model, the local disease course recognition result of the soybean leaf image is obtained, and the disease course recognition result of the soybean leaf is obtained by judging and classifying, realizing the automation of soybean bacterial leaf spot diagnosis, reducing manual input, and having important significance for the prevention and control of bacterial leaf spot. Description of the Drawings
[0032] In order to more clearly illustrate the embodiments of the present invention and its design, the accompanying drawings required for this embodiment will be briefly introduced below. The accompanying drawings in the following description are only partial embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0033] Figure 1 It is a flowchart of a method for identifying the disease course of soybean bacterial leaf spot in an embodiment of the present invention.
[0034] Figure 2 It is an example of soybean leaf changes and picture samples of bacterial leaf spot at different times in an embodiment of the present invention. Among them, Figure 2 (A) is an example of soybean leaf changes; Figure 2 (B) is a picture of the whole leaf at different disease stages; Figure 2 (C) is a picture sample after manual segmentation of the typical characteristics of the disease at different times.
[0035] Figure 3 It is a training loss graph of the training set and the validation set of the Swin Transformer model in an embodiment of the present invention.
[0036] Figure 4 It is an evaluation result graph of the Swin Transformer model for the disease dataset in an embodiment of the present invention. Among them, Figure 4 (A) is an evaluation result graph of the training set data in the disease dataset, Figure 4 (B) is an evaluation result graph of the validation set data in the disease dataset, Figure 4 (C) is an evaluation result graph of the test set data in the disease dataset, Figure 4 (D) is a confusion matrix graph of the true value and the predicted value.
[0037] Figure 5 It is a confusion matrix graph of different sliding windows and step sizes in an embodiment of the present invention.
[0038] Figure 6 is a bar chart of the model evaluation index in the embodiment of the present invention, wherein: Figure 6 (A) is a bar chart of precision. Figure 6 (B) Recall bar chart, Figure 6 (C) F1 value bar chart, Figure 6 (D) is a bar chart of accuracy.
[0039] Figure 7 This is a network diagram of the SWIN TRANSFORMER classification model in an embodiment of the present invention. Figure 7 (a) represents the overall framework of the adopted Transformaer network. Figure 7 (b) shows a schematic diagram of the connection between two consecutive Transformer modules.
[0040] Figure 8 The present invention is a flow chart of a method for identifying the course of soybean bacterial spot disease. DETAILED DESCRIPTION
[0041] In order to enable those skilled in the art to better understand the technical solution of the present invention and implement it, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the scope of protection of the present invention.
[0042] Example
[0043] The present invention provides a method for identifying the course of soybean bacterial spot disease. Figure 1 As shown, the specific steps include:
[0044] Step 1: Collect images of soybean leaves. Soybean plants were planted at the experimental base of Northeast Agricultural University in Harbin (45°36'N, 126°18'E, China), and the field design was: row spacing 2m, plant spacing 5cm, and ridge spacing 60cm. Infected leaves and normal soybean leaves were collected as a dataset.
[0045] The captured leaf images were segmented, and low-quality images such as similar, low-pixel, and blurred images were removed to obtain 200 original soybean bacterial spot disease leaf images. The leaf images at different periods were as follows: Figure 2 As shown in (B).
[0046] Step 2: The acquired image data is limited, so overfitting is likely to occur during training with a convolutional neural network. To address the adverse effects of a small sample size, the data is enhanced. The leaf images are segmented into pictures of size 230×230 using a sliding window method and divided into four-stage pictures according to normal, early, middle, and late stages, with 260 pictures in each stage, for a total of 1300 pictures as the initial dataset. The images at different times after cutting are as shown in Figure 2 as shown in (C) of
[0047] The selected image dataset is expanded based on data augmentation methods, which specifically include resizing, random cropping, deformation, rotation (by 90°, 180°, 270°), flipping (both horizontally and vertically), brightness change (including brightening and darkening), pixel translation, adding salt-and-pepper noise and Gaussian noise, blurring, and scale transformation. Finally, 15,600 datasets are obtained, and 30 whole-leaf images from each period are selected, totaling 120 images as the test set.
[0048] Dataset division: Before training, the enhanced data is divided into a training set, a validation set, and a test set in a ratio of 8:1:1. Figure 7 The selection of batch size, number of iterations, training model, and optimizer are important factors affecting model training. By comparing four classification networks, namely VGG16, ResNet50, Vision Transformer, and Swin Transformer, and two optimizers, SGD and Adam, the model with the highest classification accuracy is Swin Transformer, as shown in Figure 3 as shown. The optimal parameters are Epoch = 200, batch size = 8, and the optimizer is SGD; the second-best is Swin Transformer, with Epoch = 200, batch size = 4, and the optimizer is SGD. The F1 values of the two models differ by 0.01. Therefore, in this invention, the data in the training set is used to train the Swin Transformer model to obtain a disease course recognition model. Among them, Epoch (the number of times the entire training dataset is learned by the model once) is 200, batch size (the number of samples used each time the model weights are updated) is 4, and the optimizer is SGD as the optimal classification model. Its training loss graph is as shown in
[0049] The parameter update of the SGD optimization algorithm is:
[0050]
[0051] Where \(l\) is the number of iterations, \(\alpha>0\) is the learning rate, \(\theta\) is the parameter vector, \(E(\theta)\) is the loss function, and \(\gamma\) determines the contribution of the previous gradient step to the current iteration.
[0052] Selection of sliding window size and stride: Use Python to write a sliding segmentation algorithm to set different sliding window sizes and strides to segment 120 soybean disease leaves. The confusion matrices for different sliding windows and strides are as Figure 5 shown. It can be concluded that a sliding window size of 600×600 and a stride of 600 are the most suitable choices for the sliding window size and stride.
[0053] Step 4: Evaluate the model. Randomly select 100 groups from 200 original images using Python for testing. Evaluate the model. The specific evaluation metrics include accuracy, precision, and recall, which are calculated using the following formulas:
[0054]
[0055] where the F1 value is the harmonic mean of precision and recall, and its value ranges from 0 to 1, which is used to measure the overall performance of the model. The larger the F1 value, the better the model performance. Obtain the bar charts of Precision, Recall, F1, and Accuracy, as Figure 6 shown. It can be seen that the data for each group have achieved good results, indicating that the model has good robustness.
[0056] Step 5: Obtain the images of the soybean leaves to be detected and segment and predict. Input the images of the soybean leaves to be detected into the disease course recognition model to obtain the local disease course recognition results in the soybean leaf images.
[0057] Step 6: Classify the local disease course recognition results according to the judgment rules to obtain the disease course recognition results of the entire leaf. The judgment rules are as follows:
[0058] If at least one of the prediction results of all the segmented images of this leaf picture is predicted as the late stage of the disease, then the leaf is in the late stage of bacterial leaf spot disease.
[0059] If at least one of the prediction results of all the segmented images of this leaf picture is predicted as the middle stage of the disease and does not contain the late stage of the disease, then the leaf is in the middle stage of bacterial leaf spot disease.
[0060] If at least one of the prediction results of all the segmented images of this leaf image is predicted as the early stage of the disease, and does not contain the late stage and the middle stage of the disease, then the leaf is in the early stage of bacterial leaf spot disease.
[0061] If all the prediction results of all the segmented images of this leaf image do not contain the early stage of the disease, the middle stage of the disease and the late stage of the disease, then the leaf is in the normal stage.
[0062] The present invention solves the problem of insufficient sample data volume in detection by using a sliding segmentation algorithm, thereby improving the accuracy and robustness of the model. As Figure 4 shown, according to the analysis of the diagnostic results, it can be seen that the Precision, Recall, F1, and Accuracy values of each group are all above 90%, and the recognition accuracy rate of the test set reaches 99.64%, which is very high. At the same time, it avoids the extraction of specific features by traditional machine learning and greatly shortens the training time of the model.
[0063] The present invention also provides a system for identifying the course of soybean bacterial leaf spot disease, specifically including:
[0064] A data module, which is used to obtain soybean leaf images, and use a sliding window segmentation algorithm to obtain local area images of soybean leaf images as a basic segmentation data set; screen the basic segmentation data set according to the course of the disease to obtain leaf images in different course stages as the data set.
[0065] A model training module, which is used to train the Swin Transformer model with the data in the data set to obtain a course recognition model.
[0066] A local recognition module, which is used to obtain and segment the soybean leaf image to be detected, and input the segmented image into the course recognition model to obtain the local course recognition result of the soybean leaf image to be detected.
[0067] A leaf course recognition result, which is used to classify the local course recognition result to obtain the course recognition result of the soybean leaf to be detected.
[0068] Each module in the above-mentioned system for identifying the course of soybean bacterial leaf spot disease can be implemented in whole or in part by software, hardware and their combination. The above-mentioned modules can be embedded in the processor of the computer device in the form of hardware or independent of it, or stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
[0069] The present invention also provides a computer device, including a memory, a processor, and a computer program stored on the memory. The processor executes the computer program to implement the steps in an embodiment of a method for identifying the course of soybean bacterial blight. For the specific implementation method, reference can be made to the method embodiment, which will not be elaborated here.
[0070] Furthermore, the present invention also provides a non-transitory computer-readable storage medium containing instructions, on which a computer program is stored. For example, a memory containing instructions, and the above instructions can be executed by the processor of the computer device to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc. When the computer program is executed by the processor, it can implement the steps in an embodiment of a method for identifying the course of soybean bacterial blight. For the specific implementation method, reference can be made to the method embodiment, which will not be elaborated here.
[0071] Those skilled in the art should understand that the embodiments of the present invention can provide a method, a system, or a computer program product. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0072] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0073] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing devices to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means implements the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0074] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are executed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions for implementing the process Figure 1 in one process or a plurality of processes and / or boxes Figure 1 or steps for implementing the functions specified in one box or a plurality of boxes.
[0075] It should be noted that the above-described specific embodiments may enable those skilled in the art to more fully understand the present invention, but do not limit the present invention in any way. Therefore, although the present specification and embodiments have described the present invention in detail, those skilled in the art should understand that the present invention may still be modified or equivalently replaced; and all technical solutions and improvements that do not depart from the spirit and scope of the present invention are covered by the protection scope of the patent of the present invention. Any reference numeral in a claim should not be construed as limiting the claim concerned. Any simple variation or equivalent replacement of a technical solution that can be obviously obtained by any person skilled in the art within the technical scope disclosed by the present invention falls within the protection scope of the present invention.
Claims
1. A method for identifying the course of soybean bacterial blight, characterized in that, It includes the following steps: Obtain a soybean leaf image, and use a sliding window segmentation algorithm to obtain local region pictures of the soybean leaf image as a basic segmentation dataset; Screen the basic segmentation dataset according to the disease course to obtain leaf images at different disease course stages as the dataset; Use the data in the dataset to train a Swin Transformer model to obtain a disease course recognition model; Obtain and segment a soybean leaf image to be detected, and input the segmented image into the disease course recognition model to obtain the local disease course recognition result of the soybean leaf image to be detected; Classify the local disease course recognition result to obtain the disease course recognition result of the soybean leaf to be detected.
2. The method for identifying the course of soybean bacterial blight according to claim 1, characterized in that, The step of using the sliding window segmentation algorithm to obtain local region pictures of the soybean leaf image as a basic segmentation dataset is specifically to obtain local region pictures of a specified size through a sliding window in a python compiler by using the sliding window segmentation algorithm, and specifically includes the following steps: Use the sliding window to obtain local region pictures of the same size as the sliding window from left to right and from top to bottom in sequence; For the cropping of the last row or the last column that does not meet the window size, take the pixel row or column upward or leftward to obtain the local region picture of the soybean leaf image.
3. A method for identifying the course of soybean bacterial blight according to claim 1, characterized in that, It also includes selecting the Stochastic Gradient Descent (SGD) optimization algorithm as the optimizer to update parameters during the model training process, specifically through the following formula: where l is the number of iterations, α>0 is the learning rate, θ is the parameter vector, E(θ) is the loss function, and γ determines the contribution of the previous gradient step to the current iteration.
4. A method for identifying the course of soybean bacterial blight according to claim 1, characterized in that, The different disease course stages are specifically the early stage of the disease, the middle stage of the disease, the late stage of the disease, and the normal stage.
5. The method for identifying the course of soybean bacterial blight according to claim 4, characterized in that, The step of classifying the local disease course recognition result to obtain the disease course recognition result of the soybean leaf to be detected is specifically: If there is one prediction result of the late stage of the disease among all the prediction results of the segmented pictures of the soybean leaf picture to be detected, then the leaf is in the late stage of bacterial leaf spot disease; If there is at least one prediction result of the middle stage of the disease among all the prediction results of the segmented pictures of the soybean leaf picture to be detected and there is no late stage of the disease, then the leaf is in the middle stage of bacterial leaf spot disease; If there is at least one prediction result of the early stage of the disease among all the prediction results of the segmented pictures of the soybean leaf picture to be detected and there is no late stage and middle stage of the disease, then the leaf is in the early stage of bacterial leaf spot disease; If all the prediction results of all the segmented pictures of the soybean leaf picture to be detected do not contain the early stage, middle stage, and late stage of the disease, then the leaf is in the normal stage.
6. A soybean bacterial blight disease course recognition system, characterized in that, It includes: A data module for obtaining a soybean leaf image and using a sliding window segmentation algorithm to obtain local region pictures of the soybean leaf image as a basic segmentation dataset; Screen the basic segmentation dataset according to the disease course to obtain leaf images at different disease course stages as the dataset; A model training module for using the data in the dataset to train a Swin Transformer model to obtain a disease course recognition model; A local recognition module, configured to acquire and segment an image of a soybean leaf to be detected, and input the segmented image into the disease course recognition model to obtain a local disease course recognition result in the image of the soybean leaf to be detected; A leaf disease course recognition result, configured to classify the local disease course recognition result to obtain a disease course recognition result of the soybean leaf to be detected.
7. A computer device, comprising a memory, a processor, and a computer program stored on the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is loaded by the processor, it is capable of executing the steps of the method according to any one of claims 1 to 5.