Rice disease identification method and system based on random forest
Through the rice disease identification method based on random forest, combined with image annotation, enhancement, feature extraction and model optimization technology, the problem of insufficient data quality and feature extraction in the identification of rice diseases and insect pests in the existing technology is solved, and high accuracy and robustness are achieved. Excellent pest and disease identification effect.
Patent Information
- Application Number
- CN202410628752.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-05-21
AI Technical Summary
Existing image processing and machine learning technologies have problems with low data quality, incomplete feature extraction, and insufficient model optimization methods in identifying rice diseases and insect pests, resulting in low recognition accuracy and robustness.
The rice disease identification method based on random forest is adopted, through image annotation, enhancement, high-level feature extraction, extreme gradient boosting model classification and Bayesian optimization algorithm optimization, combined with generative adversarial network and convolutional neural network, to achieve automated and deep-level identification. Feature extraction and model training.
It significantly improves the accuracy and robustness of rice pest and disease identification, provides high-quality disease data reports, and can effectively deal with complex and changeable pest and disease characteristics.
Smart Images

Figure CN118411609B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method and system for identifying rice diseases based on random forests. Background Art
[0002] Existing image processing and machine learning technologies have made some progress in pest and disease identification, but there are still many shortcomings. First, existing methods often lack systematicity in the collection and annotation of image data, resulting in low data quality and affecting the training effect of the model. Secondly, in terms of feature extraction and classification models, traditional feature extraction methods often rely on manually designed features, which makes it difficult to fully and accurately capture disease characteristics. Finally, existing methods lack effective means to optimize models and improve recognition effects, resulting in recognition accuracy and robustness that still need to be improved. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a method and system for identifying rice diseases based on random forests, which are used to improve the accuracy of identifying rice diseases based on random forests.
[0004] The present invention provides a method for identifying rice diseases based on random forest, comprising: collecting rice leaf images in a target area, and annotating the rice leaf images to obtain annotated rice leaf images;
[0005] Performing image enhancement on the labeled rice leaf image to obtain an enhanced rice leaf image;
[0006] Extracting high-level features from the enhanced rice leaf image to obtain a high-level feature set;
[0007] Inputting the high-level feature set into a preset extreme gradient boosting model for feature classification to obtain a classification feature set;
[0008] Inputting the classification feature set into a preset Bayesian optimization algorithm to perform feature optimization to obtain an optimized feature set;
[0009] The optimized feature set is input into a pest and disease identification model based on random forest to identify rice pests and diseases, and obtain pest and disease identification data, wherein the pest and disease identification data includes: disease spot area and disease spot type, and the disease type of rice in the target area is matched with the disease type through the pest and disease identification data to obtain rice disease type data.
[0010] In the present invention, the step of collecting rice leaf images of a target area and annotating the rice leaf images to obtain annotated rice leaf images comprises:
[0011] Collecting rice leaf images in a target area, performing image similarity analysis on the rice leaf images, and obtaining multiple groups of similar images;
[0012] Perform image similarity segmentation on each group of similar images respectively, and obtain similarity region images corresponding to each group of similar images;
[0013] The lesion area is calibrated for the similar area images corresponding to each group of similar pictures respectively, so as to obtain the lesion area map corresponding to each group of similar pictures;
[0014] Semantic information calibration is performed on the lesion area map corresponding to each group of similar pictures to obtain semantic information of the lesion area map corresponding to each group of similar pictures;
[0015] The rice leaf image is annotated according to the semantic information of the diseased spot area image corresponding to each group of similar images to obtain an annotated rice leaf image.
[0016] In the present invention, the step of performing image enhancement on the labeled rice leaf image to obtain an enhanced rice leaf image comprises:
[0017] Performing image denoising on the labeled rice leaf image by a median filtering algorithm to obtain a denoised labeled rice leaf image;
[0018] Performing contrast adjustment on the denoised and annotated rice leaf image by using a histogram equalization algorithm to obtain an adjusted and annotated rice leaf image;
[0019] Performing color correction processing on the adjusted and annotated rice leaf image by a white balance algorithm to obtain a corrected and annotated rice leaf image;
[0020] Inputting the corrected and annotated rice leaf image into a preset generator of a generative adversarial network to generate an image, thereby obtaining an initial annotated rice leaf image;
[0021] The initial annotated rice leaf image is input into the discriminator of the generative adversarial network for image optimization to obtain the enhanced rice leaf image.
[0022] In the present invention, the step of extracting high-level features from the enhanced rice leaf image to obtain a high-level feature set comprises:
[0023] Inputting the enhanced rice leaf image into a preset convolutional neural network, wherein the convolutional neural network includes a convolution layer, a pooling layer, a normalization layer, an activation layer, a fully connected layer, and an output layer;
[0024] In the convolution layer, the enhanced rice leaf image is convolved to obtain a convolution feature map;
[0025] Inputting the convolution feature map into the pooling layer for average pooling processing to obtain a pooling feature map;
[0026] Inputting the pooling feature map into the activation layer for activation processing to obtain an activation feature map;
[0027] Inputting the activated feature map into the fully connected layer for feature fusion processing to obtain a fused feature map;
[0028] Performing dimensionality reduction processing on the fused feature map to obtain a reduced-dimensionality feature vector;
[0029] The dimension-reduced feature vector is input into the output layer for feature screening to obtain the high-level feature set.
[0030] In the present invention, the step of inputting the high-level feature set into a preset extreme gradient boosting model for feature classification to obtain a classification feature set includes:
[0031] Inputting the high-level feature set into the extreme gradient boosting model for standardization to obtain a standardized feature set;
[0032] Performing data division on the standardized feature set to obtain a training feature set and a verification feature set;
[0033] Matching a target variable to each sample in the training feature set, wherein the target variable is used to represent a pest type label;
[0034] Performing model parameter analysis on the extreme gradient boosting model to obtain a model parameter set, wherein the model parameter set includes: the number of model trees, the maximum depth of trees, and a learning rate;
[0035] Performing parameter configuration on the extreme gradient boosting model by using the model parameter set to obtain a configured extreme gradient boosting model;
[0036] Inputting the training feature set into the configured extreme gradient boosting model to perform data prediction to obtain an initial prediction result;
[0037] Calculating the loss value of the initial prediction result by using a preset loss function to obtain a target loss value;
[0038] Calculating target gradient data by using the target loss value, and updating parameters of the extreme gradient boosting model by using a preset gradient descent algorithm and the target loss value based on the verification feature set to obtain an extreme gradient boosting model after parameter update;
[0039] The high-level feature set is input into the extreme gradient boosting model after parameter update to perform feature classification to obtain a classification feature set.
[0040] In the present invention, the step of inputting the classification feature set into a preset Bayesian optimization algorithm for feature optimization to obtain an optimized feature set includes:
[0041] Defining a parameter space for the classification feature set to obtain a target parameter space;
[0042] Extracting feature selection parameters from the target parameter space to obtain feature selection parameters;
[0043] Extracting samples from the target parameter space to obtain a sample set;
[0044] Based on the feature selection parameters and the sample set, the classification feature set is input into the Bayesian optimization algorithm for feature optimization to obtain the optimized feature set.
[0045] In the present invention, the step of inputting the optimized feature set into the pest and disease identification model based on random forest to identify rice pests and diseases to obtain pest and disease identification data, wherein the pest and disease identification data includes: disease spot area and disease spot type, matching the rice in the target area with the disease type through the pest and disease identification data to obtain the rice disease type data includes:
[0046] Inputting the optimized feature set into a pest and disease identification model based on random forest to load data, thereby obtaining loaded feature data;
[0047] Performing disease spot region identification on the loaded feature data to obtain a disease spot region set, and performing region classification on the disease spot region set to obtain multiple groups of disease spot sub-regions;
[0048] Performing lesion type analysis on each group of lesion sub-regions respectively to obtain the lesion type corresponding to each group of lesion sub-regions;
[0049] Generate the pest identification data based on the lesion type corresponding to each group of lesion sub-areas, wherein the pest identification data includes: lesion area and lesion type;
[0050] The disease and insect pest identification data is used to match the rice in the target area with the disease type to obtain rice disease type data.
[0051] The present invention also provides a rice disease identification system based on random forest, comprising:
[0052] A collection module, used for collecting rice leaf images in a target area, and annotating the rice leaf images to obtain annotated rice leaf images;
[0053] An enhancement module, used for performing image enhancement on the labeled rice leaf image to obtain an enhanced rice leaf image;
[0054] An extraction module, used for extracting high-level features from the enhanced rice leaf image to obtain a high-level feature set;
[0055] A classification module, used for inputting the high-level feature set into a preset extreme gradient boosting model for feature classification to obtain a classification feature set;
[0056] An optimization module, used for inputting the classification feature set into a preset Bayesian optimization algorithm for feature optimization to obtain an optimized feature set;
[0057] The identification module is used to input the optimized feature set into a pest and disease identification model based on random forest to identify rice pests and diseases, and obtain pest and disease identification data, wherein the pest and disease identification data includes: disease spot area and disease spot type, and the rice in the target area is matched with the disease type through the pest and disease identification data to obtain rice disease type data.
[0058] In the technical solution provided by the present invention, by performing similarity analysis on the rice leaf images of the target area, multiple groups of similar pictures can be effectively screened out, redundant data can be reduced, and data utilization can be improved. By segmenting similar areas of similar pictures and calibrating the lesion area, the lesion information can be accurately extracted, and combined with semantic information calibration, a high-quality annotated data set can be provided for subsequent image processing and model training. This systematic and refined data acquisition and annotation method not only improves the accuracy and representativeness of the data, but also greatly reduces the workload of manual annotation and improves the efficiency of data processing. In the image enhancement link, the median filtering algorithm is used for image denoising, which can effectively remove the noise in the image and make the image clearer. Subsequently, the contrast of the image is adjusted by the histogram equalization algorithm, so that the lesion features are more prominent. The application of the white balance algorithm can correct the color deviation of the image and restore the true color of the image. Then, the image is generated and optimized by the generator and discriminator of the generative adversarial network (GAN), which can not only generate high-quality lesion images, but also further improve the details and resolution of the image, so that the enhanced image is more representative and informative. This series of image enhancement processing steps significantly improves the image quality and lays a solid foundation for feature extraction and model training. The convolutional neural network (CNN) is used to process the enhanced rice leaf image, which can automatically extract the deep features in the image. Through the combined processing of multiple convolutional layers, pooling layers, normalization layers and activation layers, the convolution feature map, pooling feature map and activation feature map of the image are extracted, and then the feature fusion and dimensionality reduction are processed through the fully connected layer to finally obtain the high-level feature set. This automated and deep feature extraction method can fully capture the various feature information of the lesions, avoid the limitations of traditional manual feature extraction methods, and make the extracted features more accurate and comprehensive. The extreme gradient boosting (XGBoost) model is used for feature classification. By standardizing the high-level feature set, dividing the data, matching the target variables and configuring the model parameters, the classification model is made more accurate and robust. The extreme gradient boosting model can continuously optimize the model parameters, reduce errors, and improve the accuracy and efficiency of classification in multiple iterations of training and verification evaluation. In particular, in the application of target gradient calculation and gradient descent algorithm, the model parameters can be automatically updated and optimized, making the classification results more reliable. The Bayesian optimization algorithm is used to optimize the classification feature set. By defining the parameter space, extracting feature selection parameters and sample sets, the optimal parameter combination can be effectively searched. In terms of feature selection and parameter optimization, the Bayesian optimization algorithm has the advantages of global search and automatic tuning, which can greatly improve the efficiency and effect of feature optimization, making the optimized feature set more representative and discriminative. In the pest and disease identification link, by inputting the optimized feature set into the pest and disease identification model based on random forest, the lesion area identification and type analysis can be performed, which can accurately identify the specific location and type of the lesion.By matching the disease type with the pest and disease identification data, the name of the rice disease and the degree of the disease can be quickly and accurately determined, and a detailed disease data report can be generated. This pest and disease identification model based on random forests has high recognition accuracy and robustness, can effectively deal with complex and changeable pest and disease characteristics, and provide reliable recognition results. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0060] Figure 1 The present invention is a flowchart of a method for identifying rice diseases based on random forests in an embodiment of the present invention.
[0061] Figure 2 Schematic diagram of a rice disease identification system based on random forest in an embodiment of the present invention. DETAILED DESCRIPTION
[0062] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0063] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0064] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0065] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , Figure 1 is a flow chart of a method for identifying rice diseases based on random forests according to an embodiment of the present invention. Figure 1 As shown, the following steps are included:
[0066] S101, collecting rice leaf images in a target area, and annotating the rice leaf images to obtain annotated rice leaf images;
[0067] S102, performing image enhancement on the annotated rice leaf image to obtain an enhanced rice leaf image;
[0068] S103, extracting high-level features from the enhanced rice leaf image to obtain a high-level feature set;
[0069] S104, inputting the high-level feature set into a preset extreme gradient boosting model for feature classification to obtain a classification feature set;
[0070] S105, inputting the classification feature set into a preset Bayesian optimization algorithm for feature optimization to obtain an optimized feature set;
[0071] S106, inputting the optimized feature set into a pest and disease identification model based on random forest to identify rice pests and diseases, and obtaining pest and disease identification data, wherein the pest and disease identification data includes: disease spot area and disease spot type, and matching the rice in the target area with the disease type through the pest and disease identification data to obtain rice disease type data.
[0072] It should be noted that the rice leaf images in the target area are collected and annotated to obtain annotated rice leaf images. In order to ensure the diversity and representativeness of the data, the collection work should be carried out in different time periods, different weather conditions and different growth stages. Suppose in a rice field, we use a drone equipped with a high-definition camera to shoot the rice in the field and collect a large number of rice leaf images. These images not only cover normal leaves, but also include leaves affected by common diseases such as rice blast, bacterial leaf blight, and bacterial leaf streak.
[0073] The collected rice leaf images are annotated. First, similar images are identified and grouped through image similarity analysis. For example, we can use a feature matching-based algorithm to identify leaf images containing similar lesion features and group them together. Subsequently, similar regions are segmented for each group of similar images. This step can be achieved through image segmentation algorithms, such as K-means clustering or GrabCut algorithm, to extract the lesion areas in the image. After segmenting similar regions, these regions are further calibrated for lesion areas, and the specific boundaries and positions of each lesion are calibrated. Then, semantic information is calibrated for these lesion areas, and the types and severity of the lesions are annotated. Assuming that a leaf with typical rice blast lesions is identified in the image, the lesion area can be annotated as rice blast through expert manual annotation or semi-automatic tools, and relevant semantic information can be attached, such as "early infection" and "area accounting for 10%". In this way, we finally obtain a rice leaf image dataset with rich annotation information. When performing image enhancement on the annotated rice leaf image, the median filter algorithm is first applied to denoise the image to eliminate noise and interference in the image and obtain a clearer denoised image. For example, after an image with white leaf blight spots is processed by median filtering, the fine noise points on the edge of the leaf are effectively removed, making the lesion area more obvious. Then, the histogram equalization algorithm is used to adjust the contrast of the denoised image to make the contrast between the lesions and the normal leaf area more obvious. Then, the image is color corrected by the white balance algorithm to make the image color more realistic. The corrected image can more accurately reflect the actual color of the leaf and the characteristics of the lesions.
[0074] After that, the corrected image is input into the preset generator of the generative adversarial network (GAN) for image generation to obtain the initial enhanced image. The generative adversarial network generates realistic disease spot images through the generator, judges the authenticity of the image through the discriminator, optimizes the output of the generator, and finally obtains a high-quality enhanced image. Assuming an originally blurred disease spot image, after the processing of GAN, the edges and details of the disease spot become clearer and more realistic, providing better basic data for subsequent feature extraction. In the high-level feature extraction stage, the enhanced rice leaf image is input into the preset convolutional neural network (CNN). CNN contains multiple layers of convolutional layers, pooling layers, normalization layers, activation layers, fully connected layers, and output layers. First, the image is convolved through the convolutional layer to extract low-level image features such as edges and textures. Next, the convolutional feature map is input into the pooling layer for average pooling to reduce the dimension of the feature map while retaining important information. Then, the pooled feature map is processed by the activation layer, and nonlinear activation functions such as ReLU can enhance the expressiveness of the feature. Subsequently, the feature graphs are fused and dimensionally reduced through the fully connected layer, and finally the most representative high-level feature set is selected in the output layer. The high-level feature set is input into the preset extreme gradient boosting (XGBoost) model for feature classification. First, the high-level feature set is standardized to ensure that the data of different features are distributed on the same scale. Then, the data is divided into a training set and a validation set. The training set is used to train the model, and the validation set is used to evaluate the model performance. During the training process, the target variables of each sample are matched, and these target variables represent the type label of the disease. By analyzing the model parameters, setting parameters such as the number of trees, the maximum depth of trees, and the learning rate, the extreme gradient boosting model is configured. During the training process, the model continuously iterates, calculates the loss value and gradient, and uses the gradient descent algorithm to update the parameters, and finally obtains the model with optimized parameters. All high-level feature sets are input into the updated extreme gradient boosting model for feature classification to obtain the classification feature set. Next, the classification feature set is input into the preset Bayesian optimization algorithm for feature optimization. The Bayesian optimization algorithm defines the parameter space, extracts the feature selection parameters and sample sets, performs a global search, and finds the optimal parameter combination. Through the feature selection parameters and sample sets, the classification feature set is input into the Bayesian optimization algorithm, and the optimized feature set is finally obtained. Finally, the optimized feature set is input into the pest and disease recognition model based on random forests for rice pest and disease recognition. The random forest model uses multiple decision trees to classify the feature set and identify the lesion area and lesion type. Assume that when processing an image with bacterial leaf streak, the random forest model can accurately identify the specific location and type of the leaf streak. The recognition results include the specific area and type information of the lesion. Through these recognition data, the rice in the target area is matched with the disease type, and finally detailed rice disease data is obtained, including the type, severity and distribution of the disease.
[0075] By executing the above steps, by performing similarity analysis on the rice leaf images in the target area, multiple groups of similar images can be effectively screened out, redundant data can be reduced, and data utilization can be improved. By segmenting similar areas of similar images and calibrating the lesion area, the lesion information can be accurately extracted, and combined with semantic information calibration, a high-quality annotated data set can be provided for subsequent image processing and model training. This systematic and refined data collection and annotation method not only improves the accuracy and representativeness of the data, but also greatly reduces the workload of manual annotation and improves the efficiency of data processing. In the image enhancement link, the median filtering algorithm is used for image denoising, which can effectively remove the noise in the image and make the image clearer. Subsequently, the contrast of the image is adjusted by the histogram equalization algorithm to make the lesion features more prominent. The application of the white balance algorithm can correct the color deviation of the image and restore the true color of the image. Then, the image generation and optimization are performed through the generator and discriminator of the generative adversarial network (GAN), which can not only generate high-quality lesion images, but also further improve the details and resolution of the image, making the enhanced image more representative and informative. This series of image enhancement processing steps significantly improves the quality of the image and lays a solid foundation for feature extraction and model training. The convolutional neural network (CNN) is used to process the enhanced rice leaf image, which can automatically extract the deep features in the image. Through the combined processing of multiple convolutional layers, pooling layers, normalization layers and activation layers, the convolution feature map, pooling feature map and activation feature map of the image are extracted, and then the feature fusion and dimensionality reduction are processed through the fully connected layer to finally obtain the high-level feature set. This automated and deep feature extraction method can fully capture various feature information of the lesions, avoid the limitations of traditional manual feature extraction methods, and make the extracted features more accurate and comprehensive. The extreme gradient boosting (XGBoost) model is used for feature classification. By standardizing the high-level feature set, dividing the data, matching the target variables and configuring the model parameters, the classification model is made more accurate and robust. The extreme gradient boosting model can continuously optimize the model parameters, reduce errors, and improve the accuracy and efficiency of classification in multiple iterations of training and verification evaluation. In particular, in the application of target gradient calculation and gradient descent algorithm, the model parameters can be automatically updated and optimized, making the classification results more reliable. The Bayesian optimization algorithm is used to optimize the classification feature set. By defining the parameter space, extracting feature selection parameters and sample sets, the optimal parameter combination can be effectively searched. In terms of feature selection and parameter optimization, the Bayesian optimization algorithm has the advantages of global search and automatic tuning, which can greatly improve the efficiency and effect of feature optimization, making the optimized feature set more representative and discriminative. In the pest and disease identification link, by inputting the optimized feature set into the pest and disease identification model based on random forest, the lesion area identification and type analysis can be performed, which can accurately identify the specific location and type of the lesion.By matching the disease type with the pest and disease identification data, the name of the rice disease and the degree of the disease can be quickly and accurately determined, and a detailed disease data report can be generated. This pest and disease identification model based on random forests has high recognition accuracy and robustness, can effectively deal with complex and changeable pest and disease characteristics, and provide reliable recognition results.
[0076] In a specific embodiment, the process of executing step S101 may specifically include the following steps:
[0077] (1) Collect rice leaf images in the target area, perform image similarity analysis on the rice leaf images, and obtain multiple groups of similar images;
[0078] (2) Segment the similar regions of each group of similar images to obtain the similar region images corresponding to each group of similar images;
[0079] (3) Calibrate the lesion area for the similar area images corresponding to each group of similar images to obtain the lesion area map corresponding to each group of similar images;
[0080] (4) Semantic information calibration is performed on the lesion area map corresponding to each group of similar images to obtain the semantic information of the lesion area map corresponding to each group of similar images;
[0081] (5) The rice leaf images are annotated using the semantic information of the diseased spot area map corresponding to each group of similar images to obtain an annotated rice leaf image.
[0082] Specifically, for example, the SIFT (Scale-Invariant Feature Transform) feature extraction method is used to identify key points and features in the image, and then the K-means clustering algorithm is used to group these images according to feature similarity. In this way, multiple groups of similar pictures are obtained, and the lesion feature similarity in each group of pictures is high, which helps to improve the accuracy and efficiency of annotation. After obtaining multiple groups of similar pictures, the next step is to segment the similar regions of each group of similar pictures. Using image segmentation algorithms such as GrabCut or K-means clustering, similar regions in each group of pictures can be extracted. Assume that in a group of similar pictures, the GrabCut algorithm is used to separate the lesion area from the normal leaf area in each picture, and the similar region images corresponding to each group of similar pictures are obtained. The purpose of this is to further accurately locate the lesion area and lay the foundation for subsequent calibration work. Next, the lesion area is calibrated for the similar region images corresponding to each group of similar pictures. The calibration process can be performed using manual annotation or semi-automatic annotation tools. Assume that typical lesions of rice blast are found in a group of pictures. By using annotation tools to calibrate these lesion areas, the specific boundaries and positions of the lesions are drawn, and the lesion area map corresponding to each group of similar pictures is obtained. At this point, the lesion area of each picture has been clearly calibrated, providing high-quality annotation data for subsequent image analysis. After the lesion area calibration is completed, the lesion area map corresponding to each group of similar pictures needs to be calibrated for semantic information. Semantic information calibration includes annotating the type of lesions, infection degree and other related information. For example, for rice blast lesions, they can be labeled as "early infection" or "severe infection", and detailed information such as the percentage of lesion area is attached. These semantic information can be manually annotated or automatically generated using a pre-trained deep learning model. In this way, the semantic information of the lesion area map corresponding to each group of similar pictures is obtained, so that these annotation data not only contain the spatial location of the lesions, but also include rich semantic information. Through the semantic information of the lesion area map corresponding to each group of similar pictures, the rice leaf image is annotated, and finally the annotated rice leaf image is obtained. Suppose that in a certain set of pictures, after the above processing steps, the detailed annotation of the rice blast lesion area and its semantic information are obtained. This information is integrated into the image annotation dataset, so that each picture not only has the boundary of the lesion area, but also contains information such as the lesion type and infection degree. These annotation data will serve as the basis for subsequent image enhancement and feature extraction. For example, in practical applications, a series of images can be taken by drones, one of which shows the early infection characteristics of rice blast. Through image similarity analysis, these images are divided into a group. Then, the GrabCut algorithm is used to segment similar regions and extract the lesion area in each picture.Then, annotation tools are used to demarcate these lesion areas, draw the boundaries of the lesions, and add semantic information, such as "early infection of rice blast." Finally, these annotated data are integrated into the annotation dataset to form an annotated image containing the lesion area and detailed semantic information.
[0083] In a specific embodiment, the process of executing step S102 may specifically include the following steps:
[0084] (1) De-noising the labeled rice leaf image using a median filter algorithm to obtain a de-noised labeled rice leaf image;
[0085] (2) The contrast of the denoised and annotated rice leaf image is adjusted by using a histogram equalization algorithm to obtain an adjusted and annotated rice leaf image;
[0086] (3) Performing color correction on the adjusted and annotated rice leaf image using a white balance algorithm to obtain a corrected and annotated rice leaf image;
[0087] (4) Inputting the corrected and annotated rice leaf image into the preset generator of the generative adversarial network to generate an image, thereby obtaining an initial annotated rice leaf image;
[0088] (5) The initial annotated rice leaf image is input into the discriminator of the generative adversarial network for image optimization to obtain an enhanced rice leaf image.
[0089] Specifically, the image of the annotated rice leaf is denoised by the median filtering algorithm to remove noise and interference in the image. Median filtering is a nonlinear filtering method that effectively removes impulse noise and salt and pepper noise by replacing each pixel value in the image with the median value in the neighborhood of the pixel. For example, a leaf image containing rice blast lesions is collected. Due to the influence of the acquisition equipment or environment, there may be some noise points in the image. Through median filtering, these noise points are smoothed, making the lesion area clearer and the image quality significantly improved. After the denoising process is completed, the contrast of the denoised annotated rice leaf image is adjusted using the histogram equalization algorithm. Histogram equalization is a technology for enhancing image contrast. It redistributes the grayscale of the image so that the grayscale histogram of the image is evenly distributed in the entire grayscale range, thereby enhancing the details and contrast of the image. For example, an image of a rice blast leaf that has been processed by median filtering may have a low contrast, and the difference between the lesion area and the normal leaf area is not obvious enough. Through histogram equalization processing, the overall brightness and contrast of the image are improved, and the contrast between the diseased area and the normal area is more obvious, which is very important for the subsequent diseased area identification and analysis. Subsequently, the adjusted annotated rice leaf image is color corrected using the white balance algorithm. The white balance algorithm aims to eliminate the color deviation in the image and make the color of the image closer to the real color under natural light. For example, during the shooting process, due to changes in lighting conditions, the image may appear yellowish or bluish, which will affect the color characteristics of the diseased spots. Through white balance correction, the color of the image can be adjusted to restore it to a normal color state. For example, a yellowish rice blast leaf image, after white balance processing, the green color of the leaf and the color of the diseased spot are truly restored, making the diseased spot features more prominent and clear. After completing the color correction, the corrected annotated rice leaf image is input into the preset generator of the generative adversarial network (GAN) for image generation. The generative adversarial network consists of a generator and a discriminator. The generator is responsible for generating realistic images, and the discriminator is responsible for judging the authenticity of the image. The generator can generate images that are closer and closer to the real through continuous learning. For example, a white-balanced rice blast leaf image is fed into the generator, which generates an initial enhanced image based on the existing image data. These initially generated images may be richer in details and textures, but may still have some minor flaws. To further optimize the image quality, the initially generated annotated rice leaf image is fed into the discriminator of the generative adversarial network for image optimization. The discriminator evaluates the generated image, determines its similarity to the real image, and transmits feedback information back to the generator, prompting the generator to further improve the image generation quality. Through this process, the generator and the discriminator compete with each other, and the generated images gradually tend to be realistic and high-quality.For example, the initially generated rice blast leaf image may not be clear enough in the details of the lesion edge. Through the feedback of the discriminator, the generator is constantly adjusted and optimized, and the enhanced image generated in the end is very close to the real leaf image in terms of the lesion edge, color and texture. Suppose in actual operation, a rice blast leaf image is taken by a drone. The image is noisy due to insufficient light, and the contrast is low and the color deviation is obvious. After denoising by the median filter algorithm, the noise points in the image are effectively removed, and the leaf and lesion areas are clearer. Then, through histogram equalization processing, the contrast is significantly improved, and the boundary between the lesion area and the normal leaf area is clearer. Then, the white balance algorithm is used for color correction, and the color of the image is restored to normal, and the yellow of the lesion and the green of the leaf are more realistic. The corrected image is input into the generator of the generative adversarial network to generate the initial enhanced image, which is richer in lesion details and overall texture. Finally, the initial enhanced image is evaluated and fed back by the discriminator, and the generator is constantly adjusted to finally obtain a high-quality enhanced rice leaf image. These enhanced images, which have undergone multiple processing, are not only clearer and more realistic visually, but also more accurate in expressing the characteristics of lesions, providing a high-quality data foundation for subsequent high-level feature extraction and pest and disease identification.
[0090] In a specific embodiment, the process of executing S103 may specifically include the following steps:
[0091] (1) Inputting the enhanced rice leaf image into a preset convolutional neural network, wherein the convolutional neural network includes a convolution layer, a pooling layer, a normalization layer, an activation layer, a fully connected layer, and an output layer;
[0092] (2) In the convolution layer, the enhanced rice leaf image is convolved to obtain a convolution feature map;
[0093] (3) Input the convolution feature map into the pooling layer for average pooling to obtain the pooled feature map;
[0094] (4) Input the pooled feature map into the activation layer for activation processing to obtain an activated feature map;
[0095] (5) Input the activated feature map into the fully connected layer for feature fusion processing to obtain a fused feature map;
[0096] (6) Perform dimensionality reduction processing on the fused feature map to obtain a reduced-dimensionality feature vector;
[0097] (7) The reduced-dimensional feature vector is input into the output layer for feature screening to obtain a high-level feature set.
[0098] Specifically, the enhanced rice leaf image is input into a pre-set convolutional neural network, which includes a convolutional layer, a pooling layer, a normalization layer, an activation layer, a fully connected layer, and an output layer. Suppose we process an image of a rice blast leaf after image enhancement. Through the multi-layer processing of CNN, the deep features contained in the image can be extracted. In the convolutional layer, the enhanced rice leaf image is convolved. The convolutional layer scans the image by applying multiple convolutional kernels (filters) to extract features of different scales and angles. Each convolutional kernel slides on the image and performs a dot product operation with the local area of the image to generate a feature map. For example, the convolutional kernel can identify low-level features such as edges, corners, and textures in the image, which will be gradually merged into more complex lesion features in subsequent layers. Through the convolution operation, we obtain convolutional feature maps, which contain preliminary structural information of the image. The convolutional feature map is input into the pooling layer for average pooling. The pooling layer reduces the size of the feature map by downsampling the feature map while retaining important information. Average pooling generates a smaller pooled feature map by calculating the average value of the local area in the feature map. For example, a feature map containing rice blast spots is reduced in size by half after average pooling, but the main features of the spots are still retained. This downsampling operation not only reduces the amount of data, but also has a certain smoothing effect, which helps to enhance the robustness of the features. Next, the pooled feature map is input into the activation layer for activation processing. The activation layer usually uses a nonlinear activation function, such as ReLU (Rectified Linear Unit), to perform a nonlinear transformation on the input. The ReLU function sets the negative values in the input to zero and keeps the positive values unchanged, thereby introducing nonlinear characteristics, so that the model can better fit the complex spot features. For example, a feature map of rice blast leaves after convolution and pooling is activated by ReLU, in which the negative values are suppressed, the positive values are retained and enhanced, and the spot features are more prominent in the activation feature map. Then, the activated feature map is input into the fully connected layer for feature fusion processing. The fully connected layer connects all the nodes of the previous layer with all the nodes of the current layer through the fully connected operation to achieve feature integration and fusion. The fully connected layer can be viewed as a mapping of a high-dimensional feature space, which aggregates the local features extracted by the convolutional layer and the pooling layer into global features. For example, in the fully connected layer, the local edge and texture features of a leaf with rice blast are integrated into the overall lesion features to generate fused feature maps, which contain comprehensive information about the lesions. The fused feature maps are subjected to dimensionality reduction. Common dimensionality reduction methods include principal component analysis (PCA) or convolution kernel sparsification. Through dimensionality reduction operations, we can reduce the dimension of the feature vector while retaining the most important feature information.For example, through PCA dimensionality reduction, a disease spot image containing rich feature information is reduced to only several principal components that best represent the characteristics of the disease spot, generating reduced dimension feature vectors, which can effectively describe the main characteristics of the disease spot. Finally, the reduced dimension feature vector is input into the output layer for feature screening. The output layer selects the most discriminative features through a preset screening mechanism to generate a high-level feature set. These high-level feature sets will serve as the basis for subsequent classification and recognition. For example, through output layer screening, in the reduced dimension feature vector of a rice blast leaf, only those features that are most useful for disease spot recognition are retained. These feature sets can significantly improve the accuracy and robustness of the disease recognition model. Suppose in actual operation, we collect an image of a rice blast leaf. Through the aforementioned image enhancement steps, the image quality is significantly improved. Then, this enhanced image is input into the preset convolutional neural network. First, the convolution operation is performed in the convolution layer to extract the edge and texture features in the image and generate a preliminary convolution feature map. Then, through the average pooling process of the pooling layer, the size of the feature map is reduced while retaining the main disease spot features. Then, the pooled feature map is input into the activation layer, and nonlinear activation is performed through the ReLU function, so that the lesion features are more obvious in the activation feature map. Subsequently, the activation feature map is input into the fully connected layer for feature fusion. Through the fully connected operation, the local features are integrated into global features to generate a fused feature map. The fused feature map is subjected to PCA dimensionality reduction, the most important feature information is retained, and a reduced-dimensional feature vector is generated. Finally, the reduced-dimensional feature vector is input into the output layer, and the most discriminative features are selected through feature screening to generate a high-level feature set. These high-level feature sets will serve as the input of the subsequent random forest-based disease type recognition model, providing a solid foundation for the accurate recognition and classification of lesions. Through the above systematic feature extraction process, we have achieved high-level feature extraction of enhanced rice leaf images. These high-level feature sets not only comprehensively and accurately describe the various features of lesions, but also provide high-quality data support for subsequent disease and pest identification. Combined with the disease type recognition method based on random forests, these high-level feature sets can significantly improve the accuracy and robustness of recognition, providing a scientific and reliable basis for the prevention and control of rice diseases and pests.
[0099] In a specific embodiment, the process of executing step S104 may specifically include the following steps:
[0100] (1) Input the high-level feature set into the extreme gradient boosting model for standardization to obtain a standardized feature set;
[0101] (2) Divide the data of the standardized feature set to obtain the training feature set and the verification feature set;
[0102] (3) Match the target variable to each sample in the training feature set, where the target variable is used to represent the pest type label;
[0103] (4) Analyze the model parameters of the extreme gradient boosting model to obtain a model parameter set, where the model parameter set includes: the number of model trees, the maximum depth of the trees, and the learning rate;
[0104] (5) Parameter configuration of the extreme gradient boosting model is performed through the model parameter set to obtain the configured extreme gradient boosting model;
[0105] (6) Input the training feature set into the configured extreme gradient boosting model for data prediction to obtain the initial prediction result;
[0106] (7) Calculate the loss value of the initial prediction result using the preset loss function to obtain the target loss value;
[0107] (8) Calculate the target gradient data through the target loss value, and based on the verification feature set, update the parameters of the extreme gradient boosting model through the preset gradient descent algorithm and the target loss value to obtain the extreme gradient boosting model after parameter update;
[0108] (9) The high-level feature set is input into the extreme gradient boosting model with updated parameters for feature classification to obtain a classified feature set.
[0109] Specifically, the high-level feature set is input into the extreme gradient boosting model for standardization to ensure that the data of different features are distributed on the same scale. Standardization is usually performed by subtracting the mean and dividing by the standard deviation so that the mean of each feature is zero and the standard deviation is one. Assuming that the high-level feature set we extracted contains multiple features such as the color, texture, and shape of the lesions, and the value range of each feature may be different, these differences can be eliminated through standardization, making each feature equally important in model training. Next, the standardized feature set is partitioned to divide the data set into a training feature set and a validation feature set. Usually we divide it in an 8:2 ratio, that is, 80% of the data is used for training and 20% of the data is used for validation. This ensures that the model has enough data to learn during the training process, and can also effectively evaluate the performance of the model during the validation process. Assuming that we have 1,000 lesion feature samples, after partitioning, 800 samples are used for training and 200 samples are used for validation. In the training feature set, each sample needs to match a target variable, which is used to represent the type label of the pest. For example, for rice blast and bacterial blight, we can set different labels, such as 1 for rice blast and 2 for bacterial blight. In this way, each training sample is associated with a specific disease type label, ensuring that the model can recognize and distinguish different disease characteristics during the learning process. Then, the model parameter analysis of the extreme gradient boosting model is performed to obtain the model parameter set. These parameters include the number of model trees, the maximum depth of the trees, and the learning rate. The number of model trees determines the complexity and learning ability of the model, the maximum depth of the trees determines the maximum number of nodes per tree, and the learning rate controls the step size of each parameter update. Suppose that through parameter analysis, we decide to use 100 trees, the maximum depth of each tree is 6, and the learning rate is 0.1. The extreme gradient boosting model is parameterized through the model parameter set to obtain the configured extreme gradient boosting model. The configured model contains all the parameter settings we determined in the parameter analysis phase, ensuring that the model can be trained and predicted in the best state. The training feature set is input into the configured extreme gradient boosting model for data prediction to obtain the initial prediction results. During the training process, the model predicts each training sample through multiple iterations and makes adjustments based on the difference between the predicted result and the actual label. The initial prediction result may have a certain error. At this time, it is necessary to calculate the loss value of the initial prediction result through the preset loss function to obtain the target loss value. Commonly used loss functions include mean square error (MSE) and cross entropy loss. By calculating the loss value, we can quantify the prediction error of the model. The target gradient data is calculated through the target loss value, and the target gradient data is used to guide the update of the model parameters. Based on the verification feature set, the parameters of the extreme gradient boosting model are updated through the preset gradient descent algorithm and the target loss value.The gradient descent algorithm is an iterative optimization algorithm that continuously adjusts the model parameters and gradually reduces the loss value, making the model's prediction results more and more accurate. In each iteration, the model will update the parameters according to the current gradient data until the loss value converges or reaches the preset number of iterations. After multiple iterations and parameter updates, the extreme gradient boosting model with updated parameters is obtained. At this point, the model has been adjusted and optimized for the training set and the validation set many times, and has a strong feature classification ability. Finally, all high-level feature sets are input into the extreme gradient boosting model with updated parameters for feature classification to obtain classification feature sets. These classification feature sets contain the final classification results of each sample, indicating the specific classification of each lesion feature by the model. For example, in actual operation, we collected a batch of high-level feature sets of rice blast and bacterial blight leaves, and eliminated the dimensional differences between the features through standardization. Then, these standardized feature sets were divided into training sets and validation sets, and specific disease type labels were matched for each sample. Then, the extreme gradient boosting model was used for parameter configuration, including 100 trees, a maximum depth of 6, and a learning rate of 0.1. The training set is input into the configured model for prediction, and the loss value is calculated through the loss function. According to the loss value and gradient data, the gradient descent algorithm is used to update the model parameters. After multiple iterations, the model is gradually optimized, and finally an extreme gradient boosting model with updated parameters is obtained. All high-level feature sets are input into the model for feature classification to obtain the final classification feature set. Through these classification feature sets, the model can accurately identify and distinguish different types of lesions, providing a reliable data basis for subsequent identification of pests and diseases. This systematic feature classification process not only improves the accuracy and robustness of the model, but also lays a solid foundation for the rice disease identification method based on random forests, ensuring the efficiency and reliability of disease identification.
[0110] In a specific embodiment, the process of executing step S105 may specifically include the following steps:
[0111] (1) Define the parameter space of the classification feature set to obtain the target parameter space;
[0112] (2) Extract feature selection parameters from the target parameter space to obtain feature selection parameters;
[0113] (3) Extract samples from the target parameter space to obtain a sample set;
[0114] (4) Based on the feature selection parameters and sample set, the classification feature set is input into the Bayesian optimization algorithm for feature optimization to obtain the optimized feature set.
[0115] Specifically, for example, in the previous extreme gradient boosting model, the parameters that may be included include the number of model trees, the maximum depth of trees, the learning rate, etc. Assume that the number of trees ranges from 50 to 200, the maximum depth of trees ranges from 3 to 10, and the learning rate ranges from 0.01 to 0.3. After defining these parameter ranges, a target parameter space is constructed, which will be used for subsequent feature optimization. Next, feature selection parameters are extracted from the target parameter space. Feature selection parameters refer to a specific set of parameters that need to be paid attention to during the optimization process. Through the selection of these parameters, the search range can be effectively narrowed and the optimization efficiency can be improved. For example, the three key parameters of the number of trees, the maximum depth of trees, and the learning rate are extracted from the target parameter space as feature selection parameters. These parameters have an important impact on the performance of the model. By optimizing these parameters, the classification accuracy and generalization ability of the model can be significantly improved. Then, sample extraction is performed on the target parameter space. The sample set is a set of parameter combinations randomly selected from the parameter space. Through these samples, the impact of the parameters on the model performance can be preliminarily evaluated. For example, multiple parameter combinations can be randomly selected from the target parameter space, each of which corresponds to a specific value of the number of trees, the maximum depth of trees, and the learning rate to form an initial sample set. Assume that 10 sets of parameter combinations are randomly selected, and these combinations will be used to train the model and evaluate its performance. Based on the feature selection parameters and sample set, the classification feature set is input into the Bayesian optimization algorithm for feature optimization. Bayesian optimization is a global optimization algorithm that effectively explores and utilizes the parameter space by building a proxy model to find the optimal parameter combination. At the beginning of the optimization, the initial sample set is first evaluated. The performance indicators corresponding to each set of parameter combinations are obtained by training the extreme gradient boosting model and calculating its verification error. Then, the Bayesian optimization algorithm will build a proxy model based on these initial evaluation results. The proxy model can be a Gaussian process regression model to predict the performance of the unevaluated parameter combination. After the proxy model is built, the Bayesian optimization algorithm will select the next optimal parameter combination for evaluation based on the prediction results of the proxy model and the acquisition function. The acquisition function is a key part of Bayesian optimization, which determines how to balance exploration and utilization. Commonly used acquisition functions include expected improvement and upper confidence bound. Through the acquisition function, the combination that is most likely to improve the model performance can be selected from the unevaluated parameter combinations for evaluation. Assume that in actual operation, new parameter combinations are selected by the Bayesian optimization algorithm, and these combinations are applied to the extreme gradient boosting model, and trained and evaluated to obtain new validation errors. This process is repeated continuously, and through multiple iterations, the Bayesian optimization algorithm continuously updates the proxy model and selects new parameter combinations for evaluation.After each iteration, the algorithm records the current optimal parameter combination and its corresponding performance index until the preset number of iterations is reached or the performance index converges. Through this iterative optimization process, the Bayesian optimization algorithm can effectively explore the parameter space and find the global optimal parameter combination. Finally, the optimized feature set is obtained, which is the result of training and verification of the optimal parameter combination and has the highest classification accuracy and robustness. For example, after optimization, it may be found that the optimal parameter combination is 150 trees, 8 maximum tree depth, and 0.05. These parameter combinations make the model perform best on the validation set, and the classification feature set can accurately distinguish different types of rice diseases. Specifically, when applying the Bayesian optimization algorithm for feature optimization, the feature selection parameters are first defined and extracted from the target parameter space. These parameters include the number of model trees, the maximum tree depth, and the learning rate. Then, the model is trained and evaluated through a randomly selected initial sample set, the proxy model is constructed, and the acquisition function is used to select the optimal parameter combination in the parameter space for evaluation. Through multiple iterations and evaluations, the algorithm continuously updates the proxy model and records the optimal parameter combination, and finally finds the global optimal parameter combination to generate an optimized feature set. This optimization process ensures that the model can be trained and predicted with the best parameters, improving the classification accuracy and model robustness. In practical applications, it is assumed that a batch of rice disease data is being processed, and the classification feature set has been obtained through the aforementioned feature extraction and classification steps. In order to further optimize the model performance, the Bayesian optimization algorithm is used to optimize the features. First, the number of trees, the maximum depth of trees, and the learning rate are extracted from the target parameter space as feature selection parameters. Then, multiple parameter combinations are randomly selected to form an initial sample set, and each combination is trained and evaluated for the model. Through the Bayesian optimization algorithm, the proxy model is constructed, and the acquisition function is used to select the optimal parameter combination for multiple iterative evaluations. Finally, the algorithm finds the optimal parameter combination with a number of trees of 150, a maximum tree depth of 8, and a learning rate of 0.05, and generates an optimized feature set. These optimized feature sets provide a solid foundation for subsequent pest and disease identification, ensuring the accuracy and reliability of identification. Through this systematic feature optimization process, the rice disease identification method based on random forests was further improved, providing a scientific and efficient solution for agricultural pest and disease control.
[0116] In a specific embodiment, the process of executing step S106 may specifically include the following steps:
[0117] (1) Input the optimized feature set into the pest and disease identification model based on random forest to load data and obtain loaded feature data;
[0118] (2) Identify the lesion area on the loaded feature data to obtain a lesion area set, and classify the lesion area set to obtain multiple groups of lesion sub-areas;
[0119] (3) Analyze the lesion type of each group of lesion sub-regions to obtain the lesion type corresponding to each group of lesion sub-regions;
[0120] (4) generating pest and disease identification data based on the lesion type corresponding to each group of lesion sub-areas, wherein the pest and disease identification data includes: lesion area and lesion type;
[0121] (5) Use pest and disease identification data to match rice disease types in the target area and obtain rice disease data.
[0122] It should be noted that the optimized feature set obtained by the Bayesian optimization algorithm is input into the preset pest and disease identification model based on random forests for data loading. The data loading process includes reading the optimized feature set and converting it into a format that can be processed by the model for subsequent identification and analysis. After loading the feature data, the lesion area is then identified for these data. The random forest model classifies the feature data by integrating multiple decision trees. Each tree independently judges the input data and finally determines the lesion area by majority voting. For example, after the feature data of a rice blast leaf is input into the model, each decision tree in the model will predict the lesion area in the image, and finally these prediction results are combined to obtain the lesion area set. These lesion area sets are image areas that may have lesions identified by the model, and contain all areas that are considered to have disease characteristics. Next, the lesion area set is further classified. The purpose of regional classification is to subdivide the identified lesion area into smaller lesion sub-areas for more detailed analysis. By classifying the lesion area, lesion sub-areas of different types or severity can be distinguished. For example, in the lesion area concentration, we may identify multiple independent lesion areas, which may belong to different lesion types or stages. Through regional classification, we can subdivide these lesion areas into multiple groups of lesion sub-areas, each of which contains lesions with similar characteristics. Then, lesion type analysis is performed on each group of lesion sub-areas. Lesion type analysis refers to detailed feature extraction and classification of each sub-area to determine its specific lesion type. The random forest model can perform type analysis on each sub-area through its powerful classification ability combined with pre-trained lesion features. For example, for the identification of rice blast and bacterial blight, we can use the model to analyze the color, shape, texture and other features of each sub-area, and finally determine which lesion type these sub-areas belong to. After this process, we get the lesion type corresponding to each group of lesion sub-areas. This type information is very important because it directly reflects the specific situation and severity of the disease. Based on the lesion type corresponding to each group of lesion sub-areas, pest and disease identification data is generated. Pest and disease identification data includes lesion area and lesion type, which are obtained by analyzing and classifying each lesion sub-area. The lesion area data describes the specific location and range of the lesion in the image, while the lesion type data describes the specific type and characteristics of the lesion. For example, in a leaf image containing rice blast and bacterial blight, through the aforementioned regional classification and type analysis, we can generate pest and disease identification data, which describes in detail the specific location and type of each lesion. Through the pest and disease identification data, the rice in the target area is matched with the disease type, and finally the rice disease type data is obtained. The process of disease type matching is to compare the identification data with the preset disease type database to determine the specific type and distribution of the disease.For example, the pest and disease identification data contains multiple lesion areas and type information. By comparing with the information of rice blast, bacterial blight and other diseases in the disease database, the specific disease type and its distribution of each lesion can be determined. This step can not only accurately identify the type of disease, but also provide the specific location and distribution information of the disease, providing a scientific basis for agricultural management and disease prevention. In practical applications, suppose we have a batch of rice disease images. Through the aforementioned feature extraction and optimization steps, we get an optimized feature set. These feature sets are input into the pest and disease identification model based on random forests. First, data is loaded to ensure that the model can correctly read and process these feature data. Then, the model identifies the lesion area of the feature data, identifies all possible lesion areas in the image, and forms a lesion area set. Then, these lesion areas are further classified and subdivided into multiple lesion sub-areas. Each sub-area is analyzed for lesion type by the model to determine its specific lesion type. Through these steps, pest and disease identification data including lesion area and lesion type are generated. Finally, by comparing with the disease database, these identification data are matched with the disease type to obtain specific rice disease data. For example, in an image of a leaf with rice blast, multiple diseased areas are identified through the recognition of the random forest model. After these areas are classified, they are subdivided into multiple sub-areas. Then, through the analysis of the disease type, it is determined that these sub-areas are infected in the early and middle stages of rice blast. By matching the generated pest and disease identification data with the disease database, it is finally determined that the leaf contains diseased areas and their specific locations infected in the early and middle stages of rice blast. These rice disease data can be used for agricultural management and disease prevention and control, providing detailed disease information to help farmers and agricultural experts take corresponding prevention and control measures. Through this systematic identification process, the rice disease identification method based on random forests not only improves the accuracy and efficiency of disease identification, but also provides a scientific and reliable basis for agricultural disease prevention and control.
[0123] The embodiment of the present invention also provides a rice disease identification system based on random forest. Figure 2 As shown, the rice disease identification system based on random forest specifically includes:
[0124] The acquisition module 201 is used to acquire the rice leaf image in the target area and annotate the rice leaf image to obtain an annotated rice leaf image;
[0125] An enhancement module 202 is used to perform image enhancement on the labeled rice leaf image to obtain an enhanced rice leaf image;
[0126] An extraction module 203 is used to extract high-level features from the enhanced rice leaf image to obtain a high-level feature set;
[0127] A classification module 204 is used to input the high-level feature set into a preset extreme gradient boosting model for feature classification to obtain a classification feature set;
[0128] The optimization module 205 is used to input the classification feature set into a preset Bayesian optimization algorithm to perform feature optimization to obtain an optimized feature set;
[0129] The identification module 206 is used to input the optimized feature set into the pest and disease identification model based on random forest to identify rice pests and diseases, and obtain pest and disease identification data, wherein the pest and disease identification data includes: disease spot area and disease spot type, and the disease type of rice in the target area is matched with the pest and disease identification data to obtain rice disease type data.
[0130] Through the collaborative work of the above modules, by performing similarity analysis on the rice leaf images in the target area, multiple groups of similar images can be effectively screened out, redundant data can be reduced, and data utilization can be improved. By segmenting similar areas of similar images and calibrating the lesion area, the lesion information can be accurately extracted, and combined with semantic information calibration, a high-quality annotated data set can be provided for subsequent image processing and model training. This systematic and refined data collection and annotation method not only improves the accuracy and representativeness of the data, but also greatly reduces the workload of manual annotation and improves the efficiency of data processing. In the image enhancement link, the median filtering algorithm is used for image denoising, which can effectively remove the noise in the image and make the image clearer. Subsequently, the contrast of the image is adjusted by the histogram equalization algorithm, making the lesion features more prominent. The application of the white balance algorithm can correct the color deviation of the image and restore the true color of the image. Then, the image generation and optimization are performed through the generator and discriminator of the generative adversarial network (GAN), which can not only generate high-quality lesion images, but also further improve the details and resolution of the image, making the enhanced image more representative and informative. This series of image enhancement processing steps significantly improves the image quality and lays a solid foundation for feature extraction and model training. The convolutional neural network (CNN) is used to process the enhanced rice leaf image, which can automatically extract the deep features in the image. Through the combined processing of multiple convolutional layers, pooling layers, normalization layers and activation layers, the convolution feature map, pooling feature map and activation feature map of the image are extracted, and then the feature fusion and dimensionality reduction are processed through the fully connected layer to finally obtain the high-level feature set. This automated and deep feature extraction method can fully capture the various feature information of the lesions, avoid the limitations of traditional manual feature extraction methods, and make the extracted features more accurate and comprehensive. The extreme gradient boosting (XGBoost) model is used for feature classification. By standardizing the high-level feature set, dividing the data, matching the target variables and configuring the model parameters, the classification model is made more accurate and robust. The extreme gradient boosting model can continuously optimize the model parameters, reduce errors, and improve the accuracy and efficiency of classification in multiple iterations of training and verification evaluation. In particular, in the application of target gradient calculation and gradient descent algorithm, the model parameters can be automatically updated and optimized, making the classification results more reliable. The Bayesian optimization algorithm is used to optimize the classification feature set. By defining the parameter space, extracting feature selection parameters and sample sets, the optimal parameter combination can be effectively searched. In terms of feature selection and parameter optimization, the Bayesian optimization algorithm has the advantages of global search and automatic tuning, which can greatly improve the efficiency and effect of feature optimization, making the optimized feature set more representative and discriminative. In the pest and disease identification link, by inputting the optimized feature set into the pest and disease identification model based on random forest, the lesion area identification and type analysis can be performed, which can accurately identify the specific location and type of the lesion.By matching the disease type with the pest and disease identification data, the name of the rice disease and the degree of the disease can be quickly and accurately determined, and a detailed disease data report can be generated. This pest and disease identification model based on random forests has high recognition accuracy and robustness, can effectively deal with complex and changeable pest and disease characteristics, and provide reliable recognition results.
[0131] The above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. Although the present invention has been described in detail with reference to the embodiments, a person skilled in the art should understand that the specific implementation modes of the present invention can still be modified or replaced by equivalents, and any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be included in the scope of the claims of the present invention.
Claims
1. A method for identifying rice diseases based on random forest, characterized in that: include: Collecting rice leaf images in a target area, and annotating the rice leaf images to obtain annotated rice leaf images; Performing image enhancement on the labeled rice leaf image to obtain an enhanced rice leaf image; Extracting high-level features from the enhanced rice leaf image to obtain a high-level feature set; Inputting the high-level feature set into a preset extreme gradient boosting model for feature classification to obtain a classification feature set; Inputting the classification feature set into a preset Bayesian optimization algorithm to perform feature optimization to obtain an optimized feature set; The optimized feature set is input into a pest and disease identification model based on random forest to identify rice pests and diseases, and obtain pest and disease identification data, wherein the pest and disease identification data includes: disease spot area and disease spot type, and the disease type of rice in the target area is matched with the disease type through the pest and disease identification data to obtain rice disease type data.
2. The method for identifying rice diseases based on random forests according to claim 1, characterized in that: The step of collecting the rice leaf image of the target area and annotating the rice leaf image to obtain the annotated rice leaf image comprises: Collecting rice leaf images in a target area, performing image similarity analysis on the rice leaf images, and obtaining multiple groups of similar images; Perform image similarity segmentation on each group of similar images respectively, and obtain similarity region images corresponding to each group of similar images; The lesion area is calibrated for the similar area images corresponding to each group of similar pictures respectively, so as to obtain the lesion area map corresponding to each group of similar pictures; Semantic information calibration is performed on the lesion area map corresponding to each group of similar pictures to obtain semantic information of the lesion area map corresponding to each group of similar pictures; The rice leaf image is annotated according to the semantic information of the diseased spot area image corresponding to each group of similar images to obtain an annotated rice leaf image.
3. The method for identifying rice diseases based on random forest according to claim 1, characterized in that: The step of performing image enhancement on the labeled rice leaf image to obtain an enhanced rice leaf image comprises: Performing image denoising on the labeled rice leaf image by a median filtering algorithm to obtain a denoised labeled rice leaf image; Performing contrast adjustment on the denoised and annotated rice leaf image by using a histogram equalization algorithm to obtain an adjusted and annotated rice leaf image; Performing color correction processing on the adjusted and annotated rice leaf image by a white balance algorithm to obtain a corrected and annotated rice leaf image; Inputting the corrected and annotated rice leaf image into a preset generator of a generative adversarial network to generate an image, thereby obtaining an initial annotated rice leaf image; The initial annotated rice leaf image is input into the discriminator of the generative adversarial network for image optimization to obtain the enhanced rice leaf image.
4. The method for identifying rice diseases based on random forests according to claim 1, characterized in that: The step of extracting high-level features from the enhanced rice leaf image to obtain a high-level feature set comprises: Inputting the enhanced rice leaf image into a preset convolutional neural network, wherein the convolutional neural network includes a convolution layer, a pooling layer, a normalization layer, an activation layer, a fully connected layer, and an output layer; In the convolution layer, the enhanced rice leaf image is convolved to obtain a convolution feature map; Inputting the convolution feature map into the pooling layer for average pooling processing to obtain a pooling feature map; Inputting the pooling feature map into the activation layer for activation processing to obtain an activation feature map; Inputting the activated feature map into the fully connected layer for feature fusion processing to obtain a fused feature map; Performing dimensionality reduction processing on the fused feature map to obtain a reduced-dimensionality feature vector; The dimension-reduced feature vector is input into the output layer for feature screening to obtain the high-level feature set.
5. The method for identifying rice diseases based on random forest according to claim 1, characterized in that: The step of inputting the high-level feature set into a preset extreme gradient boosting model for feature classification to obtain a classification feature set comprises: Inputting the high-level feature set into the extreme gradient boosting model for standardization to obtain a standardized feature set; Performing data division on the standardized feature set to obtain a training feature set and a verification feature set; Matching a target variable to each sample in the training feature set, wherein the target variable is used to represent a pest type label; Performing model parameter analysis on the extreme gradient boosting model to obtain a model parameter set, wherein the model parameter set includes: the number of model trees, the maximum depth of trees, and a learning rate; Performing parameter configuration on the extreme gradient boosting model by using the model parameter set to obtain a configured extreme gradient boosting model; Inputting the training feature set into the configured extreme gradient boosting model to perform data prediction to obtain an initial prediction result; Calculating the loss value of the initial prediction result by using a preset loss function to obtain a target loss value; Calculating target gradient data by using the target loss value, and updating parameters of the extreme gradient boosting model by using a preset gradient descent algorithm and the target loss value based on the verification feature set to obtain an extreme gradient boosting model after parameter update; The high-level feature set is input into the extreme gradient boosting model after the parameter update to perform feature classification to obtain a classification feature set.
6. The method for identifying rice diseases based on random forest according to claim 1, characterized in that: The step of inputting the classification feature set into a preset Bayesian optimization algorithm for feature optimization to obtain an optimized feature set includes: Defining a parameter space for the classification feature set to obtain a target parameter space; Extracting feature selection parameters from the target parameter space to obtain feature selection parameters; Extracting samples from the target parameter space to obtain a sample set; Based on the feature selection parameters and the sample set, the classification feature set is input into the Bayesian optimization algorithm for feature optimization to obtain the optimized feature set.
7. The method for identifying rice diseases based on random forest according to claim 6, characterized in that: The step of inputting the optimized feature set into the pest and disease identification model based on random forest to identify rice pests and diseases to obtain pest and disease identification data, wherein the pest and disease identification data includes: disease spot area and disease spot type, matching the rice in the target area with the disease type through the pest and disease identification data to obtain rice disease type data includes: Inputting the optimized feature set into a pest and disease identification model based on random forest to load data, thereby obtaining loaded feature data; Performing disease spot region identification on the loaded feature data to obtain a disease spot region set, and performing region classification on the disease spot region set to obtain multiple groups of disease spot sub-regions; Performing lesion type analysis on each group of lesion sub-regions respectively to obtain the lesion type corresponding to each group of lesion sub-regions; Generate the pest identification data based on the lesion type corresponding to each group of lesion sub-areas, wherein the pest identification data includes: lesion area and lesion type; The disease and insect pest identification data is used to match the rice in the target area with the disease type to obtain rice disease type data.
8. A rice disease identification system based on random forest, used to execute the rice disease identification method based on random forest as claimed in any one of claims 1 to 7, characterized in that: include: A collection module, used for collecting rice leaf images in a target area, and annotating the rice leaf images to obtain annotated rice leaf images; An enhancement module, used for performing image enhancement on the labeled rice leaf image to obtain an enhanced rice leaf image; An extraction module, used for extracting high-level features from the enhanced rice leaf image to obtain a high-level feature set; A classification module, used for inputting the high-level feature set into a preset extreme gradient boosting model for feature classification to obtain a classification feature set; An optimization module, used for inputting the classification feature set into a preset Bayesian optimization algorithm for feature optimization to obtain an optimized feature set; The identification module is used to input the optimized feature set into a pest and disease identification model based on random forest to identify rice pests and diseases, and obtain pest and disease identification data, wherein the pest and disease identification data includes: disease spot area and disease spot type, and the rice in the target area is matched with the disease type through the pest and disease identification data to obtain rice disease type data.
