A cotton pest identification method under complex background under semantic guidance

By constructing a semantically guided cotton pest identification method, and utilizing feature encoding, foreground proposal, and decoding modules, a cotton leaf foreground mask is generated and diseased leaves are classified. This solves the problem of insufficient identification accuracy in complex backgrounds and achieves high-precision cotton pest identification.

CN122176500APending Publication Date: 2026-06-09HUNAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUNAN UNIV
Filing Date
2026-02-26
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing cotton pest identification methods have low accuracy in complex backgrounds and cannot meet the requirements for high precision. In particular, when the edges of diseased leaves are blurred, the background texture is similar, or the target scale varies greatly, feature fusion without explicit semantic guidance is easily interfered with.

Method used

A semantically guided cotton pest identification method is adopted. By constructing a feature encoding module, a foreground proposal module, a feature decoding module, and a semantic guidance module, the method achieves refined extraction of multi-scale features, foreground mask generation, and mask-guided feature fusion, generating cotton leaf foreground masks and classifying diseased leaves.

Benefits of technology

It significantly improves the accuracy and robustness of cotton disease identification, effectively solves the problem of insufficient identification accuracy caused by background information interference in complex environments, and achieves high-precision cotton pest identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122176500A_ABST
    Figure CN122176500A_ABST
Patent Text Reader

Abstract

The application provides a cotton pest identification method under complex background with semantic guidance, comprising: collecting a cotton disease and pest image; constructing a cotton pest identification network model; the cotton pest identification network model comprises a feature coding module, a foreground proposal module, a feature decoding module and a semantic guidance module; inputting the cotton disease and pest image into the cotton pest identification network model to output an identification result of the cotton pest. Through "feature fine extraction-foreground mask generation-mask guided feature fusion-disease leaf classification", the method effectively solves the problem of insufficient recognition accuracy caused by background information interference in a complex environment, and significantly improves the accuracy and robustness of cotton disease identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of deep learning image processing, and in particular to a semantically guided method for identifying cotton pests in complex backgrounds. Background Technology

[0002] Cotton, as an important economic crop, relies heavily on stable production to ensure agricultural development and security. However, it is susceptible to various pests throughout its growth cycle, including common pests such as cotton leafhoppers, cotton spider mites, and noctuid moths, which severely impact yield and quality. These pests damage cotton leaves by feeding on them and sucking sap, significantly weakening the cotton's photosynthetic capacity and negatively affecting plant growth. In severe cases, this can lead to reduced yield or even death. Therefore, accurate and rapid identification of cotton pests is crucial for pest early warning, scientific control, and ensuring the stable development of the cotton industry.

[0003] Modern cotton disease identification primarily relies on manual observation and judgment based on experience. This method is not only time-consuming and labor-intensive but also has limited accuracy, making it difficult to meet the demands of modern agriculture for large-scale and high-precision production. The application of computer vision technology has brought new possibilities to pest detection, greatly improving detection speed and accuracy while reducing manual intervention and helping to lower costs. The advantage of cotton pest identification based on machine learning technology compared to manual observation lies in its ability to extract features of cotton pests for automatic detection. Traditional machine learning methods such as support vector machines, random forests, and nearest neighbor classification have all achieved the goal of cotton disease identification.

[0004] However, these methods rely heavily on knowledge of pests and diseases, require manual feature design, have limited model robustness, and suffer from low accuracy in complex environments. This limits their widespread application in intelligent pest and disease identification. With the rapid development of artificial intelligence and computer vision technologies, deep learning methods offer new solutions for the automatic detection and classification of cotton pests. Deep learning, with its automatic feature extraction, is superior in both accuracy and robustness. For example, Zafar et al. used a deep convolutional neural network (VGG-16) to achieve automatic identification of multiple cotton diseases, outperforming traditional methods. Qiu et al. used a deep learning network based on the Transformer architecture to achieve high-precision identification of cotton pests and diseases. Feng et al. proposed an improved YOLOv8n model, enhancing the performance of natural field disease detection.

[0005] The aforementioned studies significantly improved the accuracy of crop pest identification. However, in practical applications, these identification methods primarily rely on visual feature modeling, failing to adequately utilize pixel-level hierarchical constraints on the foreground region, making it difficult to accurately focus on diseased leaf areas in complex field backgrounds. Especially when the edges of diseased leaves are blurred, background textures are similar, or the target scale varies significantly, feature fusion lacking explicit semantic guidance is easily interfered with, leading to decreased identification and localization performance, and failing to meet the high-precision identification requirements for cotton pests in complex scenarios. Summary of the Invention

