Weed detection method and device used in complex environment background

By using the SSS-YOLO model, combined with the SCB, SPPF_EGAS and EMSN modules, the accuracy and robustness issues of weed detection in complex environments are solved, achieving high-precision detection even under occlusion and overlapping backgrounds, making it suitable for smart agriculture applications.

CN121147765APending Publication Date: 2025-12-16XINJIANG AIR & EARTH INTEGRATION LABORATORY TECHNOLOGY CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511432087.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-09
Publication Date
2025-12-16

AI Technical Summary

Technical Problem

Existing technologies struggle to maintain high accuracy while being lightweight in weed detection under complex environments, especially when weeds are detected in occluded or overlapping backgrounds. Furthermore, existing YOLO series algorithms do not perform well in complex environments.

Method used

The SSS-YOLO model is adopted, combined with the Spatial Channel Convolutional Attention Module (SCB), the Multi-Scale Pyramid Pooling Super Edge Gaussian Aggregation Module (SPPF_EGAS), and the Efficient Multi-Scale Spatial Augmentation Network Module (EMSN). The detection accuracy is improved by optimizing the algorithm to adapt to the needs of real-world scenarios.

Benefits of technology

It significantly improves the model's ability to perceive and classify weeds, making it suitable for real-time farmland robot vision systems and precise pesticide application decisions. It solves the problem of weed occlusion in complex environments and improves detection accuracy and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121147765A_ABST
    Figure CN121147765A_ABST
Patent Text Reader

Abstract

The invention discloses a weed detection method and device used in a complex environment background, and the method comprises the steps: carrying out the simplification of channel attention convolution and channel self-attention convolution in a smooth U-shaped network; a space channel convolution attention module is designed by introducing a space attention branch, a gating mechanism and two different residual connection modes, an edge filtering and Gaussian filtering combined mechanism is proposed based on an edge Gaussian aggregation module in a linear efficient Gaussian network, and rapid spatial pyramid pooling is fused. A multi-scale pooling strategy, a channel attention mechanism and a dynamic weight distribution mechanism are introduced, a multi-scale pyramid pooling hyper-edge Gaussian aggregation module is designed, a context consistency strategy is constructed on the basis of a space enhancement feedforward module in a space enhancement multi-scale network, dynamic gating is designed through shielding masks, and a multi-scale pyramid pooling hyper-edge Gaussian aggregation algorithm is constructed. Designing an efficient multi-scale space enhancement network module; based on a YOLOv9t model, a space channel convolution attention module, a multi-scale fast pyramid pooling hyper-edge Gaussian aggregation module and an efficient multi-scale space enhancement network module are combined to construct a space enhancement type YOLO model; and weeds are detected based on the spatial enhanced YOLO model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of weed detection, in particular to a weed detection method and device for complex environment background. BACKGROUND

[0002] Weeds are one of the key factors that restrict the healthy growth of plants and have an important influence on the yield and quality of crops. Precise detection of plant weeds is of great significance to improve crop yield. In recent years, weed detection technology based on deep learning has made significant progress, but it is still a big problem to maintain high detection accuracy while being lightweight.

[0003] Currently, many scholars are committed to improving deep learning algorithm models and trying to apply them to weed detection task research. Although the existing methods have achieved precision improvement, the generalization ability in actual complex scenes still needs to be strengthened. In fact, different growth stages, temperature, light, nutrients and water factors will change the plant growth environment in different areas, resulting in differences in weed morphology. These factors make different individuals of the same weed have differences, and fine changes are difficult to detect; and some weed species have high similarity, for example: gooseweed and gray-green gooseweed, combined with individual morphological differences, the detection difficulty will be further increased.

[0004] In addition, although the existing technology has made significant progress in detecting single weeds, it is still difficult to maintain high precision while being lightweight in the complex background with occlusion and overlap. SUMMARY

[0005] The present application provides a weed detection method and device for complex environment background, which is based on YOLOv9t (YOLO ninth version lightweight) model, combines the ideas of Flat U-Net (flat U-shaped network), LEG-Net (linear efficient Gaussian network) and SEM-Net (spatial efficient multi-scale network) three frameworks, proposes SSS-YOLO (spatial enhancement-YOLO) model, uses edge Gaussian aggregation and heterogeneous multi-scale feature fusion method to solve the problem of weed occlusion in complex environment background; the core idea of the model is to improve the detection accuracy through optimization algorithm while reducing the parameter quantity and computational resources, to better adapt to the actual scene demand, see the description below:

[0006] In a first aspect, a weed detection method for complex environment background is provided, the method comprising:

[0007] The collected corn field weed data is preprocessed, the preprocessed weed data set is divided and a data set label file is written;

[0008] Based on the simplified channel attention convolution and channel self-attention convolution in the smooth U-shaped network, a spatial channel convolution attention module is designed by introducing a spatial attention branch, a gating mechanism and two different residual connection modes.

[0009] Based on the edge Gaussian aggregation module in the linear efficient Gaussian network, a mechanism combining edge filtering and Gaussian filtering is proposed, and a multi-scale pyramid pooling super edge Gaussian aggregation module is designed by fusing fast spatial pyramid pooling, introducing multi-scale pooling strategy, efficient channel attention mechanism and dynamic weight distribution mechanism.

[0010] Based on the spatial enhancement feedforward module in the spatial enhancement multi-scale network, a context consistency strategy is constructed, and a dynamic gate is designed through an occlusion mask to design an efficient multi-scale spatial enhancement network module.

[0011] Based on the YOLOv9t model, a spatial enhancement YOLO model is constructed by combining the spatial channel convolution attention module, the multi-scale fast pyramid pooling super edge Gaussian aggregation module and the efficient multi-scale spatial enhancement network module.

[0012] Based on the spatial enhancement YOLO model, weeds are detected.

[0013] The spatial channel convolution attention module includes Query, Key and Value feature branches,

[0014] 1x1 convolution is used for channel compression and 3x3 convolution is used to extract multi-scale spatial features, the attention correlation matrix between channels is calculated, the attention weight is obtained through Softmax, and the Query feature is globally pooled to generate a gating signal after introducing the Sigmoid gating mechanism, and the attention weight is multiplied to realize dynamic channel screening.

[0015] It includes add residual connection mode and concat residual connection mode, and finally outputs through BatchNorm and ReLU activation, uses channel attention to suppress noise channels, and realizes feature filtering in occlusion scene.

[0016] 7x7 spatial attention kernel is used to capture long-range dependencies and highlight key areas to realize small target image restoration.

[0017] The concat residual connection mode is used to concatenate the output and the input along the channel dimension, and the dimension is reduced to the original channel number through 1x1 convolution, and the channel attention is calculated, including double weight generation.

[0018] Softmax branch: produces channel competitive weight; Sigmoid branch: produces channel gating weight.

[0019] The two weights are balanced by learnable parameters α and β:

[0020] ; ;

[0021] ; wherein, is a channel competitive weight, Softmax is a normalization exponential function, Q is a query vector, K is a key vector, T is a transpose, is a scaling factor, Gch is a channel gating weight, Sigmoid is a sigmoid function, is a learnable weight balance parameter, is a minimum value, is a dynamic balance weight.

