Grass pest recognition method and system based on target recognition model
By constructing an integrated grass-worm recognition model, using enhanced annotation and multi-scale differential attention mechanism, combined with grid algorithms and expert experience database, the problem of low accuracy of grass-worm recognition in rice fields is solved, accurate and rapid identification and hazard assessment are achieved, and the intelligence and efficiency of agricultural production are improved.
Patent Information
- Application Number
- CN202511051591.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-29
- Publication Date
- 2025-08-29
AI Technical Summary
The existing grass pest identification methods have low recognition accuracy in rice fields, especially in complex backgrounds, and it is difficult to distinguish weeds and pests with high similarity. They lack real-time and automation, and cannot meet the needs of large-scale farmland monitoring.
A grass-worm integrated recognition model was constructed, and the texture, color and structural characteristics of rice and malignant weeds were extracted through enhanced annotation and multi-scale differential attention mechanisms, and combined with grid algorithms and expert experience databases to achieve accurate and rapid identification and hazard assessment.
It improves the accuracy and real-time identification of pests in rice fields, reduces the rate of misjudgment, supports targeted zoning application, and improves the intelligence and efficiency of agricultural production.
Smart Images

Figure CN120564052A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of model recognition, and in particular relates to a grass insect pest recognition method and system based on a target recognition model. Background Art
[0002] With the development of modern agriculture, the identification and diagnosis of grass pests has become an important task in agricultural production. Traditional grass pest identification methods mainly rely on manual observation and empirical judgment. This method is not only time-consuming and labor-intensive, but also easily affected by human factors, resulting in low recognition accuracy. In recent years, technologies based on image processing and machine learning have been widely used in the agricultural field, but existing grass pest identification methods still have some shortcomings. First, existing image recognition systems usually require a large amount of labeled data for training, and obtaining high-quality labeled data is costly and time-consuming. Second, existing methods have low recognition accuracy in complex backgrounds, especially when lighting conditions vary greatly and image quality is poor. In addition, existing systems often lack real-time performance and automation, and cannot meet the needs of large-scale farmland monitoring.
[0003] The above existing technologies have the following problems: although the existing technologies can only identify weed types with large differences and pests exposed outside, there are many weeds in rice-growing farmlands that are very similar to rice, especially malignant weeds such as barnyard grass and chinensis in the seedling and tillering stages, which are very similar to rice seedlings. This causes the existing identification methods to cause identification errors during identification. Although the existing technology can use a hyperspectral imaging system to identify barnyard grass, a single spectral feature is difficult to distinguish between barnyard grass and rice, and hyperspectral imaging is sensitive to weather and brightness, and the equipment is expensive and should not be promoted. In addition, during the growth of rice, many pests will be inside the rice or wrapped by rice leaves, resulting in the inability to identify the corresponding pests, causing losses to rice growth. For this reason, the present invention provides a grass pest identification method and system based on a target recognition model. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this paper proposes a method and system for identifying weed and insect pests based on a target recognition model. The method involves first acquiring image data of rice during its seedling and tillering stages, performing enhanced annotation of the rice and different weed types, and performing enhanced classification annotation of the insect pest images to generate weed identification pairs and pest identification sequences. Second, these sequences are input into the weed and pest enhanced identification sub-models within an integrated weed and insect recognition model, respectively, to achieve dual identification of weeds and pests. Third, grid and clustering algorithms are used to determine the types and numbers of malignant and non-malignant weeds and the number of different pest types in each area. Finally, an evaluation algorithm, combined with weed and insect damage scores from an expert experience database, determines the weed and insect damage level and overall comprehensive damage level for each area of the monitored plot. This method achieves accurate and rapid identification and damage level assessment of weed and insect pests in farmland.
[0005] To achieve the above object, the present invention provides the following technical solutions:
[0006] A grass insect pest identification method based on a target recognition model, comprising the following steps:
[0007] S1. Obtain images of rice in the monitoring plot during the seedling and tillering stages, as well as images of different types of weeds and insect pests during the corresponding periods. Perform a first enhanced annotation on the rice and different types of weeds, and simultaneously perform enhanced classification annotation on the insect pest images to obtain enhanced weed identification sequences and pest identification sequences.
[0008] S2. Inputting the enhanced weed recognition pair sequence into the weed enhanced recognition sub-model of the configured weed-insect integrated recognition model to perform dual weed recognition training. Simultaneously, inputting the pest recognition sequence into the pest enhanced recognition sub-model of the weed-insect integrated recognition model to perform pest enhanced classification and recognition training. A trained weed-insect integrated recognition model is obtained and outputs different weed types and pest types.
[0009] S3. Based on the different weed types and pest types obtained, a grid algorithm combined with a clustering algorithm is used to obtain data and numbers of malignant weed types and non-malignant weed types, as well as numbers of leaf-rolling and non-leaf-rolling pests in the corresponding weed types in each area;
[0010] S4. Based on the data and number of malignant weed types and the data and number of non-malignant weed types and the number of leaf-curling and non-leaf-curling pests in the weed types corresponding to each area, and the pre-saved damage scores of each type of grass and insects, the evaluation algorithm is used to obtain the grass-insect damage level corresponding to each area of the monitored plot and the comprehensive grass-insect damage level of the monitored plot.
[0011] Specifically, the step of obtaining enhanced weed recognition sequence and pest recognition sequence in S1 includes:
[0012] S101, obtaining rice plant attribute information and images of rice seedling and tillering stages in the early, mid, and late time periods, and constructing a rice triplet feature library in the seedling and tillering stages based on the rice plant attribute information through natural language;
[0013] S102: configuring a trained automatic annotation model based on a triplet feature library of rice at the seedling and tillering stages, and performing enhanced feature annotation on leaf veins, leaf edges, auricles, ligules, and fine hairs on the ligules in images of the rice at the seedling and tillering stages, thereby obtaining annotated images of the rice at the seedling and tillering stages;
[0014] S103, performing primary classification of weed types using an image similarity matching algorithm based on images of different types of weeds at the rice seedling and tillering stages, to obtain types of similarly malignant weeds and broadleaf weeds;
[0015] S104. Based on the text feature information of similar malignant weeds, an automatic annotation model is used to perform first enhanced feature annotation and type annotation on the malignant weeds, and weed type annotation is performed on the broadleaf weeds, thereby obtaining the annotated enhanced malignant weed type and broadleaf weed type.
[0016] S105. Construct an enhanced weed recognition pair sequence based on the labeled rice seedling and tillering stage images and the labeled enhanced malignant weed type images, and construct a common weed recognition sequence based on the labeled broadleaf weed types and the seedling and tillering stage images labeled only with rice type labels.
[0017] Specifically, the step of obtaining enhanced weed recognition sequences and pest recognition sequences in S1 further includes:
[0018] S106, performing primary classification on the insect pest image data to obtain leaf roller images and non-leaf roller images;
[0019] S107. Based on the white spot characteristics and curling characteristics of leaves corresponding to leaf rollers, the leaf roller images are enhanced and the pest types are labeled. Based on the yellowing spot characteristics and pest type characteristics of leaves corresponding to non-leaf rollers, the non-leaf roller images are labeled to obtain enhanced leaf roller and non-leaf roller identification sequences.
[0020] Specifically, the steps for conducting dual weed identification training include:
[0021] S201, inputting the enhanced weed recognition pair sequence and the common weed recognition pair sequence into the background segmentation layer of the weed enhanced recognition sub-model to perform background and size segmentation, thereby obtaining the enhanced weed recognition pair sequence and the common weed recognition pair sequence with the same input size;
[0022] S202, randomly sorting the segmented enhanced weed identification pair sequence and the common weed identification pair sequence through a random sorting layer to obtain a comprehensive weed identification pair sequence;
[0023] S203: Inputting the rice image in the comprehensive weed identification sequence into the first coding sublayer of the first coding layer to obtain the texture and color of the rice leaves, the semantic labels corresponding to the rice enhanced annotations, and the rice structural features; simultaneously, inputting the weed image corresponding to the rice image into the second coding sublayer of the first coding layer to obtain the texture and color of the weed leaves, the semantic labels corresponding to the weed enhanced annotations, and the rice structural features;
[0024] S204. Inputting the semantic labels and structural features of rice leaves, color, and rice enhanced annotations, and the semantic labels and structural features of weed leaves, color, and weed enhanced annotations, into a first multi-scale difference attention sublayer in the first coding layer. Using a matching similarity function and similarity threshold built into the first multi-scale difference attention sublayer, similarity values of the multi-scale features of rice and weeds in the integrated weed identification pair are obtained.
[0025] Specifically, the steps of performing dual weed identification training also include:
[0026] S205, filtering out the features whose multi-scale features of rice and weeds have similarity values greater than a similarity threshold, to obtain a first multi-scale difference feature space and a first filtering loss;
[0027] S206, repeating the processes of S203 and S204, inputting the first multi-scale difference feature space into the first coding sublayer and the second coding sublayer of the second coding layer simultaneously for half down-sampling, and inputting the output result into the second multi-scale difference attention sublayer of the second coding layer for similar feature filtering, to obtain a second multi-scale difference feature space and a second filtering loss;
[0028] S207, repeating S206 to perform one-quarter downsampling and similar feature filtering and one-eighth downsampling and similar feature filtering on the second multi-scale difference feature space, to obtain a third multi-scale difference feature space and a third filtering loss and a fourth multi-scale difference feature space and a fourth filtering loss;
[0029] S208, inputting the first multi-scale difference feature space, the second multi-scale difference feature space, the third multi-scale difference feature space, and the fourth multi-scale difference feature space into an upsampling layer, performing upsampling, and mapping the channel dimensions of the corresponding multi-scale difference feature spaces to the same channel dimensions as the images in the comprehensive weed recognition sequence in S202;
[0030] S209: Input the upsampled first multi-scale difference feature space, second multi-scale difference feature space, third multi-scale difference feature space, and fourth multi-scale difference feature space into a feature fusion layer, and concatenate them through corresponding channel dimensions to obtain a comprehensive multi-scale difference feature space.
[0031] Specifically, the steps of performing dual weed identification training also include:
[0032] S210, inputting the integrated multi-scale difference feature space into the lightweight decoding layer to obtain the type of rice and each malignant and broadleaf weed and the corresponding classification loss;
[0033] S211. Set a loss threshold and an early stopping threshold, and construct a comprehensive training loss based on the first filtering loss, the second filtering loss, the third filtering loss, the fourth filtering loss, and the classification loss;
[0034] S212: When the comprehensive training losses corresponding to consecutive early stopping threshold training cycles are all less than the loss threshold, a trained weed enhancement recognition sub-model is obtained.
[0035] Specifically, the steps of training the pest enhanced recognition sub-model include:
[0036] S213, segmenting the image in the enhanced leaf roller identification sequence into the same size as the weed identification pair, and inputting the image into the first coding sublayer of the first coding layer in S203 to obtain the leaf roller body type features and the color, texture, and curl features of the leaf roller-infested leaves. Simultaneously, segmenting the non-leaf roller identification sequence into the same size as the weed identification pair, and inputting the image into the second coding sublayer of the first coding layer in S203 to obtain the non-leaf roller body type features and the color, texture, and bite mark features of the leaf roller-infested leaves.
[0037] S214: Input the leaf roller type features and the color, texture, and curl features of the leaf roller-infested leaves, as well as the non-leaf roller type features and the color, texture, and bite mark features of the leaf roller-infested leaves, into the first multi-scale difference attention sublayer in the first encoding layer in S204 to obtain the first leaf roller and non-leaf roller type pest difference feature space and the fifth filtering loss;
[0038] S215, repeating the process of S214, inputting the first leaf-rolling and non-leaf-rolling type pest difference feature space into the second encoding layer of the process of S206, to obtain the second leaf-rolling and non-leaf-rolling type pest difference feature space and the sixth filtering loss;
[0039] S216, inputting the first feature space of the difference between leaf-rolling and non-leaf-rolling pests and the second feature space of the difference between leaf-rolling and non-leaf-rolling pests into the second feature fusion layer and the second lightweight decoding layer of the pest enhanced recognition sub-model in sequence, to obtain each pest type of leaf rollers and the corresponding classification loss, and each pest type of non-leaf rollers and the corresponding classification loss;
[0040] S217: Construct a second comprehensive training loss based on the fifth filtering loss, the sixth filtering loss, the classification loss corresponding to leaf rollers, and the classification loss corresponding to non-leaf rollers, and repeat S212 to obtain a trained pest enhanced recognition sub-model.
[0041] Specifically, the steps for constructing the grass-insect integrated recognition model include:
[0042] S218: Set the process corresponding to S201 to S212 as a first recognition selection path, and the process corresponding to S213 to S217 as a second recognition selection path. According to the first recognition selection path and the second recognition selection path, integrate the layers and sub-layers corresponding to the weed enhanced recognition sub-model and the pest enhanced recognition sub-model to obtain a weed-insect integrated recognition model.
[0043] S219: When the identification object is a weed, the first identification selection path corresponding process is called for identification; when the identification object is a pest, the second identification selection path corresponding process is called for identification to obtain corresponding weed and pest type identification results.
[0044] A grass insect pest identification system based on a target recognition model includes: a data processing module, a grass insect identification module, a regional clustering module and a comprehensive evaluation module;
[0045] The data processing module includes a data acquisition unit and an enhanced annotation unit; the data acquisition unit is used to obtain images of rice in the seedling and tillering stages of the monitored plot, as well as images of different types of weeds and insect pests during the corresponding periods; the enhanced annotation unit performs a first enhanced annotation on the attributes of rice and different types of weeds, and simultaneously performs enhanced classification annotation on the insect pest images for leaf rollers and non-leaf rollers, thereby obtaining enhanced weed identification sequences and pest identification sequences;
[0046] The grass and insect recognition module includes a weed recognition unit, a pest recognition unit, and a path selection unit; the weed recognition unit performs dual weed recognition based on the enhanced weed recognition pair sequence through the configured weed enhanced recognition sub-model in the grass-insect integrated recognition model to obtain different weed types; the pest recognition unit performs enhanced pest classification recognition based on the pest recognition sequence through the pest enhanced recognition sub-model in the grass-insect integrated recognition model to obtain different pest types; the path selection unit constructs a first recognition selection path and a second recognition selection path based on the recognition process of the weed recognition unit and the pest recognition unit, and selects the corresponding recognition selection path according to whether the recognition object is a weed or a pest.
[0047] Specifically, the regional clustering module includes a division clustering unit and a measurement unit;
[0048] Divide the cluster units, and according to the different weed types and pest types obtained, use the grid algorithm combined with the clustering algorithm to obtain the corresponding data of the malignant weed type and non-malignant weed type and different types of pests in each area;
[0049] A measurement unit is used to automatically count the number of malignant weed types and non-malignant weed types and the number of pests in each area after the clustering unit is divided into clusters, and obtain the corresponding number of each type of weeds and leaf-curling and non-leaf-curling pests in each area;
[0050] The comprehensive evaluation module obtains the corresponding weed-insect damage degree of each area of the monitoring plot and the comprehensive weed-insect damage degree of the monitoring plot through an evaluation algorithm based on the corresponding number of each type of weeds and pests in each area of the monitoring plot and the pre-saved damage score of each type of weeds and pests.
[0051] Compared with the prior art, the present invention has the following beneficial effects:
[0052] In response to the shortcomings of the existing technology, the present invention constructs a triple feature library of rice seedling and tillering stages and uses an automatic annotation model to enhance the annotation of subtle features such as rice leaf veins and ligule hairs, thereby significantly improving the characterization accuracy of rice growth status and morphological characteristics; through image similarity matching algorithm and multi-scale difference attention mechanism, the texture, color and structural features of rice and malignant weeds are hierarchically extracted in the weed enhancement recognition sub-model, and combined with the dynamic feature fusion strategy of multi-level downsampling and upsampling, morphologically similar rice and malignant weeds are effectively distinguished; for pest identification, the feature decoupling annotation and difference attention mechanism of leaf rollers and non-leaf rollers are used to distinguish the texture, color and structural features of rice and malignant weeds; The force sub-layer captures the local white spot features of curled leaves and the bite mark texture of non-leaf-rolling insects, respectively, and combines with the hierarchical coding structure to enhance the robustness of recognition of hidden pests; in addition, a grid clustering algorithm is used to divide the monitoring area into multiple sub-units, and combined with the hazard score weights in the expert experience library, it realizes the accurate quantitative assessment of the density of malignant weeds and pest distribution hotspots, thereby supporting zoned targeted spraying; at the same time, the weed-insect integrated recognition model uses a dual-path dynamic calling mechanism to ensure the independent extraction of weed and pest features, and uses a lightweight decoding layer and loss optimization strategy to reduce the computational complexity, taking into account both high-precision recognition and real-time requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 This is a flow chart of a grass pest identification method based on a target recognition model according to Example 1 of the present invention;
[0054] Figure 2 This is a diagram of the architecture of the grass-insect integrated recognition model according to Example 1 of the present invention;
[0055] Figure 3 This is a module diagram of a grass pest identification system based on a target recognition model in Example 2 of the present invention. DETAILED DESCRIPTION
[0056] Example 1
[0057] See also Figure 1 The present invention provides an embodiment of a grass and insect pest identification method based on a target recognition model. The target recognition model in this embodiment is applied to the identification and diagnosis of grass and insect pests, that is, the grass-insect integrated identification model in this embodiment, and the steps include:
[0058] S1. Obtain images of rice in the monitoring plot during the seedling and tillering stages, as well as images of different types of weeds and insect pests during the corresponding periods. Perform a first enhanced annotation on the rice and different types of weeds, and simultaneously perform enhanced classification annotation on the insect pest images to obtain enhanced weed identification sequences and pest identification sequences.
[0059] Furthermore, in this embodiment, the steps of obtaining enhanced weed recognition sequences and pest recognition sequences include:
[0060] S101, obtaining rice plant attribute information and images of rice seedling and tillering stages in the early, mid, and late time periods, and constructing a rice triplet feature library in the seedling and tillering stages based on the rice plant attribute information through natural language;
[0061] S102: configuring a trained automatic annotation model based on a triplet feature library of rice at the seedling and tillering stages, and performing enhanced feature annotation on leaf veins, leaf edges, auricles, ligules, and fine hairs on the ligules in images of the rice at the seedling and tillering stages, thereby obtaining annotated images of the rice at the seedling and tillering stages;
[0062] S103, performing primary classification of weed types using an image similarity matching algorithm based on images of different types of weeds at the rice seedling and tillering stages, to obtain types of similarly malignant weeds and broadleaf weeds;
[0063] Furthermore, in this embodiment, malignant weeds include long-leaved weeds like barnyard grass and Leptochloa chinensis, which are similar to rice and difficult to distinguish at first glance. In this embodiment, an expert experience algorithm is combined with a graph database to construct a malignant weed information database to store text feature information of malignant weeds, which is used for the determination and identification of malignant weeds in this embodiment.
[0064] S104. Based on the text feature information of similar malignant weeds, an automatic annotation model is used to perform first enhanced feature annotation and type annotation on the malignant weeds, and weed type annotation is performed on the broadleaf weeds, thereby obtaining the annotated enhanced malignant weed type and broadleaf weed type.
[0065] S105. Construct an enhanced weed recognition pair sequence based on the labeled rice seedling and tillering stage images and the labeled enhanced malignant weed type images, and construct a common weed recognition sequence based on the labeled broadleaf weed types and the seedling and tillering stage images labeled only with rice type labels.
[0066] S106, performing primary classification on the insect pest image data to obtain leaf roller images and non-leaf roller images;
[0067] S107. Based on the white spot characteristics and curling characteristics of leaves corresponding to leaf rollers, the leaf roller images are enhanced and the pest types are labeled. Based on the yellowing spot characteristics and pest type characteristics of leaves corresponding to non-leaf rollers, the non-leaf roller images are labeled to obtain enhanced leaf roller and non-leaf roller identification sequences.
[0068] The process constructs a triplet feature library for images of rice at different growth stages and uses an automatic labeling model to enhance the annotated rice features, ensuring accurate identification of the rice's health status. Secondly, the weed types are preliminarily classified based on the image similarity matching algorithm, and further targeted enhanced feature annotation is implemented for similar malignant weeds and broadleaf weeds. This not only improves the accuracy of weed identification, but also effectively distinguishes malignant weeds similar to crops, reducing the misjudgment rate. Finally, pest images are preliminarily classified based on whether they cause leaf curling, and feature enhancement annotation is performed on the two types of pests separately, enhancing the detection ability of hidden pests. The enhanced weed identification sequence and pest identification sequence generated by this series of steps greatly improve the timeliness and accuracy of agricultural pest control and reduce the risks in agricultural production.
[0069] S2. Inputting the enhanced weed recognition pair sequence into the weed enhanced recognition sub-model of the configured weed-insect integrated recognition model to perform dual weed recognition training. Simultaneously, inputting the pest recognition sequence into the pest enhanced recognition sub-model of the weed-insect integrated recognition model to perform pest enhanced classification and recognition training. A trained weed-insect integrated recognition model is obtained and outputs different weed types and pest types.
[0070] Further, see Figure 2 In this embodiment, the steps of constructing the grass-insect integrated recognition model include:
[0071] S201, inputting the enhanced weed recognition pair sequence and the common weed recognition pair sequence into the background segmentation layer of the weed enhanced recognition sub-model to perform background and size segmentation, thereby obtaining the enhanced weed recognition pair sequence and the common weed recognition pair sequence with the same input size;
[0072] S202, randomly sorting the segmented enhanced weed identification pair sequence and the common weed identification pair sequence through a random sorting layer to obtain a comprehensive weed identification pair sequence;
[0073] S203: Inputting the rice image in the comprehensive weed identification sequence into the first coding sublayer of the first coding layer to obtain the texture and color of the rice leaves, the semantic labels corresponding to the rice enhanced annotations, and the rice structural features; simultaneously, inputting the weed image corresponding to the rice image into the second coding sublayer of the first coding layer to obtain the texture and color of the weed leaves, the semantic labels corresponding to the weed enhanced annotations, and the rice structural features;
[0074] Furthermore, the first coding sublayer and the second coding sublayer corresponding to the first coding layer, the second coding layer, the third coding layer, and the fourth coding layer in this embodiment are all constructed by stacking three encoder layers in the original ViT (Visual Transformer);
[0075] S204, inputting the label semantics and rice structural features corresponding to the rice leaf texture, color, and rice enhanced annotations, and the label semantics and rice structural features corresponding to the weed leaf texture, color, and weed enhanced annotations into the first multi-scale difference attention sublayer in the first coding layer, and obtaining similarity values of the multi-scale features of rice and weeds in the integrated weed identification pair using a matching similarity function and a similarity threshold built into the first multi-scale difference attention sublayer;
[0076] Furthermore, in this embodiment, the first multi-scale difference attention sub-layer, the second multi-scale difference attention sub-layer, the third multi-scale difference attention sub-layer and the fourth multi-scale difference attention sub-layer are all constructed using a convolutional attention network;
[0077] S205, filtering out the features whose multi-scale features of rice and weeds have similarity values greater than a similarity threshold, to obtain a first multi-scale difference feature space and a first filtering loss;
[0078] S206, repeating the processes of S203 and S204, inputting the first multi-scale difference feature space into the first coding sublayer and the second coding sublayer of the second coding layer simultaneously for half down-sampling, and inputting the output result into the second multi-scale difference attention sublayer of the second coding layer for similar feature filtering, to obtain a second multi-scale difference feature space and a second filtering loss;
[0079] S207, repeating S206 to perform one-quarter downsampling and similar feature filtering and one-eighth downsampling and similar feature filtering on the second multi-scale difference feature space, to obtain a third multi-scale difference feature space and a third filtering loss and a fourth multi-scale difference feature space and a fourth filtering loss;
[0080] Furthermore, in this embodiment, the third multi-scale difference feature space is obtained by the third coding layer, which includes the first coding sublayer, the second coding sublayer, and the third multi-scale difference attention sublayer; the fourth multi-scale difference feature space is obtained by the fourth coding layer, which includes the first coding sublayer, the second coding sublayer, and the fourth multi-scale difference attention sublayer;
[0081] S208, inputting the first multi-scale difference feature space, the second multi-scale difference feature space, the third multi-scale difference feature space, and the fourth multi-scale difference feature space into an upsampling layer, performing upsampling, and mapping the channel dimensions of the corresponding multi-scale difference feature spaces to the same channel dimensions as the images in the comprehensive weed recognition sequence in S202;
[0082] Furthermore, in this embodiment, the upsampling layer is constructed by a first MLP sublayer, a second MLP sublayer, a third MLP sublayer, and a fourth MLP sublayer, wherein the first multi-scale difference feature space corresponds to the first MLP sublayer, the second multi-scale difference feature space corresponds to the second MLP sublayer, the third multi-scale difference feature space corresponds to the third MLP sublayer, and the fourth multi-scale difference feature space corresponds to the fourth MLP sublayer;
[0083] S209: Input the upsampled first multi-scale difference feature space, second multi-scale difference feature space, third multi-scale difference feature space, and fourth multi-scale difference feature space into a feature fusion layer, and concatenate them through corresponding channel dimensions to obtain a comprehensive multi-scale difference feature space;
[0084] Furthermore, in this embodiment, the feature fusion layer obtains a difference feature space containing different scales by performing dimensional cascade on the channel dimension of the first multi-scale difference feature space, the second multi-scale difference feature space, the third multi-scale difference feature space, and the fourth multi-scale difference feature space;
[0085] S210, inputting the integrated multi-scale difference feature space into the lightweight decoding layer to obtain the type of rice and each malignant and broadleaf weed and the corresponding classification loss;
[0086] Furthermore, in this embodiment, the lightweight decoding layer maps the fused features to the target weed type through a classification linear function;
[0087] S211. Set a loss threshold and an early stopping threshold, and construct a comprehensive training loss based on the first filtering loss, the second filtering loss, the third filtering loss, the fourth filtering loss, and the classification loss;
[0088] S212: When the comprehensive training losses corresponding to the consecutive early stopping threshold training cycles are all less than the loss threshold, a trained weed enhancement recognition sub-model is obtained;
[0089] S213, segmenting the image in the enhanced leaf roller identification sequence into the same size as the weed identification pair, and inputting the image into the first coding sublayer of the first coding layer in S203 to obtain the leaf roller body type features and the color, texture, and curl features of the leaf roller-infested leaves. Simultaneously, segmenting the non-leaf roller identification sequence into the same size as the weed identification pair, and inputting the image into the second coding sublayer of the first coding layer in S203 to obtain the non-leaf roller body type features and the color, texture, and bite mark features of the leaf roller-infested leaves.
[0090] S214: Input the leaf roller type features and the color, texture, and curl features of the leaf roller-infested leaves, as well as the non-leaf roller type features and the color, texture, and bite mark features of the leaf roller-infested leaves, into the first multi-scale difference attention sublayer in the first encoding layer in S204 to obtain the first leaf roller and non-leaf roller type pest difference feature space and the fifth filtering loss;
[0091] S215, repeating the process of S214, inputting the first leaf-rolling and non-leaf-rolling type pest difference feature space into the second encoding layer of the process of S206, to obtain the second leaf-rolling and non-leaf-rolling type pest difference feature space and the sixth filtering loss;
[0092] S216, inputting the first feature space of the difference between leaf-rolling and non-leaf-rolling pests and the second feature space of the difference between leaf-rolling and non-leaf-rolling pests into the second feature fusion layer and the second lightweight decoding layer of the pest enhanced recognition sub-model in sequence, to obtain each pest type of leaf rollers and the corresponding classification loss, and each pest type of non-leaf rollers and the corresponding classification loss;
[0093] S217, constructing a second comprehensive training loss based on the fifth filtering loss, the sixth filtering loss, the classification loss corresponding to leaf rollers, and the classification loss corresponding to non-leaf rollers, setting a second loss threshold, and repeating S212 to obtain a trained pest enhanced recognition sub-model;
[0094] S218: Set the process corresponding to S201 to S212 as a first recognition selection path, and the process corresponding to S213 to S217 as a second recognition selection path. According to the first recognition selection path and the second recognition selection path, integrate the layers and sub-layers corresponding to the weed enhanced recognition sub-model and the pest enhanced recognition sub-model to obtain a weed-insect integrated recognition model.
[0095] S219: When the identification object is a weed, the first identification selection path corresponding process is called for identification; when the identification object is a pest, the second identification selection path corresponding process is called for identification to obtain corresponding weed and pest type identification results;
[0096] By constructing an integrated weed-insect recognition model, this process achieves accurate classification and identification of weeds and pests, significantly improving the intelligent level of agricultural pest and disease control. First, by applying background segmentation, random sorting, multi-scale feature extraction, and attention mechanisms to the enhanced weed recognition sequence and pest recognition sequence, the model ensures consistency and diversity in image data of rice and its symbiotic or parasitic weeds and pests at different growth stages, enhancing the model's generalization ability. Second, by employing hierarchical encoding and multi-scale differential attention sub-layers to progressively refine feature extraction, this not only improves the accuracy of capturing subtle features (such as leaf texture and color), but also effectively distinguishes rice from weeds and leaf rollers from non-leaf rollers through similarity matching, reducing false positives. Third, by alternating multiple downsampling and upsampling steps and applying feature fusion layers, the model captures features of the target object at different scales, ensuring comprehensive coverage from macroscopic to microscopic features. Finally, the introduction of a lightweight decoding layer and a comprehensive training loss optimization strategy ensures that the model maintains high accuracy while maintaining low computational complexity, facilitating its practical deployment and application.
[0097] Furthermore, this process constructs an efficient integrated weed-insect recognition model by separating and ultimately integrating the weed and pest recognition pathways. First, the enhanced recognition sub-models for weeds and pests are optimized separately to ensure the most accurate feature extraction and classification for each object, reducing cross-interference. Next, the model utilizes techniques such as hierarchical encoding, multi-scale differential attention mechanisms, and feature fusion to improve adaptability to complex agricultural environments and recognition accuracy. Finally, the corresponding recognition pathway is selectively invoked based on the specific object being identified, achieving efficient utilization of model resources and accelerating recognition speed. This approach not only enhances the model's targeting and generalization capabilities but also simplifies operational processes in practical applications, facilitating timely and accurate monitoring of farmland pests and diseases.
[0098] S3. Based on the different weed types and pest types obtained, a grid algorithm combined with a clustering algorithm is used to obtain data and numbers of malignant weed types and non-malignant weed types, as well as numbers of leaf-rolling and non-leaf-rolling pests in the corresponding weed types in each area;
[0099] Furthermore, in this embodiment, when different weed and pest types are obtained, weed and pest counts of different types are also performed simultaneously. Based on the different weed and pest types and the corresponding counting results, the monitoring plot is divided using a grid algorithm, and the weeds and pests of the same type in each area are clustered for centralized monitoring and calculation. The data and number of malignant weed types and non-malignant weed types, as well as the number of leaf-curling and non-leaf-curling pests, are obtained for each weed type in each area. This is because both weeds and pests generally appear in patches in fields.
[0100] S4. Based on the data and number of malignant weed types and the data and number of non-malignant weed types and the number of leaf-curling and non-leaf-curling pests in the weed types corresponding to each area, and the pre-saved damage scores of each type of grass and insects, the evaluation algorithm is used to obtain the grass-insect damage level corresponding to each area of the monitored plot and the comprehensive grass-insect damage level of the monitored plot.
[0101] Furthermore, the damage scores of each type of weed and insect stored in the expert experience database are obtained through the expert experience method. The corresponding damage degree of each type of weed and pest in the field is obtained, and the corresponding expert experience database is constructed. For each divided area, based on the obtained weed type and pest type data and the corresponding scores, the degree of damage to rice in the corresponding area can be obtained, and targeted weeding and pesticide spraying can be carried out based on this, further improving the efficiency of field management.
[0102] This process uses a grid-based algorithm combined with a clustering algorithm to fine-tune the management of monitored plots, significantly improving the efficiency and accuracy of weed and pest monitoring. First, as weed and pest types are identified, they are simultaneously counted. Based on these counts, a grid-based algorithm is used to divide the monitored plot, ensuring that weeds and pests of the same type within each area are centrally monitored and counted. This approach leverages the clustering nature of weeds and pests, improving the targetedness and efficiency of data processing. Second, a clustering algorithm groups weeds and pests of the same type together, reducing data redundancy and facilitating subsequent centralized management and analysis. Based on the damage scores for each weed and pest type stored in an expert experience database, the evaluation algorithm accurately calculates the overall weed-insect damage level for each area, providing a scientific basis for field management. This allows for targeted weed control and pesticide spraying based on actual damage levels, avoiding resource waste and environmental pollution, and further improving the efficiency and sustainability of field management. Ultimately, this approach not only optimizes resource allocation for agricultural production but also enhances the effectiveness of weed and pest control, ensuring the healthy growth of crops.
[0103] Example 2
[0104] See also Figure 3 , another embodiment provided by the present invention: a grass insect pest identification system based on a target recognition model, comprising: a data processing module, a grass insect identification module, a regional clustering module and a comprehensive evaluation module;
[0105] A data processing module is used for preprocessing and enhanced annotation of weed and pest image data; the data processing module includes a data acquisition unit and an enhanced annotation unit;
[0106] The data acquisition unit is used to acquire images of rice in the seedling and tillering stages of the monitored plot, as well as images of different types of weeds and insect pests during the corresponding periods; the enhanced annotation unit performs a first enhanced annotation on the attributes of rice and different types of weeds, and simultaneously performs enhanced classification annotation on the insect pest images for leaf rollers and non-leaf rollers, thereby obtaining enhanced weed identification sequences and pest identification sequences;
[0107] The grass and insect identification module is used to identify the types of weeds and pests. The grass and insect identification module includes a weed identification unit, a pest identification unit, and a path selection unit.
[0108] The weed recognition unit performs dual weed recognition based on the enhanced weed recognition pair sequence using the weed enhanced recognition sub-model in the configured grass-insect integrated recognition model to obtain different weed types. The pest recognition unit performs enhanced pest classification recognition based on the pest recognition sequence using the pest enhanced recognition sub-model in the grass-insect integrated recognition model to obtain different pest types.
[0109] The path selection unit constructs a first recognition selection path and a second recognition selection path according to the recognition processes of the weed recognition unit and the pest recognition unit, and selects a corresponding recognition selection path according to whether the recognition object is a weed or a pest.
[0110] Regional clustering module, used for monitoring plot area division and grass insect clustering; regional clustering module includes division clustering unit and measurement unit;
[0111] Divide the cluster units, and according to the different weed types and pest types obtained, use the grid algorithm combined with the clustering algorithm to obtain the corresponding data of the malignant weed type and non-malignant weed type and different types of pests in each area;
[0112] A measurement unit is used to automatically count the number of malignant weed types and non-malignant weed types and the number of pests in each area after the clustering unit is divided into clusters, and obtain the corresponding number of each type of weeds and leaf-curling and non-leaf-curling pests in each area;
[0113] The comprehensive evaluation module uses an evaluation algorithm to obtain the corresponding weed-insect damage level in each area of the monitored plot and the comprehensive weed-insect damage level of the monitored plot based on the corresponding number of each type of weeds and pests in each area of the monitored plot and the damage score of each type of weeds and pests stored in the expert experience database.
[0114] Example 3
[0115] An electronic device includes a memory and a processor, wherein the memory stores a computer program and the processor implements a grass insect pest identification method based on a target recognition model when executing the computer program.
[0116] A computer-readable storage medium stores computer instructions, which, when executed, execute a grass insect pest identification method based on a target identification model.
[0117] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also change, modify, replace and modify the above-mentioned embodiments without departing from the scope of protection of the purpose of the present invention and the claims, and all of these are protected by the present invention.
Claims
1. A grass insect pest identification method based on a target recognition model, characterized in that: include: S1. Obtain images of rice in the monitoring plot during the seedling and tillering stages, as well as images of different types of weeds and insect pests during the corresponding periods. Perform a first enhanced annotation on the rice and different types of weeds, and simultaneously perform enhanced classification annotation on the insect pest images to obtain enhanced weed identification sequences and pest identification sequences. S2. Inputting the enhanced weed recognition pair sequence into the weed enhanced recognition sub-model of the configured weed-insect integrated recognition model to perform dual weed recognition training. Simultaneously, inputting the pest recognition sequence into the pest enhanced recognition sub-model of the weed-insect integrated recognition model to perform pest enhanced classification and recognition training. A trained weed-insect integrated recognition model is obtained and outputs different weed types and pest types. S3. Based on the different weed types and pest types obtained, a grid algorithm combined with a clustering algorithm is used to obtain data and numbers of malignant weed types and non-malignant weed types, as well as numbers of leaf-rolling and non-leaf-rolling pests in the corresponding weed types in each area; S4. Based on the data and number of malignant weed types and the data and number of non-malignant weed types and the number of leaf-curling and non-leaf-curling pests in the weed types corresponding to each area, and the pre-saved damage scores of each type of grass and insects, the evaluation algorithm is used to obtain the grass-insect damage level corresponding to each area of the monitored plot and the comprehensive grass-insect damage level of the monitored plot.
2. A grass insect pest identification method based on a target recognition model according to claim 1, characterized in that: The step of obtaining enhanced weed recognition sequence and pest recognition sequence in S1 comprises: S101, obtaining rice plant attribute information and images of rice seedling and tillering stages in the early, mid, and late time periods, and constructing a rice triplet feature library in the seedling and tillering stages based on the rice plant attribute information through natural language; S102: configuring a trained automatic annotation model based on a triplet feature library of rice at the seedling and tillering stages, and performing enhanced feature annotation on leaf veins, leaf edges, auricles, ligules, and fine hairs on the ligules in images of the rice at the seedling and tillering stages, thereby obtaining annotated images of the rice at the seedling and tillering stages; S103, performing primary classification of weed types using an image similarity matching algorithm based on images of different types of weeds at the rice seedling and tillering stages, to obtain types of similarly malignant weeds and broadleaf weeds; S104. Based on the text feature information of similar malignant weeds, an automatic annotation model is used to perform first enhanced feature annotation and type annotation on the malignant weeds, and weed type annotation is performed on the broadleaf weeds, thereby obtaining the annotated enhanced malignant weed type and broadleaf weed type. S105. Construct an enhanced weed recognition pair sequence based on the labeled rice seedling and tillering stage images and the labeled enhanced malignant weed type images, and construct a common weed recognition sequence based on the labeled broadleaf weed types and the seedling and tillering stage images labeled only with rice type labels.
3. A grass insect pest identification method based on a target recognition model as claimed in claim 2, characterized in that: The step of obtaining enhanced weed recognition sequences and pest recognition sequences in S1 further comprises: S106, performing primary classification on the insect pest image data to obtain leaf roller images and non-leaf roller images; S107. Based on the white spot characteristics and curling characteristics of leaves corresponding to leaf rollers, the leaf roller images are enhanced and the pest types are labeled. Based on the yellowing spot characteristics and pest type characteristics of leaves corresponding to non-leaf rollers, the non-leaf roller images are labeled to obtain enhanced leaf roller and non-leaf roller identification sequences.
4. A grass insect pest identification method based on a target recognition model as claimed in claim 3, characterized in that: The steps of performing dual weed identification training include: S201, inputting the enhanced weed recognition pair sequence and the common weed recognition pair sequence into the background segmentation layer of the weed enhanced recognition sub-model to perform background and size segmentation, thereby obtaining the enhanced weed recognition pair sequence and the common weed recognition pair sequence with the same input size; S202, randomly sorting the segmented enhanced weed identification pair sequence and the common weed identification pair sequence through a random sorting layer to obtain a comprehensive weed identification pair sequence; S203: Inputting the rice image in the comprehensive weed identification sequence into the first coding sublayer of the first coding layer to obtain the texture and color of the rice leaves, the semantic labels corresponding to the rice enhanced annotations, and the rice structural features; simultaneously, inputting the weed image corresponding to the rice image into the second coding sublayer of the first coding layer to obtain the texture and color of the weed leaves, the semantic labels corresponding to the weed enhanced annotations, and the rice structural features; S204. Inputting the semantic labels and structural features of rice leaves, color, and rice enhanced annotations, and the semantic labels and structural features of weed leaves, color, and weed enhanced annotations, into a first multi-scale difference attention sublayer in the first coding layer. Using a matching similarity function and similarity threshold built into the first multi-scale difference attention sublayer, similarity values of the multi-scale features of rice and weeds in the integrated weed identification pair are obtained.
5. The grass pest identification method based on the target recognition model according to claim 4, characterized in that: The step of performing dual weed identification training also includes: S205, filtering out the features whose multi-scale features of rice and weeds have similarity values greater than a similarity threshold, to obtain a first multi-scale difference feature space and a first filtering loss; S206, repeating the processes of S203 and S204, inputting the first multi-scale difference feature space into the first coding sublayer and the second coding sublayer of the second coding layer simultaneously for half down-sampling, and inputting the output result into the second multi-scale difference attention sublayer of the second coding layer for similar feature filtering, to obtain a second multi-scale difference feature space and a second filtering loss; S207, repeating S206 to perform one-quarter downsampling and similar feature filtering and one-eighth downsampling and similar feature filtering on the second multi-scale difference feature space, to obtain a third multi-scale difference feature space and a third filtering loss and a fourth multi-scale difference feature space and a fourth filtering loss; S208, inputting the first multi-scale difference feature space, the second multi-scale difference feature space, the third multi-scale difference feature space, and the fourth multi-scale difference feature space into an upsampling layer, performing upsampling, and mapping the channel dimensions of the corresponding multi-scale difference feature spaces to the same channel dimensions as the images in the comprehensive weed recognition sequence in S202; S209: Input the upsampled first multi-scale difference feature space, second multi-scale difference feature space, third multi-scale difference feature space, and fourth multi-scale difference feature space into a feature fusion layer, and concatenate them through corresponding channel dimensions to obtain a comprehensive multi-scale difference feature space.
6. A grass insect pest identification method based on a target recognition model as claimed in claim 5, characterized in that: The step of performing dual weed identification training also includes: S210, inputting the integrated multi-scale difference feature space into the lightweight decoding layer to obtain the type of rice and each malignant and broadleaf weed and the corresponding classification loss; S211. Set a loss threshold and an early stopping threshold, and construct a comprehensive training loss based on the first filtering loss, the second filtering loss, the third filtering loss, the fourth filtering loss, and the classification loss; S212: When the comprehensive training losses corresponding to consecutive early stopping threshold training cycles are all less than the loss threshold, a trained weed enhancement recognition sub-model is obtained.
7. A grass insect pest identification method based on a target recognition model according to claim 6, characterized in that: The training steps of the pest enhanced recognition sub-model include: S213, segmenting the image in the enhanced leaf roller identification sequence into the same size as the weed identification pair, and inputting the image into the first coding sublayer of the first coding layer in S203 to obtain the leaf roller body type features and the color, texture, and curl features of the leaf roller-infested leaves. Simultaneously, segmenting the non-leaf roller identification sequence into the same size as the weed identification pair, and inputting the image into the second coding sublayer of the first coding layer in S203 to obtain the non-leaf roller body type features and the color, texture, and bite mark features of the leaf roller-infested leaves. S214: Input the leaf roller type features and the color, texture, and curl features of the leaf roller-infested leaves, as well as the non-leaf roller type features and the color, texture, and bite mark features of the leaf roller-infested leaves, into the first multi-scale difference attention sublayer in the first encoding layer in S204 to obtain the first leaf roller and non-leaf roller type pest difference feature space and the fifth filtering loss; S215, repeating the process of S214, inputting the first leaf-rolling and non-leaf-rolling type pest difference feature space into the second encoding layer of the process of S206, to obtain the second leaf-rolling and non-leaf-rolling type pest difference feature space and the sixth filtering loss; S216, inputting the first feature space of the difference between leaf-rolling and non-leaf-rolling pests and the second feature space of the difference between leaf-rolling and non-leaf-rolling pests into the second feature fusion layer and the second lightweight decoding layer of the pest enhanced recognition sub-model in sequence, to obtain each pest type of leaf rollers and the corresponding classification loss, and each pest type of non-leaf rollers and the corresponding classification loss; S217: Construct a second comprehensive training loss based on the fifth filtering loss, the sixth filtering loss, the classification loss corresponding to leaf rollers, and the classification loss corresponding to non-leaf rollers, and repeat S212 to obtain a trained pest enhanced recognition sub-model.
8. A grass insect pest identification method based on a target recognition model as claimed in claim 7, characterized in that: The steps of constructing the grass-insect integrated recognition model include: S218: Set the process corresponding to S201 to S212 as a first recognition selection path, and the process corresponding to S213 to S217 as a second recognition selection path. According to the first recognition selection path and the second recognition selection path, integrate the layers and sub-layers corresponding to the weed enhanced recognition sub-model and the pest enhanced recognition sub-model to obtain a weed-insect integrated recognition model. S219: When the identification object is a weed, the first identification selection path corresponding process is called for identification; when the identification object is a pest, the second identification selection path corresponding process is called for identification to obtain corresponding weed and pest type identification results.
9. A grass insect pest identification system based on a target recognition model, which is used to implement a grass insect pest identification method based on a target recognition model according to any one of claims 1 to 8, characterized in that: include: Data processing module, grass insect identification module, regional clustering module and comprehensive evaluation module; The data processing module includes a data acquisition unit and an enhanced annotation unit; The data acquisition unit is used to acquire images of rice in the seedling and tillering stages of the monitored plot, as well as images of different types of weeds and insect pests during the corresponding periods; the enhanced labeling unit performs a first enhanced labeling of rice attributes and different types of weed attributes, and simultaneously performs enhanced classification labeling of leaf rollers and non-leaf rollers on the insect pest images to obtain enhanced weed identification sequences and pest identification sequences; The grass and insect identification module includes a weed identification unit, a pest identification unit, and a path selection unit; the weed identification unit performs dual weed identification based on the enhanced weed identification pair sequence through the weed enhanced identification sub-model in the configured grass-insect integrated identification model to obtain different weed types; The pest identification unit performs enhanced pest classification and identification based on the pest identification sequence and obtains different pest types through the pest enhanced identification sub-model in the grass-insect integrated identification model; The path selection unit constructs a first recognition selection path and a second recognition selection path according to the recognition processes of the weed recognition unit and the pest recognition unit, and selects a corresponding recognition selection path according to whether the recognition object is a weed or a pest.
10. The grass pest identification system based on target recognition model according to claim 9, characterized in that: The regional clustering module includes a clustering unit and a measurement unit; The clustering unit is divided, and according to the different weed types and pest types obtained, a grid algorithm is combined with a clustering algorithm to obtain the data of the malignant weed type and the non-malignant weed type and the different types of pests corresponding to each area; The metering unit is used to automatically count the number of malignant weed types and non-malignant weed types and the number of pests in each area after the clustering unit divides the clusters, and obtain the corresponding number of each type of weeds and leaf-curling and non-leaf-curling pests in each area; The comprehensive assessment module obtains the weed-insect damage level corresponding to each area of the monitored plot and the comprehensive weed-insect damage level of the monitored plot through an assessment algorithm based on the corresponding number of each type of weeds and pests in each area of the monitored plot and the pre-stored damage score of each type of weeds and pests.
Citation Information
Patent Citations
Method and device for identifying crop diseases, pests and weeds
CN109344738A
Rice tillering stage weed segmentation identification method based on improved coding and decoding network
CN113610035A
Weed detection method based on multi-scale fusion module and feature enhancement
CN113657326A
Crop disease, pest and weed identification processing method and device, electronic equipment and storage medium
CN113705419A
Crop disease and pest identification method and device based on incremental learning and storage medium
CN114283308A