An adaptive multi-scale state space model establishing method and a perception scanning analysis method realized by the same

By combining an adaptive multi-scale state space model with multi-directional scanning and multi-scale feature extraction, the limitations of existing pneumonia diagnosis technologies have been addressed, achieving more efficient and accurate pneumonia identification, especially in precise diagnosis in multi-category and boundary-ambiguous scenarios.

CN122336331APending Publication Date: 2026-07-03INNER MONGOLIA UNIV OF SCI & TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INNER MONGOLIA UNIV OF SCI & TECH
Filing Date
2026-04-01
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing technologies for pneumonia diagnosis suffer from problems such as difficulty in capturing long-range dependencies in local receptive fields, high computational costs, inability to adaptively adjust fixed convolutional kernels, and inability to capture pathological changes in medical images. These issues result in poor performance of the models in pneumonia identification, especially in multi-class, class-imbalanced, and boundary-ambiguous scenarios where it is difficult to simultaneously guarantee spatial structure modeling ability, pathological differentiation ability, and computational efficiency.

Method used

An adaptive multi-scale state space model is adopted. Through adaptive multi-directional scanning and multi-scale feature extraction, combined with edge enhancement module and feature fusion, an interactive fusion model is formed to capture pathological specificity and multi-scale features, so as to achieve adaptive adjustment and accurate diagnosis.

Benefits of technology

It improves the accuracy and efficiency of pneumonia diagnosis, and can simultaneously ensure spatial structure modeling ability, pathological differentiation ability and computational efficiency in multiple types of pneumonia, adapting to multi-directional scanning analysis of different pathological features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122336331A_ABST
    Figure CN122336331A_ABST
Patent Text Reader

Abstract

An adaptive multi-scale state-space model establishment method and its implementation in a perceptual scanning analysis method are presented. In multi-class pneumonia, especially in scenarios with class imbalance, small sample sizes, and blurred boundaries, it is difficult to simultaneously guarantee spatial structure modeling capability, pathological differentiation capability, and computational efficiency. There is a lack of standardized processing methods that address the detailed issues of spatial structure modeling capability, pathological differentiation capability, and computational efficiency. This invention divides the acquired and processed chest X-ray image into two data streams. One stream is processed through detection and adaptive multi-directional scanning to form a spatial model in the SSM state. The other stream is processed through multi-scale feature extraction to form an edge enhancement module and feature fusion data. The edge enhancement module, feature fusion data, and the SSM-state spatial model are interactively fused to form an interactive fusion model, which is then used to complete the classification output process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Specifically, this invention relates to an adaptive multi-scale state-space model establishment method and its implementation in a perceptual scanning analysis method. Background Technology

[0002] Pneumonia is an acute lower respiratory tract infection caused by inflammation of the alveoli and surrounding tissues. According to the World Health Organization, pneumonia accounts for approximately 15% of deaths in children under five worldwide, causing more than 800,000 deaths annually. The global outbreak of COVID-19 has further highlighted the importance of rapid and accurate diagnosis of pneumonia. Chest X-rays are widely used for lung screening due to their low cost, availability, and applicability in resource-constrained areas. However, manual interpretation of CXRs is not only time-consuming but also exhibits significant inter-observer variability, with inconsistencies reaching 15–25% among experienced radiologists. Furthermore, it requires specialized knowledge and cannot always be guaranteed in real-world clinical settings.

[0003] Differentiating different types of pneumonia in CXR (CheXNet) is clinically challenging. Categories such as normal, COVID-19, viral pneumonia, and lung opacities share highly overlapping radiographic features, including ground-glass opacities, consolidation, and interstitial changes. Existing studies show that even with interpretation by experienced experts, the sensitivity fluctuates between 63% and 91%. These uncertainties underscore the necessity of building automated computer-aided diagnostic systems that can provide objective, consistent, and rapid assessments; however, these systems also have limitations. Deep learning methods, particularly convolutional neural networks (CNNs), have driven rapid advancements in medical image analysis over the past decade. Architectures such as ResNet and DenseNe have achieved leading performance on multiple tasks, with CheXNet even approaching radiologist-level performance in pneumonia detection. Subsequent methods have further incorporated attention mechanisms and multi-task learning to enhance feature representation. However, CNNs still suffer from structural limitations, primarily in the following aspects:

[0004] First: Local receptive fields are difficult to capture long-range dependencies;

[0005] Second: Expanding the receptive field by deepening the network brings significant computational costs and the risk of gradient degradation.

[0006] Third: Fixed convolution kernels cannot adaptively adjust according to the importance of the pathological region, treating all locations the same.

[0007] VisionTransformer partially overcomes the aforementioned limitations through a global self-attention mechanism, and its medical variants have achieved excellent results on multiple tasks. However, the quadratic complexity of Transformer is extremely costly when processing high-resolution CXR, and it heavily relies on large-scale pre-training data, which is severely constrained in the field of medical imaging by the scarcity of annotations and privacy restrictions.

[0008] In summary, using fixed, predefined scanning paths, which are mostly horizontal, vertical, or their reverse, and processing all image content in the same way, cannot capture pathological changes in medical images that are highly dependent on direction and location.

[0009] In medical imaging, especially pneumonia CXR, structural characteristics differ from natural images, placing higher demands on models. Lesions exhibit significant multi-scale distribution, ranging from millimeter-scale nodules to large-area consolidation across lobes; their anatomical structures show clear directional features of ribs, blood vessels, and mediastinum, not always consistent with the horizontal / vertical scans commonly seen in natural images; pathological differences often manifest in fine-grained texture variations, such as the peripheral ground-glass opacity often seen in COVID-19. Furthermore, class imbalance and blurred boundaries are common in medical datasets, requiring models to possess stronger discriminative power and robustness. Although existing CNN, Transformer, and visual state-space models have been used for pneumonia identification on chest X-rays, significant mismatches remain between their internal modeling mechanisms and the fundamental differences in the spatial diffusion patterns of pneumonia pathology, specifically manifested in the following three technical aspects:

[0010] First, the differences in chest X-rays between different types of pneumonia are not merely reflected in local texture or brightness, but rather in the spatial diffusion patterns, connectivity structures, and evolutionary models of lesions within the lung fields. COVID-19 typically presents as a diffuse, multifocal distribution in the peripheral regions of both lungs, while viral pneumonia tends to show focal or lobar aggregations, with opaque shadows in the lungs often appearing as dense, patchy or sheet-like areas. These differences essentially stem from variations in the dynamics of spatial state evolution. However, existing models such as CNNs, Transformers, and Mamba use uniform convolutional kernels, attention weights, or state transition matrices for all categories during feature propagation, distinguishing categories only at the output layer. This forces different disease types to follow the same spatial diffusion rules within the model, failing to reflect the pathologically specific propagation characteristics.

[0011] Secondly, existing visual state-space models must unfold two-dimensional medical images into a one-dimensional sequence through predefined scanning paths, typically limiting the scanning method to horizontal, vertical, and reverse directions. This strategy implicitly assumes that the main structures in the image are arranged in orthogonal directions, but this assumption does not hold true in chest X-rays. Lung textures are radially distributed, ribs and blood vessels have obvious oblique and arc-shaped orientations, and lesions such as COVID-19 often spread in multiple directions along the periphery of the lungs. Fixed scanning paths break down spatially continuous lesions into discrete segments in the sequence, disrupting lesion connectivity, and cannot adjust the sequencing method according to the anatomical structure and lesion morphology of different cases, thus limiting the model's ability to model complex medical spatial structures.

[0012] Finally, pneumonia lesions naturally exhibit strong multi-scale characteristics, ranging from millimeter-scale nodules and fine-grained ground-glass opacities to large-area consolidation covering the entire lung lobe. However, existing state-space models can only model sequences at a single token resolution. This leads to the model losing subtle lesions when capturing large-scale infiltration, while failing to form a global structural understanding when preserving high-resolution details. Consequently, it cannot accurately model both microscopic and macroscopic pathological patterns simultaneously.

[0013] Due to the aforementioned limitations, existing methods struggle to simultaneously guarantee spatial structure modeling capabilities, pathological differentiation capabilities, and computational efficiency in scenarios involving multiple types of pneumonia, especially those with imbalanced classes, small sample sizes, and ambiguous boundaries. There is a lack of standardized approaches that address the detailed issues of spatial structure modeling capabilities, pathological differentiation capabilities, and computational efficiency. Summary of the Invention

[0014] This invention provides an adaptive multi-scale state-space model establishment method and its implementation in a perceptual scanning analysis method to solve the above-mentioned problems.

[0015] An adaptive multi-scale state-space model establishment method divides the acquired and processed chest X-ray image into two data branches. One data branch is processed by detection and adaptive multi-directional scanning to form a spatial model in the SSM state. The other data branch is processed by multi-scale feature extraction to form an edge enhancement module and feature fusion data. The edge enhancement module, feature fusion data and the spatial model in the SSM state are interactively fused to form an interactive fusion model. The interactive fusion model is used to complete the classification output process.

[0016] As a preferred option, the acquired chest X-ray images are preprocessed. The preprocessing process is as follows: first, the short side of the chest X-ray image is scaled to 256 pixels, and then a 224×224 center cropping is performed while maintaining the predetermined aspect ratio, to ensure that the cropped image completely retains the bilateral lung parenchyma areas with feature data that can be recognized by the spatial model.

[0017] As a preferred approach, the acquired chest X-ray image is divided into two data branches with the same characteristics. One of these data branches is then processed using detection and adaptive multi-directional scanning to form a spatial model under the SSM state.