[0022] The multi-scale pyramid pooling super-edge Gaussian aggregation module comprises: a spatial pyramid pooling and edge-guided attention mechanism are cooperatively integrated through a double-branch architecture.

[0023] The fast spatial pyramid pooling branch adopts a serial repeated max-pooling operation to construct a hierarchical receptive field, and captures cross-scale features from local details to global context; the expression is:

[0024]

[0025] wherein Y is an SPPF branch output, Conv 1×1 is a convolution with a convolution kernel size of 1x1, Concat is feature splicing, Y 0~3 is a sub-branch, R is a real set, B is a batch size, C is a channel number, H is a height, and W is a width.

[0026] The super-edge Gaussian aggregation branch smoothes texture noise through multi-scale Gaussian filtering, and combines a Scharr operator to explicitly extract gradient edge features, and strengthens the boundary discriminativeness of the target-background;

[0027] The outputs of the two branches are adaptively weighted and fused through efficient channel attention.

[0028] The super-edge Gaussian aggregation branch comprises:

[0029]

[0030] Finally, cross-branch feature interaction is realized through a 1x1 convolution, and a mixed representation is formed;

[0031] wherein Y Fuse is an edge Gaussian aggregation output; BN is batch normalization; ReLU is a rectified linear activation function; X is an input feature vector; Y Gauss is a Gaussian filtering component, and Y EdgeFor edge detection components, f SPPF For SPPF branches, the composite function f EGAS For the composite function of the EGAS branch, f Fusion This is the fusion function.

[0032] The high-efficiency multi-scale spatial augmentation network module includes:

[0033] A parallel occlusion perception branch is introduced, and a two-level convolutional architecture is used to generate a spatially adaptive occlusion probability map. A heterogeneous multi-scale feature fusion path is designed, and 3×3 local average pooling is used to capture leaf edge details. Combined with global adaptive pooling, long-range dependencies are established. The dual-path outputs are channel aligned to form compensation features, providing multi-scale contextual support for occluded areas. A dynamic gating fusion mechanism is adopted to perform weighted fusion of original features and compensation features based on occlusion probability. The integrity of details is preserved in the visible area, and the target morphology features are reconstructed through contextual reasoning in the occluded area.

[0034] The expression for the efficient multi-scale spatial augmentation network module is as follows:

[0035]

[0036] Where Wi represents the grouped convolution weights, i∈{1,2,3,4,5,6,7}. This represents a convolution operation, where GELU is the Gaussian activation function. For element-wise multiplication, C′ is the dimension of the intermediate hidden layer, M∈[0,1] is the occlusion mask, [·]: C′ is a tensor slicing operation, taking the first C′ channels, [·]C′: is a tensor slicing operation, taking the last C′ channels.

[0037] A second aspect is a device for weed detection in complex environmental settings, the device comprising: a processor and a memory, the memory storing program instructions, the processor calling the program instructions stored in the memory to cause the device to perform the method described in any of the first aspects.

[0038] Third aspect, a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method described in any one of the first aspects.

[0039] The beneficial effects of the technical solution provided by this invention are:

[0040] 1. To address the challenge of identifying subtle features of different weeds in agricultural settings, this invention proposes an SCB (Spatial Channel Convolutional Attention Module). This module generates three feature branches in parallel: Query, Key, and Value. First, it uses 1×1 convolution for channel compression and 3×3 convolution to extract multi-scale spatial features, effectively capturing subtle textural differences between weeds and crops. Then, it calculates the attention correlation matrix between channels and obtains attention weights using Softmax (normalized exponential function), focusing on channels highly correlated with weed features. Innovatively, a Sigmoid gating mechanism is introduced, where the Query features are globally pooled to generate a gating signal, which is then multiplied by the attention weights to achieve dynamic channels. The module effectively suppresses background noise and enhances the saliency of weed areas. In complex farmland environments, it provides two residual connection modes: the add mode directly adds the components to maintain dimensionality consistency, suitable for weed recognition in simple backgrounds; the concat mode concatenates the components and then reduces dimensionality through 1×1 convolution, preserving more feature information, suitable for dense weeds or severely occluded scenarios. Finally, the output is activated by BatchNorm and ReLU to ensure the stability of feature distribution. This structure significantly improves the model's ability to perceive and classify weeds while maintaining low computational complexity, making it particularly suitable for real-time farmland robot vision systems, precision pesticide application decisions, and other practical applications, providing reliable technical support for smart agriculture.

[0041] 2. To effectively enhance the expressive power of the input feature map, this invention proposes a multi-scale feature fusion module (SPPF_EGAS), specifically designed to improve target detection performance in complex visual scenes. This module integrates spatial pyramid pooling and edge-guided attention mechanisms through a dual-branch architecture: the SPPF (Fast Spatial Pyramid Pooling) branch uses serially repeated max pooling operations to construct hierarchical receptive fields, effectively capturing cross-scale feature information from local details to global context, enhancing the model's adaptability to scale changes; the EGAS (Super Edge Gaussian Aggregation) branch smooths texture noise through multi-scale Gaussian filtering and explicitly extracts gradient edge features using the Scharr (Image Difference Computation) operator, strengthening the boundary discriminability between the target and background; the outputs of the two branches are adaptively weighted and fused through efficient channel attention (ECA), enabling the model to dynamically focus on key feature regions in occluded scenes; experiments show that this module significantly improves the robustness of feature representation in partially occluded target detection, achieving a balance between accuracy and efficiency with low computational overhead, and is suitable for practical applications with high requirements for occlusion robustness, such as autonomous driving and surveillance analysis.

[0042] 3. To address the problem of densely growing and overlapping weeds obscuring targets in agricultural visual detection, this invention innovatively proposes an Enhanced Multi-Scale Spatial Feature Normalization Module (EMSN). This module significantly improves detection performance in obscured scenarios through a triple collaborative mechanism: First, a parallel obscuration perception branch is introduced, employing a two-level convolutional architecture to generate a spatially adaptive obscuration probability map, explicitly quantifying the vegetation coverage at each pixel location, enabling the model to identify overlapping leaf areas. Second, a heterogeneous multi-scale feature fusion pathway is designed, capturing leaf edge detail features through 3×3 local average pooling, and establishing long-range dependencies by combining global adaptive pooling. The dual-path outputs are aligned to form compensation features, providing multi-scale contextual support for obscured areas. Finally, a dynamic gating fusion mechanism is adopted, weightedly fusing the original and compensation features based on the obscuration probability. This preserves detail integrity in visible areas and reconstructs target morphological features through contextual reasoning in obscured areas, effectively solving the problem of high false positive and false negative rates in traditional methods in dense vegetation environments, providing a reliable technical solution for intelligent weed identification in precision agriculture. Attached Figure Description

[0043] Figure 1 This is a flowchart of a weed detection method for use in complex environmental settings;

[0044] Figure 2 This is a network structure diagram of a weed detection method for complex environmental backgrounds;