[0006] This application provides a semantically guided method for identifying cotton pests in complex backgrounds. To solve the aforementioned technical problems, this application employs the following technical methods: Firstly, this application provides a semantically guided method for identifying cotton pests in complex contexts, including: Collect images of cotton diseases and pests; A cotton pest identification network model is constructed; the cotton pest identification network model includes a feature encoding module, a foreground proposal module, a feature decoding module, and a semantic guidance module; The cotton pest and disease images are input into the cotton pest and disease identification network model, and the identification results of cotton pests and diseases are output.

[0007] Optionally, the step of inputting the cotton pest and disease image into the cotton pest recognition network model and outputting the cotton pest recognition result includes: The cotton pest and disease images are input into the feature encoding module to generate multi-scale output features; The multi-scale output features are input into the foreground proposal module to generate multi-scale enhanced features; The multi-scale enhanced features are input into the feature decoding module to generate multi-scale fused features and cotton leaf foreground mask; The multi-scale fusion features and the cotton leaf foreground mask are input into the semantic guidance module, and the cotton pest identification results are output.

[0008] Optionally, the feature encoding module includes a first dual-channel hybrid convolutional state space module, a second dual-channel hybrid convolutional state space module, a third dual-channel hybrid convolutional state space module, and a fourth dual-channel hybrid convolutional state space module; the multi-scale output features include first-scale output features, second-scale output features, third-scale output features, and fourth-scale output features; the step of inputting the cotton pest and disease image into the feature encoding module to generate multi-scale output features includes: The cotton pest and disease image is input into the first dual-path hybrid convolutional state space module to generate the first-scale output feature, and the first-scale output feature is copied and stored. The first-scale output features are input into the second dual-path hybrid convolutional state space module to generate the second-scale output features, and the second-scale output features are copied and stored. The second-scale output features are input into the third dual-path hybrid convolutional state space module to generate the third-scale output features, and the third-scale output features are copied and stored. The third-scale output features are input into the fourth dual-path hybrid convolutional state space module to generate the fourth-scale output features, and the fourth-scale output features are copied and stored.

[0009] Optionally, the step of inputting the cotton disease and pest image into the first dual-path hybrid convolutional state space module to generate first-scale output features includes: The local area of ​​the cotton pest and disease image is enhanced with detail to generate a first local detail feature; The cotton pest and disease images are subjected to global correlation modeling processing to generate the first global correlation feature; The first local detail feature and the first global correlation feature are fused element-wise to generate the first scale output feature.

[0010] Optionally, the step of performing detail enhancement processing on local areas of the cotton pest and disease image to generate first local detail features includes: The cotton disease and pest image is sequentially passed through a global average pooling layer, a first convolutional layer, a ReLU activation function, a second convolutional layer, and a Sigmoid activation function to generate a first local detail feature weight map; The first local detail feature weight map and the cotton disease and pest image are multiplied element-wise, and then passed through a third convolutional layer to generate the first local detail feature.

[0011] Optionally, the step of performing global correlation modeling on the cotton pest and disease images to generate a first global correlation feature includes: The cotton disease and pest image is sequentially passed through a first normalization layer, a first linear layer, a first depth-separable convolutional layer, a spiral scanning two-dimensional state space module, and a second normalization layer to generate a first normalized feature; The cotton pest and disease image is passed through a second linear layer to generate a first linear feature; After multiplying the first normalized feature and the first linear feature element by element, the result is input into the third linear layer for projection reconstruction, and then added element by element to the cotton disease and pest image to generate the first global correlation feature.

[0012] Optionally, the multi-scale enhancement features include a first-scale enhancement feature, a second-scale enhancement feature, a third-scale enhancement feature, and a fourth-scale enhancement feature; the step of inputting the multi-scale features into the foreground proposal module to generate multi-scale enhancement features includes: The fourth-scale output features are projected and input into the fourth perception layer to generate a fourth feature modulation signal; the fourth feature modulation signal is then activated by the Sigmoid activation function to generate fourth feature modulation weights. The fourth-scale output feature and the fourth-scale modulation weight are multiplied element-wise and then superimposed to generate the fourth-scale enhanced feature; The third-scale output feature is projected and then initially fused with the fourth feature modulation signal after bilinear sampling to generate a third preliminary fused feature. The third preliminary fusion feature is input into the third sensing layer to generate a third feature modulation signal; The third feature modulation signal is processed by the Sigmoid activation function to generate the third feature modulation weight; The third-scale output feature and the third-scale modulation weight are multiplied element-wise and added together to generate the third-scale enhanced feature; The second scale output feature is projected and then initially fused with the third feature modulation signal after bilinear sampling to generate a second preliminary fused feature. The second preliminary fusion feature is input into the second perception layer to generate the second feature modulation signal; The second feature modulation signal is processed through the Sigmoid activation function to generate the second feature modulation weight; The second-scale output feature and the second-feature modulation weight are multiplied element-wise and added together to generate the second-scale enhanced feature; The first scale output feature is projected and then initially fused with the second feature modulation signal after bilinear sampling to generate a first preliminary fused feature. The first preliminary fused feature is input into the first perception layer to generate a first feature modulation signal; The first feature modulation signal is processed by the Sigmoid activation function to generate the first feature modulation weight; The first-scale output feature and the first feature modulation weight are multiplied element-wise and added together to generate the first-scale enhanced feature.

