A method and device for nematode attention modulation segmentation of frequency domain space dual-view
By employing a frequency-domain spatial dual-view attention modulation segmentation method, combined with CMCE, SFEM, and DMLA modules, the robustness problem of segmentation in complex backgrounds of nematode microscopic images was solved, achieving efficient and accurate segmentation of nematodes and their eggs, and improving segmentation accuracy and stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGDONG UNIV OF TECH
- Filing Date
- 2026-02-12
- Publication Date
- 2026-05-29
AI Technical Summary
Existing technologies struggle to perform stable and reliable automated segmentation of nematode microscopic images in complex backgrounds, especially when the worm is transparent, the boundary contrast is weak, the local area is blurred, and there are background impurities. Traditional methods are not robust enough, and deep learning methods struggle to balance structural continuity and background noise reduction in scenes with weak boundaries and dense overlap.
A frequency-domain spatial dual-view attention modulation segmentation method is adopted. The global context and local boundary details are modeled collaboratively by the channel-level multi-scale context enhancement module (CMCE) and the frequency-domain information modulation feature enhancement module (SFEM). Adaptive trade-offs are achieved through gating fusion. The method is combined with the dual-view modulation low-resolution attention module (DMLA) for feature fusion and mask prediction.
It significantly improves the accuracy and robustness of nematode and egg segmentation, reduces worm body breakage, instance adhesion, and false negatives and false negatives, maintains model stability and real-time inference performance, and is suitable for high-throughput phenotypic analysis.
Smart Images