[0045] Figure 3 This is a schematic diagram of the SCB module;

[0046] Figure 4 A schematic diagram of the SPPF_EGAS module;

[0047] Figure 5 This is a schematic diagram of the EMSN module. Detailed Implementation

[0048] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below.

[0049] In recent years, deep learning-based weed detection technology has made significant progress, but maintaining high detection accuracy while keeping it lightweight remains a major challenge. The YOLO series of algorithms is widely used due to its efficiency. However, existing YOLO algorithms struggle to achieve low parameter and computational costs while maintaining high accuracy when detecting occluded and overlapping weeds. This invention proposes a target detection algorithm based on YOLOv9t: SSS-YOLO.

[0050] First, we propose the SCB (Spatial Channel Convolutional Attention) module, which uses large-kernel convolution to capture long-range dependencies, bypassing the local regions of weeds obscured by crops to associate with unobscured regions, while simultaneously enhancing the features of unobscured regions by utilizing inter-channel relationships. Second, we propose the SPPF_EGAS (Fast Spatial Pyramid Pooling with Edge Gaussian Distribution) module, which uses multi-scale max pooling to extract hierarchical contextual features and leverages a large receptive field to obtain background information around the obscured objects, inferring the features of the local regions of weeds obscured by crops. Finally, we propose the EMSN (Enhanced Multi-Scale Spatial Feedforward Network) module, which reconstructs the semantic information of obscured regions through contextual inference, effectively suppressing interference from background vegetation while maintaining the integrity of details in visible areas.

[0051] The meanings of the terms used in the embodiments of this invention are given below:

[0052] 1. Simplified Channel Attention Convolution: This is a convolutional module that incorporates a simplified version of channel attention; it learns and emphasizes feature channels that are important to the current task, while suppressing unimportant feature channels. [1] .

[0053] 2. Channel self-attention convolution: This is a convolutional module that incorporates channel self-attention, enabling the model to automatically learn each feature channel. [1] .

[0054] 3. The spatial attention branch is the attention branch that teaches the neural network to focus on which "spatial locations" in an image or feature map are more important. [2] .

[0055] 4. Residual Connections: A type of skip connection structure that introduces a direct connection from the layer input to the layer output, enabling the neural network to directly learn the difference between the input and output. [3] .

[0056] 5. Gating mechanisms are: a learnable structure that learns to decide "how much information to let through" or "how much information to forget". [4] .

[0057] 6. The edge Gaussian aggregation module is a module that assumes edge points should conform to a Gaussian distribution and optimizes edge prediction results by aggregating Gaussian weighted information from their neighborhoods. [5] .

[0058] 7. Edge filtering is an image processing technique that uses abrupt changes in pixel values ​​to delineate the outlines and boundaries of objects in an image. [5] .

[0059] 8. Gaussian filtering is an image processing technique that uses weighted averaging to blur images, smooth details, and suppress noise. [5] .

[0060] 9. Fast Spatial Pyramid Pooling: A feature pyramid module that integrates multiple max pooling operations at different scales to rapidly expand the receptive field and extract multi-scale features. [6] .

[0061] 10. Multi-scale pooling strategy: A feature fusion method that uses pooling operations of different sizes or types to capture contextual information of different ranges, thereby enhancing the model's ability to extract target features at different scales. [7] .

[0062] 11. The efficient channel attention mechanism is an attention mechanism that improves model performance with extremely low computational cost by calculating adaptive weights for each channel through one-dimensional convolutions that avoid dimensionality reduction. [8] .

[0063] 12. The dynamic weight allocation mechanism is a learning strategy that allows a neural network to automatically and dynamically adjust its internal connections and feature importance based on the content of the input data. [9] .

[0064] 13. The spatial enhancement feedforward module is an improved structure that enhances the feedforward network's ability to model spatial context information by introducing a spatial dimension and strengthening spatial perception.

[10] .

[0065] 14. Context consistency strategy: A method to improve the overall reasonableness and accuracy of prediction results by ensuring that the model maintains consistency with global context information when processing local information.

[11] .

[0066] 15. Occlusion masking is a self-supervised learning technique that randomly covers part of the input data during training to force the model to make predictions from the remaining contextual information.

[12] .

[0067] 16. Dynamic gating is a mechanism that uses learnable gating units to dynamically control the flow of data in a network based on input information.

[13] .

[0068] Example 1

[0069] This invention provides a method for weed detection in complex environments. This invention addresses the dual challenges of limited recognition accuracy in computer vision-based cornfield weed detection due to complex backgrounds and occluded targets, and the difficulty of deploying high-performance models on resource-constrained devices. Details are provided below:

[0070] Step 101: Construct a cornfield weed dataset, take photos of cornfield weeds, preprocess the collected cornfield weed data, divide the weed dataset after preprocessing, and write a dataset label file.

[0071] Step (1.1): Collect image data of six types of plants: Amaranthus retroflexus, Amaranthus albiflorus, Chenopodium album, Chenopodium monnieri, Portulaca oleracea, and Setaria viridis. Data sources include actual field photos, public datasets, and agricultural research databases.

[0072] Step (1.2): Label the image data of weeds in the cornfield;

[0073] This involves manually labeling the collected data on weeds in cornfields according to standards set by agricultural experts; the labeling includes the type of weed.

[0074] Step (1.3): Standardize the images by cropping and resizing the images of various weeds in the cornfield, setting the image size to 640*640;

[0075] Step (1.4): Classify the cornfield weeds by category, save the cornfield weed data to the folder of the respective weed category, and divide the cornfield weed dataset into training set, test set and validation set; according to the ratio of 8:1:1, use random allocation to uniformly distribute the cornfield weed data obtained in steps (1.1)-(1.3);

[0076] Step (1.5): Create a dataset label file, which includes the dataset category to which the image belongs, the cornfield weed category to which the image belongs, and the image data path of the cornfield weeds.

[0077] Step 102: Based on the YOLOv9t model, and combining the ideas of the three frameworks Flat U-Net, LEG-Net, and SEM-Net, the SSS-YOLO model is proposed to solve the above problems;

[0078] Among them, the YOLOv9t model, proposed in 2023 in the YOLO series, has the advantages of small parameter size, low computational cost, and fast detection speed. It performs well in target detection tasks with simple backgrounds, but its performance is unsatisfactory in complex environments due to occlusion and overlapping weeds. To balance speed and accuracy, the YOLOv9t model uses a shallow backbone, which results in insufficient extraction of local features from occluded targets. When only leaf edges are visible, it cannot activate high-level semantic features. Furthermore, its multi-scale feature fusion capability is weak, and the false negative rate surges when small targets are occluded. The YOLOv9t model reduces the number of channels and simplifies the attention mechanism, resulting in an inability to dynamically suppress interfering features in occluded areas. It also lacks sufficient discriminative power for overlapping targets; for example, the false positive rate increases when crops and weeds are similar in color.

