A depression image detection method fusing dynamic spatial and spiral mamba

By integrating dynamic space and spiral Mamba methods, this study addresses the shortcomings in capturing subtle facial features and modeling regional spatial correlations in facial image detection in existing technologies. This enables high-precision identification of depression and improves the robustness and discriminative ability of the model.

CN121482048BActive Publication Date: 2026-06-02ANHUI IND TECH INNOVATION RES INST +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ANHUI IND TECH INNOVATION RES INST
Filing Date
2026-01-08
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing technologies have limited ability to capture subtle spatial changes in key depressive regions such as the eyes and corners of the mouth in facial image detection, and it is difficult to model long-range spatial dependencies between different facial regions, resulting in insufficient accuracy and robustness in recognizing subtle facial expression features related to depression.

Method used

The method employs a fusion of dynamic space and spiral Mamba techniques. Through a basic feature extraction module, a spiral dependency modeling module, and a dynamic space module, global facial features, spatial dependencies of local blocks, and fine-grained dynamic facial expression features are extracted, respectively. The feature fusion and prediction modules then perform adaptive weighted fusion to generate a depression prediction score.

Benefits of technology

It significantly improves the accuracy of image detection for depression and the model's ability to analyze complex facial expressions. It can keenly perceive key local changes and understand the global structure of expressions, thus achieving high-precision depression recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121482048B_ABST
    Figure CN121482048B_ABST
Patent Text Reader

Abstract

The application provides a depression image detection method fusing dynamic space and spiral Mamba, comprising: obtaining an original face image to be detected; inputting the original face image into a trained depression detection model to obtain a depression prediction score, wherein the depression detection model comprises a basic feature extraction module, a spiral dependence modeling module, a dynamic space module and a feature fusion and prediction module. The method captures long-range spatial dependence and fine-grained expression dynamics between each local region of the face through the spiral dependence modeling module; generates a sample adaptive convolution kernel through the dynamic space module, and focuses on enhancing the local detail response of key regions such as eyes and mouth. The feature fusion module adaptively fuses the above global and local features with learnable weights, adjusts the contribution according to the sample dynamics, and generates a more discriminative comprehensive representation. The collaborative architecture significantly improves the accuracy of depression image detection and the analysis ability of the model to complex facial expressions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to an image detection method for depression that integrates dynamic space and spiral Mamba. Background Technology

[0002] Depression is a global mental disorder that seriously affects individual mental health, characterized by persistent low mood, loss of interest, and cognitive impairment. Traditional clinical diagnosis relies on psychological scale assessments and physician interviews, which have limitations such as high subjectivity, low efficiency, and difficulty in large-scale implementation.

[0003] In recent years, non-contact screening methods based on computer vision and artificial intelligence have become a research hotspot. Among them, the technical approach of assessing depressive states by analyzing subtle changes in facial expressions has shown great potential. Existing technologies mostly use convolutional neural networks (CNNs) or recurrent neural networks (RNNs) to extract features and model sequences from facial images. For example, pre-trained ResNets are used to extract static features, or 3D-CNNs are used to process video sequences to capture dynamic information.

[0004] However, these methods generally suffer from two key shortcomings: first, they have limited ability to capture subtle spatial changes in key depressive regions such as the eyes and corners of the mouth, making it difficult to model adaptive responses in local areas; second, they do not adequately model long-range spatial dependencies between different facial regions, failing to effectively integrate global facial contextual information, resulting in a need to improve the accuracy and robustness of identifying subtle depressive-related facial features. Summary of the Invention

[0005] In view of the above-mentioned deficiencies of the prior art, the present invention provides a method for detecting depression images that integrates dynamic space and spiral Mamba, so as to solve the technical problems of insufficient capture of subtle facial expression features and regional spatial correlation modeling of existing methods.

[0006] To achieve the above and other related objectives, this invention provides a method for detecting depression images by integrating dynamic space and spiral Mamba, comprising: acquiring an original facial image to be detected; inputting the original facial image into a trained depression detection model to obtain a depression prediction score, wherein the depression detection model includes: a basic feature extraction module for encoding the original facial image and extracting a global facial feature map; a spiral dependency modeling module for dividing and encoding the global facial feature map into local blocks, and modeling the spatial dependency relationship between each local block based on a spiral scanning path to extract fine-grained expression dynamic features; a dynamic space module for adaptively enhancing the global facial feature map to obtain spatially sensitive features that highlight key facial region details; and a feature fusion and prediction module for adaptively weighting and fusing the spatially sensitive features and the fine-grained expression dynamic features, and outputting the depression prediction score after pooling and fully connected processing.