[0018] One of the two processed datasets is processed through global average pooling, multi-layer feature extraction, a flexible maximum transfer function (softmax) with temperature scaling, and four types of pathological outputs to form a corresponding data probability distribution. Based on the data probability distribution, two pathological specific parameters A and D are generated to ensure that the image data processed by SelectiveScan forms an adaptively adjusted state transition matrix according to the detected pathological type, thus completing the image specific modeling process and forming the initial model.

[0019] The initial model was processed using a fixed mixing strategy with α=0.5. The basic parameters and pathological-specific parameters in the initial model were weighted and fused to ensure that the stability index required by the initial model was maintained while allowing the parameters to be dynamically adjusted according to the pathological characteristics to form an integrated SS2D model.

[0020] The integrated SS2D model undergoes adaptive multi-directional scanning processing, which involves scanning the integrated SS2D model in multiple directions, including horizontal, vertical, spiral, zigzag, and reverse directions. Under the control of predetermined adaptive parameters, the model completes the adjustment state transition process in different scanning directions to form the final model, which is a spatial model in the SSM state.

[0021] As a preferred approach: the process of forming an edge enhancement module and feature fusion data from the other data set through multi-scale feature extraction is as follows:

[0022] The multi-scale medical feature extraction process involves constructing an enhanced medical Transformer branch, which in turn involves building a hierarchical feature pyramid. This pyramid consists of LocalWindowAttention modules with different window sizes (7×7, 14×14, and 28×28). After sharpening edges and high-frequency texture details in the feature map using a depthwise separable convolution method simulating a Laplacian operator, global summary and local response data are extracted using AdaptiveAvgPool2d and AdaptiveMaxPool2d. Dynamic channel attention weights are then generated based on these data, completing the adaptive processing of preceding enhanced features and forming an edge enhancement module. This edge enhancement module is an EnhancedMedicalTransformer module that integrates multi-scale perception, detail enhancement, and context fusion. The feature fusion process is completed by combining the window attention mechanism with the edge enhancement module, resulting in multi-scale medical feature data.

[0023] As a preferred approach, the process of constructing a hierarchical feature pyramid is as follows: The hierarchical feature pyramid is a feature pyramid with three resolution levels, namely 7×7, 14×14, and 28×28. During the construction of the hierarchical feature pyramid, for each input feature map... Bilinear interpolation is used to adjust each input feature map to each scale. Thus obtain At each scale, the feature map is divided into segments of size [size missing]. The non-overlapping window is calculated using a learning weight α_s based on global feature statistics to adaptively fuse multi-scale features. Specifically:

[0024] The input feature map is obtained through bilinear interpolation. The calculation formula for adjusting to the corresponding scale is as follows:

[0025]

[0026] In the above formula, , and These methods are used to capture images of small nodules (<10mm in diameter), medium-sized lesions (10-30mm in diameter), and large infiltrative lesions (>30mm in diameter), respectively, to obtain feature representations of the same content at different resolutions. At each scale, the feature map is divided into sections of size [missing information]. The formula for calculating non-overlapping windows is:

[0027] ;

[0028] Within each window, the process of calculating multi-head self-attention is as follows:

[0029] First, perform a linear projection on the tokens within the window to generate... , and :

[0030] ;

[0031] Then, the scaled dot product attention is calculated using the following formula:

[0032] ;

[0033] In the above formula, The attention output features within the current window at the s-th scale; The query matrix is ​​obtained by query mapping of the window features at the s-th scale. The key matrix is ​​obtained by key mapping of the window features at the s-th scale. The value matrix is ​​obtained by value mapping of the window features at the s-th scale. Key matrix Transpose of; Let be the dimension of the key vector. This is the scaling factor; represents the relative position bias term at the s-th scale; Softmax(·) denotes the normalization function;

[0034] At each scale, MLP is applied for feature refinement calculation, and the calculation formula is as follows:

[0035] ;

[0036] Then, adaptive fusion processing is performed, and the calculation formula is:

[0037] ;

[0038] The formula for calculating the feature sampling down to the original resolution at each scale is:

[0039] ;

[0040] Through the above calculations, the Softmax normalization process of the weights is completed, ensuring that the sum of the three weights is 1 and that each weight is between 0 and 1. This process equalizes the weights into a probability distribution. Finally, the fused features are calculated by weighted summation to obtain multi-scale medical feature data.

[0041] As a preferred approach, the process of constructing a hierarchical feature pyramid involves: During the construction of the hierarchical feature pyramid, a window attention method is used to calculate the relationships between features. The feature map is divided into multiple non-overlapping windows, and then self-attention is independently calculated within each window. Given a feature map of scale *s*, each feature map is divided into four 2×2 window grids, ensuring that each window contains the corresponding contextual information. Specifically:

[0042] for Fine-grained features, each window size is It contains 196 feature vectors;

[0043] for Medium-granularity features, each window size is It contains 49 feature vectors;

[0044] for The coarse-grained features are obtained by dividing the feature map into 2×2 windows. Since 7 is not divisible by 2, the size of each window is 3×3, 3×4, 4×3 or 4×4, containing 9 to 16 feature vectors.

[0045] After window partitioning is completed, the feature sequence within each window w Generate queries through three linear projections ,key Sum The calculation is performed on vectors using the following formula:

[0046]

[0047] In the above formula, , and These are the projection matrices for the query, the key, and the value, respectively. and These are the dimensions of the key and the value, respectively, and num_heads is the number of attention heads, specifically 8 or 16.

[0048] Calculate the ScaledDot-ProductAttention, where attention weights are computed via the dot product of the query and the key, then... Scaling is applied to the scaling factor to ensure the gradient remains stable. Finally, softmax normalization is used to ensure the dot product values ​​remain consistent, preventing the softmax function from entering saturation. The formula for calculating the correlation between features at different locations within the model's learning window, thereby capturing local structured patterns and dependencies, is as follows:

[0049] ;

[0050] In the above formula, Output the attention result for the w-th window; , and These are the query matrix, key matrix, and value matrix within the w-th window, respectively. Key matrix Transpose of; Let be the dimension of the key vector. is the scaling factor; Softmax(·) is the normalization function.

[0051] As a preferred approach: the process of forming a spatial model in the SSM state from one of the two datasets through detection and adaptive multi-directional scanning is the process of the Mamba branch combining the pathology-specific S6 module and the adaptive scanning mechanism to capture local sequence patterns and orientation-dependent lesion features; the process of forming an edge enhancement module and feature fusion data from the other dataset through multi-scale feature extraction is the process of another Transformer branch extracting global contextual information and cross-resolution lesion patterns through a multi-scale feature pyramid and medical feature enhancement module.

[0052] As a preferred approach, the construction process of the pathology-specific S6 module is as follows: Pathology-specific state-space parameters are introduced, and specific state-space parameters are learned for each disease type. Two pathology-specific parameters, A and D, are selected as pathology-specific parameters. Pathology-specific parameter A is used for state transitions, and pathology-specific parameter D is used for connections. The two pathology-specific parameters A and D are the state-space parameters learned for each disease type.

[0053]

[0054] In the above formula, For the first Pathological state transition matrix The parameters are used for skip connection, and the pathology detector identifies disease types and outputs probability distributions. Then, adaptive parameters are generated through probability weighting;

[0055] A deep medical detector, formed by combining two-layer feature extraction, residual connection, and temperature-scaled Softmax, identifies the type from feature map x and outputs the probability distribution of four types of pathological data. ;

[0056] Then based on the pathological probability For four sets of parameter pools The weighted combination is calculated using the following formula:

[0057]

[0058] In the above formula, A_adaptive is the pathological adaptive state transition matrix obtained by weighting the state transition matrices corresponding to the four pathological types according to the pathological probability distribution; D_adaptive is the pathological adaptive jump connection parameter obtained by weighting the jump connection parameters corresponding to the four pathological types according to the pathological probability distribution; p=[p0,p1,p2,p3] is the probability distribution of the four pathological data output by the deep medical detector, where pi represents the probability that the input feature map belongs to the i-th pathological type, and satisfies ∑(i=0→3)pi=1; Ai represents the state transition matrix corresponding to the i-th pathological type; Di is the jump connection parameter corresponding to the i-th pathological type; i is the pathological category index, which takes values ​​from 0 to 3.

[0059] Among them, pathological adaptive Zero-order ZOH discretization is performed to obtain and ; A continuous state transition matrix Discrete state transition matrix after discretization; It is a discrete input matrix;

[0060] Use adaptive parameters in state updates and output generation. Includes pathology-specific state transition dynamics. This refers to the pathologically specific skip connection strength.

[0061] An adaptive multi-scale state-based perceptual scanning analysis method is implemented using the adaptive multi-scale state-space model in the aforementioned adaptive multi-scale state-space model establishment method. The perceptual scanning analysis method involves interactively fusing edge enhancement modules, feature fusion data, and the spatial model under the SSM state to form an interactive fusion model, which is the adaptive multi-scale state-space model. The classification output processing process using the interactive fusion model involves using the interactive module to perform global average pooling and enhanced medical detection head processing to classify and output four types of pneumonia: normal, COVID-19, viral pneumonia, and pulmonary opacity. The perceptual scanning analysis processing of the classification output data is then completed by combining the adaptive multi-scale state-space model with an adaptive multi-directional scanning method. The perceptual scanning analysis processing of the classification output data includes eight modes, including four basic modes and four reverse modes.

[0062] The four basic modes include horizontal scanning, vertical scanning, diagonal scanning, and zigzag scanning; horizontal scanning is performed line by line from left to right, which is suitable for capturing anatomical structures in a horizontal orientation.

[0063] Vertical scanning proceeds column by column from top to bottom, making it suitable for capturing structures with a vertical orientation.

