A hippocampus automatic segmentation method based on HAU-Net and gate spatial attention
By combining a multi-channel two-dimensional input feature map with a gated spatial attention module, the problems of high computational cost and low accuracy in hippocampal segmentation are solved, achieving efficient and accurate automatic hippocampal segmentation. This is suitable for resource-constrained clinical environments and supports early disease diagnosis and disease progression monitoring.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- THE 940TH HOSPITAL OF THE CHINESE PEOPLES LIBERATION ARMY JOINT LOGISTICS SUPPORT FORCE
- Filing Date
- 2026-03-16
- Publication Date
- 2026-07-10
AI Technical Summary
Existing deep learning methods suffer from high computational cost, high parameter count, difficulty in handling individual differences, and resource constraints in hippocampal segmentation tasks. Furthermore, purely 2D methods ignore the spatial continuity between slices, 3D methods have excessively high computational costs, and existing 2.5D methods fail to effectively model the feature dependencies between slices, resulting in poor hippocampal segmentation performance.
We employ an automatic hippocampal segmentation method based on HAU-Net and gated spatial attention. By constructing a multi-channel two-dimensional input feature map, we introduce inter-layer spatial context information and introduce a gated spatial attention module in the skip connections of the decoder. Combined with an adaptive hierarchical sampling strategy and a hybrid loss function, we optimize the segmentation accuracy and computational efficiency.
It significantly improves the accuracy and continuity of hippocampal segmentation, reduces computational costs, adapts to resource-constrained clinical environments, has good generalization ability, and provides accurate three-dimensional hippocampal segmentation results, providing an efficient tool for the early diagnosis and disease monitoring of neurodegenerative diseases such as Alzheimer's disease.
Smart Images