[0007] In one embodiment of the present invention, the basic feature extraction module is the first few residual layers of a pre-trained ResNet18 network.

[0008] In one embodiment of the present invention, the spiral dependency modeling module includes: a block encoding unit, used to divide the global facial feature map into multiple local blocks and encode each local block to obtain an initial block sequence feature; and one or more cascaded spiral Mamba units, used to perform layer-by-layer deepening processing on the block sequence feature; wherein the input of the first spiral Mamba unit is the initial block sequence feature, and the input of subsequent spiral Mamba units is the output feature of the previous spiral Mamba unit; the spiral Mamba units extract the fine-grained facial expression dynamic features through spiral scanning and selective state space modeling.

[0009] In one embodiment of the present invention, the spiral Mamba unit processes its input features in the following manner: the input features of the spiral Mamba unit are divided into a first feature and a second feature in the channel dimension; the first feature is input to a convolution branch for processing to obtain a convolution branch feature; the second feature is input to a spiral state space branch for processing to obtain a state space branch feature; the convolution branch feature and the state space branch feature are fused to obtain the output features of the spiral Mamba unit.

[0010] In one embodiment of the present invention, the convolutional branch extracts and enhances the first feature by sequentially cascading depthwise separable convolutional layers, channel attention modules, dilated convolutional layers, grouped convolutional layers, and spatial attention modules to obtain the convolutional branch feature.

[0011] In one embodiment of the present invention, the spiral state space branch processes the second feature through the following steps: performing layer normalization on the second feature and dividing it into a first sub-feature and a second sub-feature in the channel dimension; performing linear transformation and activation processing on the first sub-feature to obtain a first transformed feature; performing linear transformation, depthwise separation convolution, activation processing, and processing using a spiral 2D selective scanning module on the second sub-feature in sequence to obtain a second transformed feature; performing feature interaction and linear projection on the first transformed feature and the second transformed feature, and then performing residual connection with the second feature to obtain the state space branch feature.

[0012] In one embodiment of the present invention, the spiral 2D selective scanning module processes its input features through the following steps: spirally traversing the spatial grid corresponding to the input features of the spiral 2D selective scanning module to generate multiple scanning sequences; modeling each scanning sequence using a selective state space model to capture long-range dependencies in the sequence; and merging the features of the multiple sequences processed by the selective state space model to obtain the output features of the spiral 2D selective scanning module.

[0013] In one embodiment of the present invention, the plurality of scanning sequences include: a height-priority forward spiral scanning sequence, a height-priority reverse spiral scanning sequence, a width-priority forward spiral scanning sequence, and a width-priority reverse spiral scanning sequence.

[0014] In one embodiment of the present invention, the dynamic spatial module includes: a dynamic convolution kernel generation unit, used to generate an adaptive convolution kernel related to the sample based on the global facial feature map; a dynamic convolution unit, used to perform a convolution operation on the global facial feature map using the adaptive convolution kernel; a spatial attention weight generation unit, used to generate spatial attention weights based on the feature map after dynamic convolution; and a feature enhancement unit, used to perform weighted fusion of the spatial attention weights and the global facial feature map and perform residual connection to obtain the spatially sensitive features.

[0015] In one embodiment of the present invention, the dynamic convolution kernel generation unit generates the adaptive convolution kernel in the following manner: performing global average pooling on the global facial feature map to obtain a sample-level global description vector; inputting the global description vector into a multilayer perceptron for nonlinear transformation and dimension mapping; and reconstructing the output vector of the multilayer perceptron into a three-dimensional tensor to form the adaptive convolution kernel that matches the number of channels of the global facial feature map.

[0016] In one embodiment of the present invention, the feature fusion and prediction module obtains the depression prediction score through the following steps: adding the spatially sensitive features and the fine-grained facial expression dynamic features to obtain initial fusion features; inputting the initial fusion features into a multilayer perceptron and normalizing them using the Softmax function to calculate adaptive fusion weights for weighting the spatially sensitive features and the fine-grained facial expression dynamic features; using the adaptive fusion weights to weight the spatially sensitive features and the fine-grained facial expression dynamic features respectively and then adding them together to obtain weighted fusion features; performing global average pooling and fully connected processing on the weighted fusion features to obtain the depression prediction score.