[0064] Diagonal scanning, which follows the main diagonal direction, is suitable for detecting tilted blood vessels, ribs, etc.

[0065] Z-shaped scanning proceeds from left to right for odd-numbered rows and from right to left for even-numbered rows, preserving spatial adjacency.

[0066] The four reverse scanning modes are horizontal scanning, vertical scanning, diagonal scanning, and zigzag scanning, corresponding to the reverse scanning processing. Each of the four reverse scanning modes involves processing the feature map... Expand into a sequence ;in, The adaptive weight generation process includes three steps:

[0067] First, global semantic features of the input are extracted using global average pooling. The calculation process is as follows:

[0068] ;

[0069] The above formula is used to calculate the process of compressing the spatial dimension into a single vector while preserving global information at the channel level.

[0070] Secondly, the global features are mapped to scores for K=8 scanning patterns through a linear transformation of the learned parameters. The calculation process is as follows:

[0071] ;

[0072] In the above formula, and For learning parameters; scoring This represents the initial evaluation score of the k-th scanning mode for the current input;

[0073] Finally, normalized weights are calculated by applying the Softmax function to the score vector to obtain normalized adaptive weights. The calculation process is as follows:

[0074] ;

[0075] In the above formula, Normalization factor, weight satisfy ,and This indicates the relative importance of each scanning mode;

[0076] For each scanning mode Perform the following operations:

[0077] First, perform sequence expansion: using the k-th scanning strategy. Unfold the two-dimensional feature map into a one-dimensional sequence. ,in ;

[0078] Next, we begin state-space modeling: for the sequence Apply selective scanning mechanism The output sequence is obtained. The state space parameters A, B, C, and D are shared across all scan modes.

[0079] The third step is feature reconstruction: using a reverse scan operation. The output sequence is restored to a two-dimensional feature map. ;

[0080] The final output is a weighted sum of the outputs of the K modes using adaptive weights, calculated as follows:

[0081] ;

[0082] In the above formula, This represents element-wise multiplication, with weights. Expanded via broadcast To match This dimension completes the end-to-end mode selection process;

[0083] When the model detects that the input image has horizontal structural features, it automatically increases the weight of the horizontal scan. ;

[0084] For complex and irregular structures, the model balances the weights of multiple scanning modes, and the complete output formula is as follows:

[0085]

[0086] In the above formula, y is the final output feature obtained after weighted fusion of multiple scanning modes; K is the total number of scanning modes; k is the scanning mode index, where k = 1, 2, ..., K; is the adaptive weight corresponding to the k-th scanning mode; ReverseScan_k(·) is the reverse scan reconstruction operation corresponding to the k-th scanning mode; SelectiveScan(·) is the selective scan state space modeling operation; ScanPattern_k(x) is the sequence representation obtained after sequence expansion of the input feature x using the k-th scanning strategy; x is the input feature map; A, B, C and D are all parameters of the state space model, where A is the state transition matrix parameter, B is the input control matrix parameter, C is the output mapping matrix parameter, and D is the jump connection parameter.

[0087] Compared with existing technologies, this invention provides an adaptive multi-scale state space model establishment method and its implemented perceptual scanning analysis method, which has the following beneficial effects:

[0088] The adaptive multi-scale state space model establishment method in this invention has the characteristics of self-adaptive focus on key regions and multi-scale structure in the ideal CXR model. The capture direction-dependent anatomical pattern of this invention is more accurate. This invention interactively fuses the edge enhancement module, feature fusion data and the spatial model in the SSM state to form an interactive fusion model. The fusion model can take into account the inductive bias direction, while ensuring the ability to model spatial structure, pathological differentiation and computational efficiency.

[0089] The perceptual scanning analysis method in this invention, based on the acquisition of an adaptive multi-scale state space model, completes the classification output of four types of pneumonia—normal, COVID-19, viral pneumonia, and opaque pulmonary shadows—through an interactive module using global average pooling and enhanced medical detection head processing. Then, the perceptual scanning analysis processing of the classified output data is completed by combining an adaptive multi-scale state space model with an adaptive multi-directional scanning method, which is beneficial for providing accurate preparatory data before disease diagnosis. Attached Figure Description

[0090] Figure 1 This is a flowchart of the present invention;

[0091] Figure 2 It is an adaptive Mamba branching structure diagram;

[0092] Figure 3 This is the overall architecture diagram of AdaptiveMulti-ScaleMamba;

[0093] Figure 4 This is the flowchart for adaptive multi-directional scanning processing;

[0094] Figure 5 A comparative analysis of the scanning mechanism is presented in the visual form.

[0095] Figure 6 This is a schematic diagram illustrating the visualization process of the AM-Mamba model.

[0096] Figure 7 A visual diagram illustrating the overlay of various methods. Detailed Implementation

[0097] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0098] Specific implementation method one: Combining Figures 1 to 7This embodiment describes a method where the acquired and processed chest X-ray image is divided into two data streams. One data stream is processed through detection and adaptive multi-directional scanning to form a spatial model in the SSM state. The other data stream is processed through multi-scale feature extraction to form an edge enhancement module and feature fusion data. The edge enhancement module, feature fusion data, and spatial model in the SSM state are then interactively fused to form an interactive fusion model. The interactive fusion model is then used to complete the classification output process.

[0099] In this embodiment, the acquired chest X-ray image is first preprocessed. The preprocessing process is as follows: first, the short side of the chest X-ray image is scaled to 256 pixels, and then a 224×224 center cropping process is performed while maintaining the predetermined aspect ratio to ensure that the cropped image completely retains the bilateral lung parenchyma areas with feature data that can be recognized by the spatial model.

[0100] This invention classifies chest X-rays of multiple types of pneumonia. The input image is first converted into a token sequence using PatchPartition and LinearEmbedding, then sequentially processed through four stages of Mamba-TransformerBlocks. Each stage uses PatchMerging to achieve cross-scale feature convergence. Each MambaBlock contains two parallel paths: a Mamba branch combining a pathology-specific S6 module and an adaptive scanning mechanism to capture local sequence patterns and orientation-dependent lesion features; and a Transformer branch extracting global contextual information and cross-resolution lesion patterns through a multi-scale feature pyramid and a medical feature enhancement module. The outputs of the two branches are integrated through an interactive fusion module. Finally, the enhanced medical detection head predicts four disease categories—normal, COVID-19, viral pneumonia, and pulmonary opacity—using residual structures and global average pooling. The overall architecture of this invention fully integrates multi-scale feature modeling, pathology-specific sequence modeling, orientation-dependent scanning, and enhanced discriminative capabilities, providing an end-to-end, efficient, interpretable, and accurate standard solution for multi-type pneumonia CXR classification.

[0101] Specific Implementation Method Two: This implementation method is a further limitation of Specific Implementation Method One. In this implementation method, the acquired chest X-ray image is divided into two data branches with the same characteristics. The process of forming a spatial model in the SSM state by detecting and adaptive multi-directional scanning of one of the data branches is as follows:

[0102] One of the two processed datasets is processed through global average pooling, multi-layer feature extraction, a flexible maximum transfer function (softmax) with temperature scaling, and four types of pathological outputs to form a corresponding data probability distribution. Based on the data probability distribution, two pathological specific parameters A and D are generated to ensure that the image data processed by SelectiveScan forms an adaptively adjusted state transition matrix according to the detected pathological type, thus completing the image specific modeling process and forming the initial model.

[0103] The initial model was processed using a fixed mixing strategy with α=0.5. The basic parameters and pathological-specific parameters in the initial model were weighted and fused to ensure that the stability index required by the initial model was maintained while allowing the parameters to be dynamically adjusted according to the pathological characteristics to form an integrated SS2D model.

[0104] The integrated SS2D model undergoes adaptive multi-directional scanning processing, which involves scanning the integrated SS2D model in multiple directions, including horizontal, vertical, spiral, zigzag, and reverse directions. Under the control of predetermined adaptive parameters, the model completes the adjustment state transition process in different scanning directions to form the final model, which is a spatial model in the SSM state.

[0105] Specific Implementation Method Three: This implementation method is a further limitation of Specific Implementation Method One or Two. In this implementation method, the process of forming the edge enhancement module and feature fusion data from the other data in the two data sets through multi-scale feature extraction processing is as follows:

[0106] The multi-scale medical feature extraction process involves constructing an enhanced medical Transformer branch, which in turn involves building a hierarchical feature pyramid. This pyramid consists of LocalWindowAttention modules with different window sizes (7×7, 14×14, and 28×28). After sharpening edges and high-frequency texture details in the feature map using a depthwise separable convolution method simulating a Laplacian operator, global summary and local response data are extracted using AdaptiveAvgPool2d and AdaptiveMaxPool2d. Dynamic channel attention weights are then generated based on these data, completing the adaptive processing of preceding enhanced features and forming an edge enhancement module. This edge enhancement module is an EnhancedMedicalTransformer module that integrates multi-scale perception, detail enhancement, and context fusion. The feature fusion process is completed by combining the window attention mechanism with the edge enhancement module, resulting in multi-scale medical feature data. This invention organically unifies multi-scale perception, detail enhancement, and context fusion within the EnhancedMedicalTransformer module, generating a powerful feature representation that is rich in high-level semantics and retains fine spatial details, thereby significantly improving the model's performance and robustness in complex medical image analysis tasks.