[0013] Optionally, the feature decoding module includes a fifth dual-path hybrid convolutional state space module, a sixth dual-path hybrid convolutional state space module, a seventh dual-path hybrid convolutional state space module, an eighth dual-path hybrid convolutional state space module, and a final projection layer; the multi-scale fusion feature includes a first-scale fusion feature, a second-scale fusion feature, and a third-scale fusion feature; the step of inputting the multi-scale enhanced features into the feature decoding module to generate multi-scale fusion features and a cotton leaf foreground mask includes: The fourth-scale enhanced features are input into the fifth dual-path hybrid convolutional state space module for preliminary decoding processing to generate fourth-scale decoded features. The fourth-scale decoding feature and the third-scale enhancement feature are fused element-by-element to obtain the third intermediate fused feature; The third intermediate fusion feature is input into the sixth dual-path hybrid convolutional state space module to generate the third scale fusion feature; The third-scale fusion feature and the second-scale enhancement feature are fused element-by-element to obtain the second intermediate fusion feature; The second intermediate fusion feature is input into the seventh dual-path hybrid convolutional state space module to generate the second scale fusion feature; The second scale fusion feature and the first scale enhancement feature are fused element by element to obtain the first intermediate fusion feature; The first intermediate fusion feature is input into the eighth dual-path hybrid convolutional state space module to generate the first scale fusion feature; The first-scale fusion feature is input into the final projection layer to generate a cotton leaf foreground mask.

[0014] Optionally, the multi-scale fused features and the cotton leaf foreground mask are input into the semantic guidance module to output the cotton pest identification results, including: The first scale fusion feature, the second scale fusion feature and the third scale fusion feature are input into the fourth convolutional layer for dimension alignment to obtain multi-dimensional aligned features. The multi-dimensional aligned features are sequentially passed through the fourth linear layer and the second depthwise separable convolutional layer to generate multi-scale spatial features. The cotton leaf foreground mask and the multi-scale spatial features are input into a salient two-dimensional selective scanning unit to generate semantic core focusing features; After the semantic core focusing features are input into the third normalization layer for processing, they are multiplied element-wise with the multi-scale spatial features to generate weighted fusion features. After the weighted fusion feature is input into the fifth linear layer for feature integration, it is added element-wise with the multi-dimensional aligned feature to generate a dual-path fusion superposition feature. The dual-path fusion and superposition features are input into the classifier to generate cotton pest identification results.

[0015] Secondly, this application also provides a computer system, comprising: Memory is used to store instructions that can be executed by the processor; A processor for executing the instructions to implement the method as described in any of the first aspects.

[0016] This application has the following beneficial effects: The method proposed in this application effectively solves the problem of insufficient recognition accuracy caused by background information interference in complex environments by "refined feature extraction - foreground mask generation - mask-guided feature fusion - diseased leaf classification", and significantly improves the accuracy and robustness of cotton disease identification. Attached Figure Description

[0017] Figure 1 A flowchart illustrating a semantically guided method for identifying cotton pests in complex contexts, provided as an embodiment of this application; Figure 2 This is an overall framework diagram of the cotton pest identification network model provided in the embodiments of this application; Figure 3 This is a structural diagram of the feature encoding module provided in an embodiment of this application; Figure 4 A structural diagram of a dual-path hybrid convolutional state space module is provided for embodiments of this application; Figure 5 A structural diagram of the foreground proposal module provided in an embodiment of this application; Figure 6 This is a structural diagram of the feature decoding module provided in an embodiment of this application; Figure 7 This is a structural diagram of the semantic guidance module provided in an embodiment of this application. Detailed Implementation

[0018] To facilitate understanding by those skilled in the art, the present application will be further described below in conjunction with embodiments and accompanying drawings. The content mentioned in the embodiments is not intended to limit the present application.