[0079] Therefore, this invention addresses the occlusion and overlap issues by improving and optimizing the backbone and neck regions, respectively. The SCB module is designed, employing large-kernel convolution to capture long-range dependencies, bypassing the local regions of weeds occluded by crops to associate with unoccluded regions, while simultaneously enhancing the features of unoccluded regions using inter-channel relationships. SPPF and EGAS are fused into the SPPF_EGAS module, employing multi-scale max pooling to extract hierarchical contextual features, utilizing a large receptive field to acquire background information around the occluded objects, and inferring the features of the local regions of weeds occluded by crops. An EMSN module is proposed, reconstructing the semantic information of occluded regions through contextual inference, effectively suppressing interference from background vegetation while maintaining the integrity of visible area details.

[0080] Step (2.1): To address the issue of the YOLOv9t model's weak ability to capture important features, this embodiment of the invention proposes the SCB module. See the network structure diagram below. Figure 2 This module generates three feature branches—Query, Key, and Value—in parallel. First, it uses 1×1 convolutions for channel compression and 3×3 convolutions to extract multi-scale spatial features, effectively capturing subtle texture differences between weeds and crops. Then, it calculates the attention correlation matrix between channels and obtains attention weights through Softmax, focusing on channels highly correlated with weed features. An innovative Sigmoid gating mechanism is introduced, generating a gating signal after global pooling of the Query features. This signal is multiplied by the attention weights to achieve dynamic channel filtering, effectively suppressing background noise and enhancing the saliency of weed areas. In complex farmland environments, this module provides two residual connection modes: the add mode directly adds to maintain dimensionality consistency, suitable for weed recognition in simple backgrounds; the concat mode concatenates and then uses 1×1 convolutions for dimensionality reduction, preserving more feature information, suitable for dense weeds or heavily occluded scenes. Finally, the output is activated by BatchNorm and ReLU to ensure the stability of the feature distribution. This structure significantly improves the model's ability to perceive and classify weeds while maintaining low computational complexity. It is particularly suitable for real-time agricultural robot vision systems and precision pesticide application decisions, providing reliable technical support for smart agriculture. Channel attention (α_softmax + β_sigmoid) is used to suppress noisy channels and enhance effective channels, enabling feature filtering in occluded scenarios. A 7×7 spatial attention kernel is used to capture long-range dependencies, highlighting key regions and enabling small target image restoration. By automatically switching between full attention and lightweight convolutional paths, computational efficiency at different resolutions is balanced, achieving multi-scale adaptation. Learnable α and β parameters enable adaptive fusion of soft and hard attention, achieving dynamic balance in complex environments.

[0081] like Figure 2As shown, after the input feature map enters the SCB module, it first performs a size judgment: when the feature map height H and width W are greater than or equal to the preset threshold min_size (default 32), it enters the full attention path; when the feature map size is less than min_size, it enables the lightweight convolution path. In the full attention path, it first undergoes three feature extractions: Query branch: grouped 1×1 convolution (channel compression) + GroupNorm + ReLU + grouped 3×3 convolution (spatial feature extraction), outputting Q features; Key branch: symmetrical in structure to the Query branch but with independent parameters, outputting K features; Value branch: directly uses grouped 3×3 convolution + GroupNorm, outputting V features. In the lightweight convolution path, when the feature map is small: it directly uses a single 3×3 grouped convolution + GroupNorm + ReLU, maintaining the same residual connection options as the main path. Then, residual connection processing is performed: ①Add mode: the attention output / lightweight convolution output is added element-wise to the input features; ②Concat mode: the output and input are concatenated along the channel dimension, and the dimensionality is reduced to the original number of channels through 1x1 convolution. Then, after channel attention calculation, ① similarity matrix: multiply Q by the transpose of K, and then divide by the scaling factor; ② channel statistics: sum the similarity matrix along the spatial dimension to obtain the channel description vector; ③ dual weight generation: Softmax branch: generate channel competitive weights (highlight the most salient features) and Sigmoid branch: generate channel gating weights (preserve the possibility of multiple features); ④ dynamic fusion: balance the two weights by learningable parameters α and β.

[0082] (1)