[0107] Combination Figure 2 As shown, the edge enhancement module in this embodiment is a key component for enhancing lesion boundary features in medical image analysis. Lesions in medical images often have complex boundary features, and simple feature extraction is insufficient to fully capture edge information. The edge enhancement module adopts a progressive convolution stacking design: First, edge detection is performed through Laplacian-class convolution, specifically through grouped convolution with groups=C. This operation preserves spatial details while reducing the number of parameters, effectively capturing boundary information in the image. Second, batch normalization and the GELU activation function enhance nonlinear expression capabilities. Subsequently, depthwise convolution is used to extract texture features, which extracts spatial texture information while maintaining computational efficiency. Then, 1×1 pointwise convolution is used for cross-channel information fusion, realizing feature interaction between channels. Finally, batch normalization stabilizes the feature representation. The above processing enables the module to fully enhance the edge and texture features in medical images while maintaining computational efficiency, providing a more robust feature table for subsequent feature fusion and classification tasks.

[0108] Specific Implementation Method Four: This implementation method is a further limitation of Specific Implementation Methods One, Two, or Three. In this implementation method, the hierarchical feature pyramid is a feature pyramid with three resolution levels, namely 7×7, 14×14, and 28×28. During the construction of the hierarchical feature pyramid, for each input feature map... Bilinear interpolation is used to adjust each input feature map to each scale. Thus obtain At each scale, the feature map is divided into segments of size [size missing]. The non-overlapping window is calculated using a learning weight α_s based on global feature statistics to adaptively fuse multi-scale features. Specifically:

[0109] The input feature map is obtained through bilinear interpolation. The calculation formula for adjusting to the corresponding scale is as follows:

[0110] ;

[0111] In the above formula, , and These methods are used to capture images of small nodules (<10mm in diameter), medium-sized lesions (10-30mm in diameter), and large infiltrative lesions (>30mm in diameter), respectively, to obtain feature representations of the same content at different resolutions. At each scale, the feature map is divided into sections of size [missing information]. The formula for calculating non-overlapping windows is:

[0112] ;

[0113] Within each window, the process of calculating multi-head self-attention is as follows:

[0114] First, perform a linear projection on the tokens within the window to generate... , and :

[0115] ;

[0116] Then, the scaled dot product attention is calculated using the following formula:

[0117] ;

[0118] In the above formula, This represents the attention output feature within the current window at the s-th scale; This represents the query matrix obtained by query mapping of the window features at the s-th scale; This represents the key matrix obtained by key mapping of the window features at the s-th scale; This represents the value matrix obtained by value mapping of the window features at the s-th scale; Key matrix Transpose of; The dimension of the key vector. This is a scaling factor used to normalize the dot product of the query matrix and the key matrix to prevent the Softmax function from entering the saturation region due to excessively large dot product values. represents the relative position bias term at the s-th scale, used to characterize the spatial relationship between tokens at different positions within the window; Softmax(·) represents the normalization function, used to convert the attention score into probability distribution weights;

[0119] At each scale, MLP is applied for feature refinement calculation, and the calculation formula is as follows:

[0120] ;

[0121] Then, adaptive fusion processing is performed, and the calculation formula is:

[0122] ;

[0123] The formula for calculating the feature sampling down to the original resolution at each scale is:

[0124] ;

[0125] Through the above calculations, the Softmax normalization process of the weights is completed, ensuring that the sum of the three weights is 1 and that each weight is between 0 and 1. This process equalizes the weights into a probability distribution. Finally, the fused features are calculated by weighted summation to obtain multi-scale medical feature data.

[0126] Specific Implementation Method Five: This implementation method is a further limitation of Specific Implementation Methods One, Two, Three, or Four. In this implementation method, the process of constructing a hierarchical feature pyramid is as follows: During the construction of the hierarchical feature pyramid, the relationship between features is calculated using a window attention method. The feature map is divided into multiple non-overlapping windows, and then self-attention is independently calculated within each window. Given a feature map of scale *s*, each feature map is divided into four 2×2 window grids, ensuring that each window contains the corresponding contextual information. Specifically:

[0127] for Fine-grained features, each window size is It contains 196 feature vectors;

[0128] for Medium-granularity features, each window size is It contains 49 feature vectors;

[0129] for The coarse-grained features are obtained by dividing the feature map into 2×2 windows. Since 7 is not divisible by 2, the size of each window is 3×3, 3×4, 4×3 or 4×4, containing 9 to 16 feature vectors.

[0130] After window partitioning is completed, the feature sequence within each window w Generate queries through three linear projections ,key Sum The calculation is performed on vectors using the following formula:

[0131]

[0132] In the above formula, , and These are the projection matrices for the query, the key, and the value, respectively. and These are the dimensions of the key and the value, respectively, and num_heads is the number of attention heads, specifically 8 or 16.

[0133] Calculate the ScaledDot-ProductAttention, where attention weights are computed via the dot product of the query and the key, then... Scaling is applied to the scaling factor to ensure the gradient remains stable. Finally, softmax normalization is used to ensure the dot product values ​​remain consistent, preventing the softmax function from entering saturation. The formula for calculating the correlation between features at different locations within the model's learning window, thereby capturing local structured patterns and dependencies, is as follows:

[0134] ;

[0135] In the above formula, This represents the attention output of the w-th window; , and These represent the query matrix, key matrix, and value matrix within the w-th window, respectively. Key matrix Transpose of; The dimension of the key vector. is the scaling factor; Softmax(·) represents the normalization function used to convert the dot product result into attention weights.

[0136] Specific Implementation Method Six: This implementation method is a further limitation of Specific Implementation Methods One, Two, Three, Four, or Five. In this implementation method, the process of forming a spatial model in the SSM state through detection and adaptive multi-directional scanning processing of one of the two datasets is the process of capturing local sequence patterns and direction-dependent lesion features by combining the Mamba branch with the pathology-specific S6 module and the adaptive scanning mechanism. The process of forming edge enhancement modules and feature fusion data through multi-scale feature extraction processing of the other dataset is the process of extracting global context information and cross-resolution lesion patterns through another Transformer branch using multi-scale feature pyramids and medical feature enhancement modules. Table 1 below is a comparison table between the adaptive multi-directional scanning processing method and the standard VMamba scanning method in this invention.

[0137] Table 1

[0138]

[0139] The above approach ensures that the model can directly improve the ability to model complex medical image spatial structures while maintaining computational efficiency, and is particularly suitable for medical image analysis tasks with multi-directional anatomical structures and irregular pathological features.

[0140] Specific Implementation Method Seven: This implementation method is a further limitation of Specific Implementation Methods One, Two, Three, Four, Five, or Six. In this implementation method, the construction process of the pathology-specific S6 module is as follows: Pathology-specific state space parameters are introduced, and specific state space parameters are learned for each disease type. Two pathology-specific parameters A and D are selected as pathology-specific parameters, where pathology-specific parameter A is used for state transition, and pathology-specific parameter D is used for connection. The two pathology-specific parameters A and D are the state space parameters learned for each disease type.

[0141] ;

[0142] In the above formula, For the first Pathological state transition matrix The parameters are used for skip connection, and the pathology detector identifies disease types and outputs probability distributions. Then, adaptive parameters are generated through probability weighting;

[0143] A deep medical detector, formed by combining two-layer feature extraction, residual connection, and temperature-scaled Softmax, identifies the type from feature map x and outputs the probability distribution of four types of pathological data. ;

[0144] Then based on the pathological probability For four sets of parameter pools The weighted combination is calculated using the following formula:

[0145] ;

[0146] In the above formula, This represents the pathological adaptive state transition matrix obtained by weighting the state transition matrices corresponding to the four pathological types according to the pathological probability distribution; D_adaptive represents the pathological adaptive jump connection parameters obtained by weighting the jump connection parameters corresponding to the four pathological types according to the pathological probability distribution; p=[p0,p1,p2,p3] represents the probability distribution of the four pathological data output by the deep medical detector, where pi represents the probability that the input feature map belongs to the i-th pathological type, and satisfies ∑(i=0→3)pi=1; Ai represents the state transition matrix corresponding to the i-th pathological type; Di represents the jump connection parameters corresponding to the i-th pathological type; i is the pathological category index, with a value of 0 to 3.

[0147] Among them, pathological adaptive Zero-order ZOH discretization is performed to obtain and ; Represents a continuous state transition matrix Discrete state transition matrix after discretization; This represents a discrete input matrix, used to characterize the effect of the input signal on state updates, compared to the fixed matrix used in standard Mamba. , Used to adjust memory length and state evolution rate according to disease type.

[0148] Use adaptive parameters in state updates and output generation. Includes pathology-specific state transition dynamics. This refers to the pathologically specific skip connection strength.

[0149] Specific implementation method eight: Combination Figures 1 to 7As shown, the perceptual scanning analysis method in this embodiment is implemented through an adaptive multi-scale state space model. The perceptual scanning analysis method involves interactively fusing the edge enhancement module, feature fusion data, and the spatial model under the SSM state to form an interactive fusion model, which is the adaptive multi-scale state space model. The classification output processing process using the interactive fusion model involves using the interactive module to complete the classification output of four types of pneumonia: normal, COVID-19, viral pneumonia, and lung opacity shadows, through global average pooling and enhanced medical detection head processing. Then, the perceptual scanning analysis processing of the classification output data is completed by combining the adaptive multi-scale state space model with the adaptive multi-directional scanning method. The perceptual scanning analysis processing of the classification output data includes eight modes, including four basic modes and four reverse modes.

[0150] The four basic modes include horizontal scanning, vertical scanning, diagonal scanning, and zigzag scanning; horizontal scanning is performed line by line from left to right, which is suitable for capturing anatomical structures in a horizontal orientation.

[0151] Vertical scanning proceeds column by column from top to bottom, making it suitable for capturing structures with a vertical orientation.

[0152] Diagonal scanning, which follows the main diagonal direction, is suitable for detecting tilted blood vessels, ribs, etc.