[0017] The beneficial effects of this invention are as follows: This invention proposes a method for detecting depression images that integrates dynamic space and spiral Mamba techniques. This method achieves high-precision recognition of facial depression features by constructing a collaborative architecture of basic feature extraction, spiral dependency modeling, dynamic space enhancement, and adaptive fusion. First, the method utilizes a spiral dependency modeling module to segment and spirally scan global features, effectively modeling the long-range spatial dependencies between various local facial regions, thereby capturing scattered and subtle dynamic changes in facial expressions. Second, the dynamic space module generates sample-adaptive convolutional kernels, which can significantly enhance the feature responses of key depression-representing regions such as the eyes and corners of the mouth, improving the model's sensitivity to changes in local details. Finally, the feature fusion and prediction module adaptively fuses the two types of complementary features using learnable weights, enabling the model to dynamically adjust the contributions of global dependencies and local details according to different samples, generating a more discriminative comprehensive feature representation. This method significantly improves the accuracy of depression image detection and the model's ability to analyze complex facial expressions. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. The accompanying drawings are incorporated in and constitute a part of this specification, illustrating embodiments consistent with this application, and are used together with the description to explain the principles of this application. Obviously, the drawings described below are merely some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without creative effort.

[0019] Figure 1 This is an architectural diagram of a depression detection model provided in an embodiment of the present invention;

[0020] Figure 2 This is an architectural diagram of a spiral Mamba unit provided in an embodiment of the present invention;

[0021] Figure 3This is an architectural diagram of a spiral 2D selective scanning module provided in an embodiment of the present invention;

[0022] Figure 4 This is an architectural diagram of a dynamic space module provided in an embodiment of the present invention. Detailed Implementation

[0023] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. It should be noted that, unless otherwise specified, the following embodiments and features can be combined with each other. In addition to the specific methods, equipment, and materials used in the embodiments, based on the knowledge of the prior art and the description of the present invention by those skilled in the art, any prior art methods, equipment, and materials similar to or equivalent to the methods, equipment, and materials in the embodiments of the present invention can be used to implement the present invention.

[0024] It should be understood that the terminology used in the embodiments of this invention is for describing specific implementations and not for limiting the scope of protection of this invention. Unless otherwise defined, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art.

[0025] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the invention. However, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details. In some embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the invention.

[0026] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functions, and operations that may be implemented in the methods and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0027] An embodiment of the present invention provides a method for detecting depression images by integrating dynamic space and spiral Mamba, including steps 1.1 and 1.2.

[0028] Step 1.1: Obtain the original facial image to be detected. The original facial image is usually an RGB face image captured by a camera. Before inputting it into the model, a series of preprocessing operations are required, including but not limited to: face detection and alignment to ensure that the facial region is located in the center of the image; image size normalization (e.g., adjusting to 224×224 pixels) to meet the input requirements of the feature extraction network; and pixel value normalization (e.g., normalizing to the [0,1] range or standardizing) to accelerate model training convergence and improve generalization performance.

[0029] Step 1.2: Input the original facial image into the trained depression detection model to obtain a depression prediction score. This depression detection model is the innovation of this invention. Simply input the original facial image into the trained model, and it can output a depression prediction score. The score is generally normalized to a value between 0 and 1, with higher scores indicating greater severity. Subsequently, based on a set threshold, the predicted score can be converted into labels, such as "yes" for scores greater than 0.5 and "no" otherwise, or "severe" for scores in the range [0.8, 1] and "moderate" for scores in the range [0.5, 0.8), etc.

[0030] Please see Figure 1 , Figure 1 The diagram illustrates the overall architecture of a depression detection model. In this model, the depression detection model includes a basic feature extraction module, a spiral dependency modeling module, a dynamic space module, and a feature fusion and prediction module. Specifically, the basic feature extraction module encodes the original facial image to extract a global facial feature map; the spiral dependency modeling module divides and encodes the global facial feature map into local blocks, and models the spatial dependencies between these local blocks based on the spiral scanning path, extracting fine-grained facial dynamic features; the dynamic space module performs adaptive spatial enhancement on the global facial feature map to obtain spatially sensitive features that highlight key facial region details; and the feature fusion and prediction module adaptively weights and fuses the spatially sensitive features and fine-grained facial dynamic features, then outputs a depression prediction score after pooling and fully connected processing.