[0083] Gch=Sigmoid(QK T (2)

[0084] (3)

[0085] in, For channel competition weights, Softmax is the normalized exponential function, Q is the query vector, K is the key vector, and T is the transpose. Gch is the scaling factor, Gch is the channel gating weight, and Sigmoid is the sigmoid logistic function. For learnable weight balancing parameters, To be the minimum value (avoid division by zero), For dynamic balancing weights.

[0086] Then, spatial attention is calculated: ① Dual pooling: Channel average pooling and max pooling are performed on the V features respectively, resulting in two 1×H×W feature maps; ② Feature concatenation: The dual pooling results are concatenated along the channel dimension; ③ Spatial weights: A 7×7 convolution + sigmoid is used to generate the spatial attention map. Then, dual attention fusion is performed, multiplying the channel attention weights and spatial attention weights point by point, and then weighting them with the V features. Finally, output processing is performed: ① Normalization: GroupNorm processing (for features after adding or concatenating); ② Activation: ReLU non-linear activation; ③ Output: The final enhanced feature map (maintaining the same size C×H×W as the input).

[0087] Step (2.2): To address the feature representation degradation problem caused by scale changes and local occlusion in complex visual scenes, this embodiment of the invention designs the SPPF_EGAS module. This is a composite neural network module that collaboratively integrates Fast Spatial Pyramid Pooling (SPPF) and Super Edge Gaussian Aggregation (EGAS). Its core functions include: This module collaboratively integrates spatial pyramid pooling and edge-guided attention mechanisms through a dual-branch architecture: The SPPF branch uses serially repeated max pooling operations to construct hierarchical receptive fields, effectively capturing cross-scale feature information from local details to global context, enhancing the model's adaptability to scale changes; the EGAS branch smooths texture noise through multi-scale Gaussian filtering and explicitly extracts gradient edge features using the Scharr operator, strengthening the boundary discriminability between the target and background. The outputs of the two branches are adaptively weighted and fused through efficient channel attention (ECA), enabling the model to dynamically focus on key feature regions in occluded scenes. Experiments show that this module significantly improves the robustness of feature representation in partially occluded target detection, achieving a balance between accuracy and efficiency with low computational overhead. It is suitable for practical application scenarios with high requirements for occlusion robustness, such as autonomous driving and monitoring analysis.

[0088] Multi-scale context fusion constructs a hierarchical receptive field through serially repeated max pooling (SPPF), capturing multi-level feature responses from local details to global semantics, thus mitigating feature matching bias caused by the diversity of target scales. The dilated pooling strategy (kernel=k, stride=1, padding=k / 2) explicitly preserves contextual information at different scales while maintaining the spatial resolution of the feature map.

[0089] SPPF branch: Y=Conv 1×1 (Concat[Y0,Y1,Y2,Y3]) ∈R B×C×H×W (4)

[0090] Y represents the SPPF branch output, Conv 1×1This is a convolution with a kernel size of 1×1, where Concat is used for feature concatenation, and Y... 0~3 For sub-branches, R is the set of real numbers, B is the batch size, C is the number of channels, H is the height, and W is the width.

[0091] Edge enhancement feature recalibration, with an edge-aware branch (EGAS), extracts first-order gradient features using the Scharr operator to enhance the separation of low- and high-frequency components at the target-background boundary and suppress texture noise interference in occluded areas. Multi-scale Gaussian smoothing complements edge detection, balancing detail preservation and noise robustness through scale parameters (σ∈[0.8,1.2]). Dynamic channel attention fusion, introducing efficient channel attention (ECA), assigns channel-level weights to the fused features, enhancing...

[0092] The response intensity of strong target-related features weakens the ineffective activation in occluded areas.

[0093] EGAS branch: (5)

[0094] Y Gauss = (G0.8(X)+G1.2(X)) (6)

[0095] (7)

[0096] Y Fuse =BN(ReLU(X+Y Gauss +Y Edge )) (8)

[0097] Finally, cross-branch feature interaction is achieved through 1×1 convolution, forming a hybrid representation with stronger discriminative power.

[0098] SPPF_EGAS(X) = fFusion(f SPPF (X),f EGAS (X)) (9)

[0099] in, It is a Gaussian vector. , As expected, Given the standard deviation, the input feature map X∈RB×C1×H×W, with Gaussian filter scale: σ∈{0.8,1.2}, Y Gauss Y is the Gaussian filtered component. Edge For edge detection components, f SPPF For SPPF branches, the composite function f EGAS For the composite function of the EGAS branch, f Fusion The fusion function is a 1×1 convolution.

[0100] Step (2.3): To address the weak detection capability of YOLOv9t in weed-overlapping scenarios, an EMSN module is proposed. This module significantly improves detection performance in occluded scenarios through a triple collaborative mechanism: First, a parallel occlusion perception branch is introduced, and a two-level convolutional architecture is used to generate a spatially adaptive occlusion probability map, explicitly quantifying the vegetation coverage at each pixel location, enabling the model to identify overlapping leaf areas; Second, a heterogeneous multi-scale feature fusion pathway is designed, capturing leaf edge detail features through 3×3 local average pooling, and establishing long-range dependencies by combining global adaptive pooling. The dual-path outputs are aligned to form compensation features, providing multi-scale contextual support for occluded areas; Finally, a dynamic gating fusion mechanism is adopted, which performs weighted fusion of the original features and compensation features based on the occlusion probability, preserving the integrity of details in visible areas, and reconstructing target morphological features through contextual reasoning in occluded areas. This effectively solves the problem of high false positive and false negative rates in traditional methods in dense vegetation environments, providing a reliable technical solution for intelligent weed identification in precision agriculture.

[0101] like Figure 4 As shown, it has three main features: ① Explicit occlusion modeling mechanism: By adding a parallel occlusion perception branch, it builds the ability to automatically generate spatial occlusion masks from feature maps. This branch adopts a two-level convolutional structure: the first-level 3×3 convolution compresses the channel dimension to extract local features, and the second-level 3×3 convolution restores the original number of channels and generates a spatial attention map through Sigmoid activation. The output occlusion mask quantifies the probability that each pixel location is covered by vegetation, enabling the model to explicitly distinguish between occluded and visible areas. ② Heterogeneous multi-scale feature fusion: A dual-path structure is designed to solve the scale limitations of traditional single-path: the main path uses 3×3 average pooling to retain local geometric features, combined with two layers of 3×3 convolution to build morphological perception capabilities, specifically capturing the jagged edges of weed leaves. The small-scale path compresses the spatial dimension through global average pooling, combined with 1×1 convolution to establish long-range dependencies, effectively modeling cross-regional occlusion context. The two feature paths are scale-aligned through channel duplication and then added element-wise to form compensating features. ③ The dynamic feature enhancement strategy proposes an adaptive feature fusion method based on occlusion masks: the original feature map and multi-scale compensation features are weighted and summed, with the weights dynamically controlled by the occlusion mask. In the identified occluded areas (mask values ​​close to 1), compensation features are mainly used, while in the visible areas (mask values ​​close to 0), the original features are preserved, achieving pixel-level feature restoration.

[0102]

[0103] Where Wi represents the grouped convolution weights, i∈{1,2,3,4,5,6,7}. The convolution operation is represented by GELU, the Gaussian activation function is ⊙, element-wise multiplication is ⊙, C′ is the dimension of the intermediate hidden layer, M∈[0,1] is the occlusion mask, [·]:C′ is a tensor slicing operation, taking the first C′ channels, [·]C′: is a tensor slicing operation, taking the last C′ channels. This mechanism enables the model to maintain the detail integrity of the visible area, reconstruct the local semantic information of weeds occluded by crops through contextual reasoning, and suppress the interference of background vegetation.

[0104] Step 103: Set evaluation indicators and experimental parameters, specifically:

[0105] Step (3.1): Set evaluation metrics: To evaluate the target detection model, this embodiment of the invention uses multiple metrics, including: maximum average precision (mAP50~95), mean average precision (mAP50), precision, recall, computations per second (GFLOPs), and number of parameters.

[0106] Step (3.2): Setting experimental parameters: The experimental equipment was an Nvidia RTX 3050 Ti 4G, and the environment was configured with CUDA 11.7, Torch 1.12.0, and Torchvision 0.13.0. The learning rate decrease function was a cosine function, the model optimizer was stochastic gradient descent (SGD), and the optimizer weight decay factor was set to 0.0005. Considering the GPU memory limitations, the batch size was set to 6, the training cycle was set to 500 epochs, and the experimental resolution was 640×640 pixels.

[0107]

[0108] Step 104: Design comparative experiments to verify the comprehensive performance advantages of the method proposed in this invention.

[0109] Step 4.1: Comparative experiments were conducted with multiple YOLO series models on public datasets, namely YOLOv5n, YOLOv8n, YOLOv9t, YOLOv9s, YOLOv9m, YOLOv10n, YOLOv10s, YOLOv10m, YOLOv11n, YOLOv11s, YOLOv11m, and YOLOv12n, to verify the performance of the proposed model in the object detection task.

[0110] Step 4.2: To evaluate the effectiveness of the model improvement strategy in weed detection in cornfields, ablation experiments were conducted on the SCB, SPPF_EGAS, and ESMN modules.

[0111] Step 4.3: To systematically evaluate the model deployment efficiency and accuracy of the pruning and distillation strategies in weed detection in cornfields, an ablation experiment was conducted on the pruning and distillation strategies.

[0112] In summary, this embodiment of the invention, through steps 104 to 104 above, builds upon the existing target detection model YOLOv9t by combining the proposed channel spatial attention convolution module SCB, the spatial pyramid pooling module SPPF_EGAS with fused edge Gaussian aggregation module, and the efficient multi-scale spatial feedforward network module EMSN, to propose a weed detection method and device for complex environmental backgrounds: SSS-YOLO. This embodiment of the invention has achieved good results on both self-built datasets and publicly available cornfield weed datasets.

[0113] Example 2

[0114] The feasibility of the scheme in Example 1 is verified below using specific experimental data and calculation formulas, as detailed in the following description:

[0115] Comparative experiments were conducted on public datasets with multiple YOLO series models, namely YOLOv5n, YOLOv8n, YOLOv9t, YOLOv9s, YOLOv9m, YOLOv10n, YOLOv10s, YOLOv10m, YOLOv11n, YOLOv11s, YOLOv11m, and YOLOv12n, to verify the performance of the proposed model in object detection tasks.

[0116]

[0117] To systematically evaluate the effectiveness of the model improvement strategy in weed detection in cornfields, ablation experiments were conducted on three modules: SCB, SPPF_EGAS, and EMSN.

[0118]

[0119] Example 3

[0120] To evaluate the overall performance of the model, the evaluation metrics used in this experiment are mean precision, precision, recall, F1 score, GFLOPs, and parameters. Mean precision, mean precision, and F1 score consider both precision and recall. The calculation methods for these metrics are summarized in formulas (1)-(7). Mean precision, mean precision, and F1 score consider both precision and recall. The above metrics are defined as follows:

[0121]

[0122]

[0123]

[0124]

[0125]

[0126]

[0127]

[0128] In this context, TP represents a true positive defect, FP represents a false positive defect, and FN represents a false negative defect. Precision is the proportion of true positive samples among predicted positive samples. Recall is the proportion of true positive samples correctly identified. AP is the mean precision; the precision-recall curve reflects the relationship between precision and recall for classifiers at different thresholds. F1-Score is a metric used to comprehensively evaluate the performance of classification models; it is the harmonic mean of precision and recall, aiming to balance the trade-off between the two. GFLOPs is a metric for measuring model computational complexity, used to evaluate the computational efficiency of the model in practical applications. Parameters is an important metric for measuring model complexity, reflecting the model's storage requirements and training difficulty, where O represents constant order, K represents kernel size, C represents the number of channels, M represents the input image size, and i represents the number of iterations.

[0129] To demonstrate the accuracy of the method, a generalization comparison was conducted using the publicly available dataset CottonWeedDet12 and the self-built dataset Six weeds. The CottonWeedDet12 dataset was collected from common weeds in cotton fields in various southern states of the United States. These images were taken between February and October 2021 under natural light conditions using smartphones or handheld digital cameras, forming a large-scale weed dataset.

[0130] The results show that the model proposed in this embodiment of the invention exhibits superior performance on both public and self-built datasets. Furthermore, the model in this embodiment of the invention improves both the average detection accuracy and F1-score on different datasets, indicating that SSS-YOLO has good generalization ability across various datasets.

[0131]

[0132] This invention is based on Anaconda Navigator 2.14. It uses the GUI functionality to design the original *.ui and *.py files. Then, the *.ui file is modified using the pyside6-designer built into Anaconda Navigator 2.14 to generate the *.py file, which can be used for interface design.

[0133] The software offers multiple cornfield weed detection models for users to choose from. These models may be based on different algorithms or training data, allowing users to select the most suitable model for cornfield weed detection according to their needs and application scenarios. Each model may have different performance characteristics and feature recognition capabilities, allowing users to choose based on their specific circumstances.

[0134] The software currently supports detecting six common cornfield weeds. When the user inputs a photograph, the system will activate the offline detection function; when the user uses a camera for real-time detection, the system will activate the real-time detection function.

[0135] The software can not only detect the types of weeds in cornfields, but also count their numbers. Users can obtain information on the quantity of each type of weed in the detected area, making it easier to understand the distribution of weeds in cornfields.

[0136] To improve the accuracy and flexibility of detection, the software provides adjustable confidence level and IOU (Intersection over Union) parameters. Users can adjust these parameters as needed to meet the precise detection requirements of different scenarios and needs.

[0137] For offline detection, the system supports saving the detection results. After each offline detection, users can save the detection results by clicking the "Save" button. The saved data includes photos or videos with marked boxes after detection, as well as a *.csv file containing the weed category, confidence level, and coordinate location, which facilitates subsequent weed tracking.

[0138] The software can present the detection results to users in the form of intuitive charts and data. Users can understand the distribution of different weed types in cornfields through statistical results, which can help them with agricultural research, ecological analysis, and other work.

[0139] Example 4

[0140] A weed detection device for use in complex environmental settings includes a processor and a memory. The memory stores program instructions, and the processor invokes the program instructions stored in the memory to cause the device to perform the following method steps in Embodiment 1:

[0141] The collected cornfield weed data was preprocessed, and the preprocessed weed dataset was divided and a dataset label file was created.

[0142] Based on the simplified channel attention convolution and channel self-attention convolution in the smooth U-shaped network, a spatial channel convolution attention module is designed by introducing spatial attention branch, gating mechanism and two different residual connection methods.

[0143] Based on the edge Gaussian aggregation module in linear efficient Gaussian networks, a mechanism combining edge filtering and Gaussian filtering is proposed. Fast spatial pyramid pooling is integrated, and multi-scale pooling strategy, channel attention mechanism and dynamic weight allocation mechanism are introduced to design a multi-scale pyramid pooling super-edge Gaussian aggregation module.

[0144] Based on the spatial augmentation feedforward module in the spatial augmentation multi-scale network, a context consistency strategy is constructed, and a dynamic gating is designed through occlusion mask design, thus designing an efficient multi-scale spatial augmentation network module.

[0145] Based on the YOLOv9t model, a spatially enhanced YOLO model is constructed by combining a spatial channel convolutional attention module, a multi-scale fast pyramid pooling super-edge Gaussian aggregation module, and an efficient multi-scale spatial enhancement network module.

[0146] Weed detection is performed using a spatially enhanced YOLO model.

[0147] The spatial channel convolutional attention module includes: Query, Key, and Value feature branches.

[0148] 1×1 convolution is used for channel compression and 3×3 convolution is used to extract multi-scale spatial features. The attention correlation matrix between channels is calculated, and attention weights are obtained through Softmax. A Sigmoid gating mechanism is introduced to generate a gating signal after global pooling of the query features. This signal is then multiplied with the attention weights to achieve dynamic channel filtering.

[0149] This includes: add residual connection mode and concat residual connection mode, which are finally activated by BatchNorm and ReLU, and channel attention is used to suppress noise channels to achieve feature filtering in occluded scenes;

[0150] By using a 7×7 spatial attention kernel to capture long-range dependencies, key areas are highlighted, enabling image restoration of small targets.

[0151] The concat residual connection mode is used to concatenate the output and input along the channel dimension, reduce the dimensionality to the original number of channels through 1x1 convolution, and calculate the channel attention, including: dual weight generation;

[0152] Softmax branch: generates channel-competitive weights; Sigmoid branch: generates channel-gated weights;

[0153] The two weights are balanced by weighting with learnable parameters α and β:

[0154] ;

[0155] Gch=Sigmoid(QK T );

[0156] ;

[0157] in, For channel competition weights, Softmax is the normalized exponential function, Q is the query vector, K is the key vector, and T is the transpose. Gch is the scaling factor, Gch is the channel gating weight, and Sigmoid is the sigmoid logistic function. For learnable weight balancing parameters, It is the minimum value. For dynamic balancing weights.

[0158] The multi-scale pyramid pooling super-edge Gaussian aggregation module includes: a dual-branch architecture that collaboratively integrates spatial pyramid pooling and edge-guided attention mechanisms;

[0159] The fast spatial pyramid pooling branch uses serially repeated max pooling operations to construct a hierarchical receptive field, capturing cross-scale features from local details to global context;

[0160] The super-edge Gaussian aggregation branch smooths texture noise through multi-scale Gaussian filtering and combines it with the Scharr operator to explicitly extract gradient edge features, thereby enhancing the boundary discrimination between the target and the background.

[0161] The outputs of the two branches are adaptively weighted and fused using efficient channel attention.

[0162] The super-edge Gaussian aggregation branch includes:

[0163] Y Fuse =BN(ReLU(X+Y Gauss +Y Edge ));

[0164] Finally, cross-branch feature interaction is achieved through 1×1 convolution to form a hybrid representation;

[0165] SPPF_EGAS(X) = fFusion(f SPPF (X),f EGAS (X));

[0166] Among them, Y Fuse The output is Gaussian aggregation at the edge; BN is batch normalization; ReLU is a modified linear activation function; X is the input feature vector; Y is the output of the feature vector. Gauss Y is the Gaussian filtered component. Edge For edge detection components, f SPPF For SPPF branches, the composite function f EGAS For the composite function of the EGAS branch, f Fusion This is the fusion function.

[0167] The high-efficiency multi-scale spatial augmentation network module includes:

[0168] A parallel occlusion perception branch is introduced, and a two-level convolutional architecture is used to generate a spatially adaptive occlusion probability map. A heterogeneous multi-scale feature fusion path is designed, and 3×3 local average pooling is used to capture leaf edge details. Combined with global adaptive pooling, long-range dependencies are established. The dual-path outputs are channel aligned to form compensation features, providing multi-scale contextual support for occluded areas. A dynamic gating fusion mechanism is adopted to perform weighted fusion of original features and compensation features based on occlusion probability. The integrity of details is preserved in the visible area, and the target morphology features are reconstructed through contextual reasoning in the occluded area.

[0169] The expression for the efficient multi-scale spatial augmentation network module is as follows:

[0170]

[0171] Where Wi represents the grouped convolution weights, i∈{1,2,3,4,5,6,7}. represents the convolution operation, GELU is the Gaussian activation function, ⊙ is the element-wise multiplication, C′ is the dimension of the intermediate hidden layer, M∈[0,1] is the occlusion mask, [·]:C′ is the tensor slicing operation, taking the first C′ channels, [·]C′: is the tensor slicing operation, taking the last C′ channels.

[0172] It should be noted that the device descriptions in the above embodiments correspond to the method descriptions in the embodiments, and the embodiments of the present invention will not be repeated here.

[0173] The execution entities of the aforementioned processor and memory can be devices with computing functions such as computers, microcontrollers, and single-chip microcomputers. In specific implementations, the embodiments of the present invention do not limit the execution entities and can select them according to the needs of actual applications.

[0174] Data signals are transmitted between the memory and the processor via a bus, which will not be elaborated upon in this embodiment of the invention.

[0175] Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium, the storage medium including a stored program, which, when the program is running, controls the device where the storage medium is located to execute the method steps in the above embodiments.

[0176] The computer-readable storage medium includes, but is not limited to, flash memory, hard disk, solid-state drive, etc.

[0177] It should be noted that the description of the readable storage medium in the above embodiments corresponds to the description of the method in the embodiments, and the embodiments of the present invention will not be repeated here.

[0178] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of the present invention is generated.

[0179] A computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions can be stored in or transmitted through a computer-readable storage medium. A computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be magnetic or semiconductor, etc.

[0180] Unless otherwise specified, the model numbers of the various devices in this embodiment of the invention are not limited, and any device that can perform the above functions is acceptable.

[0181] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0182] References