[0153] Z-shaped scanning proceeds from left to right for odd-numbered rows and from right to left for even-numbered rows, preserving spatial adjacency.

[0154] The four reverse scanning modes are horizontal scanning, vertical scanning, diagonal scanning, and zigzag scanning, corresponding to the reverse scanning processing. Each of the four reverse scanning modes involves processing the feature map... Expand into a sequence ;in, The adaptive weight generation process includes three steps:

[0155] First, global semantic features of the input are extracted using global average pooling. The calculation process is as follows:

[0156] ;

[0157] The above formula is used to calculate the process of compressing the spatial dimension into a single vector while preserving global information at the channel level.

[0158] Secondly, the global features are mapped to scores for K=8 scanning patterns through a linear transformation of the learned parameters. The calculation process is as follows:

[0159] ;

[0160] In the above formula, and For learning parameters; scoring This represents the initial evaluation score of the k-th scanning mode for the current input;

[0161] Finally, normalized weights are calculated by applying the Softmax function to the score vector to obtain normalized adaptive weights. The calculation process is as follows:

[0162] ;

[0163] In the above formula, Normalization factor, weight satisfy ,and This indicates the relative importance of each scanning mode;

[0164] For each scanning mode Perform the following operations:

[0165] First, perform sequence expansion: using the k-th scanning strategy. Unfold the two-dimensional feature map into a one-dimensional sequence. ,in ;

[0166] Next, we begin state-space modeling: for the sequence Apply selective scanning mechanism The output sequence is obtained. The state space parameters A, B, C, and D are shared across all scan modes.

[0167] The third step is feature reconstruction: using a reverse scan operation. The output sequence is restored to a two-dimensional feature map. ;

[0168] The final output is a weighted sum of the outputs of the K modes using adaptive weights, calculated as follows:

[0169] ;

[0170] In the above formula, This represents element-wise multiplication, with weights. Expanded via broadcast To match This dimension completes the end-to-end mode selection process;

[0171] When the model detects that the input image has horizontal structural features, it automatically increases the weight of the horizontal scan. ;

[0172] For complex and irregular structures, the model balances the weights of multiple scanning modes, and the complete output formula is as follows:

[0173] ;

[0174] In the above formula, y represents the final output feature obtained after weighted fusion of multiple scanning modes; K represents the total number of scanning modes; k represents the scanning mode index, where k = 1, 2, ..., K; The adaptive weights corresponding to the k-th scanning mode are represented by: ReverseScan_k(·) represents the reverse scan reconstruction operation corresponding to the k-th scanning mode, used to restore the output in sequence form to a two-dimensional feature map; SelectiveScan(·) represents the selective scan state space modeling operation; ScanPattern_k(x) represents the sequence representation obtained after performing sequence expansion on the input feature x using the k-th scanning strategy; x represents the input feature map; A, B, C, and D represent the parameters of the state space model, where A represents the state transition matrix, B represents the input control matrix, C represents the output mapping matrix, and D represents the skip connection parameters.

[0175] Specific Implementation Method Nine: This implementation method is a further limitation of Specific Implementation Methods One, Two, Three, Four, Five, Six, Seven, or Eight. In this implementation method, standard Mamba uses an input-dependent selective mechanism to adjust parameters. , , Depends on the current input However, this local adaptability is insufficient to capture the systemic differences among different pneumonia types. Therefore, the Medical-AdaptiveS6 algorithm is proposed, introducing pathology-specific state-space parameters. Simultaneously, specific state-space parameters are learned for each disease type. Based on medical prior knowledge, the space parameter A for state transitions and the space parameter D for connection are selected as pathology-specific parameters. The state-space parameters learned for each disease type are as follows:

[0176] in For the first Pathological state transition matrix These are the parameters for skip connections. A pathology detector identifies disease types and outputs a probability distribution. Then, adaptive parameters are generated through probability weighting. The specific pseudocode for the pathological adaptive S6 algorithm is shown in Table 2 below.

[0177] Table 2

[0178]

[0179] This process first uses a deep medical detector to identify disease types from feature map x, outputting the probability distribution of four pathological types. The relevant content of this invention regarding the dataset is as follows: In the specific experiment, a multi-source computerized chest radiology image dataset was used for the pneumonia four-class classification task. This dataset contains 21,165 chest X-ray images, divided into four categories: normal type (n=10,192 images), COVID-19 type (n=3,616 images), viral pneumonia type (n=1,345 images), and lung opacity type (n=6,012 images). This multi-class structure is highly consistent with existing large-scale CXR studies, ensuring the clinical relevance of the task and label diversity.

[0180] As shown in Table 3, to ensure the fairness and reproducibility of the experiment, the dataset was divided into training, validation, and test sets in a 6:2:2 ratio. The training set accounted for 60% (12,699 images), the validation set for 20% (4,233 images), and the test set for 20% (4,233 images). Image preprocessing followed a common workflow for medical image classification, similar to COVIDx: first, the shorter side was scaled to 256 pixels, then a 224×224 center crop was performed while maintaining the aspect ratio. Further evaluation of the cropping operation's impact on key anatomical structures confirmed that the cropped images still completely preserved the bilateral lung parenchyma. The cropped area mainly consisted of the peripheral thoracic region, and did not affect the model's recognition of lung pathological features, such as infiltration, patchy opacities, and ground-glass opacities. Table 3 shows the results.

[0181] Table 3

[0182]

[0183] All experiments were conducted on an NVIDIA RTX 4090 discrete graphics card with 24GB of VRAM, using PyTorch 2.0.1 and CUDA 11.8. Three model variants were employed: AM-Mamba-Tiny with 25.8M parameters, AM-Mamba-Small with 44.3M parameters, and AM-Mamba-Base with 89.7M parameters, with depth configurations of [2,2,4,2], [2,2,8,2], and [2,2,12,2], respectively. To improve efficiency, the AM-Mamba-Tiny model was used in the main experiments.

[0184] The batch size was set to 8, and gradient clipping with a maximum norm of 1.0 was applied to stabilize the training process. Image preprocessing followed a standard chest X-ray classification procedure. First, the shorter side of each image was scaled to 256 pixels while maintaining the aspect ratio, followed by a 224×224 center crop to ensure complete coverage of the lung field.

[0185] During training, appropriate data augmentation strategies were employed to improve the model's generalization ability while preserving pathological structural features. Specific measures included random horizontal flipping with a probability of 0.5 and small-angle random rotations within ±10 degrees to simulate subtle differences in patient positioning. To avoid truncating lung regions due to rotation, padding and resampling were performed before central cropping to ensure the integrity of both lung parenchymas. All augmentation operations were strictly limited to small amplitudes to prevent unrealistic anatomical distortions or lesion distortions.

[0186] Finally, the images were normalized using dataset-specific mean and standard deviation to stabilize the training process. The model converged after approximately 300 training epochs.

[0187] The perceptual scanning analysis method of this invention involves interactively fusing edge enhancement modules, feature fusion data, and a spatial model under SSM (Spatial Scale) conditions to form an interactive fusion model, which is an adaptive multi-scale state space model. The classification output process using this interactive fusion model involves using a global average pooling and enhanced medical detection head processing method to classify four types of pneumonia: normal, COVID-19, viral pneumonia, and opaque pulmonary opacities. The evaluation analysis of the perceptual scanning analysis processing of the classified output data is then performed by combining the adaptive multi-scale state space model with an adaptive multi-directional scanning method. The evaluation analysis content includes:

[0188] This study combines classification performance across four categories: viral pneumonia, COVID-19, opaque lungs, and normal lungs. It employs evaluation metrics for overall performance and the impact of class imbalance to address the often-existing problem of imbalanced class distribution in medical data. This approach ensures a balance between comprehensive inclusion of minority classes and the ability to identify all classes. The study uses Balanced Accuracy and Macro-F1 Score as metrics, as these two metrics are considered more robust in imbalanced data scenarios and can more fairly measure the contribution of all classes.

[0189] In terms of computational efficiency, the number of model parameters (Params) and the number of floating-point operations (FLOPs) are measured as key criteria for evaluating the deployment value of deep vision models in resource-constrained environments. Specifically, given the true positive (TP), false positive (FP), false negative (FN), and true negative (TN) metrics for each category, the calculation methods for each metric are as follows:

[0190]

[0191] To systematically verify the overall performance of AM-Mamba and its competitiveness across different architectures, three representative baseline methods were selected as controls to ensure comprehensive coverage in terms of model paradigms and capacity. CNN models: ConvNeXtV2, ResNet-50, and DenseNet-121 represent classic architectures based on local convolutional modeling; Transformer models: Twins-ViT-pcpvt, SwinTransformer-Tiny, and ViT-Base represent visual modeling frameworks based on global self-attention; State-space model SSM models: MedMamba, VMamba-Tiny, and Vim-Tiny represent efficient sequence modeling architectures that have emerged in recent years.

[0192] To ensure fairness in the experimental comparisons, all baseline models used the same data partitioning, data augmentation strategies, and a identical 300-round training plan. The official implementations and recommended hyperparameter settings for each model were strictly followed, with only the classifier head adjusted to adapt to the four-class classification task. All experiments were trained and inferred on the same NVIDIA RTX 4090D hardware environment to eliminate the impact of hardware differences. These settings ensure a fair comparison between AM-Mamba and various mainstream models, objectively demonstrating its performance advantages across the CNN, Transformer, and SSM architectures.