[0031] The innovation of this overall architecture lies in its systematic integration and optimization of two key information processing paths for facial images. The spiral dependency modeling module focuses on extracting long-range spatial dependencies and fine-grained dynamic features from segmented sequences, simulating an understanding of the global structure of facial expressions; while the dynamic spatial module enhances the perception of spatial details in key local regions (eyes, mouth) through an adaptive mechanism. Finally, the feature fusion module adaptively fuses these two types of enhanced features at different levels. This design enables the model not only to understand the "overall facial expression posture" but also to keenly perceive "local key changes," and to dynamically adjust the proportion of the two types of information according to the characteristics of the input image, thereby possessing a stronger ability to recognize the feature patterns unique to depression, which are often reflected in the correlation between subtle local changes and overall facial expressions.

[0032] In one specific embodiment of the present invention, the basic feature extraction module is the first few residual layers of a pre-trained ResNet18 network. ResNet18 is a classic deep residual network that effectively alleviates the gradient vanishing problem in deep networks by introducing residual connections, thus facilitating training. In this invention, we use the first few residual layers of a pre-trained ResNet18 network (e.g., the residual blocks of the first two stages, i.e., the first four residual layers) as the basic feature extraction module to extract features with sufficient semantic information while preserving high spatial resolution, providing a foundation for subsequent fine-grained block analysis. The output of this module is the "global facial feature map". In addition to ResNet18, shallow or mid-layers of other pre-trained deep convolutional neural networks (such as VGG, EfficientNet, etc.) can also be used to achieve the same feature extraction function.

[0033] See also Figure 1 In a specific embodiment of the present invention, the spiral dependency modeling module includes a block encoding unit and one or more cascaded spiral Mamba units. The block encoding unit divides the global facial feature map into multiple local blocks and encodes each local block to obtain an initial block sequence feature. The one or more cascaded spiral Mamba units are used to perform layer-by-layer deepening processing on the block sequence feature. The input of the first spiral Mamba unit is the initial block sequence feature, and the input of subsequent spiral Mamba units is the output feature of the previous spiral Mamba unit. The spiral Mamba units extract fine-grained facial expression dynamic features through spiral scanning and selective state space modeling.

[0034] In this embodiment, the spiral dependency modeling module achieves hierarchical modeling of facial expression features from coarse to fine and from shallow to deep through the collaboration of "block encoding" and "multi-layer Mamba unit cascading". Block encoding transforms the spatial information of the image into a sequential representation, laying the foundation for subsequent sequence modeling. The cascaded spiral Mamba units then refine and enhance the spatial dependency information and dynamic change patterns in the sequence features through layer-by-layer deepening processing. This design allows the model to build deeper representations and apply the core mechanism of spiral scanning and selective state space modeling multiple times, thereby more fully uncovering the complex depressive cues hidden in facial block sequences.

[0035] In a specific embodiment of the present invention, the block encoding unit divides the global facial feature map into 9, 16, or 25 local blocks, preferably 16 local blocks. The choice of the number of blocks needs to strike a balance between feature expressiveness and computational complexity. Too few blocks (such as 9 blocks) may result in overly mixed information within each block, losing the significance of fine-grained local analysis; too many blocks (such as 25 blocks) will increase the sequence length and computational burden, and may introduce noise due to insufficient information in each block. Dividing into 16 (4×4) blocks is an empirically preferred solution, which can reasonably divide the face into meaningful local regions (such as corresponding to eyebrows, eyes, nose, mouth, etc.) while maintaining a moderate sequence length, which is beneficial for the efficient modeling of subsequent spiral Mamba units.

[0036] Please see Figure 2 In a specific embodiment of the present invention, the spiral Mamba unit processes its input features through the following steps 2.1 to 2.4.

[0037] Step 2.1: Divide the input features of the spiral Mamba unit into first features and second features along the channel dimension. Separating the input features along the channel dimension aims to provide a differentiated input information basis for the two subsequent branches with different functional focuses. This separation allows the convolutional branch and the spiral state space branch to extract information components more suitable for their respective processing modes from the same feature set, which is a prerequisite for achieving parallel processing and functional complementarity between the two branches.

[0038] Step 2.2: Input the first feature into the convolution branch for processing to obtain the convolution branch feature.

[0039] In a specific embodiment of the present invention, the convolutional branch extracts and enhances local features of the first feature through a series of cascaded depthwise separable convolutional layers, channel attention modules, dilated convolutional layers, grouped convolutional layers, and spatial attention modules, resulting in convolutional branch features. This embodiment's convolutional branch designs an efficient and feature-rich local feature extraction path. Depthwise separable convolution reduces the number of parameters and extracts basic spatial features; the channel attention module adaptively calibrates the importance of each channel, focusing on information-rich feature channels; dilated convolution expands the receptive field without increasing parameters, capturing a wider range of context; grouped convolution further enhances feature diversity; and the final spatial attention module focuses on key spatial locations on the feature map. This path, through a series of carefully designed operations, achieves layer-by-layer enhancement of the "first feature," focusing on extracting robust and discriminative local detail features.