Figure CN122116352A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of nematode microscopic image processing, specifically to a frequency-domain spatial dual-view nematode attention modulation segmentation method and apparatus. Background Technology
[0002] Caenorhabditis elegans, due to its clear genetic background, short lifespan, and ease of culture and manipulation, has become a commonly used model organism in drug screening, gene function verification, and environmental toxicology assessment. During experiments, researchers typically acquire images of the nematodes and their eggs using microscopic imaging, and then conduct phenotypic quantitative analyses (such as individual morphology, reproductive status, and behavioral characteristics). With the development of high-throughput experiments, relying on manual observation and frame-by-frame annotation is not only time-consuming and labor-intensive but also difficult to guarantee consistency. Therefore, developing a stable and reliable automated segmentation method has become a crucial foundation for microscopic nematode analysis.
[0003] However, microscopic nematode images exhibit significant scene complexity: the nematodes are slender and flexible structures with highly variable postures, prone to bending, entanglement, and dense overlap; simultaneously, the nematodes are transparent with weak boundary contrast, and local areas often show breakage or blurring. The culture medium background may also contain impurities, air bubbles, and noise artifacts, making small targets such as eggs easily confused with the background and obscuring each other, leading to problems such as missed detections, adhesion, and breakage in the segmentation results. Traditional rule-based methods based on thresholds and morphology are sensitive to illumination and noise, and lack robustness in complex backgrounds; while deep learning methods improve overall performance, they still struggle to simultaneously achieve "structural continuity" and "background noise reduction" in scenes with weak boundaries and dense overlap.
[0004] To address the aforementioned contradictions, relying solely on a single attention perspective often fails to achieve stable results: spatial attention excels at capturing morphological structures and instance boundaries, but is easily affected by background textures; frequency domain / contrast modulation is better at suppressing high-frequency noise and improving the separability of weakly saliency regions, but without structural constraints, it may lead to excessive smoothing of elongated regions and weakened boundaries. Therefore, starting from a dual-perspective attention approach combining spatial structure enhancement and frequency domain saliency modulation, this study collaboratively models global context and local boundary details, and achieves adaptive trade-offs through gated fusion. This approach is expected to significantly improve the accuracy and robustness of nematode and egg segmentation under conditions of transparent worms, complex backgrounds, and dense overlap, providing reliable support for high-throughput phenotypic analysis. Summary of the Invention
[0005] To address the aforementioned technical problems, this invention provides a frequency-domain spatial dual-view nematode attention modulation segmentation method and apparatus, which can provide users with a more accurate, efficient, and image-adaptive nematode segmentation solution.
[0006] Specifically, the method includes the following steps: S1: Preprocess the nematode microscopic images, divide them into training, test and validation sets, and input the features extracted from the images into the channel-level multi-scale context enhancement module CMCE to generate enhanced features from the spatial perspective; S2: Input the feature map extracted from the processed image into the frequency domain information modulation feature enhancement module SFEM to obtain enhanced features from the frequency domain perspective; S3: Fuse the enhanced features from the two perspectives and input them into the dual-view modulated low-resolution attention computation module DMLA to obtain dual-view attention modulation features, input them into the decoder, and predict the segmentation mask.
[0007] Preferably, S1 includes the following steps: S1.1: Collect raw nematode data, preprocess the data, and divide it into training set, test set and validation set. Extract features through backbone. S1.2: Construct hybrid receptive field features through multi-scale convolution and hierarchical connections, and calculate channel weights to fuse layer features to highlight key contexts; S1.3: Global and local complementary fusion of adjacent scale features to generate enhanced features with both semantic localization and detail preservation of spatial perspective; Preferably, S1.1 includes the following steps: First, microscopic images of nematodes are collected and preprocessed, including standardization, size uniformity, and data augmentation. Then, the data is divided into training, validation, and test sets in an 8:1:1 ratio. Finally, the preprocessed images are input into a backbone network for convolution and feature extraction to obtain the input feature map. This serves as the input to CMCE; the calculation process is as follows: , , In the above formula, This represents a microscopic image of a primitive nematode. This indicates preprocessing and enhancement operations; This represents the preprocessed image; This represents the feature extraction function of the backbone network; This represents the backbone output feature map. For the dimensions of the passageway and space; Preferably, S1.2 includes the following steps: First, the input feature map Grouping along the channel dimension yields multiple channel sub-features. Subsequently, convolutional blocks with different kernel sizes were applied to each channel group. By simulating different receptive fields and employing hierarchical connections to fuse the outputs of adjacent groups step by step, multi-scale contextual features are obtained. Then, Compared with the original features splicing in the channel dimension, and through Convolution is used to compress and fuse channels to obtain hybrid features. Finally, a channel recalibration mechanism is constructed, consisting of local detail branches and global channel weight branches: on the one hand, for... Perform twice Convolution extracts local texture and boundary details to obtain local enhancement features. On the other hand, Perform global average pooling and then Convolution and Sigmoid generate channel attention weights reuse right Perform channel-by-channel modulation and Residual fusion highlights key contextual channels and suppresses redundant responses, outputting context-enhanced features. The calculation process is as follows: , , , , , , In the above formula, Indicates channel grouping operation; Number of groups; Indicates the first The convolutional blocks consist of convolutional layers, batch normalization layers, and activation layers. Different groups of convolutional kernels have different sizes to form multi-scale receptive fields. Indicates channel-dimensional splicing; This indicates channel compression fusion convolution; This represents a local detail extraction convolution; Indicates global average pooling; Indicates channel attention weights; Indicates Sigmoid activation; Represents a nonlinear activation function; This indicates element-wise multiplication; This indicates element-wise addition; Indicates spatial perspective enhancement feature output; Preferably, S1.3 includes the following steps: Selecting features at adjacent scales and The fused base features are obtained by splicing them together in the channel dimension. Subsequently, two global object distribution branches are constructed: the first branch... Perform global average pooling, through two layers. Convolution and Sigmoid generate channel weights and then... Channel modulation is performed to obtain the upper branch feature. The second branch Global max pooling also involves two layers. Convolution and Sigmoid generate complementary channel weights and then... Modulation yields lower branch features Simultaneously, construct local detail branches, through two layers. Convolution extracts local texture and boundary details to obtain local features. Finally, the two global branches and local branches are added and merged, and then... Convolution enables information exchange and outputs spatial perspective-enhanced features. The calculation process is as follows: , , , , , in, , Indicates features at adjacent scales; This indicates the fused substrate after splicing; , This represents two types of global channel weights; Indicates global max pooling; Indicates global average pooling; Represents a nonlinear activation function; Indicates local detailed features; This indicates the output of spatial perspective enhancement features.
[0008] Preferably, S2 includes the following steps: S2.1: Select target scale features from the feature pyramid and generate a mask based on the annotation to achieve foreground-background decoupling and provide input for smoothing; S2.2: Dimensionality reduction and smoothing of background features are performed to suppress high-frequency noise, and the background features are recombined with foreground features to obtain an enhanced feature representation; S2.3: By adaptively fusing the enhanced features and the original features through a gating mechanism, the enhancement intensity is controlled to obtain a stable and reliable frequency domain modulation output; Preferably, S2.1 includes the following steps: Select target scale features from the feature pyramid. Subsequently, a binary mask is constructed based on the training labels. The foreground region is set to 1 and the background region to 0. Finally, the features are decomposed pixel by pixel using a mask, decoupling the features into foreground features. and background features This provides input for subsequent background smoothing, and the calculation process is as follows: , , In the above formula, Indicates the FPN number Layer feature map; This represents a binary mask generated from the annotations; , This indicates foreground / background decoupling features; This indicates element-wise multiplication; Preferably, S2.2 includes the following steps: Background features Apply adaptive smoothing operator This is used to suppress high-frequency background noise; subsequently, the smoothed background features and foreground features are recombined and added together to obtain the frequency domain enhanced features. To highlight the spectral significance of small targets and reduce background interference, the calculation process is as follows: , , In the above formula, This represents the background adaptive smoothing operator; Indicates the dimensionality reduction rate of the channel; Indicates the first Layer dimensionality reduction / upgrading convolution parameters; It represents the Hadamardi (or Hadama) stack; Indicates nonlinear activation; It represents Sigmoid; This indicates the enhanced features output by the module; Preferably, S2.3 includes the following steps: For the original features Gated weights are generated using convolution and Sigmoid. This is used to characterize the enhancement strength; subsequently, the enhancement features are... Compared with the original features Weighted fusion is performed to avoid information distortion caused by over-enhancement; finally, the modulation output characteristics from the frequency domain perspective are obtained. The calculation process is as follows: , , In the above formula, Indicates the gating weight; This indicates the frequency domain modulation enhancement characteristics of the SFEM output.
[0009] Preferably, S3 includes the following steps: S3.1: Fuse context-enhanced features and frequency-domain enhanced features, and perform local structure enhancement and fixed-resolution downsampling to reduce attention overhead; S3.2: Attention is calculated in a fixed low-resolution space, and then linear interpolation is used to restore the spatial size. This is then fused with the feature map residual to obtain dual-view modulation features. S3.3: Input the fused and enhanced features into the decoder for mask prediction and output the final segmentation result of the nematode or egg; S3.4: Train, validate, and test the model using the training, validation, and test sets; Preferably, S3.1 includes the following steps: First, enhance the spatial perspective features. Enhanced features from the frequency domain perspective The concatenation is performed along the channel dimension, and the fusion gating coefficients are obtained by convolution plus Sigmoid. Achieving adaptive fusion of dual perspectives Subsequently, LSConv was used to enhance the elongated structure and boundary texture; finally, the features were downsampled to a fixed resolution. To reduce the computational cost of attention and achieve resolution-independent attention overhead, the computation process is as follows: , , , In the above formula, This indicates the dual-view fusion gating weights; Indicates DMLA input features; Indicates LS convolution; Indicates downsampling to a fixed spatial size ; This represents the low-resolution attention computation features; Preferably, S3.2 includes the following steps: Low-resolution features The query is constructed using linear projection. ,key AND value Subsequently, the scaled dot product attention weight matrix is calculated. and to The attention output is obtained by performing a weighted summation; then, the attention output is linearly projected and upsampled to restore it to the original spatial scale; finally, the restored attention result is compared with... The dual-view attention modulation features are obtained by summing the residuals. The calculation process is as follows: , , , , In the above formula, Indicates the linear projection parameters; A represents the number of input channels; A represents the attention weight matrix. This indicates the spatial dimensions recovered by bilinear interpolation; This indicates element-wise addition; This represents the attention-modulated fusion features of the DMLA output; Preferably, S3.3 includes the following steps: Modulation characteristics of DMLA output The input is a decoder network; subsequently, the decoder recovers multi-scale semantic and detail information step by step and outputs segmentation logits; finally, the final segmentation mask is obtained through Softmax, and the segmentation result of the nematode or egg is output. The calculation process is as follows: , , In the above formula, Indicates the segmentation decoder; This indicates the segmentation of logits; This indicates the final segmentation mask output; Preferably, S3.4 includes the following steps: The model is trained and validated using the training and validation sets to obtain the optimal model weights. Then, the optimal model weights are imported into the test code, and the model is tested using the test set.
[0010] The beneficial effects of this invention are as follows: First, in the data processing stage, the collected nematode microscopic images are standardized, cropped, noise-suppressed, and data-enhanced. Training, validation, and test sets are rationally divided to reduce interference from illumination fluctuations and background impurities, providing a stable and consistent data foundation for model training. In the model construction process, a channel-level multi-scale context enhancement module (CMCE) is proposed. This module acquires mixed receptive field information through grouped multi-scale convolution and hierarchical connections, and combines channel attention recalibration to highlight key context channels, thereby enhancing the structural continuity of the slender nematode and the feature separability against complex backgrounds. Furthermore, a frequency domain information modulation feature enhancement module (SFEM) is proposed. This module suppresses high-frequency noise through foreground-background decoupling and background smoothing, and achieves an adaptive trade-off between enhanced and original features using gated fusion, effectively improving the salience of weak contrast regions and small target eggs. Based on this, a dual-view modulation low-resolution attention module (DMLA) is proposed. This module adaptively fuses the enhanced features of CMCE and SFEM, and after completing attention modeling in a fixed low-resolution space, it upsamples the residuals for recovery, decoupling the attention computational overhead from the input resolution, thus balancing global relationship modeling and inference efficiency. These innovative designs work synergistically to enable the present invention to effectively reduce insect body breakage, instance adhesion, and missed detections and false detections in complex microscopic scenarios such as overlapping entanglement, weak boundaries, low contrast, and noise interference. This significantly improves segmentation accuracy and robustness while maintaining good model stability and real-time inference performance, making it valuable for engineering applications and promotion. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following is a brief introduction to the drawings used in the prior art and embodiments. The following drawings are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 is a flowchart illustrating a frequency-domain spatial dual-view nematode attention modulation segmentation method according to the present invention. Figure 2 is a model architecture diagram of a frequency domain spatial dual-view nematode attention modulation segmentation method according to the present invention; Figure 3 is a schematic diagram of the channel-level multi-scale context enhancement module (CMCE) structure of the nematode attention modulation segmentation method of the frequency domain spatial dual perspective of the present invention. Figure 4 is a schematic diagram of the frequency domain information modulation feature enhancement module (SFEM) structure of the nematode attention modulation segmentation method of the present invention with a frequency domain spatial dual-view perspective. Figure 5 is a schematic diagram of the dual-view modulation low-resolution attention calculation module DMLA structure of the frequency domain spatial dual-view nematode attention modulation segmentation method of the present invention. Detailed Implementation Plan To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of this application. Unless otherwise specified, all other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.
[0013] This invention provides a frequency-domain spatial dual-view nematode attention modulation segmentation method and apparatus for achieving accurate segmentation of nematodes, assisting in nematode identification, and improving the accuracy and efficiency of nematode image processing.
[0014] Reference Figure 1 The method includes the following steps: S1: Preprocess the nematode microscopic images, divide them into training, test and validation sets, and input the features extracted from the images into the channel-level multi-scale context enhancement module CMCE to generate enhanced features from the spatial perspective; S2: Input the feature map extracted from the processed image into the frequency domain information modulation feature enhancement module SFEM to obtain enhanced features from the frequency domain perspective; S3: Fuse the enhanced features from the two perspectives and input them into the dual-view modulated low-resolution attention computation module DMLA to obtain dual-view attention modulation features, input them into the decoder, and predict the segmentation mask.
[0015] Furthermore, refer to Figure 3 S1 includes the following steps: S1.1: Collect raw nematode data, preprocess the data, and divide it into training set, test set and validation set. Extract features through backbone. S1.2: Construct hybrid receptive field features through multi-scale convolution and hierarchical connections, and calculate channel weights to fuse layer features to highlight key contexts; S1.3: Global and local complementary fusion of adjacent scale features to generate enhanced features with both semantic localization and detail preservation of spatial perspective; Furthermore, S1.1 includes the following steps: First, microscopic images of nematodes are collected and preprocessed, including standardization, size uniformity, and data augmentation. Then, the data is divided into training, validation, and test sets in an 8:1:1 ratio. Finally, the preprocessed images are input into a backbone network for convolution and feature extraction to obtain the input feature map. This serves as the input to CMCE; the calculation process is as follows: , , In the above formula, This represents a microscopic image of a primitive nematode. This indicates preprocessing and enhancement operations; This represents the preprocessed image; This represents the feature extraction function of the backbone network; This represents the backbone output feature map. For the dimensions of the passageway and space; Furthermore, S1.2 includes the following steps: First, the input feature map Grouping along the channel dimension yields multiple channel sub-features. Subsequently, convolutional blocks with different kernel sizes were applied to each channel group. By simulating different receptive fields and employing hierarchical connections to fuse the outputs of adjacent groups step by step, multi-scale contextual features are obtained. Then, Compared with the original features splicing in the channel dimension, and through Convolution is used to compress and fuse channels to obtain hybrid features. Finally, a channel recalibration mechanism is constructed, consisting of local detail branches and global channel weight branches: on the one hand, for... Perform twice Convolution extracts local texture and boundary details to obtain local enhancement features. On the other hand, Perform global average pooling and then Convolution and Sigmoid generate channel attention weights reuse right Perform channel-by-channel modulation and Residual fusion highlights key contextual channels and suppresses redundant responses, outputting context-enhanced features. The calculation process is as follows: , , , , , , In the above formula, Indicates channel grouping operation; Number of groups; Indicates the first The convolutional blocks consist of convolutional layers, batch normalization layers, and activation layers. Different groups of convolutional kernels have different sizes to form multi-scale receptive fields. Indicates channel-dimensional splicing; This indicates channel compression fusion convolution; This represents a local detail extraction convolution; Indicates global average pooling; Indicates channel attention weights; Indicates Sigmoid activation; Represents a nonlinear activation function; This indicates element-wise multiplication; This indicates element-wise addition; Indicates spatial perspective enhancement feature output; Furthermore, S1.3 includes the following steps: Selecting features at adjacent scales and The fused base features are obtained by splicing them together in the channel dimension. Subsequently, two global object distribution branches are constructed: the first branch... Perform global average pooling, through two layers. Convolution and Sigmoid generate channel weights and then... Channel modulation is performed to obtain the upper branch feature. The second branch Global max pooling also involves two layers. Convolution and Sigmoid generate complementary channel weights and then... Modulation yields lower branch features Simultaneously, construct local detail branches, through two layers. Convolution extracts local texture and boundary details to obtain local features. Finally, the two global branches and local branches are added and merged, and then... Convolution enables information exchange and outputs spatial perspective-enhanced features. The calculation process is as follows: , , , , , in, , Indicates features at adjacent scales; This indicates the fused substrate after splicing; , This represents two types of global channel weights; Indicates global max pooling; Indicates global average pooling; Represents a nonlinear activation function; Indicates local detailed features; This indicates the output of spatial perspective enhancement features.
[0016] Furthermore, refer to Figure 4 S2 includes the following steps: S2.1: Select target scale features from the feature pyramid and generate a mask based on the annotation to achieve foreground-background decoupling and provide input for smoothing; S2.2: Dimensionality reduction and smoothing of background features are performed to suppress high-frequency noise, and the background features are recombined with foreground features to obtain an enhanced feature representation; S2.3: By adaptively fusing the enhanced features and the original features through a gating mechanism, the enhancement intensity is controlled to obtain a stable and reliable frequency domain modulation output; Furthermore, S2.1 includes the following steps: Select target scale features from the feature pyramid. Subsequently, a binary mask is constructed based on the training labels. The foreground region is set to 1 and the background region to 0. Finally, the features are decomposed pixel by pixel using a mask, decoupling the features into foreground features. and background features This provides input for subsequent background smoothing, and the calculation process is as follows: , , In the above formula, Indicates the FPN number Layer feature map; This represents a binary mask generated from the annotations; , This indicates foreground / background decoupling features; This indicates element-wise multiplication; Furthermore, S2.2 includes the following steps: Background features Apply adaptive smoothing operator This is used to suppress high-frequency background noise; subsequently, the smoothed background features and foreground features are recombined and added together to obtain the frequency domain enhanced features. To highlight the spectral significance of small targets and reduce background interference, the calculation process is as follows: , , In the above formula, This represents the background adaptive smoothing operator; Indicates the dimensionality reduction rate of the channel; Indicates the first Layer dimensionality reduction / upgrading convolution parameters; It represents the Hadamardi (or Hadama) stack; Indicates nonlinear activation; It represents Sigmoid; This indicates the enhanced features output by the module; Furthermore, S2.3 includes the following steps: For the original features Gated weights are generated using convolution and Sigmoid. This is used to characterize the enhancement strength; subsequently, the enhancement features are... Compared with the original features Weighted fusion is performed to avoid information distortion caused by over-enhancement; finally, the modulation output characteristics from the frequency domain perspective are obtained. The calculation process is as follows: , , In the above formula, Indicates the gating weight; This indicates the frequency domain modulation enhancement characteristics of the SFEM output.
[0017] Furthermore, refer to Figure 5 S3 includes the following steps: S3.1: Fuse context-enhanced features and frequency-domain enhanced features, and perform local structure enhancement and fixed-resolution downsampling to reduce attention overhead; S3.2: Attention is calculated in a fixed low-resolution space, and then linear interpolation is used to restore the spatial size. This is then fused with the feature map residual to obtain dual-view modulation features. S3.3: Input the fused and enhanced features into the decoder for mask prediction and output the final segmentation result of the nematode or egg; S3.4: Train, validate, and test the model using the training, validation, and test sets; Furthermore, S3.1 includes the following steps: First, enhance the spatial perspective features. Enhanced features from the frequency domain perspective The concatenation is performed along the channel dimension, and the fusion gating coefficients are obtained by convolution plus Sigmoid. Achieving adaptive fusion of dual perspectives Subsequently, LSConv was used to enhance the elongated structure and boundary texture; finally, the features were downsampled to a fixed resolution. To reduce the computational cost of attention and achieve resolution-independent attention overhead, the computation process is as follows: , , , In the above formula, This indicates the dual-view fusion gating weights; Indicates DMLA input features; Indicates LS convolution; Indicates downsampling to a fixed spatial size ; This represents the low-resolution attention computation features; Furthermore, S3.2 includes the following steps: Low-resolution features The query is constructed using linear projection. ,key AND value Subsequently, the scaled dot product attention weight matrix is calculated. and to The attention output is obtained by performing a weighted summation; then, the attention output is linearly projected and upsampled to restore it to the original spatial scale; finally, the restored attention result is compared with... The dual-view attention modulation features are obtained by summing the residuals. The calculation process is as follows: , , , , In the above formula, Indicates the linear projection parameters; A represents the number of input channels; A represents the attention weight matrix. This indicates the spatial dimensions recovered by bilinear interpolation; This indicates element-wise addition; This represents the attention-modulated fusion features of the DMLA output; Furthermore, S3.3 includes the following steps: Modulation characteristics of DMLA output The input is a decoder network; subsequently, the decoder recovers multi-scale semantic and detail information step by step and outputs segmentation logits; finally, the final segmentation mask is obtained through Softmax, and the segmentation result of the nematode or egg is output. The calculation process is as follows: , , In the above formula, Indicates the segmentation decoder; This indicates the segmentation of logits; This indicates the final segmentation mask output; Furthermore, S3.4 includes the following steps: The model is trained and validated using the training and validation sets to obtain the optimal model weights. Then, the optimal model weights are imported into the test code, and the model is tested using the test set.
[0018] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments described. Those skilled in the art can make other equivalent modifications or substitutions without departing from the spirit of the invention. These equivalent modifications or substitutions are included within the scope defined by the claims.
Claims
1. A frequency-domain spatial dual-view nematode attention modulation segmentation method, characterized in that, The method includes the following steps: S1: Preprocess the nematode microscopic images, divide them into training, test and validation sets, and input the features extracted from the images into the channel-level multi-scale context enhancement module CMCE to generate enhanced features from the spatial perspective; S2: Input the feature map extracted from the processed image into the frequency domain information modulation feature enhancement module SFEM to obtain enhanced features from the frequency domain perspective; S3: Fuse the enhanced features from the two perspectives and input them into the dual-view modulated low-resolution attention computation module DMLA to obtain dual-view attention modulation features, input them into the decoder, and predict the segmentation mask.
2. The frequency-domain spatial dual-view nematode attention modulation segmentation method according to claim 1, characterized in that, S1 includes the following steps: S1.1: Collect raw nematode data, preprocess the data, and divide it into training set, test set and validation set. Extract features through backbone. S1.2: Construct hybrid receptive field features through multi-scale convolution and hierarchical connections, and calculate channel weights to fuse layer features to highlight key contexts; S1.3: Global and local complementary fusion of adjacent scale features to generate enhanced features with both semantic localization and detail preservation of spatial perspective; S1.1 includes the following steps: First, microscopic images of nematodes are collected and preprocessed, including standardization, size uniformity, and data augmentation. Then, the data is divided into training, validation, and test sets in an 8:1:1 ratio. Finally, the preprocessed images are input into a backbone network for convolution and feature extraction to obtain the input feature map. This serves as the input to CMCE; the calculation process is as follows: , , In the above formula, This represents a microscopic image of a primitive nematode. This indicates preprocessing and enhancement operations; This represents the preprocessed image; This represents the feature extraction function of the backbone network; This represents the backbone output feature map. For the dimensions of the passageway and space; S1.2 includes the following steps: First, the input feature map Grouping along the channel dimension yields multiple channel sub-features. Subsequently, convolutional blocks with different kernel sizes were applied to each channel group. By simulating different receptive fields and employing hierarchical connections to fuse the outputs of adjacent groups step by step, multi-scale contextual features are obtained. Then, Compared with the original features splicing in the channel dimension, and through Convolution is used to compress and fuse channels to obtain hybrid features. Finally, a channel recalibration mechanism is constructed, consisting of local detail branches and global channel weight branches: on the one hand, for... Perform twice Convolution extracts local texture and boundary details to obtain local enhancement features. On the other hand, Perform global average pooling and then Convolution and Sigmoid generate channel attention weights reuse right Perform channel-by-channel modulation and Residual fusion highlights key contextual channels and suppresses redundant responses, outputting context-enhanced features. The calculation process is as follows: , , , , , , In the above formula, Indicates channel grouping operation; Number of groups; Indicates the first The convolutional blocks consist of convolutional layers, batch normalization layers, and activation layers. Different groups of convolutional kernels have different sizes to form multi-scale receptive fields. Indicates channel-dimensional splicing; This indicates channel compression fusion convolution; This represents convolution for extracting local details. Indicates global average pooling; Indicates channel attention weights; Indicates Sigmoid activation; Represents a non-linear activation function; This indicates element-wise multiplication; This indicates element-wise addition; Indicates spatial perspective enhancement feature output; S1.3 includes the following steps: Selecting features at adjacent scales and The fused base features are obtained by splicing them together in the channel dimension. Subsequently, two global object distribution branches are constructed: the first branch... Perform global average pooling, through two layers Convolution and Sigmoid generate channel weights and then... Channel modulation is performed to obtain the upper branch feature. The second branch Global max pooling also involves two layers. Convolution and Sigmoid generate complementary channel weights and then... Modulation yields lower branch features Simultaneously, construct local detail branches, through two layers. Convolution extracts local texture and boundary details to obtain local features. Finally, the two global branches and local branches are added and merged, and then... Convolution enables information exchange and outputs spatial perspective-enhanced features. The calculation process is as follows: , , , , , in, , Indicates features at adjacent scales; This indicates the fused substrate after splicing; , This represents two types of global channel weights; Indicates global max pooling; Indicates global average pooling; Represents a non-linear activation function; Indicates local detailed features; This indicates the output of spatial perspective enhancement features.
3. The frequency-domain spatial dual-view nematode attention modulation segmentation method according to claim 1, characterized in that, S2 includes the following steps: S2.1: Select target scale features from the feature pyramid and generate a mask based on the annotation to achieve foreground-background decoupling and provide input for smoothing; S2.2: Dimensionality reduction and smoothing of background features are performed to suppress high-frequency noise, and the background features are recombined with foreground features to obtain an enhanced feature representation; S2.3: By adaptively fusing the enhanced features and the original features through a gating mechanism, the enhancement intensity is controlled to obtain a stable and reliable frequency domain modulation output; S2.1 includes the following steps: Select target scale features from the feature pyramid. Subsequently, a binary mask is constructed based on the training labels. The foreground region is set to 1 and the background region to 0. Finally, the features are decomposed pixel by pixel using a mask, decoupling the features into foreground features. and background features This provides input for subsequent background smoothing, and the calculation process is as follows: , , In the above formula, Indicates the FPN number Layer feature map; This represents a binary mask generated from the annotations; , This indicates foreground / background decoupling features; This indicates element-wise multiplication; S2.2 includes the following steps: Background features Apply adaptive smoothing operator This is used to suppress high-frequency background noise; subsequently, the smoothed background features and foreground features are recombined and added together to obtain the frequency domain enhanced features. To highlight the spectral significance of small targets and reduce background interference, the calculation process is as follows: , , In the above formula, This represents the background adaptive smoothing operator; Indicates the dimensionality reduction rate of the channel; Indicates the first Layer dimensionality reduction / upgrading convolution parameters; It represents the Hadamardi (or Hadama) stack; Indicates nonlinear activation; It represents Sigmoid; This indicates the enhanced features output by the module; S2.3 includes the following steps: For the original features Gated weights are generated using convolution and Sigmoid. This is used to characterize the enhancement strength; subsequently, the enhancement features are... Compared with the original features Weighted fusion is performed to avoid information distortion caused by over-enhancement; finally, the modulation output characteristics from the frequency domain perspective are obtained. The calculation process is as follows: , , In the above formula, Indicates the gating weight; This indicates the frequency domain modulation enhancement characteristics of the SFEM output.
4. The frequency-domain spatial dual-view nematode attention modulation segmentation method according to claim 1, characterized in that, S3 includes the following steps: S3.1: Fuse context-enhanced features and frequency-domain enhanced features, and perform local structure enhancement and fixed-resolution downsampling to reduce attention overhead; S3.2: Attention is calculated in a fixed low-resolution space, and then linear interpolation is used to restore the spatial size. This is then fused with the feature map residual to obtain dual-view modulation features. S3.3: Input the fused and enhanced features into the decoder for mask prediction and output the final segmentation result of the nematode or egg; S3.4: Train, validate, and test the model using the training, validation, and test sets; S3.1 includes the following steps: First, enhance the spatial perspective features. Enhanced features from the frequency domain perspective The concatenation is performed along the channel dimension, and the fusion gating coefficients are obtained by convolution plus Sigmoid. Achieving adaptive fusion of dual perspectives Subsequently, LSConv was used to enhance the elongated structure and boundary texture; finally, the features were downsampled to a fixed resolution. To reduce the computational cost of attention and achieve resolution-independent attention overhead, the computation process is as follows: , , , In the above formula, This indicates the dual-view fusion gating weights; Indicates DMLA input features; Indicates LS convolution; Indicates downsampling to a fixed spatial size ; This represents the low-resolution attention computation features; S3.2 includes the following steps: Low-resolution features The query is constructed using linear projection. ,key AND value Subsequently, the scaled dot product attention weight matrix is calculated. and to The attention output is obtained by performing a weighted summation; then, the attention output is linearly projected and upsampled to restore it to the original spatial scale; finally, the restored attention result is compared with... The dual-view attention modulation features are obtained by summing the residuals. The calculation process is as follows: , , , , In the above formula, Indicates the linear projection parameters; Indicates the number of input channels; Represents the attention weight matrix; This indicates the spatial dimensions recovered by bilinear interpolation; This indicates element-wise addition; This represents the attention-modulated fusion feature of the DMLA output; S3.3 includes the following steps: Modulation characteristics of DMLA output The input is a decoder network; subsequently, the decoder recovers multi-scale semantic and detail information step by step and outputs segmentation logits; finally, the final segmentation mask is obtained through Softmax, and the segmentation result of the nematode or egg is output. The calculation process is as follows: , , In the above formula, Indicates the segmentation decoder; This indicates the segmentation of logits; This indicates the final segmentation mask output; S3.4 includes the following steps: The model is trained and validated using the training and validation sets to obtain the optimal model weights. Then, the optimal model weights are imported into the test code, and the model is tested using the test set.
5. A frequency-domain spatial dual-view nematode attention modulation segmentation device, characterized in that, include: Channel-level multi-scale context enhancement module CMCE: used for spatial view enhancement branches to enhance the model's response to multi-scale structures and boundary details of nematodes and eggs in complex microscopic backgrounds; used to construct spatial view enhancement branches based on CMCE to improve the separability and localization ability of small targets; Among them, the spatial perspective enhancement branch extracts feature maps from the backbone network. The input to the CMCE module performs grouped multi-scale convolution, hierarchical connections, and channel attention recalibration, and performs global and local complementary fusion between adjacent scales to obtain spatial viewpoint enhanced feature maps. ; The Frequency Domain Information Modulation Feature Enhancement (SFEM) module is used to enhance the model's response to the spectral saliency and noise resistance of small targets such as nematodes and their eggs in the frequency domain perspective enhancement branch. It is used to construct the SFEM-based frequency domain perspective enhancement branch, highlighting target features and reducing background interference. The frequency domain perspective enhancement branch integrates feature pyramid layers... With binary mask The input SFEM module performs adaptive background smoothing and feature reconstruction, and then fuses the enhanced features with the original features through a gating mechanism to obtain a frequency domain viewpoint enhanced feature map. ; The Dual-View Modulation Low-Resolution Attention Computation Module (DMLA) is used to fuse spatial and frequency-domain view enhancement features to obtain stable and efficient attention modulation features. It is used to construct dual-view fused attention modulation features, enabling the model to jointly enhance responses to the slender structure, adhesion regions, and boundary textures of nematodes while reducing attention computation. Specifically, the model will integrate the spatial view enhancement feature map... Enhanced feature map from the frequency domain perspective The DMLA module performs lightweight attention computation and outputs a fused feature map after attention modulation. .