Intensive tiny pest image detection method based on density-guided state space model
By constructing a pest image detection method based on a density-guided state space model, the problems of missed detection and false detection of dense small-scale pests in complex agricultural backgrounds are solved, and real-time accurate detection of pests is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI UNIV
- Filing Date
- 2026-01-29
- Publication Date
- 2026-05-15
AI Technical Summary
Existing technologies struggle to effectively detect dense and small-scale pests in complex agricultural contexts, resulting in high false negative and false positive rates. Furthermore, convolutional neural network-based methods lose the characteristics of tiny pests in deep networks, while Transformer-based methods suffer from high computational complexity.
A density-guided state space model-based approach is adopted. By setting up a dense dataset of small pests and performing data augmentation, a pest image detection network integrating frequency domain information and the density-guided state space model is constructed. The network utilizes a density-guided state space feature extraction module, a pest multi-scale frequency domain feature enhancement perception module, and a classification and localization module to achieve accurate pest detection.
It improves the training effect and generalization ability of the model, solves the problems of limited receptive field and background noise interference in traditional methods, and significantly improves the feature extraction efficiency and detection accuracy of densely overlapping pest areas.
Smart Images

Figure CN122049945A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of pest image recognition technology, specifically a method for detecting dense, small pest images based on a density-guided state space model. Background Technology
[0002] Outbreaks of crop pests severely impact agricultural economic benefits. Simultaneously, they force agricultural workers to rely on excessive pesticide use for control, leading to a vicious cycle of environmental pollution, pesticide residues, and increased pest resistance. Real-time, accurate pest detection is fundamental to reducing pesticide use and ensuring the quality of agricultural products and the safety of the ecological environment. However, pest detection in complex environments often faces significant challenges. On the one hand, agricultural environments are extremely complex; on the other hand, pests are often densely distributed and extremely small in size. This makes it difficult for traditional detection methods to effectively extract features, resulting in low detection accuracy and high false negative rates.
[0003] Furthermore, while convolutional neural network-based methods are widely used, they rely on multi-layer downsampling to expand the receptive field. This leads to a significant loss of the already sparse spatial features of tiny pests in deep networks, and convolutional operations are limited to local perception, making it difficult to effectively distinguish overlapping targets in densely occluded scenes. While Transformer-based methods, which have emerged in recent years, possess global modeling capabilities, their computational complexity increases quadratically with image resolution, resulting in enormous computational overhead. Simultaneously, most existing methods focus only on spatial domain features, neglecting the frequency domain edge information crucial for tiny, blurred targets.
[0004] Therefore, designing a method that can effectively detect dense and small-scale pest images in complex environments has become an urgent technical problem to be solved. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of existing technologies in detecting small-scale, dense pests in complex agricultural contexts, which are prone to missed detection and false detection. This invention provides a method for detecting dense, small pest images based on a density-guided state space model to solve the above problems.
[0006] To achieve the above objectives, the technical solution of the present invention is as follows:
[0007] A method for detecting dense micro-pest images based on a density-guided state-space model includes the following steps:
[0008] 11) Set up a dense dataset of tiny pests and perform data augmentation.
[0009] 12) Establish a pest image detection network that integrates frequency domain information and a density-guided state space model;
[0010] 13) Train a pest image detection network using augmented datasets;
[0011] 14) Acquire images of the dense cluster of tiny pests to be detected;
[0012] 15) Obtaining pest image detection results: Input the dense, tiny pest images to be detected into the trained pest image detection network to obtain pest image detection results.
[0013] The process of setting up a dense dataset of minute pests and performing data augmentation includes the following steps:
[0014] 21) Obtain a dataset of dense images of tiny pests and their corresponding annotation files, and divide it into a training set and a validation set in a 7:3 ratio;
[0015] 22) Perform a multi-scale segmentation strategy on the dense dataset of tiny pest images to expand the dataset:
[0016] First, set a set of multi-scale cutoff factors {224, 384, 512}. Then, for each cutoff factor in the multi-scale cutoff factor set... Perform a sliding traversal of the image and crop it;
[0017] When the actual image content size of the cropping region is detected to be smaller than the current cropping factor When this happens, a zero-filling strategy is used to perform completion;
[0018] Remap the original labeled coordinates to the current image slice coordinate system, calculate the ratio of the truncated area in the current image slice to the original target area, and delete incomplete pest targets and image slices without pest targets whose ratio is less than 0.5.
[0019] We aggregate image slices generated at various scales and cleaned labeled data to create an augmented dataset containing multi-scale features.
[0020] The pest image detection network that integrates frequency domain information and density-guided state space model includes the following steps:
[0021] 31) The pest image detection network is designed to include a density-guided state space feature extraction module that integrates frequency domain information, a pest multi-scale frequency domain feature enhancement perception module, and a classification and localization module;
[0022] 32) Set up a density-guided state space feature extraction module;
[0023] 33) Set up a multi-scale frequency domain feature enhancement sensing module for pests;
[0024] 34) Set up the category positioning module.
[0025] The method of training the pest image detection network using augmented datasets includes the following steps:
[0026] 41) Initialize the parameters of the pest image detection network, including the weight parameters of the density-guided state space feature extraction module, the pest multi-scale frequency domain feature enhancement perception module, and the classification and localization module;
[0027] 42) Set training hyperparameters, including initial learning rate, batch size, number of training rounds, and define classification loss function, bounding box regression loss function, and distribution focus loss function as the total loss function;
[0028] 43) Input the pest images from the enhanced dataset into the density-guided state space feature extraction module. Then, it sequentially passes through four cascaded frequency dynamic convolutional structures and a hierarchical focusing feature extraction structure based on the density-guided state space model to output a set of pest feature maps that focus on dense regions and integrate spatial and frequency domain information. ;
[0029] 44) Collect pest feature maps The input pest multi-scale frequency domain feature enhancement perception module performs cross-level feature fusion through bilinear interpolation and splicing operations, and utilizes a frequency-enhanced multi-scale feature fusion structure to perform frequency domain attention and interaction, generating a set of multi-scale detection output feature maps. ;
[0030] 45) Set up the multi-scale detection output feature maps The input to the classification and localization module predicts the category confidence and bounding box regression distribution of pest targets based on feature maps at various scales. It then calculates the weighted sum of classification loss, bounding box regression loss, and distribution focus loss using labeled data as the total loss value. The calculation formula is as follows:
[0031] ,
[0032] in, For category classification loss, For bounding box regression loss, For the distribution focus loss, , and These are the corresponding balancing hyperparameter weights;
[0033] 46) The AdamW optimization algorithm is used to backpropagate the total loss value, update the network parameters, realize the joint optimization of frequency dynamic convolution, density-guided state space model, frequency domain enhanced perception module and classification and localization module, and save the pest image detection network weights with the best validation set index.
[0034] The set density-guided state space feature extraction module includes the following steps:
[0035] 51) The density-guided state space feature extraction module includes four cascaded frequency dynamic convolutional structures and a hierarchical focusing feature extraction structure based on the density-guided state space model;
[0036] 52) Define a frequency dynamic convolution structure, which includes a Fourier mutually exclusive weight generation unit, a kernel space modulation unit, and a frequency band modulation unit;
[0037] 521) Set up a Fourier mutually exclusive weight generation unit;
[0038] 5211) Initialize the quasi-spatial domain weight tensor Reshape it into a two-dimensional matrix form ;
[0039] in For input channel number, For the number of output channels, The kernel size;
[0040] 5212) This two-dimensional matrix Perform a Fast Fourier Transform to obtain the frequency domain weight parameters. ;
[0041] 5213) Based on frequency domain weight parameters Calculate the L2 norm of the coordinate index in the frequency domain and sort the parameters in ascending order of frequency;
[0042] 5214) Divide the sorted parameters into Each group is a mutually exclusive set of parameters, where only the spectral coefficients for a specific frequency band are retained, and the rest are set to 0. ;
[0043] in, For the first Group frequency domain index The parameter value at that location;
[0044] 5215) Use the inverse discrete Fourier transform to convert each set of frequency domain parameters into the corresponding spatial domain weight tensor. For the first The conversion formula for the group parameters is as follows:
[0045] ,
[0046] in, For the first Position in group spatial weights The element value, The kernel size is the convolution kernel size. The imaginary unit, This is a multiplication operation;
[0047] 5216) Transform the spatial weights Perform cutting and recombination to obtain A base weight with different frequency response characteristics;
[0048] 522) Set the core space modulation unit;
[0049] 5221) Input pest images and first-layer feature maps from the augmented dataset. Second layer feature map Or the third layer feature map Using a step size of 1 Convolution operations capture local channel context information to obtain local features. ;
[0050] 5222) Input pest images and first-layer feature maps from the augmented dataset. Second layer feature map Or the third layer feature map Global average pooling and fully connected layer operations are used to extract global channel information. ;
[0051] 5223) and Perform element-wise addition to generate a dense modulation matrix. Then, multiply this matrix element-wise with the basis weights output by the Fourier mutually exclusive weight generation unit to obtain the spatial modulation convolution kernel weights. ;
[0052] 523) Set the frequency band modulation unit;
[0053] 5231) Using a set of predefined binary masks Decompose the convolution kernel weights in the frequency domain and isolate them. Different frequency band components, where the mask Defined as:
[0054] ,
[0055] in, and For the preset frequency threshold, Indexed by horizontal and vertical frequencies;
[0056] 5232) The decomposed frequency band components are transformed back to the spatial domain by inverse Fourier transform to obtain the frequency band convolution kernel. ;
[0057] 5233) uses a step size of 1. The convolution operations process the pest images and the first-layer feature maps in the input augmentation dataset, respectively. Second layer feature map Or the third layer feature map Generate spatial gating maps corresponding to different frequency bands. ;
[0058] 5234) Spatial gating diagram Each component is multiplied at the pixel level with its corresponding frequency band component, and the weighted frequency band component is output.
[0059] 5235) Add the weighted frequency band components output from 5234) to obtain the frequency-domain enhanced input feature map. ;
[0060] 524) Using the spatially modulated convolutional kernel weights generated in 522) to adjust the output of 523). Perform a convolution operation to obtain the output feature map. The calculation formula is:
[0061] ,
[0062] in, This represents the convolution operation. These are trainable parameters that allow for the dynamic emphasis or suppression of specific frequency information at different spatial locations;
[0063] 53) Define a hierarchical focusing feature extraction structure based on a density-guided state space model. This structure includes a density-aware generation unit, a density-guided sparse sampling unit, and a sparse state space recursive processing unit.
[0064] 531) Set up a density-sensing generation unit;
[0065] Feature maps output by input frequency dynamic convolution structure For the input feature map Execute sequentially Convolution, batch normalization, and the sigmoid activation function are used to generate a density map reflecting the density of pest distribution. ,
[0066] Used to characterize location The confidence level of the target exists and is used for subsequent target region selection and spatial weighting of the state space model on the time scale;
[0067] 532) Define density-guided sparse sampling units;
[0068] 5321) Set the preset density threshold density map The target region mask is generated by comparing it element-by-element with the threshold. :
[0069] like Then let Mark as target area For target area mask The value at that location, Density map The confidence level that the target exists;
[0070] like Then let Marked as background area;
[0071] 5322) Based on the target region mask From the input feature map Only the feature vectors corresponding to the positions marked as 1 are extracted and concatenated into a one-dimensional sparse input sequence. ;
[0072] 5323) Extraction In density map The density weights at corresponding positions form a sparse weight sequence. For this sparse input sequence Define the continuous state matrix A and the time scale parameter. Using sparse weight sequences Position-by-position adjustments are performed on the time-scale parameters to generate density-sensitive step sizes. The calculation formula is:
[0073] ,
[0074] 5324) Based on density-sensitive step size The discretized state transition matrix is obtained using the zero-order preservation rule. and discretized input matrix :
[0075] ,
[0076] ,
[0077] in, B is the identity matrix, and B is a continuous input matrix;
[0078] 533) Define a sparse state space recursive processing unit;
[0079] 5331) Using the discretized parameters to process sparse input sequences Perform a selective scan operation and update the hidden state based on the recursive formula. And calculate the sparse output sequence The formula is as follows:
[0080] ,
[0081] ,
[0082] in, For indices in sparse sequences, To output the projection matrix, This is the hidden state of the previous time step. This represents the hidden state at the current time step.
[0083] 5332) Based on the target region mask Record the spatial index position, and output a sparse sequence. The original features are filled back to the corresponding coordinates of the two-dimensional feature map. For the background areas that have not been scanned, the original features are retained to fill the original features, thereby reconstructing the two-dimensional intermediate feature map.
[0084] 5333) The reconstructed 2D intermediate feature map and density map Perform Hadamard product and output the final hierarchical focused features through residual connections;
[0085] 54) The pest images from the augmented dataset are sequentially passed through four cascaded frequency dynamic convolutional structures and a hierarchical focusing feature extraction structure based on a density-guided state space model, outputting a set of pest feature maps that focus on dense regions and integrate spatial and frequency domain information. Specifically, it includes the following steps:
[0086] 541) Perform the first cascaded frequency dynamic convolution structure and the hierarchical focusing feature extraction structure based on the density-guided state space model on the pest images of the augmented dataset to obtain the first layer feature map. ;
[0087] 542) For the first layer feature map The second layer feature map is obtained by executing the second cascaded frequency dynamic convolution structure and the hierarchical focusing feature extraction structure based on the density-guided state space model. ;
[0088] 543) For the second layer feature map The third layer feature map is obtained by executing the third cascaded frequency dynamic convolution structure and the hierarchical focusing feature extraction structure based on the density-guided state space model. ;
[0089] 544) For the third layer feature map The fourth layer feature map is obtained by executing the fourth cascaded frequency dynamic convolution structure and the hierarchical focusing feature extraction structure based on the density-guided state space model. .
[0090] The method for setting up a multi-scale frequency domain feature enhancement perception module for pests includes the following steps:
[0091] 61) The set of feature maps output by the input density-guided state space feature extraction module ;
[0092] 62) To Perform bilinear interpolation to obtain the fourth-layer upsampled feature map. ,right , Perform a stitching operation, and then apply a hierarchical focusing feature extraction structure based on a density-guided state-space model to the stitched result to obtain a three- or four-layer fused feature map. ;
[0093] 63) To Perform bilinear interpolation to obtain the third and fourth layer upsampled fused feature maps. ;
[0094] 64) will , , The input is fed into a frequency-enhanced multi-scale feature fusion structure.
[0095] 641) against First, execute the focused downsampling structure;
[0096] 6411) Perform interval sampling on it, decomposing the original feature map into four sub-feature maps of half the size in the spatial dimension, and perform a concatenation operation on the four sub-feature maps with a step size of 1. Convolutional layers, batch normalization layers, and the SiLU activation function are used to obtain the first layer of downsampled feature maps. ;
[0097] 642) , and Perform the splicing operation, then perform... Convolution is used to obtain the initial concatenated feature map. According to the preset ratio Perform channel segmentation on the output feature map to obtain the first segmented feature map. Second part segmentation feature map ;
[0098] 643) implement Convolution and GELU activation function are used to obtain intermediate output feature maps. Then perform an adaptive average pooling layer on it and Convolution yields the spatial attention vector. ,right Execute in parallel Convolution and Convolution performs element-wise summation on the parallel outputs to obtain the feature maps of the convolutional branches. ;
[0099] 644) Perform a Fourier transform to obtain the frequency domain representation. ,Will and Element-wise multiplication, followed by inverse Fourier transform, yields the frequency attention feature map. ;
[0100] 645) will The input undergoes three parallel convolutional branches, including convolution, Convolution and Convolution, respectively, yields , , The outputs of the three branches are summed element-wise to obtain the multi-scale aggregated features. ;
[0101] 646) implement Convolution, to obtain And then Perform a Fourier transform to obtain ,Will and Perform element-wise multiplication to obtain the result of the multiplication. ;
[0102] 647) The result after multiplication Perform an inverse Fourier transform to obtain the interaction features. Utilizing learnable parameters and Perform a weighted summation to obtain the adaptive frequency domain calibration features. ;
[0103] ,
[0104] in, Initialize to 0, Initialized to 1, used for adaptive control of the injection ratio of frequency domain information;
[0105] 648) implement Convolution, ReLU activation function Convolution and Sigmoid activation function are used to obtain channel weights, and these channel weights are then compared with... Multiply to obtain the weighted aggregate features. ;
[0106] 649) , Perform element-wise addition, and then sequentially apply the ReLU activation function to the resulting feature map. Convolution, output enhancement, output features ;
[0107] 6410) , Perform the stitching operation, and then sequentially execute the following steps on the stitched feature maps: Convolution and GELU activation function are used to obtain frequency-enhanced features. ;
[0108] 65) To Execute a hierarchical focusing feature extraction structure based on a density-guided state-space model to obtain the output features of the second layer detection layer. ;
[0109] 66) To implement Convolution, combining the convolved feature map with... Perform a concatenation operation, then execute a hierarchical focusing feature extraction structure based on a density-guided state-space model to obtain the third layer of detection output features. ;
[0110] 67) To implement Convolution, to obtain ,right and Perform a concatenation operation, and then apply a hierarchical focusing feature extraction structure based on a density-guided state-space model to the concatenated feature map to obtain the fourth layer detection output features. .
[0111] The classification and positioning module includes the following steps:
[0112] 71) Input the set of multi-scale feature maps output by the multi-scale frequency domain feature enhancement perception module for pests. ;
[0113] 72) For each scale of feature map, perform bounding box regression and class classification branches:
[0114] 721) Execute the bounding box regression branch, executing two branches sequentially. Convolution, one Convolution outputs a regression distribution feature map;
[0115] 722) Execute the category branch, and execute the two branches in sequence. Convolution, one Convolution outputs a classification feature map;
[0116] 73) Perform a concatenation operation on the regression distribution feature map and the classification feature map to obtain the joint output feature map at this scale.
[0117] A computer-readable storage medium storing a computer program that, when executed by a processor, enables a method for detecting dense micro-pest images based on a density-guided state-space model.
[0118] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When executed by the processor, the program enables a method for detecting dense micro-pest images based on a density-guided state-space model.
[0119] Beneficial effects
[0120] The present invention provides a method for detecting dense, small pest images based on a density-guided state space model. Compared with existing technologies, the multi-scale segmentation strategy adopted by this invention improves the training effect and generalization ability of the model, and fully leverages the complementary advantages of spatial sparsity attention and frequency domain global perception, thereby achieving real-time and accurate detection of dense, small-scale pests in complex environments.
[0121] This invention addresses the limitations of traditional convolutional neural networks in handling densely packed small targets in complex agricultural contexts by constructing a density-guided state-space feature extraction module that integrates frequency domain information. Specifically, the introduced density-guided sparse sampling mechanism breaks the limitation of traditional state-space models that require full-image scanning. It dynamically allocates computational resources based on the density of pest distribution, effectively filtering redundant background information and significantly improving the model's efficiency and focus in extracting features from densely overlapping pest areas.
[0122] This invention enhances the perception module by incorporating multi-scale frequency domain features of pests. Leveraging the global receptive field and sensitivity to edge textures of frequency domain information, it effectively improves the model's robustness in perceiving small-scale pests. Through dynamic frequency convolution and frequency domain interaction mechanisms, this module captures subtle features that are difficult to extract in the spatial domain, effectively mitigating the problem of feature loss for small targets in deep networks, thereby significantly improving detection accuracy and localization precision. Attached Figure Description
[0123] Figure 1 This is a sequence diagram of the method of the present invention;
[0124] Figure 2 This is a schematic diagram of the pest image detection network that integrates frequency domain information and density-guided state space model involved in this invention.
[0125] Figure 3 This is a diagram showing the actual pest detection effect of the present invention. Detailed Implementation
[0126] To provide a better understanding of the structural features and effects achieved by the present invention, a detailed description is provided below, accompanied by preferred embodiments and accompanying drawings:
[0127] like Figure 1 As shown, the present invention provides a method for detecting dense micro-pest images based on a density-guided state-space model, comprising the following steps:
[0128] The first step is to set up a dense dataset of tiny pests and perform data augmentation.
[0129] (1) Obtain the dense micro-pest image dataset and its corresponding annotation file, and divide it into training set and validation set according to a 7:3 ratio.
[0130] (2) Implement a multi-scale segmentation strategy on the dense micro-pest image dataset to expand the dataset:
[0131] First, set a set of multi-scale cutoff factors {224, 384, 512}. Then, for each cutoff factor in the multi-scale cutoff factor set... Perform a sliding traversal of the image and crop it;
[0132] When the actual image content size of the cropping region is detected to be smaller than the current cropping factor When this happens, a zero-filling strategy is used to perform completion;
[0133] Remap the original labeled coordinates to the current image slice coordinate system, calculate the ratio of the truncated area in the current image slice to the original target area, and delete incomplete pest targets and image slices without pest targets whose ratio is less than 0.5.
[0134] We aggregate image slices generated at various scales and cleaned labeled data to create an augmented dataset containing multi-scale features.
[0135] The second step is to set up a pest image detection network that integrates frequency domain information and a density-guided state space model.
[0136] In complex agricultural scenarios, a pest detection network integrating frequency domain information and a density-guided state-space model is constructed. This network leverages a frequency-space dual-domain collaborative perception mechanism to mine frequency domain edge texture information, sharpening the features of small targets and suppressing background noise. Simultaneously, it utilizes a density-guided dynamic focusing strategy to adaptively allocate computational resources for refined scanning of dense areas. Furthermore, it balances global long-distance dependency modeling and computational efficiency in high-resolution images, addressing the challenge of detecting densely packed, small pests with weak features and severe background interference. The network integrates modules for density-guided state-space feature extraction, multi-scale frequency domain feature enhancement perception, and classification and localization. Frequency domain enhancement improves the saliency of small targets, while density-guided dynamic focusing targets densely overlapping areas. The collaborative operation of these multiple modules achieves a balance between low computational consumption and high-precision detection in complex environments.
[0137] (1) such as Figure 2 As shown, the pest image detection network is designed to include a density-guided state space feature extraction module that integrates frequency domain information, a pest multi-scale frequency domain feature enhancement perception module, and a classification and localization module.
[0138] (2) Set up a density-guided state space feature extraction module.
[0139] A density-guided state-space feature extraction module is constructed. This module leverages a frequency-domain dynamic convolutional structure to endow convolutional kernels with frequency awareness, enabling them to keenly capture the edge contours of minute targets. Simultaneously, it utilizes a hierarchical focusing feature extraction structure based on a density-guided state-space model to map continuous density distributions into discrete sparse sampling strides, generating density-sensitive time-scale parameters. Furthermore, it overcomes the mathematical modeling challenges of variable stride state transitions to adaptively refine the feature scanning granularity of high-density regions, effectively addressing the issues of easily obscuring minute features and overlapping dense features in deep networks. This module integrates a frequency-domain dynamic convolutional structure and a hierarchical focusing feature extraction structure based on a density-guided state-space model. It enhances high-frequency detail capture through mutually exclusive grouping in the frequency domain and extracts features from regions containing targets under the guidance of a density map, effectively filtering out a large amount of redundant background information. The collaborative use of multiple structures achieves an optimized balance between feature extraction accuracy and inference efficiency.
[0140] A1) The density-guided state space feature extraction module includes four cascaded frequency dynamic convolutional structures and a hierarchical focusing feature extraction structure based on the density-guided state space model;
[0141] A2) Define a frequency dynamic convolution structure, which includes a Fourier mutually exclusive weight generation unit, a kernel space modulation unit, and a frequency band modulation unit;
[0142] A21) Set up the Fourier mutually exclusive weight generation unit;
[0143] A211) Initialize the quasi-spatial domain weight tensor Reshape it into a two-dimensional matrix form ;
[0144] in For input channel number, For the number of output channels, The kernel size;
[0145] A212) on this two-dimensional matrix Perform a Fast Fourier Transform to obtain the frequency domain weight parameters. ;
[0146] A213) Based on frequency domain weight parameters Calculate the L2 norm of the coordinate index in the frequency domain and sort the parameters in ascending order of frequency;
[0147] A214) Divide the sorted parameters into Each group is a mutually exclusive set of parameters, where only the spectral coefficients for a specific frequency band are retained, and the rest are set to 0. ;
[0148] in, For the first Group frequency domain index The parameter value at that location;
[0149] (A215) Use the inverse discrete Fourier transform to convert each set of frequency domain parameters into the corresponding spatial domain weight tensor. For the first The conversion formula for the group parameters is as follows:
[0150] ,
[0151] in, For the first Position in group spatial weights The element value, The kernel size is the convolution kernel size. Input the number of channels. Number of output channels The imaginary unit, This is a multiplication operation;
[0152] A216) The converted spatial weights Perform cutting and recombination to obtain A base weight with different frequency response characteristics;
[0153] A22) Set the core space modulation unit;
[0154] A221) The density-guided state-space feature extraction module includes four cascaded frequency-dynamic convolutional structures and a hierarchical focusing feature extraction structure based on the density-guided state-space model. The kernel space modulation unit, as the basic building block of the frequency-dynamic convolutional structure, is reused four times. Each input depends on its depth position in the network, as shown in A4). The input is the pest image and the first layer feature map from the augmented dataset. Second layer feature map Or the third layer feature map Using a step size of 1 Convolution operations capture local channel context information to obtain local features. ;
[0155] A222) Input pest images and first-layer feature maps from the augmented dataset. Second layer feature map Or the third layer feature map Global average pooling and fully connected layer operations are used to extract global channel information. ;
[0156] A223) and Perform element-wise addition to generate a dense modulation matrix. Then, multiply this matrix element-wise with the basis weights output by the Fourier mutually exclusive weight generation unit to obtain the spatial modulation convolution kernel weights. ;
[0157] A23) Set the frequency band modulation unit;
[0158] A231) Using a set of predefined binary masks Decompose the convolution kernel weights in the frequency domain and isolate them. Different frequency band components, where the mask Defined as:
[0159] ,
[0160] in, and For the preset frequency threshold, Indexed by horizontal and vertical frequencies;
[0161] (A232) The decomposed frequency band components are transformed back to the spatial domain using inverse Fourier transform to obtain the frequency band convolution kernel. ;
[0162] A233) uses a step size of 1. The convolution operations process the pest images and the first-layer feature maps in the input augmentation dataset, respectively. Second layer feature map Or the third layer feature map Generate spatial gating maps corresponding to different frequency bands. ;
[0163] A234) Spatial gating diagram Each component is multiplied at the pixel level with its corresponding frequency band component, and the weighted frequency band component is output.
[0164] A235) Add the weighted frequency band components output from A234) to obtain the frequency-domain enhanced input feature map. ;
[0165] A24) Use the spatially modulated convolution kernel weights generated in A22) to adjust the output of A23). Perform a convolution operation to obtain the output feature map. The calculation formula is:
[0166] ,
[0167] in, This represents the convolution operation. These are trainable parameters that allow for the dynamic emphasis or suppression of specific frequency information at different spatial locations;
[0168] A3) Define a hierarchical focusing feature extraction structure based on a density-guided state space model. This structure includes a density-aware generation unit, a density-guided sparse sampling unit, and a sparse state space recursive processing unit.
[0169] A31) Define the density-sensing generation unit;
[0170] Feature maps output by input frequency dynamic convolution structure For the input feature map Execute sequentially Convolution, batch normalization, and the sigmoid activation function are used to generate a density map reflecting the density of pest distribution. ,
[0171] Used to characterize location The confidence level of the target exists and is used for subsequent target region selection and spatial weighting of the state space model on the time scale;
[0172] A32) Define density-guided sparse sampling units;
[0173] A321) Set a preset density threshold density map The target region mask is generated by comparing it element-by-element with the threshold. :
[0174] like Then let Mark as target area For target area mask The value at that location, Density map The confidence level that the target exists;
[0175] like Then let Marked as background area;
[0176] A322) Based on the target area mask From the input feature map Only the feature vectors corresponding to the positions marked as 1 are extracted and concatenated into a one-dimensional sparse input sequence. ;
[0177] A323) Extraction In density map The density weights at corresponding positions form a sparse weight sequence. For this sparse input sequence Define the continuous state matrix A and the time scale parameter. Using sparse weight sequences Position-by-position adjustments are performed on the time-scale parameters to generate density-sensitive step sizes. The calculation formula is:
[0178] ,
[0179] A324) Based on density-sensitive step size The discretized state transition matrix is obtained using the zero-order preservation rule. and discretized input matrix :
[0180] ,
[0181] ,
[0182] in, B is the identity matrix, and B is a continuous input matrix;
[0183] A33) Define a sparse state space recursive processing unit;
[0184] A331) Using the discretized parameters to process the sparse input sequence Perform a selective scan operation and update the hidden state based on the recursive formula. And calculate the sparse output sequence The formula is as follows:
[0185] ,
[0186] ,
[0187] in, For indices in sparse sequences, To output the projection matrix, This is the hidden state of the previous time step. This represents the hidden state at the current time step.
[0188] A332) Based on the target area mask Record the spatial index position, and output a sparse sequence. The original features are filled back to the corresponding coordinates of the two-dimensional feature map. For the background areas that have not been scanned, the original features are retained to fill the original features, thereby reconstructing the two-dimensional intermediate feature map.
[0189] A333) The reconstructed two-dimensional intermediate feature map and density map Perform Hadamard product and output the final hierarchical focused features through residual connections;
[0190] A4) The pest images in the augmented dataset are sequentially passed through four cascaded frequency dynamic convolutional structures and a hierarchical focusing feature extraction structure based on a density-guided state space model, outputting a set of pest feature maps that focus on dense regions and integrate spatial and frequency domain information. Specifically, it includes the following steps:
[0191] A41) The first cascaded frequency dynamic convolution structure and the hierarchical focusing feature extraction structure based on the density-guided state space model are performed on the pest images of the augmented dataset to obtain the first layer feature map. ;
[0192] A42) For the first layer feature map The second layer feature map is obtained by executing the second cascaded frequency dynamic convolution structure and the hierarchical focusing feature extraction structure based on the density-guided state space model. ;
[0193] A43) Regarding the second layer feature map The third layer feature map is obtained by executing the third cascaded frequency dynamic convolution structure and the hierarchical focusing feature extraction structure based on the density-guided state space model. ;
[0194] A44) on the third layer feature map The fourth layer feature map is obtained by executing the fourth cascaded frequency dynamic convolution structure and the hierarchical focusing feature extraction structure based on the density-guided state space model. .
[0195] (3) Set up a multi-scale frequency domain feature enhancement perception module for pests.
[0196] B1) The set of feature maps output by the input density-guided state space feature extraction module ;
[0197] B2) Perform bilinear interpolation to obtain the fourth-layer upsampled feature map. ,right , Perform a stitching operation, and then apply a hierarchical focusing feature extraction structure based on a density-guided state-space model to the stitched result to obtain a three- or four-layer fused feature map. ;
[0198] B3) Perform bilinear interpolation to obtain the third and fourth layer upsampled fused feature maps. ;
[0199] B4) will , , The input is fed into a frequency-enhanced multi-scale feature fusion structure.
[0200] B41) First, execute the focused downsampling structure;
[0201] B411) performs an interval sampling operation, decomposing the original feature map into four sub-feature maps of half the size in spatial dimension. The four sub-feature maps are then concatenated with a stride of 1. Convolutional layers, batch normalization layers, and the SiLU activation function are used to obtain the first layer of downsampled feature maps. ;
[0202] B42) , and Perform the splicing operation, then perform... Convolution is used to obtain the initial concatenated feature map. According to the preset ratio Perform channel segmentation on the output feature map to obtain the first segmented feature map. Second part segmentation feature map ;
[0203] B43) implement Convolution and GELU activation function are used to obtain intermediate output feature maps. Then perform an adaptive average pooling layer on it and Convolution yields the spatial attention vector. ,right Execute in parallel Convolution and Convolution performs element-wise summation on the parallel outputs to obtain the feature maps of the convolutional branches. ;
[0204] B44) Perform a Fourier transform to obtain the frequency domain representation. ,Will and Element-wise multiplication, followed by inverse Fourier transform, yields the frequency attention feature map. ;
[0205] B45) will The input undergoes three parallel convolutional branches, including convolution, Convolution and Convolution, respectively, yields , , The outputs of the three branches are summed element-wise to obtain the multi-scale aggregated features. ;
[0206] B46) implement Convolution, to obtain And then Perform a Fourier transform to obtain ,Will and Perform element-wise multiplication to obtain the result of the multiplication. ;
[0207] B47) The result of multiplication Perform an inverse Fourier transform to obtain the interaction features. Utilizing learnable parameters and Perform a weighted summation to obtain the adaptive frequency domain calibration features. ;
[0208] ,
[0209] in, Initialize to 0, Initialized to 1, used for adaptive control of the injection ratio of frequency domain information;
[0210] B48) implement Convolution, ReLU activation function Convolution and Sigmoid activation function are used to obtain channel weights, and these channel weights are then compared with... Multiply to obtain the weighted aggregate features. ;
[0211] B49) , Perform element-wise addition, and then sequentially apply the ReLU activation function to the resulting feature map. Convolution, output enhancement, output features ;
[0212] B410) , Perform the stitching operation, and then sequentially execute the following steps on the stitched feature maps: Convolution and GELU activation function are used to obtain frequency-enhanced features. ;
[0213] B5) Execute a hierarchical focusing feature extraction structure based on a density-guided state-space model to obtain the output features of the second layer detection layer. ;
[0214] B6) implement Convolution, combining the convolved feature map with... Perform a concatenation operation, then execute a hierarchical focusing feature extraction structure based on a density-guided state-space model to obtain the third layer of detection output features. ;
[0215] B7) implement Convolution, to obtain ,right and Perform a concatenation operation, and then apply a hierarchical focusing feature extraction structure based on a density-guided state-space model to the concatenated feature map to obtain the fourth layer detection output features. .
[0216] (4) Set up the classification and positioning module.
[0217] Input pest multi-scale frequency domain feature enhancement perception module output multi-scale feature map set ;
[0218] For each scale of feature map, perform bounding box regression and class classification branches:
[0219] Execute the bounding box regression branch, and execute two branches sequentially. Convolution, one Convolution outputs a regression distribution feature map;
[0220] Execute the category branch, and execute the two branches in sequence. Convolution, one Convolution outputs a classification feature map;
[0221] Perform a concatenation operation on the regression distribution feature map and the classification feature map to obtain a joint output feature map at this scale.
[0222] The third step is to train a pest image detection network using an augmented dataset.
[0223] (1) Initialize the parameters of the pest image detection network, including the weight parameters of the density-guided state space feature extraction module, the pest multi-scale frequency domain feature enhancement perception module and the classification and localization module.
[0224] (2) Set training hyperparameters, including initial learning rate, batch size, number of training rounds, and define classification loss function, bounding box regression loss function and distribution focus loss function as total loss function.
[0225] (3) Input the pest images in the enhanced dataset into the density-guided state space feature extraction module, and sequentially pass them through four cascaded frequency dynamic convolutional structures and a hierarchical focusing feature extraction structure based on the density-guided state space model to output a set of pest feature maps that focus on dense regions and integrate spatial and frequency domain information. .
[0226] (4) Collect pest feature maps The input pest multi-scale frequency domain feature enhancement perception module performs cross-level feature fusion through bilinear interpolation and splicing operations, and utilizes a frequency-enhanced multi-scale feature fusion structure to perform frequency domain attention and interaction, generating a set of multi-scale detection output feature maps. .
[0227] (5) Set up the multi-scale detection output feature maps The input to the classification and localization module predicts the category confidence and bounding box regression distribution of pest targets based on feature maps at various scales. It then calculates the weighted sum of classification loss, bounding box regression loss, and distribution focus loss using labeled data as the total loss value. The calculation formula is as follows:
[0228] ,
[0229] in, For category classification loss, For bounding box regression loss, For the distribution focus loss, , and These are the corresponding balancing hyperparameter weights.
[0230] (6) The AdamW optimization algorithm is used to backpropagate the total loss value, update the network parameters, realize the joint optimization of frequency dynamic convolution, density-guided state space model, frequency domain enhanced perception module and classification and localization module, and save the pest image detection network weight with the best validation set index.
[0231] The fourth step is to acquire images of the dense, tiny pests to be detected.
[0232] Step 5: Obtaining the pest image detection results: Input the dense, tiny pest images to be detected into the trained pest image detection network to obtain the pest image detection results.
[0233] Depend on Figure 3 As shown, the method of the present invention detects pests in 16 randomly selected pest images. It can be seen that each pest can be detected accurately, indicating that the method of the present invention has good detection accuracy for dense, small-scale pests in complex environments.
[0234] Table 1. Comparison of the present invention and traditional methods on a dataset of densely populated micro-pests.
[0235] Network Model mAP mAP50 GFlops Params (M) Cascade-Rcnn 21.3 56.8 20.9 69.2 Cascade-RPN 21.8 59 18.2 42.0 FCOS 15.4 40.8 17.1 32.1 YOLOV8 24.7 61.9 14.3 11.1 YOLOX 23.5 59.3 13.3 8.9 YOLOV10 18.1 47.5 8.2 2.7 Method of the present invention 32.5 70.8 14.5 6.6
[0236] As can be seen from the experimental data comparison in Table 1, the method of this invention exhibits significant performance advantages in the task of detecting dense micro-pests. In terms of detection accuracy, the detection accuracy of this invention is significantly better than mainstream detection models such as YOLOv8 and Cascade-RCNN, proving the effectiveness of this invention in solving the problem of detecting dense micro-pests and significantly reducing the false positive and false negative rates. Meanwhile, in terms of model complexity, this invention successfully achieves a lightweight network structure design. This optimal balance between high accuracy and low computational cost fully demonstrates that this invention possesses extremely high computational efficiency and can meet the deployment needs of resource-constrained terminal devices in real-world agricultural scenarios.
[0237] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention. The scope of protection claimed by the appended claims and their equivalents is defined.
Claims
1. A method for detecting dense micro-pest images based on a density-guided state-space model, characterized in that, Includes the following steps: 11) Set up a dense dataset of tiny pests and perform data augmentation. 12) Establish a pest image detection network that integrates frequency domain information and a density-guided state space model; 13) Train a pest image detection network using augmented datasets; 14) Acquire images of the dense cluster of tiny pests to be detected; 15) Obtaining pest image detection results: Input the dense, tiny pest images to be detected into the trained pest image detection network to obtain pest image detection results.
2. The method for detecting dense micro-pest images based on a density-guided state-space model according to claim 1, characterized in that, The process of setting up a dense dataset of minute pests and performing data augmentation includes the following steps: 21) Obtain a dataset of dense images of tiny pests and their corresponding annotation files, and divide it into a training set and a validation set in a 7:3 ratio; 22) Perform a multi-scale segmentation strategy on the dense dataset of tiny pest images to expand the dataset: First, set a set of multi-scale cutoff factors {224, 384, 512}. Then, for each cutoff factor in the multi-scale cutoff factor set... Perform a sliding traversal of the image and crop it; When the actual image content size of the cropping region is detected to be smaller than the current cropping factor When this happens, a zero-filling strategy is used to perform completion; Remap the original labeled coordinates to the current image slice coordinate system, calculate the ratio of the truncated area in the current image slice to the original target area, and delete incomplete pest targets and image slices without pest targets whose ratio is less than 0.
5. We aggregate image slices generated at various scales and cleaned labeled data to create an augmented dataset containing multi-scale features.
3. The method for detecting dense micro-pest images based on a density-guided state-space model according to claim 1, characterized in that, The pest image detection network that integrates frequency domain information and density-guided state space model includes the following steps: 31) The pest image detection network is designed to include a density-guided state space feature extraction module that integrates frequency domain information, a pest multi-scale frequency domain feature enhancement perception module, and a classification and localization module; 32) Set up a density-guided state space feature extraction module; 33) Set up a multi-scale frequency domain feature enhancement sensing module for pests; 34) Set up the category positioning module.
4. The method for detecting dense micro-pest images based on a density-guided state-space model according to claim 1, characterized in that, The method of training the pest image detection network using augmented datasets includes the following steps: 41) Initialize the parameters of the pest image detection network, including the weight parameters of the density-guided state space feature extraction module, the pest multi-scale frequency domain feature enhancement perception module, and the classification and localization module; 42) Set training hyperparameters, including initial learning rate, batch size, number of training rounds, and define classification loss function, bounding box regression loss function, and distribution focus loss function as the total loss function; 43) Input the pest images from the enhanced dataset into the density-guided state space feature extraction module. Then, it sequentially passes through four cascaded frequency dynamic convolutional structures and a hierarchical focusing feature extraction structure based on the density-guided state space model to output a set of pest feature maps that focus on dense regions and integrate spatial and frequency domain information. ; 44) Collect pest feature maps The input pest multi-scale frequency domain feature enhancement perception module performs cross-level feature fusion through bilinear interpolation and splicing operations, and utilizes a frequency-enhanced multi-scale feature fusion structure to perform frequency domain attention and interaction, generating a set of multi-scale detection output feature maps. ; 45) Set up the multi-scale detection output feature maps The input to the classification and localization module predicts the category confidence and bounding box regression distribution of pest targets based on feature maps at various scales. It then calculates the weighted sum of classification loss, bounding box regression loss, and distribution focus loss using labeled data as the total loss value. The calculation formula is as follows: , in, For category classification loss, For bounding box regression loss, For the distribution focus loss, , and These are the corresponding balancing hyperparameter weights; 46) The AdamW optimization algorithm is used to backpropagate the total loss value, update the network parameters, realize the joint optimization of frequency dynamic convolution, density-guided state space model, frequency domain enhanced perception module and classification and localization module, and save the pest image detection network weights with the best validation set index.
5. The method for detecting dense micro-pest images based on a density-guided state-space model according to claim 3, characterized in that, The set density-guided state space feature extraction module includes the following steps: 51) The density-guided state space feature extraction module includes four cascaded frequency dynamic convolutional structures and a hierarchical focusing feature extraction structure based on the density-guided state space model; 52) Define a frequency dynamic convolution structure, which includes a Fourier mutually exclusive weight generation unit, a kernel space modulation unit, and a frequency band modulation unit; 521) Set up a Fourier mutually exclusive weight generation unit; 5211) Initialize the quasi-spatial domain weight tensor Reshape it into a two-dimensional matrix form ; in For input channel number, For the number of output channels, The kernel size; 5212) This two-dimensional matrix Perform a Fast Fourier Transform to obtain the frequency domain weight parameters. ; 5213) Based on frequency domain weight parameters Calculate the L2 norm of the coordinate index in the frequency domain and sort the parameters in ascending order of frequency; 5214) Divide the sorted parameters into Each group is a mutually exclusive set of parameters, where only the spectral coefficients for a specific frequency band are retained, and the rest are set to 0. ; in, For the first Group frequency domain index The parameter value at that location; 5215) Use the inverse discrete Fourier transform to convert each set of frequency domain parameters into the corresponding spatial domain weight tensor. For the first The conversion formula for the group parameters is as follows: , in, For the first Position in group spatial weights The element value, The kernel size is the convolution kernel size. The imaginary unit, This is a multiplication operation; 5216) Transform the spatial weights Perform cutting and recombination to obtain A base weight with different frequency response characteristics; 522) Set the core space modulation unit; 5221) Input pest images and first-layer feature maps from the augmented dataset. Second layer feature map Or the third layer feature map Using a step size of 1 Convolution operations capture local channel context information to obtain local features. ; 5222) Input pest images and first-layer feature maps from the augmented dataset. Second layer feature map Or the third layer feature map Global average pooling and fully connected layer operations are used to extract global channel information. ; 5223) and Perform element-wise addition to generate a dense modulation matrix. Then, multiply this matrix element-wise with the basis weights output by the Fourier mutually exclusive weight generation unit to obtain the spatial modulation convolution kernel weights. ; 523) Set the frequency band modulation unit; 5231) Using a set of predefined binary masks Decompose the convolution kernel weights in the frequency domain and isolate them. Different frequency band components, where the mask Defined as: , in, and For the preset frequency threshold, Indexed by horizontal and vertical frequencies; 5232) The decomposed frequency band components are transformed back to the spatial domain by inverse Fourier transform to obtain the frequency band convolution kernel. ; 5233) uses a step size of 1. The convolution operations process the pest images and the first-layer feature maps in the input augmentation dataset, respectively. Second layer feature map Or the third layer feature map Generate spatial gating maps corresponding to different frequency bands. ; 5234) Spatial gating diagram Each component is multiplied at the pixel level with its corresponding frequency band component, and the weighted frequency band component is output. 5235) Add the weighted frequency band components output from 5234) to obtain the frequency-domain enhanced input feature map. ; 524) Using the spatially modulated convolutional kernel weights generated in 522) to adjust the output of 523). Perform a convolution operation to obtain the output feature map. The calculation formula is: , in, This represents the convolution operation. These are trainable parameters that allow for the dynamic emphasis or suppression of specific frequency information at different spatial locations; 53) Define a hierarchical focusing feature extraction structure based on a density-guided state space model. This structure includes a density-aware generation unit, a density-guided sparse sampling unit, and a sparse state space recursive processing unit. 531) Set up a density-sensing generation unit; Feature maps output by input frequency dynamic convolution structure For the input feature map Execute sequentially Convolution, batch normalization, and the sigmoid activation function are used to generate a density map reflecting the density of pest distribution. , Used to characterize location The confidence level of the target exists and is used for subsequent target region selection and spatial weighting of the state space model on the time scale; 532) Define density-guided sparse sampling units; 5321) Set the preset density threshold density map The target region mask is generated by comparing it element-by-element with the threshold. : like Then let Mark as target area For target area mask The value at that location, Density map The confidence level that the target exists; like Then let Marked as background area; 5322) Based on the target region mask From the input feature map Only the feature vectors corresponding to the positions marked as 1 are extracted and concatenated into a one-dimensional sparse input sequence. ; 5323) Extraction In density map The density weights at corresponding positions form a sparse weight sequence. For this sparse input sequence Define the continuous state matrix A and the time scale parameter. Using sparse weight sequences Position-by-position adjustments are performed on the time-scale parameters to generate density-sensitive step sizes. The calculation formula is: , 5324) Based on density-sensitive step size The discretized state transition matrix is obtained using the zero-order preservation rule. and discretized input matrix : , , in, B is the identity matrix, and B is a continuous input matrix; 533) Define a sparse state space recursive processing unit; 5331) Using the discretized parameters to process sparse input sequences Perform a selective scan operation and update the hidden state based on the recursive formula. And calculate the sparse output sequence The formula is as follows: , , in, For indices in sparse sequences, To output the projection matrix, This is the hidden state of the previous time step. This represents the hidden state at the current time step. 5332) Based on the target region mask Record the spatial index position, and output a sparse sequence. The original features are filled back to the corresponding coordinates of the two-dimensional feature map. For the background areas that have not been scanned, the original features are retained to fill the original features, thereby reconstructing the two-dimensional intermediate feature map. 5333) The reconstructed 2D intermediate feature map and density map Perform Hadamard product and output the final hierarchical focused features through residual connections; 54) The pest images from the augmented dataset are sequentially passed through four cascaded frequency dynamic convolutional structures and a hierarchical focusing feature extraction structure based on a density-guided state space model, outputting a set of pest feature maps that focus on dense regions and integrate spatial and frequency domain information. Specifically, it includes the following steps: 541) Perform the first cascaded frequency dynamic convolution structure and the hierarchical focusing feature extraction structure based on the density-guided state space model on the pest images of the augmented dataset to obtain the first layer feature map. ; 542) For the first layer feature map The second layer feature map is obtained by executing the second cascaded frequency dynamic convolution structure and the hierarchical focusing feature extraction structure based on the density-guided state space model. ; 543) For the second layer feature map The third layer feature map is obtained by executing the third cascaded frequency dynamic convolution structure and the hierarchical focusing feature extraction structure based on the density-guided state space model. ; 544) For the third layer feature map The fourth layer feature map is obtained by executing the fourth cascaded frequency dynamic convolution structure and the hierarchical focusing feature extraction structure based on the density-guided state space model. .
6. The method for detecting dense micro-pest images based on a density-guided state-space model according to claim 5, characterized in that, The method for setting up a multi-scale frequency domain feature enhancement perception module for pests includes the following steps: 61) The set of feature maps output by the input density-guided state space feature extraction module ; 62) To Perform bilinear interpolation to obtain the fourth-layer upsampled feature map. ,right , Perform a stitching operation, and then apply a hierarchical focusing feature extraction structure based on a density-guided state-space model to the stitched result to obtain a three- or four-layer fused feature map. ; 63) To Perform bilinear interpolation to obtain the third and fourth layer upsampled fused feature maps. ; 64) will , , The input is fed into a frequency-enhanced multi-scale feature fusion structure. 641) against First, execute the focused downsampling structure; 6411) Perform interval sampling on it, decomposing the original feature map into four sub-feature maps of half the size in the spatial dimension, and perform a concatenation operation on the four sub-feature maps with a step size of 1. Convolutional layers, batch normalization layers, and the SiLU activation function are used to obtain the first layer of downsampled feature maps. ; 642) , and Perform the splicing operation, then perform... Convolution is used to obtain the initial concatenated feature map. According to the preset ratio Perform channel segmentation on the output feature map to obtain the first segmented feature map. Second part segmentation feature map ; 643) implement Convolution and GELU activation function are used to obtain intermediate output feature maps. Then perform an adaptive average pooling layer on it and Convolution yields the spatial attention vector. ,right Execute in parallel Convolution and Convolution performs element-wise summation on the parallel outputs to obtain the feature maps of the convolutional branches. ; 644) Perform a Fourier transform to obtain the frequency domain representation. ,Will and Element-wise multiplication, followed by inverse Fourier transform, yields the frequency attention feature map. ; 645) will The input undergoes three parallel convolutional branches, including convolution, Convolution and Convolution, respectively, yields , , The outputs of the three branches are summed element-wise to obtain the multi-scale aggregated features. ; 646) implement Convolution, to obtain And then Perform a Fourier transform to obtain ,Will and Perform element-wise multiplication to obtain the result of the multiplication. ; 647) The result after multiplication Perform an inverse Fourier transform to obtain the interaction features. Utilizing learnable parameters and Perform a weighted summation to obtain the adaptive frequency domain calibration features. ; , in, Initialize to 0, Initialized to 1, used for adaptive control of the injection ratio of frequency domain information; 648) implement Convolution, ReLU activation function Convolution and Sigmoid activation function are used to obtain channel weights, and these channel weights are then compared with... Multiply to obtain the weighted aggregate features. ; 649) , Perform element-wise addition, and then sequentially apply the ReLU activation function to the resulting feature map. Convolution, output enhancement, output features ; 6410) , Perform the stitching operation, and then sequentially execute the following steps on the stitched feature maps: Convolution and GELU activation function are used to obtain frequency-enhanced features. ; 65) To Execute a hierarchical focusing feature extraction structure based on a density-guided state-space model to obtain the output features of the second layer detection layer. ; 66) To implement Convolution, combining the convolved feature map with... Perform a concatenation operation, then execute a hierarchical focusing feature extraction structure based on a density-guided state-space model to obtain the third layer of detection output features. ; 67) To implement Convolution, to obtain ,right and Perform a concatenation operation, and then apply a hierarchical focusing feature extraction structure based on a density-guided state-space model to the concatenated feature map to obtain the fourth layer detection output features. .
7. The method for detecting dense micro-pest images based on a density-guided state-space model according to claim 6, characterized in that, The classification and positioning module includes the following steps: 71) Input the set of multi-scale feature maps output by the multi-scale frequency domain feature enhancement perception module for pests. ; 72) For each scale of feature map, perform bounding box regression and class classification branches: 721) Execute the bounding box regression branch, executing two branches sequentially. Convolution, one Convolution outputs a regression distribution feature map; 722) Execute the category branch, and execute the two branches in sequence. Convolution, one Convolution outputs a classification feature map; 73) Perform a concatenation operation on the regression distribution feature map and the classification feature map to obtain the joint output feature map at this scale.
8. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, enables the detection method for dense micro-pest images based on a density-guided state-space model as described in any one of claims 1-7.
9. A computer device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it can implement the image detection method for dense micro-pests based on a density-guided state-space model as described in any one of claims 1-7.