[0040] The specific architecture of the convolutional branch is as follows: Figure 2 As shown in the upper middle section, we have omitted specific descriptions of layers such as Batch Normalization (BatchNorm) when describing the convolutional branches. This is because Batch Normalization, activation functions (such as ReLU and SiLU), etc., are common standard components in deep learning models used for stabilizing training, accelerating convergence, and introducing nonlinearity. Their placement and specific selection (such as using BN or LN, ReLU or SiLU) can be adjusted according to training requirements and specific implementations, which are conventional design choices for those skilled in the art and are not the core innovation of this invention. The innovation of this invention lies in the proposed specific module connection order and functional combination, namely, the core link of depthwise separating convolution → channel attention → dilated convolution → group convolution → spatial attention.

[0041] Step 2.3: Input the second feature into the spiral state space branch for processing to obtain the state space branch feature.

[0042] In a specific embodiment of the present invention, the specific structure of the spiral state space branch is as follows: Figure 2 As shown in the lower middle section, it processes the second feature through the following steps: (1) Normalize the second feature by layer and divide it into the first sub-feature and the second sub-feature in the channel dimension; (2) Perform linear transformation and activation processing on the first sub-feature to obtain the first transformed feature; (3) Perform linear transformation, depth separation convolution, activation processing and processing using the spiral 2D selective scanning module on the second sub-feature in sequence to obtain the second transformed feature; (4) Perform feature interaction and linear projection on the first transformed feature and the second transformed feature, and then perform residual connection with the second feature to obtain the state space branch feature.

[0043] The spiral state-space branch is the core of this invention for modeling long-range dependencies. After stabilizing features through layer normalization, it employs a split-processing strategy: one path (the first sub-feature) retains basic information through simple transformations; the other path (the second sub-feature) undergoes preliminary processing via linear layers and depthwise separable convolutions before being fed into the core spiral 2D selective scanning module. This module captures complex inter-block spatial dependencies through spiral path traversal and the state-space model. Finally, the two paths interact and are fused with the original input via residual connections. This design ensures that while introducing powerful sequence modeling capabilities, it preserves the integrity of the original features, effectively extracting fine-grained facial expression dynamic patterns inherent in block sequences.

[0044] Please see Figure 3 In a specific embodiment of the present invention, the spiral 2D selective scanning module processes its input features through the following steps 3.1 to 3.3.

[0045] Step 3.1: Perform a spiral traversal on the spatial grid corresponding to the input features of the spiral 2D selective scanning module to generate multiple scanning sequences.

[0046] In a specific embodiment of the present invention, the multiple scanning sequences include: a height-priority forward spiral scanning sequence (i.e., hereinafter referred to as...). ), high-priority reverse spiral scan sequence (i.e., below) ), width-first forward spiral scan sequence (i.e., below) ) and width-first reverse spiral scan sequence (i.e., below) ).

[0047] In this embodiment, a spiral scan function `helical()` can be defined first. The height-priority spiral scan sequence starts downwards. The movement rule is that if the next cell in the current direction is within the boundary and has not been visited, the movement continues; otherwise, it switches to the next direction counterclockwise and attempts to move. This can be expressed by the formula:

[0048] ,

[0049] ,

[0050] In the formula, H and W are the height and width of the input image, respectively, and height is a parameter for the height-priority direction. This is a reverse sequence operation.

[0051] Similarly, the width-first spiral scan sequence starts to the right, and the movement rule is that it can continue as long as it is within the boundary and has not been visited along the current direction; otherwise, it changes its movement direction clockwise. This can be expressed by the formula:

[0052] ,

[0053] ,

[0054] In the formula, width is a parameter in the width-first direction.

[0055] Step 3.2: Model each scan sequence using a selective state-space model to capture long-range dependencies within the sequence. Specifically, each sequence undergoes selective scanning via the S6 mechanism, which can be expressed as:

[0056] ,