[0193] This invention achieved an accuracy of 95.40%, a balanced accuracy of 95.00%, and a macro-average F1 score of 94.80% on the test set, consistently outperforming all existing comparative methods across all metrics. Compared to traditional convolutional neural networks such as ConvNeXtV2 (93.60%), AM-Mamba improved accuracy by 1.80%; compared to Transformer-based ViT (88.26%), it improved accuracy by 7.14%. Notably, even compared to state-space models such as MedMamba (93.60%) and Twins-ViT-pcpvt (93.31%), the method maintains a significant advantage in accuracy, improving by 1.80% and 2.09%, respectively. In terms of balanced accuracy and macro-average F1 score, AM-Mamba achieved 95.00% and 94.80%, respectively, representing improvements of 0.90% and 0.75% compared to ConvNeXtV2 (94.10% and 94.05%), significantly outperforming all baseline methods and fully demonstrating the model's robustness in handling imbalanced datasets. Furthermore, while maintaining high performance, AM-Mamba has a FLOPs of only 6.8G, outperforming ConvNeXtV2 (15.4G) and MedMamba (7.2G) in computational efficiency. For a detailed comparison, refer to Table 4 below for pneumonia classification performance; in the table, ↑ indicates a higher value and ↓ indicates a lower value and better performance.

[0194] Table 4

[0195]

[0196] By summarizing the fine-grained performance of AM-Mamba on four-class tasks, the robustness of the model under class imbalance conditions was further verified. Table 5 shows that the normal class, with the largest sample size, achieved the highest F1 score of 95.7% and sensitivity of 96.0%, indicating that the model can reliably distinguish between healthy and pathological chest X-rays. The COVID-19 and lung opacity classes also performed exceptionally well, with F1 scores of 94.6% and 95.3% respectively, and sensitivities exceeding 95.0%, demonstrating the model's high sensitivity and consistency in identifying complex pathological patterns. Although viral pneumonia is the scarcest class, AM-Mamba still achieved an F1 score of 93.7% and a sensitivity of 93.5%, showing stable discrimination ability even with small sample sizes. Overall, the model's macro-average F1 score reached 94.8%, and the balanced accuracy reached 95.0%, proving that AM-Mamba achieves balanced performance across all four classes without bias towards the majority class. Detailed comparison results are shown in Table 5.

[0197] Table 5

[0198]

[0199] To validate the contribution of each innovation in AM-Mamba, ablation experiments were conducted by progressively adding components. Starting from the VMamba baseline of 93.20% accuracy using standard 4-axis fixed scanning, adding the pathology-specific A / D parameter module improved accuracy by +0.80% to 94.00%, demonstrating the effectiveness of disease-specific state-space parameters. Introducing an adaptive eight-mode scanning mechanism further improved performance to 94.70% (+0.70%), confirming that the content-aware scanning strategy is superior to the fixed mode. Finally, adding the enhanced Transformer branch contributed +0.70% to reach 95.40%, showcasing the complementarity of the dual-branch architecture and its long-range dependency modeling capabilities. The cumulative gain of +2.20% from 93.20% to 95.40% represents a substantial improvement, with each component providing a meaningful contribution, and all improvements being significant at the p<0.01 level. It is worth noting that the contributions of the three innovative points—pathology-specific parameters, adaptive scanning, and the Transformer branch—are basically balanced, at +0.80%, +0.70%, and +0.70%, respectively. This indicates that the AM-Mamba design is balanced and systematic. For a detailed comparison, refer to Table 6 below for the ablation experiment comparison table.

[0200] Table 6

[0201]

[0202] The scanning mode analysis of this invention focuses on the impact of different scanning strategies on model performance. Firstly, using only a single fixed scanning mode, spiral scanning achieved the highest accuracy of 93.85%, followed by diagonal scanning at 93.72% and zigzag scanning at 93.58%. These results indicate that, compared to traditional raster-based scanning paths, radial and oblique trajectories can more effectively capture texture changes and lesion morphology in chest images, thereby improving the model's discriminative ability. Horizontal and vertical scanning performed relatively poorly, at 93.35% and 93.28% respectively, mainly because a single direction is insufficient to fully model complex, multi-scale pathological distribution patterns.

[0203] In multi-directional scanning, a fixed four-directional scan, the standard VMamba scheme, achieves 94.00% accuracy; further extending to an eight-directional scan improves performance to 94.10%. Building upon this, the proposed adaptive eight-mode scan, which innovates only the scanning mechanism without including subsequent Transformer branches, achieves 94.70% accuracy, a performance gain of +0.60% compared to the fixed eight-directional strategy. Ultimately, the complete AM-Mamba model achieves 95.40% accuracy. The AM-Mamba model, which adds an enhanced Transformer branch to the adaptive scan, further improves accuracy by +0.70% compared to the version with only adaptive scan, fully validating the synergistic effect between the adaptive scan module and the cross-spatial-sequence feature fusion mechanism. The relevant performance results are shown in Table 7, which analyzes the scanning model performance.

[0204] Table 7

[0205]

[0206] Although the adaptive scanning mechanism can theoretically assign differentiated weights to different scanning directions, its learning process, convergence characteristics, and correlation with input features in actual training still need to be further verified.

[0207] Combination Figure 5 As shown, the processing of the adaptive scanning method was analyzed from three dimensions:

[0208] First: the temporal evolution of the weight distribution;

[0209] Second: the activation pattern of the input features;

[0210] Third: Weighted trajectory of a single scan pattern.

[0211] These three dimensions complement each other, revealing how the network learns to assign weights to different scanning directions, and how this learning process is driven by input features.

[0212] Combination Figure 5 The first image is the first heatmap, which shows the panoramic view of the spatial-temporal evolution of the weights, demonstrating the convergence process of the eight scanning patterns from disorder to order over 300 training epochs. Combined with... Figure 5 The second image, a second heatmap, provides the feature foundation driving this evolution. By showing the activation patterns of 256-dimensional features across 32 samples, it reveals significant differences in feature representations among different samples. Figure 5The third figure is a graph, clearly outlining the learning trajectory of each mode. Eight independent curves illustrate the dynamic changes in the weights of each scanning mode during training. Combined, these three figures demonstrate that the adaptive scanning mechanism successfully assigns differentiated weights to different scanning directions by learning diverse representations of input features, achieving a task-adaptive scanning strategy. The convergence and stability of the weight distribution fully validate the effectiveness of the adaptive mechanism, proving that the network can learn meaningful weight distributions, and that this learning process is driven by genuine feature differences, rather than random fluctuations.

[0213] The overall experimental visualization process in this invention employs LayerCAM technology to visualize the model's discrimination process, thereby improving the interpretability of the diagnostic system. LayerCAM generates activation maps by calculating the element-wise product of feature maps and corresponding layer gradients, accurately highlighting the local regions that contribute most to the final prediction. Compared to traditional Grad-CAM and Grad-CAM++ methods, LayerCAM performs better in preserving fine-grained spatial structure, especially suitable for locating small, discrete, and low-contrast lesions in medical images. Its advantages have been widely verified by numerous studies. LayerCAM can not only be applied to the last layer of the network but also flexibly applied to any convolutional layer, thus achieving full-layer visualization analysis of shallow texture features and deep semantic features, providing more comprehensive and reliable interpretive support for model decisions.

[0214] Combination Figure 6 As shown, the AM-Mamba model demonstrates its ability to accurately capture the characteristics of different types of lung diseases, exhibiting distinct attention distribution patterns under various pathological conditions: (a) Viral pneumonia: The LayerCAM heatmap mainly focuses on the right upper lobe region, presenting a localized area of ​​high activation. This distribution pattern is consistent with the clinical characteristics of viral pneumonia, which typically presents as unilateral lobe involvement in the early stages of the disease, and the model successfully captured this typical anatomical feature. (b) COVID-19 cases: The heatmap shows that the model focuses on the middle and lower regions of both lungs, presenting multiple scattered activation hotspots. This pattern accurately reflects the typical imaging features of COVID-19 pneumonia, with peripheral, multifocal ground-glass opacities, indicating that the model has learned the characteristic distribution patterns of the disease. (c) Increased lung opacity: The heatmap shows a significant activation area in the middle and lower regions of the left lung, highly consistent with the pathological manifestation of patchy density increase. The model can accurately locate the main area of ​​the lesion, demonstrating its sensitivity to local pathological changes. (d) Normal lungs: The activation area is evenly distributed, with the entire lung field showing a balanced activation intensity and no significant abnormal hotspots. This indicates that the model can correctly identify normal anatomical structures and avoids over-interpreting normal variations.

[0215] To gain a deeper understanding of the specific contributions of each key component in the AM-Mamba model to diagnostic performance, a systematic ablation study was conducted. By progressively adding core modules, the independent contribution of each component could be quantified, and LayerCAM heatmap visualization was used to demonstrate how these components synergistically improve the model's feature recognition capabilities. Five progressive model variants were designed: the VMamba base model, a version with added pathology-specific S6 parameters, a version integrating adaptive multiscale scanning, a version integrating an enhanced Transformer, and the complete AM-Mamba architecture.

[0216] The basic VMamba model exhibits attentional dispersion when analyzing lung images. In images of viral pneumonia, while the heatmap covers both lung regions, the activation intensity distribution is uneven, failing to precisely focus on the infected area. In COVID-19 cases, the attentional dispersion is extremely pronounced, even erroneously diverting outside the lung regions. In both opaque and normal lung images, the heatmap similarly lacks the necessary precision and focus, reflecting the inherent limitations of a single VMamba architecture in capturing complex pulmonary pathological features.