[0019] To solve the above technical problems, such as Figure 1 As shown, this application proposes a semantically guided method for identifying cotton pests in complex backgrounds, including: Step S101: Collect images of cotton diseases and pests; The image acquisition process involves collecting images of cotton pests and diseases using image acquisition equipment. Considering the practical application scenarios in cotton planting environments (such as open fields or enclosed greenhouses), the image acquisition equipment selected for this step must be portable or suitable for on-site operations. Common and general-purpose shooting devices such as cameras and mobile phone cameras can be used. Furthermore, to adapt to different scales of pest detection needs, devices with image capture capabilities, such as tablet computers, portable high-definition imagers, and drone-mounted shooting modules, can also be selected. All the aforementioned image acquisition equipment must meet the basic requirement of clearly capturing pest characteristics on cotton leaves, bolls, and other parts of the plant, ensuring that the acquired images can be used for subsequent pest identification and analysis.

[0020] Step S102: Construct a cotton pest identification network model; the cotton pest identification network model includes a feature encoding module, a foreground proposal module, a feature decoding module, and a semantic guidance module; like Figure 2 As shown, the cotton pest identification network model includes a feature encoding module, a foreground proposal module, a feature decoding module, and a semantic guidance module connected in sequence. By inputting the collected cotton pest images into the constructed cotton pest identification network model for detection and identification, the identification results of cotton pests can be obtained.

[0021] Step S103: Input the cotton pest and disease images into the cotton pest identification network model and output the cotton pest identification results.

[0022] The specific composition of the module in step S102 and the processing procedure of the cotton pest and disease images in the above module are as follows: The cotton pest and disease images are input into the feature encoding module to generate multi-scale output features, such as... Figure 3 As shown, the feature encoding module is built upon the core foundation of the dual-channel hybrid convolutional state space module CON-SSM. The core function of this CON-SSM module is to simultaneously extract local detail features and global correlation features from the input image. This feature encoding module includes a first dual-channel hybrid convolutional state space module CON-SSM1, a second dual-channel hybrid convolutional state space module CON-SSM2, a third dual-channel hybrid convolutional state space module CON-SSM3, and a fourth dual-channel hybrid convolutional state space module CON-SSM4. These four modules are connected in series to form the feature encoding module.

[0023] The cotton disease and pest images are input into the first dual-path hybrid convolutional state space module CON-SSM1 to generate the first-scale output features. And copy and retain the first-scale output features. Then the first scale output features are then processed. Input the second dual-path hybrid convolutional state space module CON-SSM2 to generate the second-scale output features. And copy and retain the second-scale output features. The second scale output features Input the third dual-path hybrid convolutional state space module CON-SSM3 to generate the third-scale output features. And replicate and retain the third-scale output features. Finally, the third-scale output features are... Input the fourth dual-path hybrid convolutional state space module CON-SSM4 to generate the fourth-scale output features. And replicate and retain the fourth-scale output features. .

[0024] The processing of the above inputs in the dual-path hybrid convolutional state space module is the same. Here, we take a cotton pest and disease image as an example, input it into the first dual-path hybrid convolutional state space module CON-SSM1, and generate the first-scale output features. The processing procedure is explained in detail: like Figure 4 As shown, the first dual-path hybrid convolutional state space module CON-SSM1 adopts a dual-path parallel processing architecture, with cotton pest and disease images as input. The process is divided into two parallel paths: the left side performs detail enhancement processing on local areas of the cotton disease and pest image to generate the first local detail feature. On the right, global correlation modeling is performed on the first cotton pest and disease image to generate the first global correlation feature. Then, the first local detail features and the first global correlation features are further fused element-wise to generate the first scale output features. : (1) in, This indicates an element-wise addition operation.

[0025] Generate first local detail features The process is as follows: First, display images of cotton diseases and pests. The spatial dimension is compressed by a global average pooling layer (AvgPool), followed by non-linear feature mapping through a bottleneck structure consisting of a first convolutional layer (1×1 Conv2d1), a ReLU activation function, and a second convolutional layer (1×1 Conv2d2). Finally, a first local detail feature weight map is generated by a Sigmoid activation function. : (2) in, This represents the Sigmoid activation function.

[0026] The first local detail feature weight map and the cotton pest and disease image are multiplied element-wise to enhance key local details. Then, a third convolutional layer (3×3 Conv2d3) is used to enhance the continuity of local spatial texture and generate the first local detail feature. : (3) in, This indicates an element-wise multiplication operation.