[0183] [1]GaoFei Zhu, GangHua Lin, Xiao Yang, Cheng Zeng.Flat U-Net: AnEfficient Ultralightweight Model for Solar Filament Segmentation in Full-diskHα Images. arXiv preprint arXiv:2502.07259, 2025.2

[0184] [2]Woo S , Park J , Lee J Y ,et al.CBAM: Convolutional BlockAttention Module[J].Springer, Cham, 2018.DOI:10.1007 / 978-3-030-01234-2_1.

[0185] [3]Liu Z , Ruan G , Tian Y ,et al.Application of a Transformernetwork based on multi-scale branches and fast Fourier gating mechanism inthe state of charge prediction for sodium-ion batteries[J].Expert SystemsWith Applications, 2025, 285.DOI:10.1016 / j.eswa.2025.127931.

[0186] [4]Dai P , Zhang J , Shu Z .Residual Connection Networks in MedicalImage Processing: Exploration of ResUnet++ Model Driven by Human ComputerInteraction[J].Applied and Computational Engineering, 2025, 116(1):194-199.DOI:10.54254 / 2755-2721 / 2025.20586.

[0187] [5]Wei Lu, Si-Bao Chen , Hui-Dong Li, Qing-Ling Shu, Chris H. Q.Ding, Jin Tang, and Bin Luo.LEGNet: Lightweight Edge-Gaussian Driven Networkfor Low-Quality Remote Sensing Image Object Detection.arXiv preprint arXiv:2503.14012,2025.3