[0217] Adding the pathology-specific S6 module significantly improved the model's attention focusing ability. In viral pneumonia images, activation regions were more concentrated in the central part of both lungs. In COVID-19 cases, the main activation regions were focused in the lower lung fields. In opaque lung images, the activation distribution showed clearer bilateral symmetry. In normal lung images, the heatmap showed a more balanced distribution. This indicates that the pathology-specific S6 parameter enables the model to dynamically adjust the feature extraction strategy according to the disease type. Integrating adaptive multi-scale scanning processing, the model exhibited significant performance improvements. In viral pneumonia images, the heatmap distribution was more uniform and accurate. In COVID-19 cases, the model was able to more accurately identify lesions and multifocal lesions in the lower lung fields. In opaque lung images, the attention region highly corresponded to the actual lesion distribution. In normal lung images, the heatmap showed a clearer centrally concentrated distribution. This demonstrates that the multi-scale adaptive scanning module, through eight different scanning directions and dynamic weight allocation, can capture pathological features from multiple angles.

[0218] Combination Figure 7As shown, after integrating the enhanced Transformer branch, the model achieves the optimal attention distribution pattern. In images of viral pneumonia, the heatmap accurately locates the infected area with clear boundaries. In COVID-19 cases, the model accurately identifies the lesion areas and the distribution of ground-glass opacities in the lower lung fields. In opaque lung images, attention is evenly distributed across both lungs. In images of normal lungs, the heatmap exhibits a moderate and balanced distribution. This demonstrates that the enhanced Transformer branch complements VMamba's capabilities in global context modeling.

[0219] The final AM-Mamba model integrates all the innovative components. The CNN branch extracts fine local texture features; the VMamba branch captures global structural information; pathology-specific S6 parameters dynamically adjust the feature extraction strategy; adaptive multi-scale scanning captures pathological features from multiple angles; an enhanced Transformer supplements the global context; and interactive fusion enables dynamic collaboration between the two branches.

[0220] Ablation studies clearly demonstrate the necessity and effectiveness of each component in the AM-Mamba model. This multi-dimensional integrated design not only improves classification accuracy but also generates highly specific and accurate attention maps for various lung diseases. This visualization method provides clinicians with an effective way to intuitively understand the AI ​​diagnostic decision-making process, offering an accurate and standardized intelligent assistance method for modern clinical decision-making. To further verify the model's generalization ability, an existing public dataset was used for external testing. This dataset originally contained five types of chest X-ray images. Considering that this study uses a four-class classification scheme, specifically COVID-19 pneumonia, viral pneumonia, lung opacity, and normal, the category with the smallest sample size and that did not match the study classification was removed. After this adjustment, the final test set included 23,424 patient samples, with 5,856 images in each of the four categories: COVID-19 pneumonia, viral pneumonia, lung opacity, and normal. All images in this dataset were not used in the model training and development process, thus ensuring its effectiveness as a completely independent test set for evaluating the model's generalization performance. The generalization experiment results are shown in Table 8.

[0221] Table 8

[0222]

[0223] Generalization experiments fully validate the cross-dataset applicability and robustness of the proposed method. To evaluate the model's performance on unseen data, it was tested on an independent COVID dataset. Experimental results show that the AM-Mamba model exhibits excellent generalization ability on this external dataset, achieving an accuracy of 95.30%, a balanced accuracy of 94.80%, and a macro-average F1 score of 94.90%. These metrics indicate that the model not only maintains high classification accuracy but also achieves good balance across different classes. Notably, this test dataset is completely independent of the model training and development process; therefore, the experimental results strongly demonstrate the excellent generalization ability and robustness of the proposed method, laying a solid foundation for its widespread application in medical image classification tasks.

[0224] The advantages of AM-Mamba in this invention stem from the synergistic effect of its four core innovations. First, the adaptive scanning module can dynamically select among eight scanning strategies based on input features, allowing the model to prioritize pathology-related regions without relying on a fixed heuristic scanning order. Second, pathology-specific S6 state-space parameters provide customized sequence modeling capabilities for different disease categories: normal samples focus on maintaining healthy tissue patterns, while COVID-19 samples pay more attention to fine-grained ground-glass opacity features, thus introducing state dynamics of disease perception into a unified model architecture. Third, the enhanced multi-scale Transformer branch, through a local window attention mechanism and a hierarchical feature pyramid structure, simultaneously captures fine-grained texture information and global anatomical structures, effectively complementing the Mamba-based sequence modeling branch. Finally, the enhanced medical detection head plays a crucial coordinating role in the overall framework; its generated robust pathology category predictions are further used to guide the selection of pathology-specific S6 parameters, thus forming a closed-loop adaptive mechanism that enhances cross-class discrimination capabilities and overall model stability.

[0225] Despite the aforementioned structural innovations, the computational overhead of AM-Mamba remains reasonable. The AM-Mamba-T model contains 25.8 million parameters, only about 2% more than the baseline Mamba, but the number of parameters is reduced by about 70% compared to ViT-Base, while the classification accuracy is improved by 3.6%. In terms of computational complexity, FLOPs increased from 4.2G to 4.9G, an improvement of 17%, but it is still about 1 / 3.6 of ViT-Base, demonstrating a good computational efficiency advantage.

[0226] This invention presents a novel state-space model architecture specifically designed for multi-class classification of pneumonia on chest X-ray images. Through an adaptive multi-mode scanning module, pathology-specific S6 state-space parameters, an enhanced multi-scale medical Transformer branch, and the AM-Mamba pathology-aware medical detector for collaborative parameter selection, it achieves high classification performance while maintaining linear computational complexity. Experimental results show that AM-Mamba achieves 95.40% accuracy on the pneumonia classification task, representing improvements of 2.7% to 4.8% compared to CNN, Transformer, and the baseline SSM method.

[0227] This invention achieves content-aware sequence modeling by combining adaptive scanning processing with a state-space model, driving the transformation of SSM from a fixed heuristic scanning strategy to a dynamic, input-dependent modeling paradigm. The pathology-specific S6 module validates that using dedicated parameter configurations for different disease categories is more advantageous than sharing parameters, significantly enhancing cross-category discrimination capabilities. Finally, ablation experiments conducted using this invention show that each innovative module can independently improve model performance, further highlighting the synergistic effect between the adaptive mechanism and multi-scale feature fusion.

Claims

1. A method for establishing an adaptive multi-scale state-space model, characterized in that: The acquired and processed chest X-ray images are divided into two datasets. One dataset is processed through detection and adaptive multi-directional scanning to form a spatial model in the SSM state. The other dataset is processed through multi-scale feature extraction to form an edge enhancement module and feature fusion data. The edge enhancement module, feature fusion data and the spatial model in the SSM state are interactively fused to form an interactive fusion model. The classification output process is completed using the interactive fusion model.

2. The method for establishing an adaptive multi-scale state-space model according to claim 1, characterized in that: The acquired chest X-ray images were preprocessed as follows: First, the short side of the chest X-ray image was scaled to 256 pixels. Then, while maintaining the predetermined aspect ratio, a 224×224 center cropping process was performed to ensure that the cropped image completely retains the bilateral lung parenchyma regions with feature data that can be recognized by the spatial model.

3. The method for establishing an adaptive multi-scale state-space model according to claim 1, characterized in that: The process of dividing the acquired chest X-ray image into two data branches with the same characteristics, and then using detection and adaptive multi-directional scanning processing to form a spatial model under the SSM state in one of the two data branches is as follows: One of the two processed datasets is processed through global average pooling, multi-layer feature extraction, a flexible maximum transfer function (softmax) with temperature scaling, and four types of pathological outputs to form a corresponding data probability distribution. Based on the data probability distribution, two pathological specific parameters A and D are generated to ensure that the image data processed by SelectiveScan forms an adaptively adjusted state transition matrix according to the detected pathological type, thus completing the image specific modeling process and forming the initial model. The initial model was processed using a fixed mixing strategy with α=0.

5. The basic parameters and pathological-specific parameters in the initial model were weighted and fused to ensure that the stability index required by the initial model was maintained while allowing the parameters to be dynamically adjusted according to the pathological characteristics to form an integrated SS2D model. The integrated SS2D model undergoes adaptive multi-directional scanning processing, which involves scanning the integrated SS2D model in multiple directions, including horizontal, vertical, spiral, zigzag, and reverse directions. Under the control of predetermined adaptive parameters, the model completes the adjustment state transition process in different scanning directions to form the final model, which is a spatial model in the SSM state.

4. The method for establishing an adaptive multi-scale state-space model according to claim 1, 2, or 3, characterized in that: The process of forming an edge enhancement module and feature fusion data from the other data set through multi-scale feature extraction is as follows: The multi-scale medical feature extraction process involves constructing an enhanced medical Transformer branch, which in turn involves building a hierarchical feature pyramid. This pyramid consists of LocalWindowAttention modules with different window sizes (7×7, 14×14, and 28×28). After sharpening edges and high-frequency texture details in the feature map using a depthwise separable convolution method simulating a Laplacian operator, global summary and local response data are extracted using AdaptiveAvgPool2d and AdaptiveMaxPool2d. Dynamic channel attention weights are then generated based on these data, completing the adaptive processing of preceding enhanced features and forming an edge enhancement module. This edge enhancement module is an EnhancedMedicalTransformer module that integrates multi-scale perception, detail enhancement, and context fusion. The feature fusion process is completed by combining the window attention mechanism with the edge enhancement module, resulting in multi-scale medical feature data.