[0027] Generate the first global association feature The process is as follows: First, display images of cotton diseases and pests. The input is processed by the first normalization layer, LayerNorm1, to stabilize the feature distribution. Then, the features are sequentially passed through the first linear layer, Linear1, for dimensionality upscaling; the first depthwise separable convolutional layer, DWConv1, for initial spatial perception; and the Spiral-SS2D spiral scanning state space module for global association encoding. The encoded features are then passed through the second normalization layer, LayerNorm2, to generate the first normalized features. : (4) Images of cotton diseases and pests Input the second linear layer (Linear2) to generate the first linear feature. : (5) The first normalized feature and the first linear feature After element-wise multiplication, the image is input into the third linear layer (Linear3) for projection reconstruction and then compared with the cotton pest and disease image. Perform element-wise addition to generate the first global association feature. : (6) The foreground proposal module plays a crucial role in enhancing the response of lesion regions and suppressing background noise during the skip connections in feature encoding and decoding, thereby achieving precise focusing on foreground pests in complex backgrounds. The input to this module is a multi-scale feature set { , , , (Corresponding to feature maps at different levels). The output is a multi-scale enhanced feature, specifically the first-scale enhanced feature. Second-scale enhancement features Third-scale enhancement features and fourth-scale enhancement features The generation process is as follows: like Figure 5 As shown, the fourth-scale output features are first... After projection, the signal is input into the fourth perceptron layer (MLP4) to generate the fourth feature modulation signal. : (7) (8) in, The above scale output features are given as arbitrary inputs. Represents GroupNorm normalization. It is a depthwise separable convolution.

[0028] The fourth feature modulation signal The fourth feature modulation weights are generated by the Sigmoid activation function and then compared with the fourth scale output features. Element-wise multiplication and stacking are performed (while preserving the original feature information through the dashed residual path) to generate fourth-scale enhanced features. .

[0029] Enhance the fourth-scale feature Perform bilinear upsampling to align the spatial dimensions and incorporate learnable weight parameters. Injecting third-scale output features The third preliminary fusion feature was obtained. : (9) In the formula, , The projected features of the current layer. This is an element-wise addition operation. For bilinear upsampling, This is a learnable scaling factor.

[0030] Subsequent operations of this kind will all use formula (9). To avoid repetition, a general fusion expression formula will be used.

[0031] The third preliminary fusion feature The third-scale output features, after projection, are input into the third perceptual layer MLP3 to generate the third feature modulation signal. The third feature modulated signal The third feature modulation weights are generated using the Sigmoid activation function, and the third-scale output features are then processed. The third feature modulation weights are then multiplied element-wise and added together to generate the third scale enhancement feature. : (10) (11) in, This represents the Sigmoid activation function.

[0032] Output features at the second scale After projection, the signal is initially fused with the third feature modulation signal after bilinear sampling to generate the second preliminary fused feature. The second preliminary fusion feature The second feature modulation signal is generated by inputting it into the second sensing layer MLP2. The second feature modulated signal The second feature modulation weights are generated by applying the Sigmoid activation function, and the second-scale output features are then processed. The second-scale enhanced features are generated by performing element-wise multiplication and addition of the second feature modulation weights. .

[0033] Output features at the first scale After projection, the signal is initially fused with the second feature modulation signal after bilinear sampling to generate the first preliminary fused feature. The first preliminary fusion feature The first feature modulation signal is generated by inputting into the first sensing layer MLP1. The first feature modulation signal The first feature modulation weights are generated using the Sigmoid activation function; the first scale output features are then processed. The first-scale enhanced feature is generated by performing element-wise multiplication and addition with the first feature modulation weights. This bottom-up mechanism enables the fusion and enhancement of multi-level input feature information, thereby strengthening the representational ability of target features at different scales.

[0034] like Figure 6As shown, the feature decoding module and the feature encoding module have similar structures and are inversely complementary in function. The feature decoding module is also built upon the CON-SSM module as its core. The input to this module is the multi-scale enhancement feature output from the foreground proposal module, and the output is the multi-scale fused feature and the cotton leaf foreground mask `pred_m`. The feature decoding module includes the fifth dual-path hybrid convolutional state space module CON-SSM5, the sixth dual-path hybrid convolutional state space module CON-SSM6, the seventh dual-path hybrid convolutional state space module CON-SSM7, the eighth dual-path hybrid convolutional state space module CON-SSM8, and the final projection layer Final Projection. The multi-scale fused feature includes the first-scale fused feature. Second-scale fusion features Third-scale fusion features .

[0035] Enhance the fourth-scale feature The fifth dual-channel hybrid convolutional state space module (CON-SSM5) is input for initial decoding processing to generate fourth-scale decoded features. These fourth-scale decoded features are then combined with the third-scale enhanced features. Element-wise fusion is performed to obtain the third intermediate fusion feature. The third intermediate fusion feature is then input into the sixth dual-path hybrid convolutional state space module CON-SSM6 to generate the third scale fusion feature. .

[0036] Third-scale fusion features Second-scale enhancement features Element-wise fusion is performed to obtain the second intermediate fused feature. The second intermediate fused feature is then input into the seventh dual-path hybrid convolutional state space module CON-SSM7 to generate the second scale fused feature. .

[0037] Second-scale fusion features and first-scale enhancement features Element-wise fusion is performed to obtain the first intermediate fused feature. The first intermediate fused feature is then input into the eighth dual-path hybrid convolutional state space module CON-SSM8 to generate the first scale fused feature. , fuse features at the first scale Input the final projection layer (Final Projection) to complete dimensional transformation and mask mapping, generating a cotton leaf foreground mask with the same size as the original input image.

[0038] The element-wise fusion operations at each level in this step acquire more global and local contextual information about the cotton leaves, forming a complete contextual feature representation. This helps improve the model's understanding of the overall image structure and key local features. Simultaneously, the module progressively upsamples these fused features to restore them to the original cotton image resolution, preserving details such as texture and edges on the cotton leaves. Furthermore, by restoring image details from high-level abstract features, the model's reconstruction and segmentation performance for cotton images is further improved, making it more semantically and visually accurate. The final generated cotton prediction mask effectively weakens background interference, thereby achieving accurate detection of cotton pests and diseases in complex backgrounds.

[0039] The semantic guidance module is a key module in this application for enhancing cotton pest features and suppressing interference under complex backgrounds. Its core function is to construct a multi-scale feature collaborative fusion mechanism and introduce a foreground semantic guidance feature weighting strategy to strengthen the effective feature response of diseased leaf areas and suppress interference from background information, ultimately improving the robustness of the recognition task under complex backgrounds. The multi-scale fused features and the cotton leaf foreground mask are input into the semantic guidance module, and the cotton pest recognition result is output. The input of the semantic guidance module is the multi-scale fused features generated by the feature decoding module and the cotton leaf foreground mask; the output is the cotton pest recognition result. The structural diagram of the semantic guidance module is shown below. Figure 7 As shown, the workflow is as follows: Receive the first-scale fused features output from the feature decoding module. Second-scale fusion features and third-scale fusion features Since there are differences in spatial resolution and channel dimensions at each level, they are first fed into an independent fourth convolutional layer (1x1Conv2d4) for dimension alignment to achieve unified dimension alignment and obtain multi-dimensional aligned features. : (12) Multi-dimensional aligned features are sequentially passed through the fourth linear layer (Linear4) to complete feature dimension mapping, and then spatial structure modeling is performed through the second deep separable convolutional layer (DWConv2) to preserve the spatial structure information of the features and generate multi-scale spatial features. : (13) The cotton leaf foreground mask pred_m is used as an explicit foreground semantic prior and multi-scale spatial features. The input is a saliency-SS2D two-dimensional selective scanning unit. This unit dynamically adjusts the parameters of the selective state-space model (SSM) based on the location information of the diseased leaf region in pred_m. The Saliency-SS2D unit can generate four saliency scanning paths for the foreground region, which are then fused into multi-scale spatial features. By fusing along this path, semantic core focusing features with semantic focusing capabilities are generated. .

[0040] To further suppress background noise, the semantic core focusing features are input into the third normalization layer LayerNorm3 for processing, and then combined with multi-scale spatial features. Element-wise multiplication is performed to achieve weighted enhancement of foreground features of diseased leaves and targeted suppression of background features, generating weighted fused features. : (14) Weighted fusion features After feature integration at the fifth linear layer (Linear5), the features are aligned with multi-dimensional features. Element-wise addition is performed to preserve the underlying texture information of the original features, generating dual-path fusion and overlay features. : (15) The dual-path fusion and superimposed features are input into the classifier to complete the classification, generating identification results for cotton pests and achieving accurate identification of cotton pests.

[0041] (16) In summary, the method proposed in this application effectively solves the problem of insufficient recognition accuracy caused by background information interference in complex environments through "refined feature extraction - foreground mask generation - mask-guided feature fusion - diseased leaf classification". It significantly improves the accuracy and robustness of cotton disease identification. The method achieves refined feature extraction of diseased leaves through a hybrid high-efficiency coding network, providing support for subsequent identification. It fully explores and utilizes the explicit semantic prior information contained in the pixel-level diseased leaf mask, thereby guiding the fusion process of multi-scale features in a targeted manner. This effectively weakens the impact of complex background interference on feature learning. Even in actual scenarios where weeds, soil and other interference factors coexist in the field, it can still effectively suppress background information interference, accurately focus on the diseased leaf area, and achieve high-precision cotton pest identification.

[0042] In some embodiments, this application also provides a computer system including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0043] This application also provides a computer-readable storage medium for storing a computer program. This computer-readable storage medium can be applied to a computer device, and the computer program causes the computer device to execute the corresponding processes in the methods described above in the embodiments of this application; for brevity, further details are omitted here.