[0188] [6]Apak S , Farsadi M .Multi-branch spatial pyramid dynamic graphconvolutional neural networks for solar defect detection[J].Computers andElectrical Engineering, 2025, 121.DOI: 10.1016 / j.compeleceng.2024.109872.

[0189] [7]Pratik S , Sharma P , Balabantaray B K ,et al.MSPolypNet: Aresidual multi-scale semantic approach for polyps segmentation[J].Computersand Electrical Engineering, 2025, 123.DOI: 10.1016 / j.compeleceng.2025.110224.

[0190] [8]Wang Q , Wu B , Zhu P ,et al.ECA-Net: Efficient Channel Attentionfor Deep Convolutional Neural Networks[C] / / 2020 IEEE / CVF Conference onComputer Vision and Pattern Recognition (CVPR).IEEE, 2020.DOI:10.1109 / CVPR42600.2020.01155.

[0191] [9]Shi Y , Jiang J , Lin H ,et al.Multiple stimuli-responsive low-molecular-weight organogel with room temperature phosphorescence for dynamicanti-counterfeiting[J].Next Materials, 2025, 6(000):100318.DOI:10.1016 / j.nxmate.2024.100318.

[0192]

[10] Shuang Chen, Haozheng Zhang, Amir Atapour-Abarghouei, Hubert PHShum. SEM -Net: Efficient Pixel Modeling for image inpainting withSpatially Enhanced SSM.arXiv preprint arXiv:2411.06318, 2024.9

[0193]

[11] Kabakum I, Montgomery T, Ravenwood D, et al.Semantic LayeredEmbedding Diffusion in Large Language Models for Multi-Contextual Consistency[J]. 2025.4