5. The method for establishing an adaptive multi-scale state-space model according to claim 4, characterized in that: The process of constructing a hierarchical feature pyramid is as follows: A hierarchical feature pyramid is a feature pyramid with three resolution levels, namely 7×7, 14×14, and 28×28. During the construction of the hierarchical feature pyramid, for each input feature map... Bilinear interpolation is used to adjust each input feature map to each scale. Thus obtain At each scale, the feature map is divided into segments of size [size missing]. The non-overlapping window is calculated using a learning weight α_s based on global feature statistics to adaptively fuse multi-scale features. Specifically: The input feature map is obtained through bilinear interpolation. The calculation formula for adjusting to the corresponding scale is as follows: , In the above formula, , and These methods are used to capture images of small nodules (<10mm in diameter), medium-sized lesions (10-30mm in diameter), and large infiltrative lesions (>30mm in diameter), respectively, to obtain feature representations of the same content at different resolutions. At each scale, the feature map is divided into sections of size [missing information]. The formula for calculating non-overlapping windows is: ; Within each window, the process of calculating multi-head self-attention is as follows: First, perform a linear projection on the tokens within the window to generate... , and : ; Then, the scaled dot product attention is calculated using the following formula: ; In the above formula, The attention output features within the current window at the s-th scale; The query matrix is ​​obtained by query mapping of the window features at the s-th scale. The key matrix is ​​obtained by key mapping of the window features at the s-th scale. The value matrix is ​​obtained by value mapping of the window features at the s-th scale. Key matrix Transpose of; Let be the dimension of the key vector. This is the scaling factor; represents the relative position bias term at the s-th scale; Softmax(·) denotes the normalization function; At each scale, MLP is applied for feature refinement calculation, and the calculation formula is as follows: ; Then, adaptive fusion processing is performed, and the calculation formula is: ; The formula for calculating the feature sampling down to the original resolution at each scale is: ; Through the above calculations, the Softmax normalization process of the weights is completed, ensuring that the sum of the three weights is 1 and that each weight is between 0 and 1. This process equalizes the weights into a probability distribution. Finally, the fused features are calculated by weighted summation to obtain multi-scale medical feature data.

6. The method for establishing an adaptive multi-scale state-space model according to claim 5, characterized in that: The process of constructing a hierarchical feature pyramid is as follows: During the construction of the hierarchical feature pyramid, the relationship between features is calculated using window attention. The feature map is divided into multiple non-overlapping windows, and then self-attention is calculated independently within each window. Given a feature map of scale *s*, each feature map is divided into four 2×2 window grids, ensuring that each window contains the corresponding contextual information. Specifically: for Fine-grained features, each window size is It contains 196 feature vectors; for Medium-granularity features, each window size is It contains 49 feature vectors; for The coarse-grained features are obtained by dividing the feature map into 2×2 windows. Since 7 is not divisible by 2, the size of each window is 3×3, 3×4, 4×3 or 4×4, containing 9 to 16 feature vectors. After window partitioning is completed, the feature sequence within each window w Generate queries through three linear projections ,key Sum The calculation is performed on vectors using the following formula: , In the above formula, , and These are the projection matrices for the query, the key, and the value, respectively. and These are the dimensions of the key and the value, respectively, and num_heads is the number of attention heads, specifically 8 or 16. Calculate the ScaledDot-ProductAttention, where attention weights are computed via the dot product of the query and the key, then... Scaling is applied to the scaling factor to ensure the gradient remains stable. Finally, softmax normalization is used to ensure the dot product values ​​remain consistent, preventing the softmax function from entering saturation. The formula for calculating the correlation between features at different locations within the model's learning window, thereby capturing local structured patterns and dependencies, is as follows: ; In the above formula, Output the attention result for the w-th window; , and These are the query matrix, key matrix, and value matrix within the w-th window, respectively. Key matrix Transpose of; Let be the dimension of the key vector. This is the scaling factor; Softmax(·) is the normalization function.

7. The method for establishing an adaptive multi-scale state-space model according to claim 1, 2, or 3, characterized in that: The process of forming a spatial model in the SSM state through detection and adaptive multi-directional scanning processing in one of the two datasets is the process of the Mamba branch combining the pathology-specific S6 module and the adaptive scanning mechanism to capture local sequence patterns and orientation-dependent lesion features. The process of forming an edge enhancement module and feature fusion data through multi-scale feature extraction processing in the other dataset is the process of another Transformer branch extracting global context information and cross-resolution lesion patterns through multi-scale feature pyramids and medical feature enhancement modules.

8. The method for establishing an adaptive multi-scale state-space model according to claim 7, characterized in that: The construction process of the pathology-specific S6 module is as follows: Pathology-specific state-space parameters are introduced, and specific state-space parameters are learned for each disease type. Two pathology-specific parameters, A and D, are selected as pathology-specific parameters. Pathology-specific parameter A is used for state transitions, and pathology-specific parameter D is used for connections. The two pathology-specific parameters A and D are the state-space parameters learned for each disease type. , In the above formula, For the first Pathological state transition matrix The parameters are used for skip connection, and the pathology detector identifies disease types and outputs probability distributions. Then, adaptive parameters are generated through probability weighting; A deep medical detector, formed by combining two-layer feature extraction, residual connection, and temperature-scaled Softmax, identifies the type from feature map x and outputs the probability distribution of four types of pathological data. ; Then based on the pathological probability For four sets of parameter pools The weighted combination is calculated using the following formula: , In the above formula, A_adaptive is the pathological adaptive state transition matrix obtained by weighting the state transition matrices corresponding to the four pathological types according to the pathological probability distribution; D_adaptive is the pathological adaptive jump connection parameter obtained by weighting the jump connection parameters corresponding to the four pathological types according to the pathological probability distribution; p=[p0,p1,p2,p3] is the probability distribution of the four pathological data output by the deep medical detector, where pi represents the probability that the input feature map belongs to the i-th pathological type, and satisfies Ai represents the state transition matrix corresponding to the i-th pathology category; Di is the jump connection parameter corresponding to the i-th pathology category; i is the pathology category index, with a value of 0 to 3; Among them, pathological adaptive Zero-order ZOH discretization is performed to obtain and ; A continuous state transition matrix Discrete state transition matrix after discretization; It is a discrete input matrix; Use adaptive parameters in state updates and output generation. Includes pathology-specific state transition dynamics. This refers to the pathologically specific skip connection strength.

9. An adaptive multi-scale state sensing scanning analysis method, implemented using the adaptive multi-scale state space model in the adaptive multi-scale state space model establishment method according to any one of claims 1 to 8, characterized in that: The perceptual scanning analysis method involves interactively fusing edge enhancement modules, feature fusion data, and the spatial model under SSM state to form an interactive fusion model, which is the adaptive multi-scale state space model. The classification output processing is completed using the interactive fusion model. After the interactive module uses global average pooling and enhanced medical detection head processing to classify and output four types of pneumonia—normal, COVID-19, viral pneumonia, and pulmonary opacity—the perceptual scanning analysis processing of the classification output data is completed by combining the adaptive multi-scale state space model with the adaptive multi-directional scanning method. The perceptual scanning analysis processing of the classification output data includes eight modes, including four basic modes and four reverse modes. The four basic modes include horizontal scanning, vertical scanning, diagonal scanning, and zigzag scanning; horizontal scanning is performed line by line from left to right, which is suitable for capturing anatomical structures in a horizontal orientation. Vertical scanning proceeds column by column from top to bottom, making it suitable for capturing structures with a vertical orientation. Diagonal scanning, which follows the main diagonal direction, is suitable for detecting tilted blood vessels, ribs, etc. Z-shaped scanning proceeds from left to right for odd-numbered rows and from right to left for even-numbered rows, preserving spatial adjacency. The four reverse scanning modes are horizontal scanning, vertical scanning, diagonal scanning, and zigzag scanning, corresponding to the reverse scanning processing. Each of the four reverse scanning modes involves processing the feature map... Expand into a sequence ;in, The adaptive weight generation process includes three steps: First, global semantic features of the input are extracted using global average pooling. The calculation process is as follows: ; The above formula is used to calculate the process of compressing the spatial dimension into a single vector while preserving global information at the channel level. Secondly, the global features are mapped to scores for K=8 scanning patterns through a linear transformation of the learned parameters. The calculation process is as follows: ; In the above formula, and For learning parameters; scoring This represents the initial evaluation score of the k-th scanning mode for the current input; Finally, normalized weights are calculated by applying the Softmax function to the score vector to obtain normalized adaptive weights. The calculation process is as follows: ; In the above formula, Normalization factor, weight satisfy ,and This indicates the relative importance of each scanning mode; For each scanning mode Perform the following operations: First, perform sequence expansion: using the k-th scanning strategy. Unfold the two-dimensional feature map into a one-dimensional sequence. ,in ; Next, we begin state-space modeling: for the sequence Apply selective scanning mechanism The output sequence is obtained. The state space parameters A, B, C, and D are shared across all scan modes. The third step is feature reconstruction: using a reverse scan operation. The output sequence is restored to a two-dimensional feature map. ; The final output is a weighted sum of the outputs of the K modes using adaptive weights, calculated as follows: ; In the above formula, This represents element-wise multiplication, with weights. Expanded via broadcast To match This dimension completes the end-to-end mode selection process; When the model detects that the input image has horizontal structural features, it automatically increases the weight of the horizontal scan. ; For complex and irregular structures, the model balances the weights of multiple scanning modes, and the complete output formula is as follows: , In the above formula, y is the final output feature obtained after weighted fusion of multiple scanning modes; K is the total number of scanning modes; k is the scanning mode index, where k = 1, 2, ..., K; is the adaptive weight corresponding to the k-th scanning mode; ReverseScan_k(·) is the reverse scan reconstruction operation corresponding to the k-th scanning mode; SelectiveScan(·) is the selective scan state space modeling operation; ScanPattern_k(x) is the sequence representation obtained after sequence expansion of the input feature x using the k-th scanning strategy; x is the input feature map; A, B, C and D are all parameters of the state space model, where A is the state transition matrix parameter, B is the input control matrix parameter, C is the output mapping matrix parameter, and D is the jump connection parameter.