[0044] The above embodiments are preferred implementations of this application. In addition, this application can be implemented in other ways. Any obvious substitutions without departing from the concept of this technical solution are within the protection scope of this application.

[0045] To facilitate understanding by those skilled in the art of the improvements made by this application compared to the prior art, some of the accompanying drawings and descriptions have been simplified, and for clarity, some other elements have been omitted from this application. Those skilled in the art should realize that these omitted elements may also constitute the content of this application.

Claims

1. A method for identifying cotton pests in complex backgrounds under semantic guidance, characterized in that, include: Collect images of cotton diseases and pests; Constructing a cotton pest identification network model; The cotton pest identification network model includes a feature encoding module, a foreground proposal module, a feature decoding module, and a semantic guidance module; The cotton pest and disease images are input into the cotton pest and disease identification network model, and the identification results of cotton pests and diseases are output.

2. The method according to claim 1, characterized in that, The step of inputting the cotton pest and disease images into the cotton pest recognition network model and outputting the cotton pest recognition results includes: The cotton pest and disease images are input into the feature encoding module to generate multi-scale output features; The multi-scale output features are input into the foreground proposal module to generate multi-scale enhanced features; The multi-scale enhanced features are input into the feature decoding module to generate multi-scale fused features and cotton leaf foreground mask; The multi-scale fusion features and the cotton leaf foreground mask are input into the semantic guidance module, and the cotton pest identification results are output.

