Agricultural pest detection method based on hypergraph cross-level feature fusion
By improving the feature extraction and neck structure of the YOLO11 network and constructing the HFT-YOLO11n network, the problems of high missed detection rate and high computational cost in agricultural pest detection under complex backgrounds are solved, and the accuracy and efficiency of agricultural pest detection are achieved with improved small target detection capability and computational efficiency.
Patent Information
- Application Number
- CN202510919354.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2025-10-21
AI Technical Summary
Existing agricultural pest detection technologies have high missed detection rates in complex backgrounds, large model parameters, high computational costs, and are difficult to deploy on mobile terminals, especially for the insufficient detection accuracy of small targets and occluded targets.
Token Statistics Self-Attention is used to replace C2PSA in the YOLO11 backbone network, and the CSPTSSA module is designed. Adaptive Fine-Grained Channel Attention is used to improve the C3k2 module. The HyperC2Net network structure and ADown module are used to redesign the YOLO11 neck structure and construct the HFT-YOLO11n network.
It improves the small target detection capability, reduces model complexity, enhances detection accuracy and computational efficiency in complex backgrounds, and is suitable for mobile terminal deployment.
Smart Images

Figure CN120823618A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of agricultural pest monitoring, and in particular to an agricultural pest detection method based on cross-level feature fusion of a hypergraph. Background Art
[0002] In recent years, deep learning-based object detection algorithms have made significant progress in agricultural pest detection. For example, methods based on two-stage neural networks: in the first stage, various image processing techniques are used to process pest images to detect their geometric shapes; in the second stage, a back-propagation neural network is trained and tested on the processed images.
[0003] Despite continuous progress in agricultural pest detection research in recent years, pest identification still faces problems such as a high missed detection rate in complex backgrounds, the number of model parameters and computational costs that restrict deployment on mobile terminals, and the extremely small number of samples in some categories making it difficult for the model to learn category features.
[0004] To address the above problems, the present invention proposes an agricultural pest detection method HFT-YOLO11n based on cross-level feature fusion of hypergraphs to improve the detection capability of pest targets. Summary of the Invention
[0005] The present invention mainly solves the problems in the background and provides an agricultural pest detection method based on cross-level feature fusion of hypergraph. The specific improvements are as follows: Token Statistics Self-Attention is used to replace PSA in C2PSA in the YOLO11 backbone network, which significantly enhances the small target detection capability; Adaptive Fine-Grained Channel Attention is used to improve the C3k2 module in the YOLO11 backbone network, optimize the distribution of feature weights, and enhance the model's more accurate feature selection capability; the HyperC2Net network structure and ADown downsampling module are used to redesign the YOLO11 neck structure, improve the neck's ability to extract high-order features, and reduce the complexity of the model.
[0006] The present invention solves the technical problem by adopting the following specific solutions:
[0007] Step S1: Using image acquisition equipment, images containing agricultural pests are collected in agricultural and forest fields. The images are screened, labeled, and divided according to proportion. A series of preprocessing is then performed to form an agricultural pest dataset.
[0008] Step S2: Improve the original algorithm and propose an original CSPTSSA module, a C3k2_FCA module and a cross-level feature fusion neck network structure HCANet. Based on the above modules, a new HFT-YOLO11n detection network architecture is proposed.
[0009] Step S3: input the agricultural pest dataset constructed in step S1 into the improved algorithm in step S2 for training;
[0010] Step S4: Compare and analyze the model detection results in step S3 with the detection results of other methods.
[0011] The key to the agricultural pest detection method based on cross-level feature fusion of hypergraphs described in the present invention is that in step S1, the specific steps of constructing the agricultural pest dataset are as follows:
[0012] Collect original images of pests in different scenes through image acquisition equipment and classify the images according to the types of pests;
[0013] Use the Labelme annotation tool to label the classified pest images;
[0014] The images were preprocessed by removing EXIF orientation information, automatically adjusting contrast through contrast stretching, and resizing to 640×640 to create a YOLO format agricultural pest dataset.
[0015] Divide the labeled data into training set, test set and validation set according to training requirements;
[0016] The key to the agricultural pest detection method based on hypergraph cross-level feature fusion described in the present invention is that in step S2, the original algorithm is improved and methods such as CSPTSSA and a more advanced network architecture HFT-YOLO11n agricultural pest detection network are proposed. The steps are as follows:
[0017] In step S2, the YOLO11n feature extraction backbone network uses the Token Statistics Self-Attention (TSSA) linear attention mechanism to improve the C2PSA module in the YOLO11n feature extraction backbone network, resulting in the design of the CSPTSSA module. The C2PSA module is an advanced module for enhanced feature extraction in YOLO11, combining the CSP (Cross Stage Partial) structure and the Pyramid Squeeze Attention (PSA) attention mechanism. TSSA is used instead of PSA due to issues such as increased computational complexity with increasing input size, potential loss of small object information due to downsampling, and the need for additional modules to fuse multimodal data.
[0018] TSSA is an improved linear attention mechanism. Its working principle is as follows: TSSA first embeds the features of each token in the input sequence to generate an initial vector; then, through linear transformation, it obtains the Query (Q), Key (K), and Value (V) vectors respectively; at the same time, it introduces a statistical information branch to extract the global or local statistical features of the token; the statistical features are concatenated or weighted with Q and K to generate an enhanced attention weight matrix; after the scaled dot product calculation and Softmax normalization, V is aggregated using the weighted attention matrix to output contextual features that integrate global statistical dependencies. The function definition of TSSA is as follows:
[0019]
[0020] Among them, Z is the data matrix (dimension d×n, d is the feature dimension, n is the number of samples); is the subspace projection matrix (each U k is d×m, projecting the data into an m-dimensional subspace); π k is the weight vector of the kth subspace; D(Z,π k |U k ) is a diagonal matrix encoding the weighted error of the sample in subspace k; τ is a hyperparameter used to scale the loss; and n is the number of samples.
[0021] In the YOLO11n feature extraction backbone network in step S2, the C3k2_FCA module is designed by adding an FCA (Adaptive Fine-Grained Channel Attention) module after two Conv convolutions in the original Bottleneck structure of the C3k2 structure.
[0022] FCA is an attention mechanism that focuses on fine-grained modeling of semantic information in the channel dimension. The design principle is as follows: FCA first performs global average pooling on the feature map F containing global spatial information and converts it into a channel descriptor U to obtain channel information. The specific formula is:
[0023]
[0024] in, C, H and W represent the number of channels, length and width respectively. GAP(x) is the global average pooling function. In order to obtain local channel information while obtaining a small number of model parameters, the local channel interaction is performed using the matrix B, and B is set to b1, b2, b3, ..., b k ],pass Calculate local information Ulc , where U is the channel descriptor and k is the number of adjacent channels. The diagonal matrix D is used to capture the dependencies between all channels as global information, and D is set to [d1, d2, d3, ..., d c ],pass Calculate global information U gc , where c is the number of channels.
[0025] In the YOLO11n neck network in step S2, the cross-level feature fusion neck network structure HCANet is designed by replacing the original PANet neck structure with the HyperC2Net (Hypergraph-Based Cross-Level and Cross-Position Representation Network) network structure while retaining the C3k2 module, and using the ADown module to replace the original Conv module in the neck network as a downsampling module.
[0026] HyperC2Net is a target detection neck network based on hypergraph computing. The specific principles are as follows: HyperC2Net first cross-layer splicing the multi-scale feature maps extracted by the backbone network (such as features at five different levels) to form a feature set containing global semantic information; then a hypergraph structure is constructed by calculating the distance between feature points, in which hyperedges connect multiple feature points with similar semantics or spatial proximity, thereby capturing high-order correlations between features; then hypergraph convolution is used to propagate messages on the hypergraph structure, allowing feature information to interact complexly at different levels and positions; finally, the enhanced features generated by hypergraph convolution are fused with the original features to provide a more discriminative multi-scale feature representation for the target detection head.
[0027] The ADown (Adaptive Downsampling) module is a lightweight and efficient downsampling operation. The ADown module achieves efficient downsampling through a parallel dual-branch structure: one branch uses average pooling and 1×1 convolution to compress the spatial dimension and adjust the channel, while the other branch performs downsampling and feature extraction simultaneously through 3×3 convolution with a stride of 2. Finally, the outputs of the two branches are spliced in the channel dimension to fuse multi-scale information.
[0028] The key to the agricultural pest detection method based on cross-level feature fusion based on hypergraph described in the present invention is that in step S3, the HFT-YOLO11n model is trained with the constructed agricultural pest dataset and the best model weight is saved.
[0029] Train the model using the training set and model configuration file, adjust the training parameter settings during the training process, and save the best trained model weights, including:
[0030] The experiment sets the batch size to 16, the number of workers to 4, the number of training rounds to 250, the input image size to 640×640, the optimizer to SGD, the number of rounds of Mosaic data enhancement to 10, and all other hyperparameter settings except the above adjustments remain default.
[0031] The key to the agricultural pest detection method based on cross-level feature fusion based on hypergraph described in the present invention is that in step S4, based on the training results on the validation set, comparative experiments are conducted with benchmark and frontier models to obtain the best-performing HFT-YOLO11n agricultural pest detection model.
[0032] Compared with the prior art, the present invention has the following advantages: the CSPTSSA module is designed by replacing the PSA in C2PSA with Token Statistics Self-Attention, and the features of small targets are focused on by analyzing the low-dimensional subspace, avoiding information loss due to high computational complexity, thereby enhancing the small target detection capability; the C3k2 module in the backbone network is improved by Adaptive Fine-Grained Channel Attention to design the C3k2_FCA module, which effectively enhances the module's feature extraction capability for multi-scale targets, and optimizes the feature fusion process by fine-grained adjustment of channel weights, significantly improving the model's detection accuracy for small targets and occluded targets in complex backgrounds, while avoiding the information ambiguity or computational redundancy problems that may exist in the traditional channel attention mechanism; the HCANet module is redesigned for the YOLO11 neck structure using the HyperC2Net network structure and the ADown module, which improves the neck feature extraction capability, allows complex high-order interactions between levels and positions, and effectively reduces the model's parameters and computational complexity. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is a flowchart of the steps of the agricultural pest detection method based on cross-level feature fusion of hypergraphs of the present invention;
[0034] Figure 2 A sample image of the dataset obtained by annotating and dividing the dataset;
[0035] Figure 3 This is an example diagram of some detection results during the HFT-YOLO11n network training process;
[0036] Figure 4 The internal structure diagram of the proposed CSPTSSA module;
[0037] Figure 5 This is the structural diagram of the TSSA attention mechanism module;
[0038] Figure 6 The internal structure diagram of the proposed C3k2_FCA module;
[0039] Figure 7 This is the structural diagram of the FCA attention mechanism module;
[0040] Figure 8 This is the internal structure diagram of the proposed HCANet module;
[0041] Figure 9 This is the detailed information diagram of HyperConv;
[0042] Figure 10 This is the network architecture diagram of the HFT-YOLO11n model; DETAILED DESCRIPTION
[0043] The following is a detailed description of the present invention in conjunction with the accompanying drawings and specific embodiments. This embodiment is based on the technical solution of the present invention and provides a specific implementation method and detailed operation process.
[0044] Example: Figure 1 As shown, the agricultural pest detection method based on HFT-YOLO11n specifically includes the following steps:
[0045] S1 collects images to create a dataset:
[0046] The original images of pests in different scenes were collected by image acquisition equipment and classified into five categories: aphids, cotton bollworms, mealybugs, brown planthoppers, and whiteflies.
[0047] Use the Labelme annotation tool to label the classified pest images;
[0048] The images were preprocessed by removing EXIF orientation information, automatically adjusting contrast through contrast stretching, and resizing to 640×640 to create a YOLO format agricultural pest dataset.
[0049] According to the training requirements, the labeled data is divided into training set, validation set and test set in a ratio of 7:2:1. The sample data set is as follows Figure 2 shown.
[0050] S2 improves the original algorithm to obtain a new detection network: In the YOLO11n feature extraction backbone network in step S2, the Token Statistics Self-Attention (TSSA) linear attention mechanism is used to improve the C2PSA module in the network, and the CSPTSSA module is designed to reduce the loss of small target information and enhance the feature extraction network's ability to detect small targets.
[0051] The C2PSA module is an advanced module used in YOLO11 to enhance feature extraction. It combines the CSP (CrossStage Partial) structure and the PSA (Pyramid SqueezeAttention) attention mechanism to improve the multi-scale feature extraction capability. PSA has problems such as computational complexity increasing with input size, downsampling may lose small target information, and the need for additional modules to fuse multimodal data. Therefore, TSSA (Token Statistics Self-Attention) is used to replace the PSA module to design the CSPTSSA module. The CSPTSSA structure diagram is shown below. Figure 4 shown.
[0052] TSSA is an improved linear attention mechanism with the following structure: Figure 5 As shown. TSSA first embeds features for each token in the input sequence to generate an initial vector; then obtains Query (Q), Key (K), and Value (V) vectors through linear transformation; at the same time, introduces a statistical information branch to extract the global or local statistical features of the Token; concatenates or weightedly fuses the statistical features with Q and K to generate an enhanced attention weight matrix; after scaled dot product calculation and Softmax normalization; finally, uses the weighted attention matrix to aggregate V and output contextual features that integrate global statistical dependencies. The function definition of TSSA is as follows:
[0053]
[0054] Among them, Z is the data matrix (dimension d×n, d is the feature dimension, n is the number of samples); is the subspace projection matrix (each U k is d×m, projecting the data into an m-dimensional subspace); π k is the weight vector of the kth subspace; D(Z,π k |U k ) is a diagonal matrix encoding the weighted error of the sample in subspace k; τ is a hyperparameter used to scale the loss; and n is the number of samples.
[0055] TSSA effectively captures the feature relationships between different image regions, accurately clustering foreground and background, and improving segmentation and efficiency. Furthermore, TSSA can focus on the features of small objects by analyzing low-dimensional subspaces, avoiding information loss caused by high computational complexity and thus enhancing small object detection capabilities. Therefore, TSSA significantly outperforms PSA in complexity, interpretability, and multi-task adaptability, making it particularly well-suited for the high-resolution, multimodal, and real-time requirements of agricultural pest detection.
[0056] In the YOLO11n feature extraction backbone network in step S2, the (FCA) Adaptive Fine-Grained ChannelAttention mechanism is used to improve the original C3k2 module in the YOLO11 backbone network. The FCA module is added after the two Conv convolutions in the original Bottleneck structure to design the C3k2_FCA module. C3k2_FCA can capture the interaction between global and local information and optimize the feature weight distribution, thereby improving the model's more accurate feature selection ability. The C3k2_FCA structure diagram is shown below. Figure 6 shown.
[0057] FCA is an attention mechanism that focuses on fine-grained modeling of semantic information in the channel dimension. Its structure is as follows: Figure 7 As shown. FCA first performs global average pooling on the feature map F containing global spatial information and converts it into a channel descriptor U to obtain channel information. The specific formula is:
[0058]
[0059] in, C, H and W represent the number of channels, length and width respectively. GAP(x) is the global average pooling function.
[0060] In order to obtain local channel information while obtaining a small number of model parameters, the local channel interaction is performed using the matrix B, and B is set to [b1, b2, b3, ..., b k ],pass Calculate local information U lc , where U is the channel descriptor and k is the number of adjacent channels.
[0061] Use the diagonal matrix D to capture the dependencies between all channels as global information, set D = [d1, d2, d3, ..., d c ],pass Calculate global information U gc , where c is the number of channels.
[0062] Integrating FCA into the C3k2 module of YOLO11 can effectively enhance the module's feature extraction capability for multi-scale targets. By fine-grainedly adjusting channel weights to optimize the feature fusion process, the model's detection accuracy for small targets and occluded targets in complex backgrounds can be significantly improved. At the same time, it avoids the information ambiguity or computational redundancy problems that may exist in the traditional channel attention mechanism, and achieves enhanced discriminability of feature representation at an efficient computational cost.
[0063] In the YOLO11n neck network in step S2, the HyperC2Net (Hypergraph-Based Cross-Level and Cross-Position Representation Network) network structure and ADown module are used to improve the original PANet neck structure while retaining the C3k2 module, and a cross-level feature fusion neck network structure HCANet is designed. The HCANet structure diagram is shown in FIG. Figure 8 shown.
[0064] The YOLO11 model uses PANet as its neck structure, which promotes the comprehensive fusion of information at different scales through top-down and bottom-up paths. The capabilities of PANet are mainly limited to the feature fusion between adjacent layers, which limits the integration of cross-level features and the utilization of the relationship between high-order features. Therefore, the HyperC2Net network structure with cross-level feature fusion function is used to improve the YOLO11 neck structure. HyperC2Net first receives the multi-scale feature map output by the backbone network (such as B1-B5), unifies the resolution through up / down sampling, and splices it into fused features along the channel; then maps the feature points at each spatial position to hypergraph vertices, dynamically generates hyperedges based on feature similarity, and realizes cross-level high-order interaction through two-stage hypergraph convolution. The detailed information of hypergraph convolution is as follows: Figure 9 As shown in Figure 2, the updated vertex features are finally split back to the original hierarchy and fused with the original features via residual connections, outputting an enhanced multi-scale representation to model complex spatial and semantic dependencies. By introducing hypergraph computing, HyperC2Net significantly improves detection accuracy in complex scenarios (such as occlusion, overlapping objects, and small and medium-sized objects), while balancing computational efficiency through dynamic sparse connections and a lightweight design.
[0065] The ADown module is used to replace the original Conv module in the neck network as the downsampling module. The ADown (Adaptive Downsampling) module is a lightweight and efficient downsampling operation, which includes auxiliary reversible branches and multi-level auxiliary information. The dual-branch design of ADown retains global context information through the average pooling branch to reduce the missed detection of small targets, while using the convolution branch with a stride of 2 to capture local detail features. The two are spliced together to form a multi-scale fusion feature, which significantly improves the adaptability to complex scenes. In addition, ADown reduces the amount of computation through the channel splitting strategy, alleviates the feature discontinuity problem caused by the checkerboard effect of pure convolution downsampling, and achieves a balance between higher accuracy and inference speed in real-time detection models, which is particularly suitable for dense target and small object detection scenarios.
[0066] Based on TSSA, CSPTSSA is improved to replace the C2PSA module, which reduces the computational complexity while enhancing the small target detection capability. Based on FCA, C3k2 is improved to replace the original C3k2 module in the backbone network with C3k2_FCA, which improves the accuracy of the model's feature weight distribution. Based on HyperC2Net and ADown, the original neck structure is improved to replace the original neck structure with the HCANet network structure, which improves the feature association capability in complex scenarios and reduces the module calculation amount. Based on CSPTSSA, C3k2_FCA, and HCANet, the HFT-YOLO11n network structure is constructed. The HFT-YOLO11n network structure is as follows: Figure 10 shown.
[0067] The network used to detect images in the constructed agricultural pest dataset includes:
[0068] The zeroth layer is a standard convolution operation with 64 channels, 3×3 kernel size, and 2 strides. The input image is convolved and the feature map is reduced to half of its original size.
[0069] The first layer is a standard convolution operation with 128 channels, 3×3 kernel size, and 2 strides. The feature map passed from the previous layer is convolved and reduced to half of its original size.
[0070] The second layer C3k2_FCA feature processing module has 256 channels and is repeated twice. It dynamically adjusts channel weights through a cross-stage residual structure and adaptive fine-grained channel attention to enhance key feature responses.
[0071] The third layer is a standard convolution operation with 256 channels, 3×3 kernel size, and 2 strides. The feature map is reduced to half of its original size.
[0072] The fourth layer C3k2_FCA feature processing module has 512 channels and is repeated twice. It combines lightweight design with fine-grained attention to optimize multi-scale feature fusion.
[0073] The fifth layer is a standard convolution operation with 512 channels, 3×3 kernel size, and 2 strides. The feature map is halved.
[0074] The sixth layer C3k2_FCA feature processing module has 512 channels and is repeated twice. It also introduces dynamic receptive field adjustment and channel recalibration mechanisms.
[0075] The seventh layer is a standard convolution operation with 1024 channels, 3×3 kernel size, and 2 strides. The feature map is halved.
[0076] The eighth layer C3k2_FCA feature processing module has 1024 channels and is repeated twice to reduce computational complexity through depthwise separable convolution.
[0077] The ninth layer is the SPPF spatial pyramid pooling module, with 1024 channels and a 5×5 pooling kernel size. It rapidly aggregates global context information through multi-scale pooling operations.
[0078] The tenth layer CSPTSSA cross-stage spatiotemporal self-attention module has 1024 channels and is repeated twice. It combines channel splitting pyramid (CSP) and token statistical self-attention (TSSA) to model long-range spatiotemporal dependencies.
[0079] The average pooling operation from the eleventh to the thirteenth layers performs 8×8, 4×4, and 2×2 downsampling on the P1 / 2, P2 / 4, and P3 / 8 level feature maps, respectively, to retain detailed information at different levels;
[0080] The 14th layer uses an upsampling operation with an upsampling factor of 2 and uses the nearest neighbor interpolation method to upsample the feature map of the 10th layer to restore the spatial resolution;
[0081] The fifteenth layer concatenates the feature maps of the eleventh, twelfth, thirteenth, sixth, and fourteenth layers in the channel dimension to fuse multi-stage and multi-scale features;
[0082] The sixteenth layer performs standard convolution operations with 512 channels and 1×1 kernel size, which reduces the dimensionality of the concatenated feature maps to reduce computational complexity.
[0083] The seventeenth layer hypergraph computing module has 512 channels and models high-order feature associations through hypergraph structures to capture complex spatial relationships.
[0084] The eighteenth layer of MANet multi-attention network, repeated three times, with 512 channels, integrates channel attention and spatial attention mechanisms to dynamically optimize feature responses;
[0085] The 19th layer performs an average pooling operation with a pooling kernel size of 2×2, which downsamples the current feature map twice to retain the core semantic information.
[0086] The twentieth layer of splicing operation integrates deep abstract features with the current layer’s detailed features to enhance feature diversity;
[0087] The 21st layer is a standard convolution operation with 1024 channels and 1×1 kernel size, generating the high-level semantic representation of the P5 / 32 layer.
[0088] The 22nd layer of splicing operations connects the middle layer features with the deep layer features to build cross-level feature interactions;
[0089] The 23rd layer C3k2 feature processing module has 512 channels and is repeated twice. It optimizes the quality of mid-layer features through residual structure and lightweight convolution.
[0090] The 24th layer upsampling operation doubles the resolution of the middle layer feature map and aligns it with the shallow layer features;
[0091] The 25th layer splicing operation fuses the upsampled features with the P3 / 8 layer features to preserve fine-grained spatial details;
[0092] The 26th layer C3k2 feature processing module has 256 channels and is repeated twice to generate high-resolution feature representation suitable for small object detection.
[0093] The 27th layer ADown adaptive downsampling operation has 256 channels and achieves feature map size compression through learnable parameters;
[0094] The 28th layer splicing operation fuses the downsampled features with the mid-level features to enhance the consistency of cross-scale features;
[0095] The 29th layer C3k2 feature processing module has 512 channels and is repeated twice to optimize the feature discrimination of medium-sized objects.
[0096] The 30th layer ADown adaptive downsampling operation has a channel number of 512, which further reduces the feature map resolution.
[0097] The 31st layer splicing operation fuses the final downsampled features with the P5 / 32 layer features to enhance the large-scale object detection capability;
[0098] The 32nd layer C3k2 feature processing module has 1024 channels and is repeated twice. It combines deep supervision to improve the semantic expression of features.
[0099] The 33rd layer Detect detects the head layer and generates the final output.
[0100] S3 performs model training based on the proposed network structure. The specific steps are as follows:
[0101] Experimental environment settings: YOLO11 version is Ultralytics 8.3.9, Python version is Python-3.10.14, PyTorch version is torch-2.3.0, and the running device is NVIDIA GeForce RTX 3060Laptop GPU;
[0102] Model training hyperparameter settings: batch size is 16, workers is set to 4, number of training rounds is 250, input image size is 640×640, optimizer is SGD, number of rounds with Mosaic data augmentation disabled is set to 10, and other hyperparameter settings except the above adjustments remain default.
[0103] The HFT-YOLO11n model is trained using the agricultural pest dataset constructed in step S1, and the best model weights are saved. Some of the results of the training process are shown in the following figure. Figure 3 shown.
[0104] S4 compares and analyzes the detection results of the HFT-YOLO11n model with those of other methods: This paper selects Precision, Recall, and mAP 50 、mAP 95 , parameters and GFLOPs.
[0105] The training results and comparative experiments on the validation set are as follows:
[0106] Table 1 Multi-model comparison experiment Model Precision Recall <![CDATA[mAP 50 ]]> <![CDATA[mAP 95 ]]> Params GFLOPs YOLOv5n 0.853 0.686 0.805 0.483 2.08M 5.8 YOLOv6n 0.739 0.746 0.783 0.485 4.16M 11.5 YOLOv8n 0.791 0.75 0.809 0.508 2.56M 6.8 YOLO11n 0.836 0.72 0.814 0.513 2.46M 6.3 HFT-YOLO11n 0.82 0.771 0.835 0.53 2.89M 7.3
[0107] The experimental results show that compared with other target detection algorithms, the method proposed in the present invention has advantages in detection accuracy, high efficiency and excellence, and can better identify agricultural pests.
[0108] Any matters not described in the present invention are applicable to the prior art.
Claims
1. A method for agricultural pest detection based on cross-level feature fusion of hypergraph, characterized by: Here are the steps: Step S1: Using image acquisition equipment, images containing agricultural pests are collected in agricultural and forest fields. The images are screened, labeled, and divided according to proportion. A series of preprocessing is then performed to form an agricultural pest dataset. Step S2: Improve the original algorithm and propose an original CSPTSSA module, a C3k2_FCA module and a cross-level feature fusion neck network structure HCANet. Based on the above modules, a new HFT-YOLO11n detection network architecture is proposed. Step S3: Input the agricultural pest dataset constructed in step S1 into the improved algorithm in step S2 for training, and save the model weights; Step S4: Compare and analyze the model detection results in step S3 with the detection results of other methods.
2. The agricultural pest detection dataset for training models according to claim 1, characterized in that: Here are the steps: Collect original images of pests in different scenes and classify the images according to the types of pests; We used Labelme to annotate the 3,935 collected original images and performed a series of preprocessing on the images to create a YOLO format agricultural pest dataset and corresponding labels. In order to train a model with the best effect, the labeled files and original images are divided into training set, validation set and test set.
3. The agricultural pest detection method based on cross-level feature fusion of hypergraph according to claim 1 is characterized in that: In step S2, the Token Statistics Self-Attention (TSSA) linear attention mechanism is used to improve the C2PSA module in the YOLO11n feature extraction backbone network. The CSPTSSA module is designed to reduce the loss of small object information and enhance the feature extraction network's ability to detect small objects. The C2PSA module is an advanced module in YOLO11 for enhanced feature extraction, combining the CSP (Cross Stage Partial) architecture and the Pyramid SqueezeAttention (PSA) attention mechanism. TSSA is used instead of PSA due to issues such as increased computational complexity with increasing input size, potential loss of small object information due to downsampling, and the need for additional modules to fuse multimodal data.
4. The agricultural pest detection method based on cross-level feature fusion of hypergraph according to claim 1, characterized in that: In step S2, the C3k2_FCA module is an Adaptive Fine-Grained Channel Attention (FCA) module added after two Conv convolutions in the original Bottleneck structure of the C3k2 structure in the YOLO11n feature extraction backbone network. This enables C3k2_FCA to optimize feature weight distribution by capturing the interaction between global and local information, thereby improving the model's ability to select more accurate features.
5. The agricultural pest detection method based on cross-level feature fusion of hypergraph according to claim 1, characterized in that: In step S2, the cross-level neck network structure HCANet replaces the original PANet neck structure of YOLO11n with the HyperC2Net (Hypergraph-Based Cross-Level and Cross-Position Representation Network) network structure while retaining the C3k2 module, and uses the ADown module to replace the original Conv module in the neck network as a downsampling module.
6. The method for agricultural pest detection based on cross-level feature fusion based on hypergraph according to claim 1, characterized in that: In step S3, training the target detection network model using the training set includes the following sub-steps: step S3.1, create your own training set path file, which contains the training set path and the validation set path, including the corresponding label path; step S3.2, use the improved YOLO11 model to train the dataset, with an image size of 640×640, Workers set to 4, a batch size of 16, Mosaic data enhancement rounds of 10, and the number of training iterations of 250, and other default values. Step S3.3, save the trained model weights.
7. The method for agricultural pest detection based on cross-level feature fusion based on hypergraph according to claim 1, characterized in that: In step S4, the improved model detection results are compared with the detection results of other methods using mAP 50 、mAP 95 , Precision, Recall, number of parameters and GFLOPs are used as model evaluation indicators; other methods for comparative analysis with the improved model detection results include YOLOv5n, YOLOv6n, YOLOv8n and YOLOv10n.
Citation Information
Cited By
Method and system for rapidly detecting abnormal articles on expressway
CN121259766A