[0057] In the formula, v∈{1,2,3,4}, S6 is the selective scan spatial state model, S v This is the sequence after processing with S6. The S6 mechanism, also known as the selective scan state-space model, is the core innovation of the Mamba model. Unlike traditional state-space models (such as S4) that use fixed parameters, S6 allows the model to dynamically generate parameters such as the state transition matrix based on the current input sequence, achieving "selective" sequence modeling. This means that the model can focus on the more important parts of the input sequence and ignore redundant information, thus capturing long-distance dependencies more efficiently and flexibly. In this invention, it is applied to sequences generated by spiral scans, enabling adaptive modeling of complex and dynamic spatial relationships between various local blocks of the face.

[0058] Step 3.3: Merge the features of multiple sequences processed by the selective state-space model to obtain the output features of the spiral 2D selective scan module. Specifically, the scan sequences can be merged using the merge() function, which can be expressed by the formula:

[0059] F HS2D =merge(S1,S2,S3,S4),

[0060] In the formula, F HS2D The output features of the spiral 2D selective scanning module are shown, with S1~S4 being the sequences obtained from step 3.2. The merge() function is responsible for integrating the features of the four spiral scanning sequences (height-first forward and reverse, width-first forward and reverse) after independent processing by the S6 model. This can be achieved through simple element-wise summation or by using a lightweight linear or convolutional layer. The goal is to aggregate potentially complementary spatial dependency information captured by different scanning paths, forming a globally enhanced, unified facial block sequence feature representation, providing a more comprehensive context for subsequent processing.

[0061] Step 2.4: Fuse the convolutional branch features with the state space branch features to obtain the output features of the spiral Mamba unit. This step can be expressed by the formula:

[0062] F Mamba =Concat(F HS2D ,F Conv ),

[0063] In the formula, F Mamba For the output characteristics of the spiral Mamba unit, F HS2D For state-space branching features, F Conv The features are convolutional branch features, and Concat is the connection operation.