Figure CN122368098A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of brain image analysis technology, and in particular to an automatic hippocampal segmentation method based on HAU-Net and gated spatial attention. Background Technology
[0002] The hippocampus, an important structure located in the medial temporal lobe of the brain, plays a crucial role in cognitive functions such as episodic memory and spatial cognition. Numerous clinical studies have shown that morphological changes in the hippocampus, particularly its shrinkage, are important imaging biomarkers for neurological diseases such as Alzheimer's disease, epilepsy, and depression. Therefore, precise segmentation of the hippocampus from magnetic resonance imaging (MRI) is of significant clinical importance for early diagnosis, disease progression monitoring, and efficacy evaluation.
[0003] However, automatic hippocampal segmentation faces several technical challenges: First, the hippocampus is small in MRI images, typically accounting for only 0.3%-0.5% of the total brain volume, making it a typical small-target segmentation problem; second, the boundaries between the hippocampus and surrounding brain tissues (such as the amygdala and caudate nucleus) are blurred, with low contrast, making it difficult to distinguish even with the naked eye, and algorithmic segmentation is more prone to errors; third, there are significant anatomical differences between individuals, and the hippocampus's morphology is complex due to disease states (such as atrophy); fourth, in clinical applications, computational resources are often limited, placing high demands on the efficiency of the algorithm.
[0004] Early segmentation methods primarily relied on traditional machine learning techniques, such as multi-image registration and statistical shape models. While achieving some success, these methods generally suffered from high computational costs, weak generalization ability, and difficulty in handling individual differences. In recent years, the rapid development of deep learning has brought breakthroughs to medical image segmentation, with convolutional neural networks, represented by U-Net, becoming the mainstream framework in this field. However, existing deep learning methods still have limitations in hippocampal segmentation: purely 2D methods process each slice independently, ignoring the spatial continuity between slices, resulting in inconsistent segmentation results in three-dimensional space; while 3D methods, although utilizing complete volumetric context, have a large number of parameters, high computational costs, and stringent requirements for training data and hardware resources, making them impractical in small-sample scenarios or resource-constrained clinical environments. To address this, researchers have attempted 2.5D methods, which introduce inter-layer information by stacking adjacent slices, aiming to strike a balance between 2D efficiency and 3D context. However, existing 2.5D methods mostly employ simple slice stacking or post-fusion strategies, failing to effectively model the feature dependencies between slices and offering limited improvement in the segmentation of fine structures like the hippocampus.
[0005] Therefore, how to design an automatic hippocampal segmentation scheme that can effectively utilize three-dimensional spatial context information, maintain computational efficiency, and have good robustness to small targets and weak boundaries has become a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0006] This application provides an automatic hippocampal segmentation method based on HAU-Net and gated spatial attention, aiming to achieve an optimized balance between segmentation accuracy and computational efficiency. While maintaining the computational efficiency of two-dimensional networks, it significantly improves the accuracy and continuity of hippocampal segmentation.
[0007] This application provides an automatic hippocampal segmentation method based on HAU-Net and gated spatial attention, including: S101, Obtain the three-dimensional MRI brain image of the target object to be segmented; S102, sample at least one target slice from the three-dimensional MRI brain image, and construct a multi-channel two-dimensional input feature map for each target slice, wherein the multi-channel two-dimensional input feature map is formed by stacking a series of slices containing the target slice along the channel dimension; S103, input the multi-channel two-dimensional input feature map into the pre-trained hippocampal segmentation network, and output the hippocampal segmentation probability map; S104, the hippocampal segmentation probability map is thresholded to obtain the final binarized hippocampal segmentation result.
[0008] Preferably, the construction of the multi-channel two-dimensional input feature map specifically includes: S201 uses a preset adaptive hierarchical sampling strategy to determine the target slice set in three-dimensional MRI brain images; S202, construct a multi-channel two-dimensional input feature map for each target slice; S203 performs normalization and preprocessing on the multi-channel two-dimensional input feature map.
[0009] Preferably, the preset adaptive hierarchical sampling strategy specifically includes: The three-dimensional MRI brain image was divided into three continuous segments along the axial direction: the initial segment, the middle segment, and the final segment; A predetermined first, second, and third number of slices are sampled from the starting segment, the middle segment, and the ending segment, respectively, to form the target slice set S.
[0010] Preferably, S202 specifically includes: For any target slice Centered on the slice, extract the preceding slice d-1, the current slice d, and the following slice d+1 that are adjacent along the axis. Stack these three consecutive slices along the channel dimension to form a multi-channel two-dimensional input feature map with size H×W×3. H and W are the height and width of the slice, respectively. The three channels are filled with the pixel values of slices d-1, d, and d+1, respectively.
[0011] Preferably, the training method for the hippocampal segmentation network is as follows: B1. Collect a large amount of three-dimensional MRI brain image data and its corresponding hippocampal annotation mask; B2. Construct a multi-channel two-dimensional input feature map for each three-dimensional MRI brain image, and form a training dataset using the corresponding hippocampal annotation mask. Each training sample in the training dataset contains a multi-channel two-dimensional input feature map and its corresponding binary mask. The binary mask is obtained by binarizing and dimensionality-expanding the hippocampal annotation mask. B3. The pre-built segmentation network is trained using the training dataset. During the training process, the error between the prediction result and the labeled mask is calculated using a preset composite loss function, and the network parameters are updated by backpropagation to obtain the final hippocampal segmentation network.
[0012] Preferably, the composite loss function is a weighted sum of the Dice loss function and the binary cross-entropy loss function, expressed as: For Dice's loss, This is the binary cross-entropy loss, where α and β are the corresponding preset loss weight values used to balance the two types of loss.
[0013] Preferably, the pre-built segmentation network includes at least: an encoder, a decoder, a jump connection connecting the encoder and the decoder, and at least one gated spatial attention module.
[0014] Preferably, the at least one gated spatial attention module is configured in the skip connection. Each gated spatial attention module is used to receive the encoder feature map and decoder feature map of the current level, and generate a spatial attention weight map based on the two to weight the encoder feature map and generate a weighted encoder feature map.
[0015] Preferably, the gated spatial attention module is specifically used for: generating a spatial attention weight map and weighting the encoder feature map. C1. Perform 1×1 convolution on the current level's decoder feature map and the corresponding encoder feature map to compress the number of channels, and obtain the first compressed feature and the second compressed feature. C2. After adding and fusing the first compressed feature and the second compressed feature element by element, the mixture is processed sequentially by the ReLU activation function and the Sigmoid activation function to generate the spatial attention weight map. C3. Multiply the spatial attention weight map element-wise with the encoder feature map of the current level to generate the weighted encoder feature map, which is used to replace the original encoder feature map and the upsampled decoder feature map for splicing and fusion, and then sent to the next level of the decoder.
[0016] Preferably, S104 specifically includes: For the obtained hippocampal segmentation probability map, a segmentation threshold T is set for each hippocampal probability map. Convert it into a binary mask This serves as the result of binarized hippocampal segmentation. The binarized hippocampal segmentation results corresponding to all target slices are re-stacked according to their spatial positions in the original 3D MRI brain image to obtain the complete 3D hippocampal segmentation result.
[0017] One or more technical solutions provided in this application have at least the following technical effects or advantages: By constructing a 2.5D input feature map and stacking adjacent three-layer slices into a multi-channel input, spatial context information between layers is introduced while maintaining the computational efficiency of the 2D network. This effectively alleviates the boundary blurring and inter-layer inconsistency problems caused by neglecting the continuity between slices in traditional 2D methods. A gated spatial attention module is introduced into the skip connections of the U-Net decoder. The spatial weight map is dynamically generated using the semantic information of the decoder to enhance the feature response of the hippocampal target region and suppress background noise, significantly improving the segmentation accuracy and boundary characterization ability of small-sized, low-contrast structures. An adaptive hierarchical sampling strategy is adopted to sample data from the beginning, middle, and end of the volume data. By selecting a fixed number of slices in the intermediate and final regions, redundant computation and noise supervision are significantly reduced while ensuring coverage of key anatomical areas of the hippocampus, allowing limited resources to focus on effective information. A hybrid loss function combining Dice loss and binary cross-entropy loss is used to balance region overlap optimization and pixel-level discrimination capability, effectively alleviating class imbalance and accelerating model convergence. Finally, the complete three-dimensional hippocampal segmentation results are reconstructed through thresholding and spatial stacking, providing an accurate, efficient, and highly generalizable automated tool for the early diagnosis and disease monitoring of neurodegenerative diseases such as Alzheimer's disease, with clear clinical application value. Attached Figure Description
[0018] Figure 1 This is a flowchart illustrating the automatic hippocampal segmentation method based on HAU-Net and gated spatial attention, according to an embodiment of the present invention. Detailed Implementation
[0019] To facilitate understanding of the present invention, a more complete description of this application will be given below with reference to the accompanying drawings, which illustrate preferred embodiments of the invention. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to enable a more thorough and complete understanding of the disclosure of the present invention.
[0020] It should be noted that the terms "vertical," "horizontal," "up," "down," "left," "right," and similar expressions used in this article are for illustrative purposes only and do not represent the only possible implementation.
[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains; the terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to limit the invention; the term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0022] Example 1: Figure 1 This is a flowchart illustrating the automatic hippocampal segmentation method based on HAU-Net and gated spatial attention, according to an embodiment of the present invention.
[0023] like Figure 1 As shown, an automatic hippocampal segmentation method based on HAU-Net and gated spatial attention includes the following steps: S101, acquire the three-dimensional MRI brain image of the target object to be segmented.
[0024] A three-dimensional MRI brain image, acquired via a T1-weighted three-dimensional MPRAGE sequence, is a three-dimensional volumetric image, denoted as V, with dimensions D×H×W. Here, D represents the number of slices along the axial direction (e.g., head to foot), and H and W represent the height and width of each two-dimensional slice image, respectively. This three-dimensional MRI brain image can be acquired directly from clinical scanning equipment or retrieved from a medical imaging database.
[0025] S102, at least one target slice is sampled from the three-dimensional MRI brain image, and for each target slice, a multi-channel two-dimensional input feature map is constructed, wherein the multi-channel two-dimensional input feature map is formed by stacking a series of slices containing the target slice along the channel dimension.
[0026] In some embodiments, constructing a multi-channel two-dimensional input feature map specifically includes: S201 uses a preset adaptive layered sampling strategy to determine the target slice set in three-dimensional MRI brain images.
[0027] Because the hippocampus has a head-to-tail shape in three-dimensional space, its probability of occurrence varies at different axial positions. To cover the key axial regions where the hippocampus appears as much as possible within a limited computational budget, a pre-defined adaptive layered sampling strategy is used to determine the target slice: The three-dimensional MRI brain image was divided into three continuous segments along the axial direction: the initial segment, the middle segment, and the final segment; A predetermined first, second, and third number of slices are sampled from the starting segment, the middle segment, and the ending segment, respectively, to form the target slice set S.
[0028] For example, the first quantity and the third quantity Both can be 5, the second quantity The target slices can be 10, for a total of 20 slices. During sampling, the slice index s must satisfy... This means excluding the first and last slices at the edges of the volume data to ensure that each target slice has a preceding slice and a following slice, thereby guaranteeing the integrity of the multidimensional stack.
[0029] In the preset adaptive hierarchical sampling strategy, the sampling function can be defined as: ,in, This represents a set of slices extracted from the initial segment of a three-dimensional MRI brain image. This represents the set of slices extracted from the middle segment. The set of slices extracted from the end segment is defined by the sampling space corresponding to each slice: , , ,in, , and These represent the number of slices sampled from the start segment, middle segment, and end segment, respectively. In this embodiment, =5, =10, =5, which aims to fully cover the head, key regions and tail of the hippocampus body data, thereby optimizing the utilization efficiency of three-dimensional spatial information.
[0030] Since the hippocampus exists only in the central axial region in MRI images, the adaptive layered sampling strategy can ensure that all slices containing the hippocampus are covered, while the selection of the initial and final sampling slices is mainly to maintain the model's ability to distinguish slices without the hippocampus and enhance robustness.
[0031] It should be noted that, for each target slice in a 3D MRI brain image, this embodiment does not process the slice alone, but combines it with adjacent slices to introduce inter-slice spatial context information. Thus, each input image not only contains the structural information of the current slice, but also incorporates contextual cues from adjacent slices, providing richer spatial features for subsequent networks.
[0032] S202, construct a multi-channel two-dimensional input feature map for each target slice.
[0033] Specifically, for any target slice Centered on the slice, extract the preceding slice d-1, the current slice d, and the following slice d+1 that are adjacent along the axis. Stack these three consecutive slices along the channel dimension to form a multi-channel two-dimensional input feature map with size H×W×3. (This is a three-channel feature tensor), where H and W are the height and width of the slice, respectively. The three channels are filled with the pixel values of slices d-1, d, and d+1, respectively.
[0034] For example, for any pixel location (x, y), the elements of the multi-channel two-dimensional input feature map at that location can be represented in the following form: Where c represents the channel index of the slice. Corresponding to all previous pieces, Corresponding to the current slice, After corresponding to the slice, V represents the original three-dimensional volume data.
[0035] Multi-channel 2D input feature maps constructed by stacking adjacent slices can introduce spatial context information, which helps the model obtain more spatial cues, thereby enhancing its ability to understand local 3D structures. This is the "multi-channel two-dimensional input feature map" that is subsequently input into the network. This input format enables the 2D convolutional network, which originally only processed a single slice, to perceive the limited spatial correlation between layers, thereby obtaining richer three-dimensional anatomical information, which helps to improve the continuity and accuracy of the segmentation results.
[0036] S203 performs normalization and preprocessing on the multi-channel two-dimensional input feature map.
[0037] Specifically, to eliminate grayscale differences between different individuals, the multi-channel two-dimensional input feature map is processed. Perform linear normalization to linearly scale the pixel values to... The interval can be calculated using the following formula: ,in, and They are respectively The minimum and maximum values, A very small constant (e.g.) ), used to prevent division by zero errors, This represents the normalized image, which replaces the original multi-channel two-dimensional input feature map and serves as the input for subsequent networks.
[0038] S103, input the multi-channel two-dimensional input feature map into the pre-trained hippocampal segmentation network, and output the hippocampal segmentation probability map.
[0039] In some embodiments, the training method for the hippocampal segmentation network is as follows: B1. Collect a large amount of three-dimensional MRI brain image data and its corresponding hippocampal annotation mask.
[0040] Specifically, for each 3D MRI brain image, there is a corresponding hippocampal annotation mask. First, load it as a three-dimensional matrix. Where D is the number of slices, H and W are the image height and width, respectively, and the corresponding annotation mask M is a binary 3D matrix with shape [missing information]. , used as a ground truth label during training, with a value of 1 indicating the hippocampus region and a value of 0 indicating the background.
[0041] B2. For each 3D MRI brain image, construct its multi-channel 2D input feature map and use the corresponding hippocampal annotation mask to form a training dataset. Each training sample in the training dataset contains a multi-channel 2D input feature map. And its corresponding hippocampal annotation mask.
[0042] In subsequent training phases, to enhance the model's generalization ability, [the following steps are taken]. Online data augmentation is applied synchronously with the corresponding hippocampal annotation mask. Data augmentation operations may include: horizontal flipping, vertical flipping, and random rotation (range). The enhanced image and mask are converted to PyTorch tensor format, with the shape changed from H×W×C to C×H×W, after random scaling (range [0.9, 1.1]), elastic deformation, brightness and contrast adjustment, and Gaussian noise injection. The enhanced image and mask are converted to PyTorch tensor format, with the shape changed from H×W×C to C×H×W, to meet the input requirements of the network.
[0043] B3. The pre-built segmentation network is trained using the training dataset. During the training process, the error between the prediction result and the labeled mask is calculated using a preset composite loss function, and the network parameters are updated by backpropagation to obtain the final hippocampal segmentation network.
[0044] The composite loss function is a weighted sum of the Dice loss function and the binary cross-entropy loss function, expressed as: in, The Dice loss is used to optimize the region overlap between the predicted results and the ground truth labels. It is derived from the Dice Similarity Coefficient (DSC), a metric used to measure the similarity between two sets of samples and widely used in medical image segmentation. The value range is [0,1]. When it is 0, it means that the prediction result completely overlaps with the true label. When it is 1, it means that the two do not overlap at all. The binary cross-entropy loss provides dense gradient supervision at the pixel level, helping the model to more accurately classify each pixel; α and β are the corresponding preset loss weights, used to balance the two losses. To predict the value of the i-th pixel in the probability map P, For the corresponding real labels (i.e. (The expanded value), where N is the total number of pixels. For smoothing terms (such as...) ), used to avoid a denominator of 0.
[0045] The two losses are weighted and combined using coefficients α and β to form the overall optimization objective. As a stable and widely adopted optimization strategy for segmenting small-structure medical images under class imbalance conditions, this approach combines the complementary characteristics of BCE and Dice losses. The model benefits from both pixel-level discriminative ability and region-level overlap optimization: BCE emphasizes local details by penalizing pixel-wise errors, while Dice directly optimizes region overlap, helping to improve geometric consistency when the background is dominant. In the implementation, α=β=1 can be set and kept constant in all experiments to avoid over-parameter tuning in small sample settings, while ensuring the reproducibility of results and fair comparison.
[0046] For example, training uses the Adam optimizer, with an initial learning rate set to... The batch size is set to 16, the training rounds are 200, and an early stopping strategy is adopted. When the Dice coefficient on the validation set does not increase for 20 consecutive rounds, the training is stopped and the best model is saved. The specific training principle can be referred to the description of related technologies, which will not be elaborated in this invention.
[0047] In some embodiments, the pre-built segmentation network is HAU-Net, whose structure is based on U-Net (U-Net includes an encoder, a decoder, and a skip connection connecting the encoder and the decoder). A gated spatial attention module is introduced in the skip connection of the decoder, that is, a gated attention module is set after each upsampling layer of the decoder. The structure of the segmentation network HAU-Net includes: an encoder, a decoder, skip connections, at least one gated spatial attention module, and a feature fusion unit.
[0048] Specifically, the encoder is used to perform multi-level feature extraction on the input multi-channel two-dimensional image to obtain encoder feature maps at multiple levels; the decoder, corresponding to the encoder level, is used to perform multi-level upsampling on the deepest encoder feature map to gradually restore spatial resolution, and generates a corresponding decoder feature map at each upsampling level; at least one skip connection connects the encoder and decoder at the corresponding level, respectively, to pass the encoder feature map at each level to the corresponding level in the decoder; at least one gated spatial attention module is configured in a skip connection, and its input is connected to the current... The encoder output and the corresponding decoder output are used to receive the encoder feature map and decoder feature map of the current layer, and generate a spatial attention weight map based on the two to weight the encoder feature map and generate a weighted encoder feature map. The feature fusion unit is configured in each upsampling layer of the decoder to fuse the weighted encoder feature map with the decoder feature map of the corresponding layer, and send the fusion result to the next layer of the decoder. The last layer of the decoder outputs a feature map, which is processed by convolution and activation functions to generate a hippocampal segmentation probability map with the same size as the input image.
[0049] Specifically: S1, an encoder, used to perform multi-level feature extraction on the multi-channel two-dimensional input feature map to obtain encoder feature maps at multiple levels.
[0050] The encoder comprises multiple sequentially connected downsampling convolutional modules, each of which includes at least two convolution operations, batch normalization, and ReLU activation operations. Adjacent downsampling convolutional modules are connected by max-pooling layers (e.g., 2×2 with a stride of 2) to progressively reduce the spatial resolution of the feature maps (e.g., from 128×128 to 8×8) while increasing the number of channels (e.g., from 3 to 1024), thereby capturing rich features from low-level details to high-level semantics.
[0051] For example, each downsampling convolutional module (e.g., the first convolutional block, 3×3 kernel, stride 1, padding 1) performs the following operations sequentially: First, it processes the input feature map... Perform the first 3×3 convolution to obtain the feature map. Then, batch normalization and ReLU activation are performed to obtain... Then on Perform a second 3×3 convolution, followed by batch normalization and ReLU activation to obtain the final output of this module. .
[0052] S2, the decoder, corresponds to the encoder level and is used to perform multi-level upsampling on the deepest encoder feature map to gradually restore the spatial resolution, and generate the corresponding decoder feature map at each upsampling level.
[0053] The decoder includes multiple upsampling modules connected in sequence. Each upsampling module includes a transposed convolutional layer (also called deconvolution, whose kernel size can be set to 2×2 and stride is 2) to double the feature map size (e.g., from 8×8 to 16×16). Each transposed convolutional layer is followed by a corresponding gated spatial attention module and a decoding convolutional module. That is, it is concatenated with the corresponding encoder feature map after being weighted by gated spatial attention, and then fed into a decoding convolutional module with the same structure as the encoder convolutional module for feature refinement.
[0054] S3, skip connections, connect the encoder and decoder at the corresponding levels respectively, and directly pass the feature map output by each level of the encoder to the corresponding level in the decoder.
[0055] Skip connections directly pass the details lost by the encoder during downsampling to the decoder, which helps to recover the fine boundaries of the target.
[0056] S4. At least one gated spatial attention module is configured in the skip connection. Each gated spatial attention module is used to receive the encoder feature map and decoder feature map of the current level, and generate a spatial attention weight map based on the two to weight the encoder feature map and generate a weighted encoder feature map.
[0057] Since the feature maps transmitted by skip connections contain a lot of background noise, a gated spatial attention module is configured on each skip connection to use the feature map of the current level of the decoder as a gating signal to guide the spatial weighting of the feature map from the encoder.
[0058] A gated spatial attention module is introduced after each upsampling layer of the decoder to generate spatial attention weights based on the features output by the current upsampling layer and the encoder features passed by the corresponding skip connections, and to weight the encoder features to enhance the feature response of the hippocampal target region.
[0059] Specifically, the gated spatial attention module generates the spatial attention weight map and weights the encoder feature map in the following way: C1. Perform 1×1 convolution on the current level's decoder feature map and the corresponding encoder feature map to compress the number of channels, and obtain the first compressed feature and the second compressed feature.
[0060] Therefore, 1×1 convolutions are performed on the feature maps from the decoder and the encoder respectively to unify and compress the number of channels, resulting in the first compressed feature and the second compressed feature.
[0061] C2. After adding and fusing the first compressed feature and the second compressed feature element by element, the mixture is processed sequentially by the ReLU activation function and the Sigmoid activation function to generate the spatial attention weight map.
[0062] The output range of the Sigmoid function is [0,1], which constitutes the spatial attention weight map α. The value of each pixel in this weight map represents the importance of the corresponding position. The spatial size of this weight map is related to the encoder features. Figure 1 Therefore, the value of each pixel is between 0 and 1.
[0063] C3. Multiply the spatial attention weight map element-wise with the encoder feature map of the current level to generate the weighted encoder feature map, which is used to replace the original encoder feature map and the upsampled decoder feature map for splicing and fusion.
[0064] The weighting operation enhances the signal from the target region while suppressing noise from the background or irrelevant regions.
[0065] S5, Feature Fusion Unit, is used to fuse the weighted encoder feature map with the corresponding decoder feature map, and send the fusion result to the next layer of the decoder. The feature map output by the last layer of the decoder is subjected to a 1×1 convolution to reduce the number of channels to 1, and then subjected to Sigmoid activation to generate a hippocampal segmentation probability map with the same size as the input image, and finally outputs the segmentation probability map.
[0066] Specifically, the weighted encoder feature map Compared with the upsampled decoder feature map By stitching along the channel dimension, a fused feature map is obtained. : ,in, This indicates a channel splicing operation. The features are then fed into the decoding convolution module for feature refinement, extracting higher-level fusion features, which serve as the input to the next layer of the decoder module.
[0067] As an example, the configuration parameters for a pre-built segmentation network can be as follows: Encoder: The input is a 3×128×128 image. The encoder contains five downsampling convolutional modules (ConvBlock1 to Conv Block5). Each convolutional module contains two convolution operations. Each convolution has a kernel size of 3×3, a stride of 1, and padding of 1. Each convolution is followed by a batch normalization layer and a ReLU activation function. Downsampling between modules is achieved through max pooling with a stride of 2 and a kernel size of 2×2. As the layers deepen, the number of feature map channels is 64, 128, 256, 512, and 1024, respectively, and the spatial resolution is halved in each case. Finally, a feature map with a size of 1024×8×8 is obtained at the bottleneck layer (Conv Block5). Decoder: The decoder contains four upsampling modules (up6 to up9). Each upsampling module first doubles the feature map size through a transposed convolutional layer (kernel size 2×2, stride 2). The upsampled feature map is then concatenated and fused with the corresponding encoder feature map after being weighted by the spatial attention module. The fused feature map is then input into a decoding convolutional module. The structure of the decoding convolutional module is the same as that of the convolutional module in the encoder, which includes two convolutions, batch normalization, and ReLU activation to refine the fused features. Gated Spatial Attention Module: A spatial attention module is inserted between each encoder-decoder layer. Taking the first gated spatial attention module as an example, its input is the encoder feature map of the current layer. and the corresponding decoder feature map (By using bilinear interpolation) Upsampling to For spaces with the same dimensions, or using other alignment methods to make the dimensions of both identical (this invention will not elaborate on this), the following calculations are performed: To each and Applying 1×1 convolution, the number of channels is compressed to (For example, ),get and : ; Will and Element-wise addition, followed by ReLU activation, yields the fused features: ; right Apply another 1×1 convolution to compress its channel count to 1, and then pass it through a sigmoid function to obtain the spatial attention weight map. : ,in, This represents the Sigmoid activation function; Will With encoder feature map Element-wise multiplication is performed to calculate the weighted encoder feature map: ,in, This represents element-wise multiplication. These are the enhanced encoder features used to replace the original ones. It is then spliced and fused with the upsampled decoder features.
[0068] The entire segmentation network goes through encoders, gated attention-guided skip connections, and progressive processing by decoders. Finally, in the last layer of the decoder, the output feature map is... After a 1×1 convolution, the number of channels is reduced to 1, resulting in the original output probability map. : Finally, the Sigmoid activation function is applied to map the probability values to the [0,1] interval, generating an image with the same size as the input image. Hippocampal segmentation probability map : .
[0069] Thus, by using a pre-trained hippocampal segmentation network, end-to-end processing of the input image is achieved. The last layer of the network is usually a 1×1 convolution, which maps the feature map output by the decoder to a single-channel image. Then, through the Sigmoid activation function, the value of each pixel is mapped to the [0,1] interval, which is the hippocampal segmentation probability map. Each pixel value in the probability map represents the confidence that the pixel belongs to the hippocampal region.
[0070] The training phase of the segmentation network also includes data augmentation of the training samples, the data augmentation being selected from one or more of the following: horizontal flipping, vertical flipping, random rotation, translation, scaling, elastic deformation, brightness adjustment, contrast adjustment, and Gaussian noise injection.
[0071] S104, the hippocampal segmentation probability map is thresholded to obtain the final binarized hippocampal segmentation result.
[0072] Specifically, for the obtained hippocampal segmentation probability map, a segmentation threshold T is set, and for each probability map... Convert it into a binary mask : Among them, for probability graphs Each pixel in The corresponding final segmentation result , For indicator functions, binary masks This is the final hippocampal segmentation result. Specifically, if the probability value of a pixel is greater than or equal to T, it is identified as a hippocampus (assigned a value of 1); otherwise, it is identified as background (assigned a value of 0). In a typical embodiment, the threshold T can be set to 0.5.
[0073] Finally, the binarized hippocampal segmentation results corresponding to all target slices are obtained. By re-stacking the images according to their spatial positions in the original 3D volumetric data, the complete 3D hippocampal segmentation result can be obtained. Since the sampling strategy has ensured coverage of all slices containing the hippocampus, the stacked 3D mask is the final hippocampal segmentation output.
[0074] The technical solutions described in the embodiments of this application have at least the following technical effects or advantages: By stacking three adjacent slices to construct a multi-channel 2D input feature map, the network can perceive limited inter-layer spatial correlations while maintaining 2D computational efficiency. This effectively alleviates the inter-layer inconsistency and boundary ambiguity problems caused by neglecting the continuity between slices in traditional 2D methods. A gated spatial attention module is introduced into the decoder skip connection. The spatial weight map is dynamically generated using the semantic information of the decoder and weighted to enhance the feature response of the hippocampal target region while suppressing irrelevant background noise. This improves the segmentation accuracy of the hippocampus, a small-sized, low-contrast structure, especially in boundary delineation and the segmentation of slender tail structures.
[0075] Compared to full 3D segmentation networks, this model introduces limited spatial context by stacking only three layers of slices, avoiding the huge computational overhead and memory consumption associated with 3D convolution. The number of model parameters is roughly equivalent to that of 2D U-Net, and the inference speed is close to that of 2D networks, significantly faster than 3D networks, enabling its deployment in resource-constrained clinical environments. It employs a hierarchical sampling strategy, selecting a fixed number of slices from the beginning, middle, and end regions of the volume data, rather than processing all slices. This strategy ensures coverage of all key slices containing the hippocampus while significantly reducing redundant computation and noisy supervision, allowing limited computational resources to focus on effective information.
[0076] Based on the probability distribution of hippocampal occurrence along the axis, slices were sampled from the head (initial segment), body (middle segment), and tail (terminal segment) to ensure that the network fully learns the morphological changes of the hippocampus at different axial positions, improving its adaptability to anatomical variations. During the training phase, various geometric and photometric transformations (such as flipping, rotation, scaling, elastic deformation, brightness adjustment, and noise injection) were applied simultaneously to the input images and masks to effectively expand the diversity of training samples and simulate the image changes caused by different scanners, protocols, and patient differences in real clinical settings, thereby enhancing the model's generalization ability on unseen data.
[0077] A weighted combination of Dice loss and binary cross-entropy loss is employed to balance region overlap optimization and pixel-level classification accuracy. Dice loss alleviates the class imbalance problem, while BCE loss provides dense pixel-level gradient supervision. The combination of the two makes the model training more stable, converges faster, and ultimately achieves higher segmentation accuracy. Each convolutional module in the encoder and decoder contains a batch normalization layer and a ReLU activation function, which helps to accelerate network convergence, prevent gradient vanishing or exploding, and improve the stability of the training process.
[0078] By thresholding the probability map output by the network (e.g., T=0.5), a clear binary mask is obtained. Then, the masks of all target slices are stacked according to their original spatial positions to reconstruct a complete three-dimensional hippocampal segmentation result. This result can be directly used for subsequent clinical quantitative analysis, such as hippocampal volume measurement and morphological analysis, providing reliable structural markers for the early diagnosis and disease monitoring of neurodegenerative diseases such as Alzheimer's disease.
[0079] The embodiments of this application have low computational resource requirements, fast inference speed, and high segmentation accuracy. They can be well adapted to application environments with limited computational resources and certain real-time requirements in clinical practice, providing a powerful technical tool for auxiliary diagnosis and scientific research of hippocampal-related diseases.
[0080] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. For those skilled in the art, the present invention can have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for automatic hippocampal segmentation based on HAU-Net and gated spatial attention, characterized in that, include: S101, Obtain the three-dimensional MRI brain image of the target object to be segmented; S102, sample at least one target slice from the three-dimensional MRI brain image, and construct a multi-channel two-dimensional input feature map for each target slice, wherein the multi-channel two-dimensional input feature map is formed by stacking a series of slices containing the target slice along the channel dimension; S103, input the multi-channel two-dimensional input feature map into the pre-trained hippocampal segmentation network, and output the hippocampal segmentation probability map; S104, the hippocampal segmentation probability map is thresholded to obtain the final binarized hippocampal segmentation result.
2. The automatic hippocampal segmentation method based on HAU-Net and gated spatial attention as described in claim 1, characterized in that, The construction of the multi-channel two-dimensional input feature map specifically includes: S201 uses a preset adaptive hierarchical sampling strategy to determine the target slice set in three-dimensional MRI brain images; S202, construct a multi-channel two-dimensional input feature map for each target slice; S203 performs normalization and preprocessing on the multi-channel two-dimensional input feature map.
3. The automatic hippocampal segmentation method based on HAU-Net and gated spatial attention as described in claim 2, characterized in that, The preset adaptive hierarchical sampling strategy specifically includes: The three-dimensional MRI brain image was divided into three continuous segments along the axial direction: the initial segment, the middle segment, and the final segment; A predetermined first, second, and third number of slices are sampled from the starting segment, the middle segment, and the ending segment, respectively, to form the target slice set S.
4. The automatic hippocampal segmentation method based on HAU-Net and gated spatial attention as described in claim 3, characterized in that, S202 specifically includes: For any target slice Centered on the slice, extract the axially adjacent slices d-1 (the previous slice), d (the current slice), and d+1 (the next slice). Stack these three consecutive slices along the channel dimension to form a multi-channel two-dimensional input feature map with size H×W×3. H and W are the height and width of the slice, respectively. The three channels are filled with the pixel values of slices d-1, d, and d+1, respectively.
5. The automatic hippocampal segmentation method based on HAU-Net and gated spatial attention as described in claim 4, characterized in that, The training method for the hippocampal segmentation network is as follows: B1. Collect a large amount of three-dimensional MRI brain image data and its corresponding hippocampal annotation mask; B2. Construct a multi-channel two-dimensional input feature map for each three-dimensional MRI brain image, and use the corresponding hippocampal annotation mask to form a training dataset. Each training sample in the training dataset contains a multi-channel two-dimensional input feature map and its corresponding binary mask. The binary mask is obtained by binarizing and expanding the dimensions of the hippocampal annotation mask. B3. The pre-built segmentation network is trained using the training dataset. During the training process, the error between the prediction result and the labeled mask is calculated using a preset composite loss function, and the network parameters are updated by backpropagation to obtain the final hippocampal segmentation network.
6. The automatic hippocampal segmentation method based on HAU-Net and gated spatial attention as described in claim 5, characterized in that, The composite loss function is a weighted sum of the Dice loss function and the binary cross-entropy loss function, expressed as: For Dice's loss, This is the binary cross-entropy loss, where α and β are the corresponding preset loss weight values used to balance the two types of loss.
7. The automatic hippocampal segmentation method based on HAU-Net and gated spatial attention as described in claim 6, characterized in that, The pre-built segmentation network includes at least: an encoder, a decoder, a jump connection connecting the encoder and the decoder, and at least one gated spatial attention module.
8. The automatic hippocampal segmentation method based on HAU-Net and gated spatial attention as described in claim 7, characterized in that, The at least one gated spatial attention module is configured in the skip connection. Each gated spatial attention module is used to receive the encoder feature map and decoder feature map of the current level, and generate a spatial attention weight map based on the two to weight the encoder feature map and generate a weighted encoder feature map.
9. The automatic hippocampal segmentation method based on HAU-Net and gated spatial attention as described in claim 8, characterized in that, The gated spatial attention module is specifically used for: generating a spatial attention weight map and weighting the encoder feature map. C1. Perform 1×1 convolution on the current level's decoder feature map and the corresponding encoder feature map to compress the number of channels, and obtain the first compressed feature and the second compressed feature. C2. After adding and fusing the first compressed feature and the second compressed feature element by element, the mixture is processed sequentially by the ReLU activation function and the Sigmoid activation function to generate the spatial attention weight map. C3. Multiply the spatial attention weight map element-wise with the encoder feature map of the current level to generate the weighted encoder feature map, which is used to replace the original encoder feature map and the upsampled decoder feature map for splicing and fusion, and then sent to the next level of the decoder.
10. The automatic hippocampal segmentation method based on HAU-Net and gated spatial attention as described in claim 9, characterized in that, S104 specifically includes: For the obtained hippocampal segmentation probability map, a segmentation threshold T is set for each hippocampal probability map. Convert it into a binary mask , as the result of binarized hippocampal segmentation; The binarized hippocampal segmentation results corresponding to all target slices are re-stacked according to their spatial positions in the original 3D MRI brain image to obtain the complete 3D hippocampal segmentation result.