[0194]

[12] Zou W , Li Q , Li C ,et al.Improving Source Code Pre-Training viaType-Specific Masking[J].ACM Transactions on Software Engineering andMethodology, 2025, 34(3).DOI:10.1145 / 3699599.

[0195]

[13] De P , Chakrabarti S .Recognition of the Hornbill Eye's IrisUsing Bit Plane Processing, Un-sharp Masking and High Boost Filtering[C] / / Analytics Global Conference.Springer, Cham, 2025.DOI:10.1007 / 978-3-031-75157-8_9.

[0196] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for weed detection in complex environmental settings, characterized in that, The method includes: The collected cornfield weed data was preprocessed, and the preprocessed weed dataset was divided and a dataset label file was created. Based on the simplified channel attention convolution and channel self-attention convolution in the smooth U-shaped network, a spatial channel convolution attention module is designed by introducing spatial attention branch, gating mechanism and two different residual connection methods. Based on the edge Gaussian aggregation module in a linear efficient Gaussian network, a mechanism combining edge filtering and Gaussian filtering is proposed. Fast spatial pyramid pooling is integrated, and a multi-scale pooling strategy, an efficient channel attention mechanism, and a dynamic weight allocation mechanism are introduced to design a multi-scale pyramid pooling super-edge Gaussian aggregation module. Based on the spatial augmentation feedforward module in the spatial augmentation multi-scale network, a context consistency strategy is constructed, and a dynamic gating is designed through occlusion mask design, thus designing an efficient multi-scale spatial augmentation network module. Based on the YOLOv9t model, a spatially enhanced YOLO model is constructed by combining a spatial channel convolutional attention module, a multi-scale fast pyramid pooling super-edge Gaussian aggregation module, and an efficient multi-scale spatial enhancement network module. Weed detection is performed using a spatially enhanced YOLO model.

2. The weed detection method for complex environmental backgrounds according to claim 1, characterized in that, The spatial channel convolutional attention module includes: Query, Key, and Value feature branches. 1×1 convolution is used for channel compression and 3×3 convolution is used to extract multi-scale spatial features. The attention correlation matrix between channels is calculated, and attention weights are obtained through Softmax. A Sigmoid gating mechanism is introduced to generate a gating signal after global pooling of the query features. This signal is then multiplied with the attention weights to achieve dynamic channel filtering. This includes: add residual connection mode and concat residual connection mode, which are finally activated by BatchNorm and ReLU, and channel attention is used to suppress noise channels to achieve feature filtering in occluded scenes; By using a 7×7 spatial attention kernel to capture long-range dependencies, key areas are highlighted, enabling image restoration of small targets.

3. The weed detection method for complex environmental backgrounds according to claim 2, characterized in that, The concat residual connection mode is used to concatenate the output and input along the channel dimension, reduce the dimensionality to the original number of channels through 1x1 convolution, and calculate the channel attention, including: dual weight generation; Softmax branch: generates channel-competitive weights; Sigmoid branch: generates channel-gated weights; The two weights are balanced by weighting with learnable parameters α and β: ; Gch=Sigmoid(QK T ); ; in, For channel competition weights, Softmax is the normalized exponential function, Q is the query vector, K is the key vector, and T is the transpose. Gch is the scaling factor, Gch is the channel gating weight, and Sigmoid is the sigmoid logistic function. For learnable weight balancing parameters, It is the minimum value. For dynamic balancing weights.

4. The weed detection method for complex environmental backgrounds according to claim 1, characterized in that, The multi-scale pyramid pooling super-edge Gaussian aggregation module includes: a dual-branch architecture that collaboratively integrates spatial pyramid pooling and edge-guided attention mechanisms; The fast spatial pyramid pooling branch uses serially repeated max pooling operations to construct a hierarchical receptive field, capturing cross-scale features from local details to global context; The super-edge Gaussian aggregation branch smooths texture noise through multi-scale Gaussian filtering and combines it with the Scharr operator to explicitly extract gradient edge features, thereby enhancing the boundary discrimination between the target and the background. The outputs of the two branches are adaptively weighted and fused using efficient channel attention.

5. The weed detection method for complex environmental backgrounds according to claim 4, characterized in that, The expression for the fast spatial pyramid pooling branch is: Y=Conv 1×1 (Concat[Y0,Y1,Y2,Y3]) ∈R B×C×H×W ; Where Y is the SPPF branch output, Conv 1×1 This is a convolution with a kernel size of 1×1, where Concat is used for feature concatenation, and Y... 0~3 For sub-branches, R is the set of real numbers, B is the batch size, C is the number of channels, H is the height, and W is the width.

6. The weed detection method for complex environmental backgrounds according to claim 4, characterized in that, The super-edge Gaussian aggregation branch includes: AND Fuse =BN(ReLU(X+Y Gauss +And Edge )); Finally, cross-branch feature interaction is achieved through 1×1 convolution to form a hybrid representation; SPPF_EGAS(X)=fFusion(f SPPF (X),f EGAS (X))? Among them, Y Fuse The output is Gaussian aggregation at the edge; BN is batch normalization; ReLU is a modified linear activation function; X is the input feature vector; Y is the output of the feature vector. Gauss Y is the Gaussian filtered component. Edge For edge detection components, f SPPF For SPPF branches, the composite function f EGAS For the composite function of the EGAS branch, f Fusion This is the fusion function.

7. The weed detection method for complex environmental backgrounds according to claim 1, characterized in that, The high-efficiency multi-scale spatial augmentation network module includes: A parallel occlusion perception branch is introduced, and a two-level convolutional architecture is used to generate a spatially adaptive occlusion probability map. A heterogeneous multi-scale feature fusion path is designed, and 3×3 local average pooling is used to capture leaf edge details. Combined with global adaptive pooling, long-range dependencies are established. The dual-path outputs are channel aligned to form compensation features, providing multi-scale contextual support for occluded areas. A dynamic gating fusion mechanism is adopted to perform weighted fusion of original features and compensation features based on occlusion probability. The integrity of details is preserved in the visible area, and the target morphology features are reconstructed through contextual reasoning in the occluded area.

8. The weed detection method for complex environmental backgrounds according to claim 7, characterized in that, The expression for the high-efficiency multi-scale spatial augmentation network module is: Where Wi represents the grouped convolution weights, i∈{1,2,3,4,5,6,7}. represents the convolution operation, GELU is the Gaussian activation function, ⊙ is the element-wise multiplication, C′ is the dimension of the intermediate hidden layer, M∈[0,1] is the occlusion mask, [·]:C′ is the tensor slicing operation, taking the first C′ channels, [·]C′: is the tensor slicing operation, taking the last C′ channels.

9. A device for weed detection in complex environmental settings, characterized in that, The device includes a processor and a memory, the memory storing program instructions, the processor invoking the program instructions stored in the memory to cause the device to perform the method according to any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method described in any one of claims 1-8.

Citation Information

Cited By

  • Training method of venous thrombosis risk prediction model

    CN122136006A