[0064] Please see Figure 4 In a specific embodiment of the present invention, the dynamic spatial module includes a dynamic convolution kernel generation unit (i.e., Figure 4 Dynamic facial convolution kernels and dynamic convolution units (i.e., dynamic facial convolution kernels) Figure 4 The system includes a dynamic facial convolution module, a spatial attention weight generation unit, and a feature enhancement unit.

[0065] The dynamic convolution kernel generation unit is used to generate an adaptive convolution kernel related to the sample based on the global facial feature map. In a specific embodiment of the present invention, the dynamic convolution kernel generation unit generates the adaptive convolution kernel in the following manner: (1) performing global average pooling on the global facial feature map to obtain a sample-level global description vector; (2) inputting the global description vector into a multilayer perceptron for nonlinear transformation and dimension mapping; (3) reconstructing the output vector of the multilayer perceptron into a three-dimensional tensor to form an adaptive convolution kernel that matches the number of channels of the global facial feature map.

[0066] This embodiment can be expressed by the following formula:

[0067] ,

[0068] In the formula, K i ∈R C×K×K Let x be the dynamic convolution kernel for the i-th sample. i ∈R C×H×W The input feature map is the i-th sample. GAP() and σ() represent global average pooling and ReLU activation functions, respectively. W1 and b1 are the weights and biases of the first layer of the multilayer perceptron, and W2 and b2 are the weights and biases of the second layer of the multilayer perceptron. The feature map is first processed by global average pooling to obtain the global description vector of each sample. Then, it is reshaped by two fully connected layers to predict a vector of convolutional kernel parameter length. Finally, it is reshaped to generate a dedicated 3×3 convolutional kernel for the corresponding sample to extract specific facial information such as the area around the eyes, corners of the mouth, and forehead.

[0069] Dynamic convolutional units are used to perform convolution operations on the global facial feature map using adaptive convolutional kernels, which can be expressed by the formula: X i =DConv(x i ,K i In the formula, DConv() is a dynamic convolutional unit, and x i For the i-th sample, input feature map, K i is the dynamic convolution kernel for the i-th sample.

[0070] The spatial attention weight generation unit generates spatial attention weights based on the feature map after dynamic convolution. The feature enhancement unit weights and global facial feature map are weighted and fused together, and then residual connections are performed to obtain spatially sensitive features. The processing of these two units can be expressed by the following formula:

[0071] F DSM =x i ⊙δ(Conv 1×1 (X i ))+x i ,

[0072] In the formula, Conv 1×1 1×1 convolution operation, δ is the sigmoid activation function, together they constitute the spatial attention weight generation unit; ⊙ is element-wise multiplication, corresponding to the weighted fusion in the feature enhancement unit.

[0073] The innovation of the dynamic spatial module lies in its "sample-adaptive" spatial feature enhancement. Instead of using fixed convolutional kernels, it dynamically generates unique convolutional kernels based on the content of each input face image, enabling customized feature extraction for the unique structures of specific faces (such as eye and mouth shapes). Combined with a spatial attention mechanism, this module can self-learn and highlight the most significant local regions for detecting depression (such as drooping corners of the eyes and tight corners of the mouth). This dynamic and focused enhancement significantly improves the model's ability to capture individualized and subtle depressive facial features.

[0074] See also Figure 1 In a specific embodiment of the present invention, the feature fusion and prediction module obtains the depression prediction score through the following steps: (1) adding the spatially sensitive features and the fine-grained facial expression dynamic features to obtain the initial fusion features; (2) inputting the initial fusion features into a multilayer perceptron and normalizing them by the Softmax function to calculate the adaptive fusion weights used to weight the spatially sensitive features and the fine-grained facial expression dynamic features; (3) using the adaptive fusion weights to weight the spatially sensitive features and the fine-grained facial expression dynamic features respectively and then adding them together to obtain the weighted fusion features; (4) performing global average pooling and fully connected processing on the weighted fusion features to obtain the depression prediction score.

[0075] In this embodiment, the above steps can be expressed by the following formula:

[0076] ,

[0077] ,

[0078] In the formula, F DSM As a spatially sensitive feature, F Mamba,N This represents fine-grained facial expression dynamic features, which are also the output features of the Nth spiral Mamba unit. α and β are learnable weight coefficients, GAP is the global average pooling operation, and FC is the fully connected operation.

[0079] The key to the feature fusion and prediction module lies in "adaptive weighting." Instead of simply concatenating or averaging the two feature sets, it uses a learnable weight network to dynamically determine the relative importance of spatially sensitive features and fine-grained dynamic features based on the characteristics of the current sample. For example, for samples with subtle local muscle activity, dynamic features may be given higher weight; for samples with a frozen overall expression and obvious local contrast, spatially sensitive features may be relied upon more. This adaptive fusion strategy allows the model to flexibly respond to different manifestations of depressive states, generating the most discriminative comprehensive features, thereby driving the final classifier to make more accurate predictions.

[0080] In a specific embodiment of the present invention, the above-mentioned depression detection model needs to be trained, and the training steps are roughly as follows: (1) Construct a facial image dataset containing labeled depression scores or tags; (2) Initialize model parameters, wherein the basic feature extraction module can use weights pre-trained on a large image dataset (such as ImageNet); (3) Train in an end-to-end manner, using loss functions (such as mean squared error loss for regression tasks or cross-entropy loss for classification tasks) to measure the difference between the model's predicted score and the real label; (4) Calculate the gradient through the backpropagation algorithm, and use an optimizer (such as Adam) to update all weight parameters of the model; (5) Iterate the above process until the model's performance converges on the validation set, and obtain the final depression detection model.

[0081] It should be noted that the steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they contain the same logical relationship, they are all within the scope of protection of this application. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this patent.

[0082] In summary, this invention utilizes a dual-path collaboration between a spiral dependency modeling module and a dynamic space module to deeply mine and enhance facial depressive features from two dimensions: "global long-range dependency" and "local adaptive detail." Finally, intelligent integration via an adaptive feature fusion module forms a new paradigm for image detection of depression that is hierarchically clear and functionally complementary. This method effectively overcomes the shortcomings of existing technologies, such as insensitivity to subtle facial expression changes and weak regional correlation modeling, providing a powerful technical solution for achieving high-precision, highly robust, non-contact intelligent screening for depression.

[0083] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A method for detecting depression images by integrating dynamic space and spiral Mamba, characterized in that, include: Obtain the original facial image to be detected; The original facial image is input into a trained depression detection model to obtain a depression prediction score, wherein the depression detection model includes: The basic feature extraction module is used to encode the original facial image and extract the global facial feature map; The spiral dependency modeling module is used to divide and encode the global facial feature map into local blocks, and to model the spatial dependency relationship between each local block based on the spiral scanning path, thereby extracting fine-grained facial expression dynamic features. A dynamic spatial module is used to adaptively enhance the global facial feature map to obtain spatially sensitive features that highlight details of key facial regions; and The feature fusion and prediction module is used to adaptively weight and fuse the spatially sensitive features and the fine-grained facial expression dynamic features, and output the depression prediction score after pooling and fully connected processing. The spiral scanning path includes: a high-priority forward spiral scanning sequence. High-priority reverse spiral scan sequence Width-first forward spiral scan sequence and width-first reverse spiral scan sequence It can be expressed by the formula: , , , , In the formula, helical() is a helical scanning function, H and W are height and width of the input picture respectively, height is a parameter of the height-first direction, width is a parameter of the width-first direction, and Φ backward is a reverse sequence operation; The spiral dependency modeling module includes: A block encoding unit is used to divide the global facial feature map into multiple local blocks and encode each local block to obtain an initial block sequence feature; and One or more cascaded spiral Mamba units are used to perform layer-by-layer deepening processing on block sequence features; wherein, the input of the first spiral Mamba unit is the initial block sequence features, and the input of subsequent spiral Mamba units is the output features of the previous spiral Mamba unit; the spiral Mamba units extract the fine-grained facial expression dynamic features through spiral scanning and selective state space modeling. The spiral Mamba unit processes its input features in the following manner: The input features of the spiral Mamba unit are divided into a first feature and a second feature along the channel dimension; The first feature is input into the convolutional branch for processing to obtain the convolutional branch feature; The second feature is input into the spiral state space branch for processing to obtain the state space branch feature; The convolutional branch features are fused with the state space branch features to obtain the output features of the spiral Mamba unit; The convolutional branch extracts and enhances local features of the first feature through a cascaded depthwise separable convolutional layer, a channel attention module, a dilated convolutional layer, a grouped convolutional layer, and a spatial attention module, thereby obtaining the convolutional branch feature. The spiral state-space branch processes the second feature through the following steps: The second feature is subjected to layer normalization and divided into a first sub-feature and a second sub-feature in the channel dimension; The first sub-feature is subjected to linear transformation and activation processing to obtain the first transformed feature; The second sub-feature is sequentially subjected to linear transformation, depthwise separation convolution, activation processing, and processing using a spiral 2D selective scanning module to obtain the second transformed feature. After performing feature interaction and linear projection on the first transformation feature and the second transformation feature, a residual connection is made with the second feature to obtain the state space branch feature.

2. The method for detecting depression images by fusing dynamic space and spiral Mamba as described in claim 1, characterized in that, The basic feature extraction module consists of the first few residual layers of a pre-trained ResNet18 network.

3. The method for detecting depression images by fusing dynamic space and spiral Mamba as described in claim 1, characterized in that, The spiral 2D selective scanning module processes its input features through the following steps: The spatial grid corresponding to the input features of the spiral 2D selective scanning module is spirally traversed to generate multiple scanning sequences; Each scan sequence is modeled using a selective state-space model to capture long-range dependencies in the sequence; The features of multiple sequences processed by the selective state-space model are merged to obtain the output features of the spiral 2D selective scanning module.

4. The method for detecting depression images by fusing dynamic space and spiral Mamba as described in claim 1, characterized in that, The dynamic space module includes: A dynamic convolutional kernel generation unit is used to generate sample-related adaptive convolutional kernels based on the global facial feature map. A dynamic convolutional unit is used to perform a convolution operation on the global facial feature map using the adaptive convolutional kernel; A spatial attention weight generation unit is used to generate spatial attention weights based on the feature map after dynamic convolution; and The feature enhancement unit is used to weight and fuse the spatial attention weights with the global facial feature map and perform residual connection to obtain the spatially sensitive features; The dynamic convolutional kernel generation unit generates the adaptive convolutional kernel in the following manner: Global average pooling is performed on the global facial feature map to obtain a sample-level global description vector; The global description vector is input into a multilayer perceptron for nonlinear transformation and dimension mapping. The output vector of the multilayer perceptron is reconstructed into a three-dimensional tensor to form the adaptive convolutional kernel that matches the number of channels in the global facial feature map.

5. The method for detecting depression images by fusing dynamic space and spiral Mamba as described in claim 1, characterized in that, The feature fusion and prediction module obtains the depression prediction score through the following steps: The spatially sensitive features are added to the fine-grained facial expression dynamic features to obtain the initial fused features; The initial fusion features are input into a multilayer perceptron and normalized by the Softmax function to calculate the adaptive fusion weights used to weight the spatially sensitive features and the fine-grained facial expression dynamic features. The spatially sensitive features and the fine-grained facial expression dynamic features are weighted separately using the adaptive fusion weights and then summed to obtain the weighted fusion features; The weighted fusion features are subjected to global average pooling and fully connected processing to obtain the depression prediction score.