Intelligent identification method and system for cotton diseases and insect pests based on transfer learning
Through the transfer learning method, the problem of low accuracy in identification of cotton pests and diseases is solved. The recognition model is generated through feature analysis and model adjustment, which improves the identification accuracy of cotton pests and diseases, and provides reliable technical support for agricultural prevention and control work.
Patent Information
- Application Number
- CN202410758154.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-11-01
AI Technical Summary
The prior art has low accuracy in automatically classifying and classifying cotton pests and diseases, which affects the timeliness and effectiveness of prevention and control work.
Using a transfer learning method, by obtaining the characteristic analysis of cotton pests and diseases, determining the basic information and distinction information of identification, using pre-trained models for model adjustment and transfer learning, generating cotton pest recognition models, and adding them to the recognition platform to achieve the Accurate recognition of cotton pest and diseases images.
It improves the accuracy of identification of cotton pests and diseases, ensures the timeliness and effectiveness of prevention and control work, and provides reliable technical support for agriculture.
Smart Images

Figure CN118887670A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent identification technology, and in particular to a method and system for intelligent identification of cotton pests and diseases based on transfer learning. Background Art
[0002] Modern agriculture has a high demand for accurate identification of pests and diseases. Pests and diseases are important factors affecting the yield and quality of crops. Therefore, accurate and timely identification of pests and diseases is crucial for agricultural production. Cotton pests and diseases are common problems in the cotton planting process, which have a serious impact on the growth and yield of cotton. Common cotton diseases include wilt, verticillium wilt, blight, anthrax, angular spot, powdery mildew and red mildew. These diseases can cause poor growth of cotton plants, yellowing of leaves, falling flowers and bolls, and even death of the entire plant. Common cotton pests include cotton bollworm, pink bollworm, blind stink bug, cotton aphid, corn borer, American leafminer, cotton thrips, bridge worm, diamond borer, weevil, whitefly, beet armyworm, and cutworm. These pests will eat the leaves, buds and bolls of cotton, resulting in a decrease in cotton yield and quality. In order to effectively prevent and control cotton pests and diseases, a series of measures need to be taken. Strengthen field management, including timely clearing of pest and disease sources, reasonable adjustment of planting density, scientific fertilization, etc., to improve cotton's resistance to pests and diseases.
[0003] At present, traditional pest and disease identification methods mainly rely on manual experience and expert knowledge, or use drones and remote sensing technology to improve pest and disease monitoring capabilities.
[0004] In summary, the existing technology has obvious deficiencies in the automatic division and classification of cotton pests and diseases, and the accuracy of the identification results is low, which directly affects the timeliness and effectiveness of prevention and control work. Summary of the invention
[0005] The purpose of this application is to provide a method and system for intelligent identification of cotton diseases and pests based on transfer learning, so as to solve the problem that the existing technology has obvious deficiencies in automatic division and classification of cotton diseases and pests, and the accuracy of the identification results is low, which directly affects the timeliness and effectiveness of prevention and control work.
[0006] In view of the above problems, the present application provides a method and system for intelligent identification of cotton diseases and pests based on transfer learning.
[0007] In a first aspect, the present application provides a method for intelligent identification of cotton pests and diseases based on transfer learning, wherein the method is implemented by an intelligent identification system for cotton pests and diseases based on transfer learning, wherein the method comprises: obtaining the category of cotton pests and diseases, performing pest feature analysis of each category, determining basic identification information and identification difference information, wherein the basic identification information is the overlapping features of each category of pests and diseases, and the identification difference information is the identification features that are distinctive between the categories; performing identification requirement analysis based on the identification basic information, and determining a pre-trained model, wherein the pre-trained model is a trained model that can identify basic information; adjusting the pre-trained model according to the identification difference information, setting model accuracy requirements, performing model transfer learning using a data sample set, obtaining a cotton pest and disease identification model, and adding the cotton pest and disease identification model to an identification platform; the identification platform receives an identification task, wherein the identification task at least includes an identification request image, and uses the cotton pest and disease identification model to identify the identification request image, and outputs an identification result; using the identification result as a feedback result, and sending it according to a preset path, wherein the preset path includes a platform display path and a customer-defined path.
[0008] In the second aspect, the present application also provides a cotton pest and disease intelligent identification system based on transfer learning, which is used to execute the cotton pest and disease intelligent identification method based on transfer learning as described in the first aspect, wherein the system includes: a feature analysis module, the feature analysis module is used to obtain the cotton pest and disease category, perform pest feature analysis of each category, determine basic identification information and identification distinction information, the basic identification information is the overlapping features of each category of pest and disease, and the identification distinction information is the identification features that are distinctive between each category; a requirement analysis module, the requirement analysis module is used to perform identification requirement analysis based on the identification basic information, and determine a pre-trained model, the pre-trained model is a trained model that can identify basic information; a cotton pest and disease identification model An acquisition module, the cotton pest and disease identification model acquisition module is used to adjust the pre-trained model according to the identification distinction information, set the model accuracy requirements, use the data sample set to perform model transfer learning, obtain the cotton pest and disease identification model, and add the cotton pest and disease identification model to the identification platform; an image recognition module, the image recognition module is used for the identification platform to receive identification tasks, the identification tasks at least include identification request images, use the cotton pest and disease identification model to identify the identification request images, and output identification results; a feedback result sending module, the feedback result sending module is used to send the identification results as feedback results according to a preset path, and the preset path includes a platform display path and a customer-defined path.
[0009] One or more technical solutions provided in this application have at least the following technical effects or advantages:
[0010] By obtaining the categories of cotton pests and diseases, analyzing the pest characteristics of each category, determining basic identification information and identification difference information, wherein the basic identification information is the overlapping characteristics of each category of pests and diseases, and the identification difference information is the identification characteristics that are distinctive between each category; based on the basic identification information, performing identification requirement analysis, determining a pre-trained model, wherein the pre-trained model is a trained model that can identify basic information; adjusting the pre-trained model according to the identification difference information, setting model accuracy requirements, using a data sample set to perform model transfer learning, obtaining a cotton pest and disease identification model, and adding the cotton pest and disease identification model to an identification platform; the identification platform receives an identification task, wherein the identification task at least includes an identification request image, and uses the cotton pest and disease identification model to identify the identification request image, and outputs an identification result; using the identification result as a feedback result, sending it along a preset path, wherein the preset path includes a platform display path and a customer-defined path. It effectively solves the obvious deficiencies of existing technologies in automatically dividing and classifying cotton pests and diseases, and the low accuracy of recognition results, which directly affects the timeliness and effectiveness of prevention and control work. It uses transfer learning to fine-tune the pre-trained model to make its recognition results more accurate, providing reliable guarantees for prevention and control work.
[0011] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented according to the contents of the specification, and in order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are specifically cited below. It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easy to understand through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the present application or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0013] Figure 1 This is a flow chart of the intelligent identification method of cotton pests and diseases based on transfer learning in this application;
[0014] Figure 2 This is a schematic diagram of the structure of the cotton pest and disease intelligent identification system based on transfer learning in this application.
[0015] Description of reference numerals:
[0016] Feature analysis module 11, requirement analysis module 12, cotton disease and insect pest identification model acquisition module 13, image recognition module 14, feedback result sending module 15. DETAILED DESCRIPTION
[0017] This application provides a method and system for intelligent identification of cotton pests and diseases based on transfer learning, which solves the obvious deficiencies of the existing technology in automatically dividing and classifying cotton pests and diseases, and the low accuracy of the identification results, which directly affects the timeliness and effectiveness of the prevention and control work. Transfer learning is used to perform fine-tuning on the basis of the pre-trained model to make its identification results more accurate, thereby providing a reliable guarantee for the prevention and control work.
[0018] Below, the technical solutions in the present application will be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments of the present application. It should be understood that the present application is not limited to the example embodiments described herein. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application. It should also be noted that, for the convenience of description, only the parts related to the present application are shown in the accompanying drawings, rather than all of them.
[0019] Embodiment 1
[0020] Please see attached Figure 1 The present application provides a method for intelligently identifying cotton pests and diseases based on transfer learning, wherein the method is applied to an intelligent identification system for cotton pests and diseases based on transfer learning, and the method specifically comprises the following steps:
[0021] Step 1: Obtain the categories of cotton pests and diseases, analyze the pest characteristics of each category, and determine basic identification information and identification distinction information. The basic identification information is the overlapping characteristics of each category of pests and diseases, and the identification distinction information is the identification characteristics that are distinguishable between each category;
[0022] Specifically, the categories of cotton pests and diseases include root rot, damping-off, anthracnose, wilt, verticillium wilt, red rot and leaf spot, and the main pests are cotton bollworm, cotton aphid, cotton thrips, blind bugs, cotton spider mites, beet armyworm and pink bollworm. Damping-off and anthracnose, both of which can occur in the entire seedling stage from cotton sowing to emergence, can cause rotten seeds, rotten buds and rotten roots. In the diseased seedlings of damping-off, pale yellow or yellow-brown lesions will appear at the base of the stem, which will then expand around the tender stems to make the diseased parts dark brown and constricted, while anthracnose will cause reddish-brown spindle-shaped stripes on the stems close to the ground. The basic information for identifying these two diseases is that both will cause symptoms such as root rot and rotten buds in the cotton seedling stage, but the difference lies in the different colors and shapes of the lesions. Cotton wilt can show symptoms from the cotyledon stage, such as a large number of leaves falling off. According to different symptoms, it can be divided into wilt type, yellow reticulated type, dwarf type, etc. The common identification basic information of these types is that the plants will have symptoms such as leaf wilt, yellowing, and falling off, but the difference lies in the specific manifestations of the symptoms. For example, the leaves of the green withering type remain unchanged in color and wilt and droop, while the yellow reticulated type has yellow spots on the leaves and gradually turns brown and dies. Cotton aphids pierce the back or tender head of cotton leaves with their piercing and sucking mouthparts to suck juice. The leaves of cotton seedlings infested by cotton aphids turn yellow and fall off, and there is honeydew excreted by aphids on the surface, which is also easy to induce mold growth. The basic identification information is that the leaves show symptoms such as yellowing and falling off, accompanied by honeydew and mold growth. The identification difference information is that cotton aphids mainly infest the seedling stage of cotton, and the back of the leaves or tender heads are their main feeding parts. Cotton bollworms mainly harm the buds, bolls, and flowers of cotton. The bracts of the damaged buds burst and fall off, causing the damaged flowers to fail to form bolls normally, and the green bolls are damaged, causing rotten bolls. The basic identification information is that the buds, bolls, and flowers of cotton are damaged, and the bracts burst and fall off. The identification information is that the cotton bollworm mainly harms the bud and boll stage of cotton, and its feeding parts are specifically buds, bolls and flowers.
[0023] Step 2: Perform recognition requirement analysis based on the recognition basic information and determine a pre-trained model, where the pre-trained model is a trained model that can recognize the basic information;
[0024] Specifically, identifying basic information, that is, the overlapping features of various categories of pests and diseases, is the key to the model's accurate identification. These overlapping features may include the common manifestations of pests and diseases in morphology, color, texture, etc., which are the basis for the model to distinguish pests and diseases from other non-pest and disease objects. A pre-trained model is a model that has been trained and completed on a large amount of data. You can choose pre-trained models that perform well in image detection tasks, such as SSD, RetinaNet, FasterRCNN, YoloV8, etc. These models have learned a large number of image features during the training process, including color, shape, texture, etc., which are also very important for the identification of pests and diseases. By fine-tuning these pre-trained models, we can make them better suited to the identification task of cotton pests and diseases.
[0025] Step 3: adjusting the pre-trained model according to the identification distinction information, setting the model accuracy requirements, using the data sample set to perform model transfer learning, obtaining a cotton pest and disease identification model, and adding the cotton pest and disease identification model to the identification platform;
[0026] Specifically, according to the identification distinction information, we need to make targeted adjustments to the pre-trained model so that it can more accurately identify various types of cotton pests and diseases. Identification distinction information refers to the identification features that are distinguishable between categories. Model accuracy refers to the correct recognition rate of the model on the test set, which directly reflects the performance of the model. According to actual needs, a reasonable model accuracy requirement can be set, such as achieving a recognition accuracy rate of more than 90%. Use the data sample set for model transfer learning. The core idea of transfer learning is to use existing knowledge and models to solve new problems. The model can be trained and adjusted using an existing annotated data sample set. The pre-trained model can be used as the initial model, and then fine-tuned on the data sample set of cotton pests and diseases. Through continuous iteration and optimization, the model gradually adapts to the new recognition task and improves its recognition performance. Various optimization strategies can be used to improve the performance of the model. For example, use a more complex network structure to extract more feature information, use data enhancement technology to increase the diversity of samples, and use regularization methods to prevent model overfitting. These strategies can be flexibly selected and adjusted according to actual conditions. When the model reaches the set accuracy requirements, it can be saved and deployed on the recognition platform. The recognition platform is a software system that integrates multiple recognition models. It can receive cotton pest and disease images uploaded by users and automatically call the corresponding recognition model for recognition. By adding the cotton pest and disease recognition model to the recognition platform, it can achieve rapid and accurate recognition of cotton pests and diseases, providing strong technical support for agricultural production.
[0027] Step 4: the recognition platform receives a recognition task, the recognition task at least includes a recognition request image, uses the cotton pest and disease recognition model to recognize the recognition request image, and outputs a recognition result;
[0028] Specifically, the recognition platform first receives the recognition request submitted by the user, which is usually an image file transmitted over the network. Users can upload images through the platform's user interface or send recognition requests directly through the API interface. Before sending the image to the recognition model, the platform may perform a series of preprocessing operations on the image, such as scaling and padding, to ensure that the image meets the input requirements of the model. For example, determine the category of pests and diseases to be identified, then collect pictures. If the number is not enough, continue to collect new photos, then mark the pictures to establish a data set, preprocess the pictures, and then send the preprocessed images to the trained cotton pest and disease recognition model. The model analyzes and recognizes the image based on the features and patterns it has learned. After the model completes the recognition, it generates one or more recognition results, which may include information such as the type, location, and severity of the pests and diseases. The recognition platform will integrate these results into a user-friendly format, such as text, charts, or visual tags, and return them to the user through the user interface or API interface.
[0029] Step 5: The recognition result is used as a feedback result and sent according to a preset path, wherein the preset path includes a platform display path and a customer-defined path.
[0030] Specifically, after obtaining the recognition results, the recognition platform needs to send these results as feedback to the corresponding recipients according to the preset path. These preset paths are set in advance according to user needs and system configuration to ensure that the recognition results can reach the specified location accurately and in a timely manner. The recognition platform will have a user interface, and the recognition results can be directly displayed to the user on this interface. For example, a user can upload a picture of cotton pests and diseases. After the platform recognizes it, it displays the type of pests and diseases, the degree of damage and other information on the interface, initiates a request to the model, and the model starts to detect the cotton photos, returns the results, and displays them to the user in real time. The recognition results will also be recorded internally by the platform for subsequent data analysis, model optimization, etc. These records may include detailed information of the recognition request, recognition results, processing time, etc. If the platform has a notification function, when the recognition results come out, the system notification such as station letter, email, SMS, etc. can be used to inform the user that the recognition has been completed and guide the user to view the results. Customer-defined path, for users who need to integrate with other systems, the recognition platform can provide an API interface to send the recognition results to the caller in the form of structured data. In this way, the caller can further process or display the recognition results according to their own needs. Some users may need to save the recognition results to a specific file or database. The platform can write the results to a file or database in a specified path based on the user's configuration.
[0031] Furthermore, step one of this application also includes:
[0032] Collect various cotton pests and diseases pictures according to the cotton pests and diseases categories, and establish an image database, wherein the image database includes pictures of various cotton pests and diseases at different angles, different times, and various degrees of severity;
[0033] Based on the image database, feature comparison and analysis of various types of pests and diseases and severity at different times are performed, and common features of various types are selected as the basic identification information;
[0034] The differential features are obtained, and the differential features are clustered to obtain the identification distinction information.
[0035] Specifically, first, according to the known categories of cotton pests and diseases, collect pictures of various types of cotton pests and diseases. These pictures should cover different angles, different time points and various severity levels to ensure the comprehensiveness and diversity of the database. The collected pictures are sorted, including removing duplicate, blurred or irrelevant pictures to ensure that every picture in the database is high-quality and representative. The sorted pictures are annotated in detail, including information such as the type of pests and diseases, shooting time, and severity. Image processing and computer vision technology are used to extract the characteristics of pests and diseases from the annotated pictures. These features may include visual features such as color, shape, and texture. The extracted features are compared and analyzed to find out the common and differentiated features between various pests and diseases. Common features can be used as basic identification information to build a general model that can identify multiple pests and diseases; while differentiated features are used as identification and differentiation information to distinguish different pests and diseases. Through comparison and analysis, the common features of various pests and diseases are screened as basic identification information. These common features should be extensive and stable, and can remain consistent in different environments and conditions. For the differentiated features, cluster analysis is further performed to group similar features into one category to form different feature clusters. Each feature cluster represents the unique features of one or several pests and diseases, that is, identification and differentiation information. The screened identification basic information and the obtained identification and differentiation information are integrated to form a complete feature set.
[0036] Furthermore, the present application also includes:
[0037] Identifying feature sizes and identifying fine feature clusters for the differential features to obtain cluster feature clusters;
[0038] The clustering feature clusters are identified by identification features to determine the identification distinction information.
[0039] Specifically, the differentiated features are dimensional analyzed to determine the size, range or scale of each feature. The feature size can be determined by various methods, such as region size, edge length, texture analysis, etc. After determining the feature size, the differentiated features are clustered to group similar fine features into one category. Clustering methods such as K-means and hierarchical clustering can be used. After clustering analysis, multiple feature clusters are obtained, each cluster containing similar features. These clusters represent different types of pests and diseases or different manifestations of the same type of pests and diseases. Each cluster feature cluster is identified so that they can be accurately referenced and distinguished in the subsequent identification process. Identification can include assigning a unique label or ID to each cluster. From the identified cluster feature clusters, the most discriminative features are selected as identification and distinguishing information. These features should be able to clearly distinguish different types of pests and diseases or different severity of the same type of pests and diseases.
[0040] Furthermore, the present application also includes:
[0041] According to the identification feature size in the identification distinction information and the feature category of the identification fine feature, a labeling box size requirement is set, and a mapping relationship between the labeling box size requirement and the identification distinction information is established;
[0042] The image database is annotated with samples according to the annotation box size requirement to construct the data sample set.
[0043] Specifically, the analysis of the size of the identified features can be based on statistical methods, such as calculating the average size, size range, size distribution, etc. of the features. According to the feature size obtained by the analysis, a reasonable range of annotation box sizes is set. This range should be able to cover most of the pest and disease features in the image. The size requirements of the annotation box need to be flexible enough to adapt to features of different sizes, while also ensuring the accuracy of the annotation. Features of different categories may require annotation boxes of different sizes to be accurately annotated. For some special and difficult-to-define feature categories, additional annotation strategies or more sophisticated annotation box size adjustments may be required. For example, labelImg can be used for annotation. For the problem of uncertain shapes of pest and disease areas, the size of the effective annotation box can be used to accurately annotate pests and diseases. For the problem of multiple pests and diseases in the same area, multiple boxes of similar sizes are used for annotation. For pests and diseases that are widely present on the entire leaf, a large box is used to annotate the entire leaf. For pest and disease types with local clear identification, a small box is used to annotate clear areas. A mapping relationship between the annotation box size requirements and the identification distinction information is established. Each specific identification distinction information should have a corresponding annotation box size requirement. Store the established mapping relationship in a queryable data structure, such as a lookup table, database, or configuration file. Ensure that the mapping relationship is stored in a way that facilitates quick query and application in the subsequent sample annotation and dataset construction process. Use the established mapping relationship to annotate each image in the image database. Draw an accurate annotation box based on the identification and distinction information of the pest and disease features in the image and the corresponding annotation box size requirements. Organize the annotated images into a data sample set. Each sample should contain the image itself, the location and size information of the annotation box, and the corresponding pest and disease category label. Perform appropriate preprocessing and enhancement on the data sample set, such as brightness changes, contrast changes, cropping, rotation, etc., to improve the generalization ability of the model.
[0044] Furthermore, step three of this application also includes:
[0045] The pre-trained model is the basic structure of YoloV8, extracts the effective feature layer, adds the enhanced feature extraction network layer and the feature fusion layer, wherein the enhanced feature extraction network layer uses convolution plus multiple attention mechanisms, the feature fusion layer uses upsampling and downsampling two paths to fuse, and the feature layer uses convolution blocks for downsampling and channel changes.
[0046] Specifically, the pre-trained model is the basic structure of YoloV8, and the enhanced feature extraction network layer is used to extract image features of different resolutions. The design of convolution operation combined with multiple attention mechanisms is used. The attention mechanism can help the model pay more attention to important feature areas when processing images, thereby improving the accuracy and efficiency of feature extraction. Preferably, the C2f convolution structure in each stage of Backbone and the enhanced feature extraction structure in PANet is changed to ParallelAttentionBlock. ParallelAttentionBlock uses convolution plus multiple attention mechanisms to enhance feature extraction. C2f is built only with convolution blocks, using a multi-branch-like structure, connecting multiple BottleNeck structures in series, and taking the output of each BottleNeck as the input of the final result. It obtains features of multiple stages without increasing the amount of calculation, and performs feature fusion to enhance feature extraction capabilities. However, since convolution can only extract local features and has weak global modeling capabilities, the Transformer structure has global modeling capabilities, but lacks the inductive bias capability of convolution, so combining the two can achieve better results. ParallelAttentionBlock combines the convolution module and the Transformer Block, combining the advantages of both. Its structure is to first use the convolution-based InvertedResidual or ConvNext Block to extract local features, and then use multiple parallel Attentions to extract global features. In this way, the model can better capture and utilize useful information in the image, providing stronger support for subsequent target detection tasks. Feature fusion can effectively combine feature information at different levels to improve the detection performance of the model. Use a two-layer MLP with a gate mechanism to fuse and output the normal extracted features of each feature layer.
[0047] The feature layer uses convolution blocks for downsampling and channel changes. Preferably, the convolution blocks in ParallelAttentionBlock are used to complete downsampling and channel changes. Compared with using only one convolution, using InvertedResidual or ConvNext Block in ParallelAttentionBlock to achieve downsampling loses less information than using a single convolution, which helps to transmit image details to the depth. Since some pests and diseases have too low resolution in the image, minimizing the data loss during downsampling can ensure the detection effect of small targets. The feature layer uses convolution blocks for downsampling and channel changes. The convolution block provides two options, which are the fine-tuning structures of InvertedResidual and ConvNext Block. This module can be replaced with any module. InvertedResidual is an inverted residual structure. The main branch starts with 1x1 convolution to increase the number of channels, then uses 3x3 depth convolution with unchanged channels to extract features, and then uses an SE attention mechanism to obtain attention on the channel. Finally, 1x1 convolution is used to restore the number of channels, and the output is added to the original input to get the final result. The original InvertedResidual ignores the residual edge during downsampling, but here the residual edge is also used during downsampling, and 1x1 convolution is used for downsampling and channel changes, so that the residual result and the main branch result are the same in shape. The advantage of this is that the residual edge is used in any case, which can more effectively reduce the gradient vanishing problem compared to partial use of the residual edge. The ConvNext Block module uses pure convolution to implement a Transformer-like structure. It first uses a 7x7 deep convolution to approximate the Attention mechanism, and then uses two 1x1 convolutions to implement the MLP structure, adding the output and the initial input to get the final result. ConvNext Block also makes similar modifications to InvertedResidual to allow the residual edge to adapt to downsampling and channel changes.
[0048] Furthermore, the present application also includes:
[0049] Based on convolution, local features are extracted, and multiple parallel attention mechanism structures are used to extract global features. The multiple parallel attention mechanism structures extract global features, including: dividing the original image into multiple windows, each window independently calculating attention to the data; dividing the original image into grids, extracting data at the same position in each grid, and calculating attention to the extracted data; treating the entire image as a window, and calculating channel attention in the channel dimension;
[0050] The extracted local features and global features are fused.
[0051] Specifically, the convolution operation is used to extract local features of the input image. The Attention block uses multiple parallel Attention structures. The parallel mechanism can achieve module parallelism compared to the serial mechanism, speeding up the model, and multiple Attention structures do not affect each other. They extract features independently and are finally fused. WindowsAttention and GridAttention use a similar window / grid form to segment the original image and use independent local features to calculate attention. WindowsAttention calculates self-attention in a local window and focuses on extracting local features. GridAttention also divides the original image into small grids, but does not calculate attention in independent grids. Instead, it takes out the data at the same position in each grid and puts them together to calculate attention. The features obtained in this way are equivalent to sparse global features. Calculating attention on sparse global features is similar to directly calculating in the pixels of the entire image, but the amount of calculation is much smaller. Both types of attention are calculated on a fixed-size window / grid. Increasing the resolution will increase the number of windows / grids, but will not increase the amount of calculation in a single window / grid. The computational complexity of increasing the image resolution is reduced from quadratic growth to linear growth, alleviating the problem of skyrocketing computation when increasing the resolution. The extracted local features are fused with the global features. The purpose of feature fusion is to combine local and global information so that the model can focus on both the details and the overall structure of the image, thereby improving the performance of image processing.
[0052] Optionally, if the total amount of input data is too large, the total amount of calculation can be reduced by reducing the amount of input data of the attention mechanism. In the Attention calculation process, the shape of the input data is the same as the shape of the output data. There are three important variables in the calculation process, namely Query, Key, and Value. The width and height of the Query affect the width and height of the final output data, while the channel of the Value affects the channel of the final data, while the width and height of the Key and Value have no effect on the width and height of the final data. Therefore, the width and height of the Key and Value can be reduced during the calculation process to reduce the complexity of the calculation. Patch embedding or pooling can be used to reduce the width and height of the Key and Value. Using high-resolution Query and low-resolution Key and Value for self-attention calculation can both obtain global attention and reduce the complexity of calculation. In addition, Channel Attention can also be used to calculate attention in the channel dimension, which is different from the original Attention calculation in space. In the original Attention, multi-head self-attention first divides multiple heads on the channel, and each head independently calculates self-attention in the spatial dimension. The Channel Attention here is still divided into multiple heads on the channel, and self-attention is also calculated on the channel dimension. A single head is used for calculation on the spatial dimension. The relationship on the channel dimension on the pixels of the entire image is calculated, which can complement other spatial attention mechanisms. Since the channel of the network is fixed, increasing the resolution will not increase the amount of calculation at a quadratic complexity, but will increase the amount of calculation linearly, thereby reducing the computational pressure of high resolution. The Channel dimension stores the color information of the image. The interaction of color channels through Channel Attention helps the model to distinguish subtle differences in color in the image and helps to detect pest and disease characteristics that are similar to leaf color. At the same time, Channel Attention calculates attention on the entire image in the spatial dimension, which is also helpful for large-scale pest and disease detection.
[0053] Furthermore, the present application also includes:
[0054] MLP is used for channel fusion, and a gating unit is added. The channel includes multiple linear layers. In the first linear layer, the output data is divided into two parts in the channel. One part uses the Sigmoid function to adjust all values to between 0 and 1, and multiply it with the previous part to get the output; then another linear layer is used for the final feature fusion;
[0055] A Dropout function is added after each linear layer to randomly discard data during training. When the training requirements are met, the feature fusion layer is obtained;
[0056] A two-layer MLP with a gate mechanism is used to dynamically fuse and output the extracted features of each feature layer.
[0057] Specifically, MLP is used to fuse features from different channels. MLP consists of multiple linear layers, each followed by a nonlinear activation function. During the fusion process, MLP is able to learn the complex relationship between channels and output a feature representation that fuses all channel information. After the first linear layer, the output data is divided into two parts in the channel dimension. One part is processed by the Sigmoid function to adjust its value between 0 and 1 as a gating signal. The other part of the data remains as it is and multiplied element-by-element with the gating signal. In this way, the gating signal can control the flow of information and determine which features are more important in subsequent layers. Dropout function is added after each linear layer. During the training process, Dropout randomly discards the output of a part of neurons to prevent the model from overfitting. In the test or evaluation phase, all neurons are retained to ensure the stability of the output. The performance indicators such as accuracy and loss on the validation set are monitored to determine whether the model meets the training requirements. Once the requirements are met, the model state, including the parameters of the feature fusion layer, is saved. The extracted features of each feature layer are dynamically fused and output using a two-layer MLP with a gating mechanism. The extracted features from different feature layers are fused. The local, global and color channel information of the image can be combined, and the captured pest and disease features of different sizes and colors can be fused, so that the model can better understand the target features that need to be detected.
[0058] Furthermore, the present application also includes:
[0059] Activate the pest and disease knowledge base, determine the pest and disease category, grade, distribution, proportion and location, and planting cycle according to the identification result, and traverse and match in the pest and disease knowledge base, including traversing the plant protection sub-base in the pest and disease knowledge base to obtain plant protection plans; traverse and analyze the planting pathology analysis sub-base in the pest and disease knowledge base to obtain planting traceability guidance information; traverse the pesticide sub-base in the pest and disease knowledge base to obtain recommended pesticides;
[0060] A connection is established between the identification result and the plant protection scheme, planting traceability guidance information, and recommended pesticides. When a value-added feedback instruction is received, the plant protection scheme, planting traceability guidance information, and recommended pesticides are fed back accordingly according to the feedback requirements in the value-added feedback instruction.
[0061] Specifically, first, use image recognition, machine learning and other technologies to identify pests and diseases of crops. The identification results should include the category, grade, distribution, proportion and location information of pests and diseases. Once pests and diseases are identified, activate the pest and disease knowledge base. This knowledge base should contain multiple sub-bases, such as plant protection sub-base, planting pathology analysis sub-base and pesticide sub-base. Retrieve control plans that match the identification results in the plant protection sub-base. These plans may include biological control, physical control and chemical control. By analyzing the planting environment and pathological information, obtain planting traceability guidance information. This information can help farmers understand the causes of pests and diseases and how to adjust planting strategies to prevent similar problems from happening again. According to the types and grades of identified pests and diseases, retrieve the list of recommended pesticides from the pesticide sub-base. These pesticides should be registered and comply with relevant regulatory requirements. Establish a connection between the identification results and the plant protection plan, planting traceability guidance information and recommended pesticides. In this way, when a value-added feedback instruction is received, this information can be fed back accordingly according to the feedback requirements in the instruction. For example, control plans, planting instructions and recommended pesticides can be sent directly to farmers or plant protection experts so they can take quick action.
[0062] In summary, the cotton pest and disease intelligent identification method based on transfer learning provided in this application has the following technical effects:
[0063] By obtaining the categories of cotton pests and diseases, analyzing the pest characteristics of each category, determining basic identification information and identification difference information, wherein the basic identification information is the overlapping characteristics of each category of pests and diseases, and the identification difference information is the identification characteristics that are distinctive between each category; based on the basic identification information, performing identification requirement analysis, determining a pre-trained model, wherein the pre-trained model is a trained model that can identify basic information; adjusting the pre-trained model according to the identification difference information, setting model accuracy requirements, using a data sample set to perform model transfer learning, obtaining a cotton pest and disease identification model, and adding the cotton pest and disease identification model to an identification platform; the identification platform receives an identification task, wherein the identification task at least includes an identification request image, and uses the cotton pest and disease identification model to identify the identification request image, and outputs an identification result; using the identification result as a feedback result, sending it along a preset path, wherein the preset path includes a platform display path and a customer-defined path. It effectively solves the obvious deficiencies of existing technologies in automatically dividing and classifying cotton pests and diseases, and the low accuracy of recognition results, which directly affects the timeliness and effectiveness of prevention and control work. It uses transfer learning to fine-tune the pre-trained model to make its recognition results more accurate, providing reliable guarantees for prevention and control work.
[0064] Embodiment 2
[0065] Based on the same inventive concept as the cotton pest intelligent identification method based on transfer learning in the aforementioned embodiment, the present application also provides a cotton pest intelligent identification system based on transfer learning, please refer to the attached Figure 2 , the system comprising:
[0066] A feature analysis module 11 is used to obtain the categories of cotton pests and diseases, perform feature analysis of each category of pests and diseases, and determine basic identification information and identification distinction information. The basic identification information is the overlapping features of each category of pests and diseases, and the identification distinction information is the identification features that are distinguishable between the categories.
[0067] A requirement analysis module 12, the requirement analysis module 12 is used to perform recognition requirement analysis based on the recognition basic information and determine a pre-trained model, the pre-trained model is a trained model that can recognize the basic information;
[0068] A cotton pest and disease identification model acquisition module 13, wherein the cotton pest and disease identification model acquisition module 13 is used to adjust the pre-trained model according to the identification distinction information, set the model accuracy requirement, use the data sample set to perform model transfer learning, obtain the cotton pest and disease identification model, and add the cotton pest and disease identification model to the identification platform;
[0069] An image recognition module 14, wherein the image recognition module 14 is used for the recognition platform to receive a recognition task, wherein the recognition task at least includes a recognition request image, and recognizes the recognition request image using the cotton pest and disease recognition model, and outputs a recognition result;
[0070] The feedback result sending module 15 is used to send the recognition result as a feedback result according to a preset path, and the preset path includes a platform display path and a customer-defined path.
[0071] Furthermore, the feature analysis module 11 in the system is also used for:
[0072] Collect various cotton pests and diseases pictures according to the cotton pests and diseases categories, and establish an image database, wherein the image database includes pictures of various cotton pests and diseases at different angles, different times, and various degrees of severity;
[0073] Based on the image database, feature comparison and analysis of various types of pests and diseases and severity at different times are performed, and common features of various types are selected as the basic identification information;
[0074] The differential features are obtained, and the differential features are clustered to obtain the identification distinction information.
[0075] Furthermore, the system further comprises a cluster analysis module, wherein the cluster analysis module is used to:
[0076] Identifying feature sizes and identifying fine feature clusters for the differential features to obtain cluster feature clusters;
[0077] The clustering feature clusters are identified by identification features to determine the identification distinction information.
[0078] Furthermore, the cotton pest and disease identification model acquisition module 13 in the system is also used for:
[0079] The pre-trained model is the basic structure of YoloV8, extracts the effective feature layer, adds an enhanced feature extraction network layer and a feature fusion layer, wherein the enhanced feature extraction network layer uses convolution plus multiple attention mechanisms, the feature fusion layer uses a double-layer MLP with a gate mechanism to achieve dynamic feature fusion, and the feature layer uses a convolution block for downsampling and channel changes.
[0080] Furthermore, the system further comprises a data sample set acquisition module, and the data sample set acquisition module is used to:
[0081] According to the identification feature size in the identification distinction information and the feature category of the identification fine feature, a labeling box size requirement is set, and a mapping relationship between the labeling box size requirement and the identification distinction information is established;
[0082] The image database is annotated with samples according to the annotation box size requirement to construct the data sample set.
[0083] Furthermore, the system further comprises a feature fusion module, wherein the feature fusion module is used for:
[0084] Local feature extraction is performed based on convolution, and global features are extracted using multiple parallel attention mechanism structures. The multiple parallel attention mechanism structures for extracting global features include: dividing the original image into multiple windows, and each window independently calculates attention to the data; dividing the original image into grids, extracting data at the same position in each grid, and calculating attention to the extracted data; treating the entire image as a window, and calculating channel attention in the channel dimension.
[0085] The extracted local features and global features are fused.
[0086] Furthermore, the system further comprises a fusion output module, wherein the fusion output module is used for:
[0087] MLP is used for channel fusion, and a gating unit is added. The channel includes multiple linear layers. In the first linear layer, the output data is divided into two parts in the channel. One part uses the Sigmoid function to adjust all values to between 0 and 1, and multiply it with the previous part to get the output; then another linear layer is used for the final feature fusion;
[0088] A Dropout function is added after each linear layer to randomly discard data during training. When the training requirements are met, the feature fusion layer is obtained;
[0089] A two-layer MLP with a gate mechanism is used to fuse the extracted features of each feature layer and output them.
[0090] Furthermore, the system further comprises a pest and disease knowledge base activation module, wherein the pest and disease knowledge base activation module is used to:
[0091] Activate the pest and disease knowledge base, determine the pest and disease category, grade, distribution, proportion and location, and planting cycle according to the identification result, and traverse and match in the pest and disease knowledge base, including traversing the plant protection sub-base in the pest and disease knowledge base to obtain plant protection plans; traverse and analyze the planting pathology analysis sub-base in the pest and disease knowledge base to obtain planting traceability guidance information; traverse the pesticide sub-base in the pest and disease knowledge base to obtain recommended pesticides;
[0092] A connection is established between the identification result and the plant protection scheme, planting traceability guidance information, and recommended pesticides. When a value-added feedback instruction is received, the plant protection scheme, planting traceability guidance information, and recommended pesticides are fed back accordingly according to the feedback requirements in the value-added feedback instruction.
[0093] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. Figure 1 The cotton pest and disease intelligent identification method based on transfer learning and the specific examples in Example 1 are also applicable to the cotton pest and disease intelligent identification system based on transfer learning in this embodiment. Through the above detailed description of the cotton pest and disease intelligent identification method based on transfer learning, those skilled in the art can clearly know the cotton pest and disease intelligent identification system based on transfer learning in this embodiment, so for the sake of brevity of the specification, it will not be described in detail here. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0094] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
[0095] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the present application and its equivalent technologies, the present application is also intended to include these modifications and variations.
Claims
1. Intelligent identification method of cotton pests and diseases based on transfer learning, It is characterized in that include: Obtaining the categories of cotton pests and diseases, analyzing the characteristics of pests and diseases of each category, and determining basic identification information and distinguishing identification information, wherein the basic identification information is the overlapping characteristics of the categories of pests and diseases, and the distinguishing identification information is the distinguishing identification characteristics between the categories; Performing recognition requirement analysis based on the recognition basic information and determining a pre-trained model, wherein the pre-trained model is a trained model capable of recognizing the basic information; According to the identification difference information, the pre-trained model is adjusted, the model accuracy requirement is set, the model transfer learning is performed using the data sample set, a cotton disease and insect pest identification model is obtained, and the cotton disease and insect pest identification model is added to the identification platform; The recognition platform receives a recognition task, the recognition task at least includes a recognition request image, recognizes the recognition request image using the cotton pest and disease recognition model, and outputs a recognition result; The recognition result is used as a feedback result and sent according to a preset path, where the preset path includes a platform display path and a customer-defined path.
2. The method according to claim 1, It is characterized in that Obtain the categories of cotton pests and diseases, analyze the characteristics of each category of pests, and determine the basic identification information and identification difference information, including: Collect various cotton pests and diseases pictures according to the cotton pests and diseases categories, and establish an image database, wherein the image database includes pictures of various cotton pests and diseases at different angles, different times, and various degrees of severity; Based on the image database, feature comparison and analysis of various types of pests and diseases and severity at different times are performed, and common features of various types are selected as the basic identification information; The differential features are obtained, and the differential features are clustered to obtain the identification distinction information.
3. The method according to claim 2, It is characterized in that Clustering the differential features to obtain the identification distinction information includes: Identifying feature sizes and identifying fine feature clusters for the differential features to obtain cluster feature clusters; The clustering feature clusters are identified by identification features to determine the identification distinction information.
4. The method according to claim 3, It is characterized in that Before using the data sample set to perform model transfer learning to obtain a cotton pest and disease identification model, the method further includes: According to the identification feature size in the identification distinction information and the feature category of the identification fine feature, a labeling box size requirement is set, and a mapping relationship between the labeling box size requirement and the identification distinction information is established; The image database is annotated with samples according to the annotation box size requirement to construct the data sample set.
5. The method according to claim 1, It is characterized in that The pre-trained model is adjusted according to the recognition difference information, including: The pre-trained model is the basic structure of YoloV8, extracts the effective feature layer, adds an enhanced feature extraction network layer and a feature fusion layer, wherein the enhanced feature extraction network layer uses convolution plus multiple attention mechanisms, and the feature fusion layer uses a double-layer MLP with a gate mechanism to dynamically fuse the extracted features of each feature layer, and the feature layer uses a convolution block for downsampling and channel change.
6. The method according to claim 5, It is characterized in that The enhanced feature extraction network layer uses convolution plus multiple attention mechanisms, including: Based on convolution, local features are extracted, and multiple parallel attention mechanism structures are used to extract global features. The multiple parallel attention mechanism structures extract global features, including: dividing the original image into multiple windows, each window independently calculating attention to the data; dividing the original image into grids, extracting data at the same position in each grid, and calculating attention to the extracted data; treating the entire image as a window, and calculating channel attention in the channel dimension; The extracted local features and global features are fused.
7. The method according to claim 5, It is characterized in that The feature fusion layer uses a two-layer MLP with a gate mechanism to dynamically fuse the extracted features of each feature layer, including: MLP is used for channel fusion, and a gating unit is added. The channel includes multiple linear layers. In the first linear layer, the output data is divided into two parts in the channel. One part uses the Sigmoid function to adjust all values to between 0 and 1, and multiply it with the previous part to get the output; then another linear layer is used for the final feature fusion; A Dropout function is added after each linear layer to randomly discard data during training. When the training requirements are met, the feature fusion layer is obtained; A two-layer MLP with a gate mechanism is used to fuse and output the normal extracted features of each feature layer.
8. The method according to claim 1, It is characterized in that After taking the recognition result as the feedback result, the method further includes: Activate the pest and disease knowledge base, determine the pest and disease category, grade, distribution, proportion and location, and planting cycle according to the identification result, and traverse and match in the pest and disease knowledge base, including traversing the plant protection sub-base in the pest and disease knowledge base to obtain plant protection plans; traverse and analyze the planting pathology analysis sub-base in the pest and disease knowledge base to obtain planting traceability guidance information; traverse the pesticide sub-base in the pest and disease knowledge base to obtain recommended pesticides; A connection is established between the identification result and the plant protection scheme, planting traceability guidance information, and recommended pesticides. When a value-added feedback instruction is received, the plant protection scheme, planting traceability guidance information, and recommended pesticides are fed back accordingly according to the feedback requirements in the value-added feedback instruction.
9. Intelligent identification system of cotton pests and diseases based on transfer learning, It is characterized in that For implementing the steps of the method according to any one of claims 1 to 8, the system comprises: A feature analysis module, which is used to obtain the categories of cotton pests and diseases, perform feature analysis of pests of each category, and determine basic identification information and identification distinction information. The basic identification information is the overlapping features of the pests and diseases categories, and the identification distinction information is the identification features that are distinguishable between the categories. A requirement analysis module, the requirement analysis module is used to perform recognition requirement analysis based on the recognition basic information and determine a pre-trained model, the pre-trained model is a trained model that can recognize the basic information; A cotton pest and disease identification model acquisition module, the cotton pest and disease identification model acquisition module is used to adjust the pre-trained model according to the identification distinction information, set the model accuracy requirements, use the data sample set to perform model transfer learning, obtain the cotton pest and disease identification model, and add the cotton pest and disease identification model to the identification platform; An image recognition module, wherein the image recognition module is used for the recognition platform to receive a recognition task, wherein the recognition task at least includes a recognition request image, and the recognition request image is recognized using the cotton pest and disease recognition model, and a recognition result is output; A feedback result sending module is used to send the recognition result as a feedback result according to a preset path, and the preset path includes a platform display path and a customer-defined path.
Citation Information
Cited By
Disease and pest recognition and prediction algorithm based on deep learning
WO2025213931A1
