A stomach organ recognition method and system based on a double attention mechanism
The gastric organ recognition method using a dual attention mechanism, combining channel and spatial attention mechanisms, solves the problem of low accuracy in gastric organ recognition in existing technologies, achieving higher accuracy and boundary localization precision.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING INFORMATION SCI & TECH UNIV
- Filing Date
- 2026-04-21
- Publication Date
- 2026-07-21
Smart Images

Figure CN122435408A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of medical image analysis and artificial intelligence processing technology, and in particular to a method and system for identifying gastric organs based on a dual attention mechanism. Background Technology
[0002] In the field of medical image analysis, gastric organ identification can provide clinicians with clearer anatomical information, which is an important prerequisite for subsequent lesion localization, structural analysis, surgical planning and quantitative assessment, and is of great significance in the construction of medical informatization and intelligentization.
[0003] However, gastric organs in medical imaging often exhibit significant individual variability, with marked differences in morphology, size, location, and tissue density distribution among patients. Furthermore, factors such as varying imaging conditions of different machines, noise interference in the images, and insufficient contrast between organs and surrounding tissues often result in blurred, discontinuous, or overlapping boundaries of gastric organs, posing considerable challenges to automatic identification. This is particularly true in the complex anatomical regions of the abdomen, where the spatial relationships between different organs are close, making the gastric organ contours susceptible to interference from background tissues and adjacent structures, leading to identification results such as offsets, incomplete boundaries, over-segmentation, or under-segmentation.
[0004] In existing methods for identifying gastric organs, convolutional neural networks (CNNs) can automatically learn multi-level feature representations from data, offering advantages in extracting local texture and edge information. For example, the U-net method and its improved models, with an encoder-decoder core structure, extract high-level semantic features through layer-by-layer downsampling and then restore spatial resolution through layer-by-layer upsampling, achieving good results in organ identification tasks. However, these methods primarily rely on local convolutional operations, exhibiting weak modeling capabilities for long-distance dependencies and global structural information. Furthermore, feature fusion typically employs simple concatenation or summation, lacking adaptive selection of key features, and easily introducing redundant background information into subsequent decoding stages, thus affecting recognition accuracy.
[0005] Transformer-based methods capture the correlations between different locations in an image through self-attention mechanisms, enabling them to model the overall structure of the stomach organs and long-range contextual information effectively, thus compensating to some extent for the limited local perception of convolutional networks. However, Transformer structures typically require large-scale training datasets and are computationally expensive; furthermore, their ability to model local details and boundary textures is relatively insufficient, and they still suffer from recognition instability in scenes with blurred stomach organ boundaries or complex structures.
[0006] To balance local detail extraction with global context modeling capabilities, hybrid architectures combining CNNs and Transformers have emerged, integrating the advantages of both. While this improves recognition performance to some extent, there is still room for improvement in the accuracy of stomach organ boundary localization. This is mainly because: firstly, conventional convolutional operations lack explicit modeling of the importance of different channels during feature propagation, easily leading to key structural information being interfered with by background regions, reducing the model's sensitivity to boundary regions; secondly, the lack of effective modeling of the importance of different spatial locations results in the model paying similar attention to stomach organ regions, boundary regions, and background regions when fusing features, affecting the accuracy of boundary localization. Therefore, there is an urgent need for a stomach organ recognition method that can adaptively select features from different channels during the encoding stage and focus on key spatial locations during the feature fusion stage, thereby improving the accuracy of organ recognition and boundary localization. Summary of the Invention
[0007] The purpose of this invention is to provide a method and system for identifying gastric organs based on a dual attention mechanism, so as to improve the accuracy of organ identification and boundary positioning precision.
[0008] To achieve the above objectives, the present invention provides a method for identifying gastric organs based on a dual attention mechanism, the method comprising: Acquire abdominal CT images to be identified; The abdominal CT image to be identified is preprocessed to obtain a preprocessed image; The preprocessed image is encoded step by step using a channel attention mechanism to obtain coding feature maps at each level; the coding feature maps at each level include first-level coding feature maps, second-level coding feature maps, third-level coding feature maps and fourth-level coding feature maps; After spatial attention mechanism is used to perform spatial position weighting on the encoded feature maps at each level, they are concatenated with the corresponding decoded feature maps of each layer and then decoded to finally obtain the stomach organ recognition result.
[0009] Optionally, the step of employing a channel attention mechanism to perform step-by-step encoding processing on the preprocessed image to obtain encoded feature maps at each level specifically includes: The preprocessed image is subjected to first-level coding feature extraction using a channel attention mechanism to obtain a first-level coding feature map. A channel attention mechanism is used to extract secondary coding features from the primary coding feature map to obtain a secondary coding feature map. A channel attention mechanism is used to extract tertiary coding features from the secondary coding feature map to obtain a tertiary coding feature map; The channel attention mechanism is used to extract fourth-level coding features from the third-level coding feature map to obtain a fourth-level coding feature map.
[0010] Optionally, the step of using a channel attention mechanism to extract first-level coding features from the preprocessed image to obtain a first-level coding feature map specifically includes: The preprocessed image is downsampled to extract low-level texture features and high-level semantic features, resulting in a downsampled feature map. The downsampled feature map is adaptively filtered and recalibrated using a channel attention mechanism to obtain a first-level encoded feature map.
[0011] Optionally, the step of adaptively filtering and recalibrating the downsampled feature map using a channel attention mechanism to obtain a first-level encoded feature map specifically includes: The downsampled feature map is subjected to average pooling, convolution, ReLU activation and convolution operations in sequence to obtain the channel average feature vector; The downsampled feature map is subjected to max pooling, convolution, ReLU activation, and convolution in sequence to obtain the channel maximum feature vector; The channel feature vector is obtained by weighted summation of the channel average feature vector and the channel maximum feature vector. The channel feature vector is activated by the Sigmoid activation function and then multiplied channel by channel with the downsampled feature map to obtain the first-level encoded feature map.
[0012] Optionally, the step of using a spatial attention mechanism to perform spatial position weighting on the encoded feature maps at each level, followed by concatenation and decoding with the corresponding decoded feature maps at each layer, ultimately yields the gastric organ recognition result. Specifically, this includes: A spatial attention mechanism is used to perform spatial position weighting processing on the first-level coding feature map, the second-level coding feature map, and the third-level coding feature map respectively to obtain a first spatial attention feature map, a second spatial attention feature map, and a third spatial attention feature map; The four-level encoded feature map is input into the encoder group for feature encoding to obtain the feature encoded map; the encoder group consists of 12 Transformer encoders. The feature encoding map is subjected to convolution and upsampling operations to obtain a layer of decoded feature map, and the layer of decoded feature map is then connected to the third spatial attention feature map to obtain a first connection feature map. The first connection feature map is subjected to convolution and upsampling operations to obtain a second-layer decoding feature map. The second-layer decoding feature map is then connected to the second spatial attention feature map to obtain a second connection feature map. The second connection feature map is subjected to convolution and upsampling operations to obtain a three-layer decoding feature map. The three-layer decoding feature map is then connected to the first spatial attention feature map by skip connection to obtain a third connection feature map. The third connection feature map is processed by convolution and upsampling operations to output the gastric organ recognition result.
[0013] Optionally, a spatial attention mechanism is used to perform spatial position weighting processing on the first-level encoded feature map to obtain a first spatial attention feature map, specifically including: After performing average pooling and max pooling operations on the first-level encoded feature map, the two maps are concatenated to obtain a concatenated feature map. The spliced feature map is subjected to 3×3 convolution, 5×5 convolution and 7×7 convolution respectively and then added together to obtain the superimposed feature map; After the superimposed feature map is activated by the Sigmoid activation function, it is multiplied element-wise with the first-level encoded feature map to obtain the first spatial attention feature map.
[0014] Optionally, the preprocessing of the abdominal CT image to be identified to obtain a preprocessed image specifically includes: The abdominal CT images to be identified are subjected to size unification, normalization, and grayscale standardization to obtain preprocessed images.
[0015] The present invention also provides a gastric organ recognition system based on a dual attention mechanism, the system comprising: The image acquisition module is used to acquire abdominal CT images to be identified; The preprocessing module is used to preprocess the abdominal CT image to be identified to obtain a preprocessed image; The channel attention encoder is used to perform step-by-step encoding processing on the preprocessed image using a channel attention mechanism to obtain encoding feature maps at each level; the encoding feature maps at each level include a first-level encoding feature map, a second-level encoding feature map, a third-level encoding feature map, and a fourth-level encoding feature map; The spatial attention decoder is used to perform spatial position weighting on the encoded feature maps at each level using a spatial attention mechanism, and then concatenates and decodes them with the corresponding spatial attention feature maps of each layer to obtain the stomach organ recognition result.
[0016] Optionally, the spatial attention decoder specifically includes: The spatial attention processing module is used to perform spatial position weighting processing on the first-level coding feature map, the second-level coding feature map and the third-level coding feature map respectively using a spatial attention mechanism to obtain a first spatial attention feature map, a second spatial attention feature map and a third spatial attention feature map; The feature encoding module is used to input the four-level encoded feature map into the encoder group for feature encoding to obtain the feature encoding map; the encoder group consists of 12 layers of Transformer encoders; The first skip connection module is used to obtain a layer of decoded feature map by performing convolution and upsampling operations on the feature encoding map, and to perform skip connection processing on the layer of decoded feature map and the third spatial attention feature map to obtain a first connection feature map. The second skip connection module is used to obtain a second-layer decoded feature map by performing convolution and upsampling operations on the first connection feature map, and to perform skip connection processing on the second-layer decoded feature map and the second spatial attention feature map to obtain a second connection feature map. The third skip connection module is used to obtain a three-layer decoded feature map by performing convolution and upsampling operations on the second connection feature map, and to perform skip connection processing on the three-layer decoded feature map and the first spatial attention feature map to obtain a third connection feature map. The organ recognition output module is used to output the gastric organ recognition result after the third connection feature map is processed by convolution and upsampling operations.
[0017] Optionally, the spatial attention processing module includes a first spatial attention processing unit, a second spatial attention processing unit, and a third spatial attention processing unit, wherein the first spatial attention processing unit specifically includes: The feature map concatenation determination subunit is used to perform average pooling and max pooling operations on the first-level encoded feature map respectively and then concatenate them to obtain the concatenated feature map; The superimposed feature map determines the sub-unit, which is used to perform 3×3 convolution, 5×5 convolution and 7×7 convolution on the spliced feature map respectively and then add them to obtain the superimposed feature map; The first spatial attention feature map determination subunit is used to input the superimposed feature map into the Sigmoid activation function and then multiply it element-by-element with the first-level encoded feature map to obtain the first spatial attention feature map.
[0018] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects: This invention discloses a method and system for identifying gastric organs based on a dual attention mechanism. First, the abdominal CT image to be identified is preprocessed to obtain a preprocessed image. Then, a channel attention mechanism is used to encode the preprocessed image step-by-step, obtaining coded feature maps at each level. Finally, a spatial attention mechanism is used to perform spatial position weighting on each level of coded feature map, which is then concatenated with the corresponding spatial attention feature maps and decoded to obtain the gastric organ identification result. The scheme disclosed in this invention fully utilizes the feature filtering capability of the channel attention mechanism and the focusing capability of the spatial attention mechanism on key regions, effectively improving the accuracy of gastric organ identification and boundary localization precision without significantly increasing the computational burden. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic diagram of the gastric organ recognition based on a dual attention mechanism according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the channel attention mechanism processing in an embodiment of the present invention; Figure 3 This is a schematic diagram of the spatial attention mechanism processing according to an embodiment of the present invention; Figure 4 The image shown is an abdominal CT image to be identified in an embodiment of the present invention. Figure 5 This is a schematic diagram of the stomach organ recognition results in an embodiment of the present invention. Detailed Implementation
[0021] 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.
[0022] The purpose of this invention is to provide a method and system for identifying gastric organs based on a dual attention mechanism, so as to improve the accuracy of organ identification and boundary positioning precision.
[0023] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0024] like Figure 1-3 As shown, this invention discloses a method for recognizing stomach organs based on a dual attention mechanism, comprising: Step S1: Obtain the abdominal CT image to be identified.
[0025] Step S2: Preprocess the abdominal CT image to be identified to obtain a preprocessed image.
[0026] Step S3: The preprocessed image is encoded step by step using a channel attention mechanism to obtain coding feature maps at each level; the coding feature maps at each level include first-level coding feature maps, second-level coding feature maps, third-level coding feature maps and fourth-level coding feature maps.
[0027] Step S4: After spatially weighting the encoded feature maps at each level using a spatial attention mechanism, the images are concatenated with the corresponding decoded feature maps at each layer and then decoded to obtain the final stomach organ recognition result.
[0028] The following is a detailed discussion of each step: Step S1: Acquire the abdominal CT image to be identified; the abdominal CT image to be identified mentioned here is as follows: Figure 4 As shown, the dimensions are [C,H,W], where C is the channel, H is the height, and W is the width. Figures 1-3 The abdominal CT image to be identified is [3,H,W], or more specifically [3,224,224].
[0029] Step S2: Preprocess the abdominal CT image to be identified to obtain a preprocessed image; the preprocessing operations mentioned here include, but are not limited to, size unification, normalization and grayscale standardization, and image enhancement, etc., without any specific limitations.
[0030] Different channels in a feature map typically correspond to different types of features. For organ recognition tasks, these features may manifest as boundary gradient information, texture patterns, shape structures, and local intensity variations, etc., and the contribution of different channels to the recognition results varies significantly. To enhance the model's (i.e., encoder-decoder) adaptive characterization of the importance of features from different channels, this invention proposes introducing an improved channel attention mechanism after each downsampling operation in the encoding stage. This mechanism allows the model to adaptively adjust the contribution ratio of average pooling and max pooling statistics according to task characteristics, thereby more effectively highlighting key structural features. The core idea is to learn the correlation between different channels and the task objective by adaptively adjusting the channel weight distribution. If certain channels are learned to be more beneficial to the task objective during training, such as containing obvious structural changes or boundary response features, the channel attention mechanism will assign them higher weights; conversely, channels with lower correlation to the current target or containing more background redundancy information will have their weights reduced. Through this targeted reinforcement mechanism, the network can enhance its effective feature representation ability during feature propagation, retaining clearer structural information in complex regions, especially boundary regions, thereby improving boundary localization accuracy and structural integrity. The specific steps are as follows: Step S3: The preprocessed image is encoded step by step using a channel attention mechanism to obtain the encoded feature maps at each level, specifically including: Step S31: Use a channel attention mechanism to extract first-level coding features from the preprocessed image to obtain a first-level coding feature map, specifically including: Step S311: Perform downsampling on the preprocessed image to extract low-level texture features and high-level semantic features, and obtain a downsampled feature map.
[0031] like Figure 2 As shown, Figure 2 The input is a downsampled feature map, and the output channel attention feature map is actually a coding feature map at each level. Taking the acquisition of the first-level coding feature map as an example, the specific details are as follows: Step S312 employs a channel attention mechanism to adaptively filter and recalibrate the downsampled feature map to obtain a first-level encoded feature map, specifically including: 1) Perform average pooling, convolution, ReLU activation, and convolution operations sequentially on the downsampled feature map to obtain the channel average feature vector.
[0032] 2) Perform max pooling, convolution, ReLU activation, and convolution operations sequentially on the downsampled feature map to obtain the channel's maximum feature vector.
[0033] 3) Perform a weighted summation of the channel average eigenvector and the channel maximum eigenvector to obtain the channel eigenvector.
[0034] 4) After activating the channel feature vector by inputting it into the Sigmoid activation function, multiply it channel by channel with the downsampled feature map to obtain the first-level encoded feature map.
[0035] This invention performs intra-channel average pooling and intra-channel max pooling operations on the downsampled feature map to achieve spatial information compression. Average pooling extracts the average response intensity of each channel within the spatial range, reflecting the overall level of channel activation distribution; max pooling extracts the maximum activation value in the channel, emphasizing the most significant feature response and being more sensitive to high-intensity local activations. The two pooling methods describe channel information from both the overall trend and peak response perspectives, forming complementary feature representations. Let the downsampled feature map be denoted as , and the calculation process for the two branches is as follows:
[0036] in This represents the convolution operation. For activation function, and These represent average pooling and max pooling operations, respectively. Represents the channel average eigenvector. This represents the largest eigenvector of the channel.
[0037] After pooling, the feature map is compressed into channel description vectors in the spatial dimension, achieving information aggregation. If the outputs of the two pooling operation branches are directly added, it is assumed that the two statistical information have equal contributions. However, in organ recognition tasks, the target region has large morphological variations, and average pooling and max pooling contribute differently to image processing at different levels. For example, when the stomach organ is small, the peak information extracted by max pooling usually reflects the characteristics of the stomach organ and boundary region better, while the information from average pooling is diluted by the influence of a large background area. Therefore, this invention adaptively weights and fuses the two types of statistical features, enabling the network to automatically learn the importance ratio of different statistical quantities. The calculation process of the channel attention weights is as follows:
[0038] in, and Indicates learnable parameters, The value of is in the range [0,1]. This represents the activation function.
[0039] By employing the nonlinear mapping of the Sigmoid activation function, the weights can be adaptively adjusted within a continuous interval and optimized during backpropagation, while avoiding alteration of the original feature structure distribution. Finally, the resulting activated vector is multiplied channel-by-channel with the downsampled feature map to achieve adaptive recalibration of the original feature response, obtaining channel attention feature maps (i.e., each level of encoding feature maps). The calculation process is as follows:
[0040] in, This represents the downsampling feature map of each layer. This indicates a channel-by-channel multiplication operation.
[0041] For channels with higher weights, their feature responses are enhanced, resulting in more comprehensive representation in subsequent layers; for channels with lower weights, their responses are suppressed, reducing interference with the recognition results. Compared to simply increasing network depth or width to improve feature representation, the weighted summation channel attention mechanism can enhance the flexibility of statistical information utilization through a learnable weighting mechanism while maintaining a lightweight structure. Furthermore, since the attention weights directly participate in the feature scaling process, they can provide more stable gradient signals for important channels during backpropagation, helping to mitigate the effects of information decay and gradient vanishing in deep networks, thereby improving overall training stability.
[0042] Step S32: Use the channel attention mechanism to extract secondary coding features from the primary coding feature map to obtain the secondary coding feature map.
[0043] Step S33: Use the channel attention mechanism to extract tertiary coding features from the secondary coding feature map to obtain the tertiary coding feature map.
[0044] Step S34: Use the channel attention mechanism to extract fourth-level coding features from the third-level coding feature map to obtain the fourth-level coding feature map.
[0045] In this invention, the coding feature maps at each level include a first-level coding feature map, a second-level coding feature map, a third-level coding feature map, and a fourth-level coding feature map, with corresponding dimensions of [64, H / 2, W / 2], [256, H / 4, W / 4], [512, H / 8, W / 8], and [1024, H / 16, W / 16], respectively. The steps determined in steps S32-S34 are the same as the specific steps in step S31, the only difference being that the downsampling objects are the first-level coding feature map, the second-level coding feature map, and the third-level coding feature map, respectively, and the output objects of the channel attention mechanism are the second-level coding feature map, the third-level coding feature map, and the fourth-level coding feature map, respectively, which will not be discussed again here.
[0046] Step S4: After applying spatial attention to the encoded feature maps at each level, the spatial location is weighted, and then concatenated with the corresponding decoded feature maps of each layer and decoded to obtain the final stomach organ recognition result, specifically including: Step S41: Spatial attention mechanism is used to perform spatial position weighting on the first-level coding feature map, the second-level coding feature map, and the third-level coding feature map to obtain the first spatial attention feature map, the second spatial attention feature map, and the third spatial attention feature map. The size of the first spatial attention feature map is [64, H / 2, W / 2], the size of the second spatial attention feature map is [256, H / 4, W / 4], and the size of the third spatial attention feature map is [512, H / 8, W / 8].
[0047] Step S42: Input the four-level encoded feature map into the encoder group for feature encoding to obtain the feature encoded map; the encoder group consists of 12 Transformer encoder layers.
[0048] Step S43: After performing convolution and upsampling operations on the feature encoding map, a layer of decoded feature map is obtained. The layer of decoded feature map is then connected to the third spatial attention feature map via a skip connection to obtain the first connected feature map. The size of the layer of decoded feature map is [512, H / 8, W / 8], and the size of the first connected feature map is [1024, H / 8, W / 8].
[0049] Step S44: After performing convolution and upsampling operations on the first connected feature map, a second-layer decoded feature map is obtained. The second-layer decoded feature map is then connected to the second spatial attention feature map via skip connections to obtain a second connected feature map. The size of the second-layer decoded feature map is [256, H / 4, W / 4], and the size of the second connected feature map is [512, H / 4, W / 4].
[0050] Step S45: After performing convolution and upsampling operations on the second connected feature map, a three-layer decoded feature map is obtained. The three-layer decoded feature map is then connected to the first spatial attention feature map via a skip connection to obtain a third connected feature map. The dimensions of the three-layer decoded feature map are [128, H / 2, W / 2], and the dimensions of the third connected feature map are [192, H / 2, W / 2].
[0051] Step S46: After performing convolution and upsampling operations on the third connection feature map, output the gastric organ recognition result with a size of [1, H, W]. For example... Figure 5 As shown, the size of the stomach organ recognition result is [1,224,224], and the output result is in mask form.
[0052] After convolutional encoding, the decoding stage begins. The four-level encoded feature map is further input into an encoder group consisting of 12 Transformer layers to capture the overall connections between different parts of the stomach organ, thereby improving the ability to recognize complex structures and regions with blurred boundaries. This process helps to compensate for the shortcomings of convolutional networks in global information modeling, providing richer semantic representations for subsequent decoding and reconstruction. The spatial attention decoder gradually recovers the spatial resolution of the feature map by upsampling layer by layer to obtain the decoded feature map of each layer, and performs skip connections with the corresponding level of spatial attention feature map obtained through the spatial attention mechanism to fuse shallow high-resolution details with deep semantic information. To avoid introducing a large number of irrelevant spatial responses during feature fusion, this invention introduces a spatial attention mechanism in the skip connections to differentially model the importance of different positions in the feature map. Through the spatial attention mechanism, the network can pay more attention to organ contours, boundary transition regions, and locations with significant structural changes, thereby better preserving the spatial morphological information of the stomach organ during the decoding process.
[0053] like Figure 3 As shown, step S41 employs a spatial attention mechanism to perform spatial position weighting processing on the first-level encoded feature map to obtain a first spatial attention feature map, specifically including: After performing average pooling and max pooling operations on the first-level encoding feature map, the concatenated feature map is obtained. The concatenated feature map is then subjected to 3×3 convolution, 5×5 convolution, and 7×7 convolution and then added together to obtain a superimposed feature map. The superimposed feature map is then activated by the Sigmoid activation function and multiplied element-wise with the first-level encoding feature map to obtain the first spatial attention feature map.
[0054] In medical imaging, the pixel distribution within or around organs is relatively smooth and stable, while organ boundary regions correspond to locations where pixel or texture patterns change rapidly. Errors are also concentrated in these complex locations. If a consistent processing method is applied to all spatial locations during feature fusion, the network is easily affected by large areas of simple structures, weakening its response strength to critical locations such as boundary regions. In medical imaging, small-scale texture details and large-scale organ structures coexist. Therefore, while relying solely on single-scale convolution can expand the receptive field and help capture large-scale structural information, it is not conducive to preserving local details and edge variation information, making it difficult to balance local fine features with global structural relationships. This invention's spatial attention mechanism starts from the spatial dimension within the channel, assigning corresponding weights to spatial locations in the feature map to guide attention to regions that significantly influence the recognition results. Addressing the problems of blurred boundaries, complex local morphological changes, and variable locations of stomach organs, this invention introduces... Figure 3The spatial attention mechanism shown uses multi-scale convolution instead of single-scale convolution to enhance the spatial attention mechanism's ability to perceive spatial structures at different scales.
[0055] Specifically, this invention constructs a multi-scale convolution module composed of convolution kernels of different sizes, such as 3×3, 5×5, and 7×7, to extract local detail features and contextual information at three levels: small scale, medium scale, and large scale. By utilizing feature responses under different receptive fields, it can more comprehensively describe the spatial distribution features of gastric organs at different scales, thereby enhancing the ability to focus on organ boundary regions.
[0056] The spatial attention mechanism first performs average pooling and max pooling operations on the encoded feature maps at each level along the channel dimension, resulting in a single-channel two-dimensional feature map to describe the feature responses at different spatial locations. Average pooling reflects the overall response level of a spatial location across all channels; max pooling captures the most significant activation response at that location, helping to highlight regions with significant boundary or contrast changes. These two pooling methods describe spatial location information from different perspectives, providing complementary spatial cues for the subsequent generation of attention weights. Let the encoded feature maps at each level be denoted as , and the calculation process for average pooling and max pooling operations be as follows:
[0057] in, and These represent average pooling and max pooling operations, respectively.
[0058] Subsequently, the two pooling results are concatenated along the channel dimension to form a joint spatial feature representation. Then, the summation is performed using 3×3, 5×5, and 7×7 multi-scale convolution modules to comprehensively model the importance of different spatial locations.
[0059] The convolutional features are then processed by the Sigmoid activation function to generate feature maps where each element takes values between [0,1]. Finally, the obtained feature map is multiplied element-wise with the corresponding encoded feature map to achieve adaptive reweighting of the original features in the spatial dimension, resulting in the spatial attention feature map. The calculation process is as follows:
[0060] in, This indicates the splicing result. , and These represent 3×3, 5×5, and 7×7 convolution operations, respectively. This represents the activation function. This indicates element-wise multiplication.
[0061] For spatial locations with significant organ boundaries or morphological changes, the corresponding weights are higher, and the feature responses are enhanced; while for structurally simple regions or background regions, the feature responses are suppressed. This process essentially readjusts the feature distribution at the spatial level, causing the network to pay more attention to regions that are discriminative in terms of organ boundaries and structural details during subsequent inference, thereby improving the spatial consistency and boundary fineness of the recognition results.
[0062] Because spatial attention mechanisms are highly dependent on the semantic hierarchy and spatial resolution of features, their introduction directly impacts their ability to model key regions. In the encoder-decoder architecture, skip connections are responsible for fusing encoded and decoded features. Each layer of encoded features contains a wealth of spatial information related to organ boundaries and local morphological changes. Applying spatial attention weighting to the feature maps during skip connections allows for explicit modeling of the importance of different spatial locations before feature fusion, thus selectively strengthening important regions and suppressing redundant responses from irrelevant areas such as the background. Compared to introducing spatial attention at other locations, embedding it during the feature propagation process of skip connections is more conducive to spatially selective enhancement.
[0063] During the encoding stage, as the network depth increases, the feature representation gradually transitions from shallow texture information to deep semantic information. The input channel attention module of the feature map obtained after downsampling at each layer is recalibrated to characterize the importance of different feature channels for the organ recognition task. Higher weights are assigned to key channels representing organ edges, morphological changes, and structural differences, while background redundancy or weakly correlated channels are suppressed. The multiple feature maps output from the encoding stage at different scales preserve the organ's local details, edge contours, and overall structural information, providing a multi-level semantic foundation for subsequent decoding, reconstruction, and feature fusion.
[0064] During the decoding stage, the spatial resolution of the feature map is gradually restored through upsampling operations, and the enhanced features from the corresponding encoder layers are fused through skip connections to achieve the joint reconstruction of high-level semantic information and low-level detailed information. Subsequently, a series of Transformer encoders further globally model the multi-scale features to enhance long-range dependencies and contextual relevance between features. During the skip connections, the shallow features output by the encoder are first processed by a spatial attention module, enabling the network to identify which spatial locations are more conducive to organ structure representation and which are background or irrelevant regions. The spatial attention module differentiates the weights assigned to spatial locations, highlighting the main organ region, boundary regions, and locations with significant local structural changes, thereby reducing background interference during feature fusion. The final output is the identification result of the stomach organ, which can be used for subsequent evaluation or further lesion analysis tasks.
[0065] The dual attention mechanism proposed in this invention achieves synergy in both the channel and spatial dimensions. On one hand, channel attention explicitly models the importance differences between channels, enhancing the discriminative power of feature representations; on the other hand, spatial attention improves the ability to focus on key regions during feature fusion. Without significantly increasing model parameters and computational overhead, it effectively improves the modeling ability of organ boundaries and structural details, which is beneficial for accurate reconstruction of organ structures in the subsequent decoding stage.
[0066] The present invention also provides a gastric organ recognition system based on a dual attention mechanism, the system comprising: The image acquisition module is used to acquire abdominal CT images to be identified.
[0067] The preprocessing module is used to preprocess the abdominal CT image to be identified to obtain a preprocessed image.
[0068] The channel attention encoder is used to perform progressive encoding processing on the preprocessed image using a channel attention mechanism to obtain encoding feature maps at each level; the encoding feature maps at each level include a first-level encoding feature map, a second-level encoding feature map, a third-level encoding feature map, and a fourth-level encoding feature map.
[0069] The spatial attention decoder is used to perform spatial position weighting on the encoded feature maps at each level using a spatial attention mechanism, and then concatenates and decodes them with the corresponding spatial attention feature maps of each layer to obtain the stomach organ recognition result.
[0070] As an optional implementation, the spatial attention decoder of the present invention specifically includes: The spatial attention processing module is used to perform spatial position weighting processing on the first-level coding feature map, the second-level coding feature map and the third-level coding feature map respectively using a spatial attention mechanism to obtain a first spatial attention feature map, a second spatial attention feature map and a third spatial attention feature map.
[0071] The feature encoding module is used to input the four-level encoded feature map into the encoder group for feature encoding to obtain the feature encoding map; the encoder group consists of 12 layers of Transformer encoders.
[0072] The first skip connection module is used to obtain a layer of decoded feature map by performing convolution and upsampling operations on the feature encoding map, and to perform skip connection processing on the layer of decoded feature map and the third spatial attention feature map to obtain a first connection feature map.
[0073] The second skip connection module is used to obtain a second-layer decoded feature map by performing convolution and upsampling operations on the first connection feature map, and to perform skip connection processing on the second-layer decoded feature map and the second spatial attention feature map to obtain a second connection feature map.
[0074] The third skip connection module is used to obtain a three-layer decoded feature map by performing convolution and upsampling operations on the second connection feature map, and to perform skip connection processing on the three-layer decoded feature map and the first spatial attention feature map to obtain a third connection feature map.
[0075] The organ recognition output module is used to output the gastric organ recognition result after the third connection feature map is processed by convolution and upsampling operations.
[0076] As an optional implementation, the spatial attention processing module of the present invention includes a first spatial attention processing unit, a second spatial attention processing unit, and a third spatial attention processing unit. The second and third spatial attention processing units are similar to the first spatial attention processing unit and will not be discussed again here. For details, please refer to the structural composition of the first spatial attention processing unit.
[0077] The first spatial attention processing unit specifically includes: The feature map concatenation determination subunit is used to perform average pooling and max pooling operations on the first-level encoded feature map and then concatenate them to obtain a concatenated feature map.
[0078] The superimposed feature map determines the sub-unit, which is used to perform 3×3 convolution, 5×5 convolution and 7×7 convolution on the spliced feature map respectively and then add them together to obtain the superimposed feature map.
[0079] The first spatial attention feature map determination subunit is used to input the superimposed feature map into the Sigmoid activation function and then multiply it element-by-element with the first-level encoded feature map to obtain the first spatial attention feature map.
[0080] For details on the parts that are the same as those in the method, please refer to the method section; they will not be repeated here.
[0081] In this invention, the preprocessed image is input into a channel attention encoder. The channel attention encoder extracts low-level texture features and high-level semantic features of the image through downsampling operations, enabling the network to progressively acquire the ability to represent the structure of the stomach organ. During the encoding process, the feature map after each downsampling layer (i.e., the downsampled feature map) is processed by the channel attention mechanism. This adaptively filters and recalibrates the structural information contained in different channels, strengthening feature channels related to the stomach organ and suppressing redundant channels that are heavily influenced by background tissue. This makes the channel attention encoder output more discriminative features. The final output, the recognition result of the target stomach organ, can be represented as a region mask, boundary contour, or other forms of structured recognition output, the specific form of which is determined according to application requirements.
[0082] This invention proposes a gastric organ recognition method based on a dual attention mechanism. This method targets gastric organ recognition in medical images. By introducing an attention mechanism during the encoding stage, it enhances information related to gastric organs and suppresses irrelevant background information, thereby improving the accuracy and boundary integrity of the recognition results. A spatial attention mechanism is introduced into the skip connections to differentially model the importance of different locations in the feature map. The spatial attention mechanism network pays more attention to the contours of gastric organs, boundary transition regions, and locations with significant structural changes, thus better preserving the spatial morphological information of gastric organs during decoding. Therefore, this invention, through the synergistic effect of channel attention and spatial attention mechanisms, accurately identifies and segments gastric organs in medical images, improving organ recognition accuracy and boundary localization accuracy.
[0083] While existing methods for identifying stomach organs have improved overall segmentation accuracy, the accuracy of boundary localization still needs improvement. This invention introduces a channel attention mechanism in the encoding stage and a spatial attention mechanism in skip connections, which further enhances the ability of the channel attention encoder and spatial attention decoder to focus on important features and space, thus providing a more effective solution for the task of identifying stomach organs.
[0084] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0085] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for recognizing stomach organs based on a dual attention mechanism, characterized in that, The method includes: Acquire abdominal CT images to be identified; The abdominal CT image to be identified is preprocessed to obtain a preprocessed image; The preprocessed image is encoded step by step using a channel attention mechanism to obtain coding feature maps at each level; the coding feature maps at each level include first-level coding feature maps, second-level coding feature maps, third-level coding feature maps and fourth-level coding feature maps; After spatial attention mechanism is used to perform spatial position weighting on the encoded feature maps at each level, they are concatenated with the corresponding decoded feature maps of each layer and then decoded to finally obtain the stomach organ recognition result.
2. The gastric organ recognition method based on a dual attention mechanism according to claim 1, characterized in that, The step of employing a channel attention mechanism to perform step-by-step encoding processing on the preprocessed image to obtain encoding feature maps at each level specifically includes: The preprocessed image is subjected to first-level coding feature extraction using a channel attention mechanism to obtain a first-level coding feature map. A channel attention mechanism is used to extract secondary coding features from the primary coding feature map to obtain a secondary coding feature map. A channel attention mechanism is used to extract tertiary coding features from the secondary coding feature map to obtain a tertiary coding feature map; The channel attention mechanism is used to extract fourth-level coding features from the third-level coding feature map to obtain a fourth-level coding feature map.
3. The gastric organ recognition method based on a dual attention mechanism according to claim 2, characterized in that, The step of using a channel attention mechanism to extract first-level coding features from the preprocessed image to obtain a first-level coding feature map specifically includes: The preprocessed image is downsampled to extract low-level texture features and high-level semantic features, resulting in a downsampled feature map. The downsampled feature map is adaptively filtered and recalibrated using a channel attention mechanism to obtain a first-level encoded feature map.
4. The gastric organ recognition method based on a dual attention mechanism according to claim 3, characterized in that, The step of adaptively filtering and recalibrating the downsampled feature map using a channel attention mechanism to obtain a first-level encoded feature map specifically includes: The downsampled feature map is subjected to average pooling, convolution, ReLU activation and convolution in sequence to obtain the channel average feature vector; The downsampled feature map is subjected to max pooling, convolution, ReLU activation, and convolution in sequence to obtain the channel maximum feature vector; The channel feature vector is obtained by weighted summation of the channel average feature vector and the channel maximum feature vector. The channel feature vector is activated by the Sigmoid activation function and then multiplied channel by channel with the downsampled feature map to obtain the first-level encoded feature map.
5. The gastric organ recognition method based on a dual attention mechanism according to claim 1, characterized in that, The process involves using a spatial attention mechanism to perform spatial position weighting on the encoded feature maps at each level, then concatenating and decoding them with the corresponding decoded feature maps at each layer to finally obtain the gastric organ recognition result. Specifically, this includes: A spatial attention mechanism is used to perform spatial position weighting processing on the first-level coding feature map, the second-level coding feature map, and the third-level coding feature map respectively to obtain a first spatial attention feature map, a second spatial attention feature map, and a third spatial attention feature map; The four-level encoded feature map is input into the encoder group for feature encoding to obtain the feature encoded map; the encoder group consists of 12 Transformer encoders. The feature encoding map is subjected to convolution and upsampling operations to obtain a layer of decoded feature map, and the layer of decoded feature map is then connected to the third spatial attention feature map to obtain a first connection feature map. The first connection feature map is subjected to convolution and upsampling operations to obtain a second-layer decoding feature map. The second-layer decoding feature map is then connected to the second spatial attention feature map to obtain a second connection feature map. The second connection feature map is subjected to convolution and upsampling operations to obtain a three-layer decoding feature map. The three-layer decoding feature map is then connected to the first spatial attention feature map by skip connection to obtain a third connection feature map. The third connection feature map is processed by convolution and upsampling operations to output the gastric organ recognition result.
6. The gastric organ recognition method based on a dual attention mechanism according to claim 5, characterized in that, The spatial attention mechanism is used to perform spatial position weighting on the first-level encoded feature map to obtain a first spatial attention feature map, specifically including: After performing average pooling and max pooling operations on the first-level encoded feature map, the two maps are concatenated to obtain a concatenated feature map. The spliced feature map is subjected to 3×3 convolution, 5×5 convolution and 7×7 convolution respectively and then added together to obtain the superimposed feature map; After the superimposed feature map is activated by the Sigmoid activation function, it is multiplied element-wise with the first-level encoded feature map to obtain the first spatial attention feature map.
7. The gastric organ recognition method based on a dual attention mechanism according to claim 5, characterized in that, The preprocessing of the abdominal CT image to be identified to obtain a preprocessed image specifically includes: The abdominal CT images to be identified are subjected to size unification, normalization, and grayscale standardization to obtain preprocessed images.
8. A gastric organ recognition system based on a dual attention mechanism, characterized in that, The system includes: The image acquisition module is used to acquire abdominal CT images to be identified; The preprocessing module is used to preprocess the abdominal CT image to be identified to obtain a preprocessed image; The channel attention encoder is used to perform step-by-step encoding processing on the preprocessed image using a channel attention mechanism to obtain encoding feature maps at each level; the encoding feature maps at each level include a first-level encoding feature map, a second-level encoding feature map, a third-level encoding feature map, and a fourth-level encoding feature map; The spatial attention decoder is used to perform spatial position weighting on the encoded feature maps at each level using a spatial attention mechanism, and then concatenates and decodes them with the corresponding spatial attention feature maps of each layer to obtain the stomach organ recognition result.
9. A gastric organ recognition system based on a dual attention mechanism according to claim 8, characterized in that, The spatial attention decoder specifically includes: The spatial attention processing module is used to perform spatial position weighting processing on the first-level coding feature map, the second-level coding feature map and the third-level coding feature map respectively using a spatial attention mechanism to obtain a first spatial attention feature map, a second spatial attention feature map and a third spatial attention feature map; The feature encoding module is used to input the four-level encoded feature map into the encoder group for feature encoding to obtain the feature encoding map; the encoder group consists of 12 layers of Transformer encoders; The first skip connection module is used to obtain a layer of decoded feature map by performing convolution and upsampling operations on the feature encoding map, and to perform skip connection processing on the layer of decoded feature map and the third spatial attention feature map to obtain a first connection feature map. The second skip connection module is used to obtain a second-layer decoded feature map by performing convolution and upsampling operations on the first connection feature map, and to perform skip connection processing on the second-layer decoded feature map and the second spatial attention feature map to obtain a second connection feature map. The third skip connection module is used to obtain a three-layer decoded feature map by performing convolution and upsampling operations on the second connection feature map, and to perform skip connection processing on the three-layer decoded feature map and the first spatial attention feature map to obtain a third connection feature map. The organ recognition output module is used to output the gastric organ recognition result after the third connection feature map is processed by convolution and upsampling operations.
10. A gastric organ recognition system based on a dual attention mechanism according to claim 9, characterized in that, The spatial attention processing module includes a first spatial attention processing unit, a second spatial attention processing unit, and a third spatial attention processing unit. The first spatial attention processing unit specifically includes: The feature map concatenation determination subunit is used to perform average pooling and max pooling operations on the first-level encoded feature map respectively and then concatenate them to obtain the concatenated feature map; The superimposed feature map determines the sub-unit, which is used to perform 3×3 convolution, 5×5 convolution and 7×7 convolution on the spliced feature map respectively and then add them to obtain the superimposed feature map; The first spatial attention feature map determination subunit is used to input the superimposed feature map into the Sigmoid activation function and then multiply it element-by-element with the first-level encoded feature map to obtain the first spatial attention feature map.