3. The method according to claim 2, characterized in that, The feature encoding module includes a first dual-path hybrid convolutional state space module, a second dual-path hybrid convolutional state space module, a third dual-path hybrid convolutional state space module, and a fourth dual-path hybrid convolutional state space module; the multi-scale output features include a first-scale output feature, a second-scale output feature, a third-scale output feature, and a fourth-scale output feature; The step of inputting the cotton pest and disease image into the feature encoding module to generate multi-scale output features includes: The cotton pest and disease image is input into the first dual-path hybrid convolutional state space module to generate the first-scale output feature, and the first-scale output feature is copied and stored. The first-scale output features are input into the second dual-path hybrid convolutional state space module to generate the second-scale output features, and the second-scale output features are copied and stored. The second-scale output features are input into the third dual-path hybrid convolutional state space module to generate the third-scale output features, and the third-scale output features are copied and stored. The third-scale output features are input into the fourth dual-path hybrid convolutional state space module to generate the fourth-scale output features, and the fourth-scale output features are copied and stored.

4. The method according to claim 3, characterized in that, The step of inputting the cotton disease and pest image into the first dual-path hybrid convolutional state space module to generate first-scale output features includes: The local area of ​​the cotton pest and disease image is enhanced with detail to generate a first local detail feature; The cotton pest and disease images are subjected to global correlation modeling processing to generate the first global correlation feature; The first local detail feature and the first global correlation feature are fused element-wise to generate the first scale output feature.

5. The method according to claim 4, characterized in that, The step of performing detail enhancement processing on local regions of the cotton pest and disease image to generate first local detail features includes: The cotton disease and pest image is sequentially passed through a global average pooling layer, a first convolutional layer, a ReLU activation function, a second convolutional layer, and a Sigmoid activation function to generate a first local detail feature weight map; The first local detail feature weight map and the cotton disease and pest image are multiplied element-wise, and then passed through a third convolutional layer to generate the first local detail feature.

6. The method according to claim 5, characterized in that, The step of performing global correlation modeling on the cotton pest and disease images to generate a first global correlation feature includes: The cotton disease and pest image is sequentially passed through a first normalization layer, a first linear layer, a first depth-separable convolutional layer, a spiral scanning two-dimensional state space module, and a second normalization layer to generate a first normalized feature; The cotton pest and disease image is passed through a second linear layer to generate a first linear feature; After multiplying the first normalized feature and the first linear feature element by element, the result is input into the third linear layer for projection reconstruction, and then added element by element to the cotton disease and pest image to generate the first global correlation feature.

7. The method according to claim 6, characterized in that, The multi-scale enhancement features include a first-scale enhancement feature, a second-scale enhancement feature, a third-scale enhancement feature, and a fourth-scale enhancement feature; The step of inputting the multi-scale output features into the foreground proposal module to generate multi-scale enhancement features includes: The fourth-scale output features are projected and input into the fourth perception layer to generate a fourth feature modulation signal; the fourth feature modulation signal is then activated by the Sigmoid activation function to generate fourth feature modulation weights. The fourth-scale output feature and the fourth-scale modulation weight are multiplied element-wise and then superimposed to generate the fourth-scale enhanced feature; The third-scale output feature is projected and then initially fused with the fourth feature modulation signal after bilinear sampling to generate a third preliminary fused feature. The third preliminary fusion feature is input into the third sensing layer to generate a third feature modulation signal; The third feature modulation signal is processed by the Sigmoid activation function to generate the third feature modulation weight; The third-scale output feature and the third-scale modulation weight are multiplied element-wise and added together to generate the third-scale enhanced feature; The second scale output feature is projected and then initially fused with the third feature modulation signal after bilinear sampling to generate a second preliminary fused feature. The second preliminary fusion feature is input into the second perception layer to generate the second feature modulation signal; The second feature modulation signal is processed through the Sigmoid activation function to generate the second feature modulation weight; The second-scale output feature and the second-feature modulation weight are multiplied element-wise and added together to generate the second-scale enhanced feature; The first scale output feature is projected and then initially fused with the second feature modulation signal after bilinear sampling to generate a first preliminary fused feature. The first preliminary fused feature is input into the first perception layer to generate a first feature modulation signal; The first feature modulation signal is processed by the Sigmoid activation function to generate the first feature modulation weight; The first-scale output feature and the first feature modulation weight are multiplied element-wise and added together to generate the first-scale enhanced feature.

8. The method according to claim 7, characterized in that, The feature decoding module includes a fifth dual-channel hybrid convolutional state space module, a sixth dual-channel hybrid convolutional state space module, a seventh dual-channel hybrid convolutional state space module, an eighth dual-channel hybrid convolutional state space module, and a final projection layer; the multi-scale fusion feature includes a first-scale fusion feature, a second-scale fusion feature, and a third-scale fusion feature; the multi-scale enhanced features are input into the feature decoding module to generate multi-scale fusion features and a cotton leaf foreground mask; including: The fourth-scale enhanced features are input into the fifth dual-path hybrid convolutional state space module for preliminary decoding processing to generate fourth-scale decoded features. The fourth-scale decoding feature and the third-scale enhancement feature are fused element-by-element to obtain the third intermediate fused feature; The third intermediate fusion feature is input into the sixth dual-path hybrid convolutional state space module to generate the third scale fusion feature; The third-scale fusion feature and the second-scale enhancement feature are fused element-by-element to obtain the second intermediate fusion feature; The second intermediate fusion feature is input into the seventh dual-path hybrid convolutional state space module to generate the second scale fusion feature; The second scale fusion feature and the first scale enhancement feature are fused element by element to obtain the first intermediate fusion feature; The first intermediate fusion feature is input into the eighth dual-path hybrid convolutional state space module to generate the first scale fusion feature; The first-scale fusion feature is input into the final projection layer to generate a cotton leaf foreground mask.

9. The method according to claim 8, characterized in that, The multi-scale fused features and the cotton leaf foreground mask are input into the semantic guidance module, which outputs the cotton pest identification results, including: The first scale fusion feature, the second scale fusion feature and the third scale fusion feature are input into the fourth convolutional layer for dimension alignment to obtain multi-dimensional aligned features. The multi-dimensional aligned features are sequentially passed through the fourth linear layer and the second depthwise separable convolutional layer to generate multi-scale spatial features. The cotton leaf foreground mask and the multi-scale spatial features are input into a salient two-dimensional selective scanning unit to generate semantic core focusing features; After the semantic core focusing features are input into the third normalization layer for processing, they are multiplied element-wise with the multi-scale spatial features to generate weighted fusion features. After the weighted fusion feature is input into the fifth linear layer for feature integration, it is added element-wise with the multi-dimensional aligned feature to generate a dual-path fusion superposition feature. The dual-path fusion and superposition features are input into the classifier to generate cotton pest identification results.

10. A computer system, characterized in that, include: Memory is used to store instructions that can be executed by the processor; A processor for executing the instructions to implement the method as described in any one of claims 1 to 9.