A cross-head attention enhancement system and method for medical image cell detection
By using a cross-head attention enhancement system, the problems of extreme scale variations, high cell density, and complex background interference in medical cell image detection are solved, achieving efficient cell detection and improving detection accuracy and robustness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGDONG UNIV OF TECH
- Filing Date
- 2026-04-17
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies lack systematic solutions for medical cell image detection, especially in the collaborative optimization of global perception and local focusing at different stages of feature extraction, coupled with appropriate detection scales and loss functions. This leads to problems such as extreme scale variations, high cell density, morphological diversity, and interference from complex backgrounds.
A cross-head attention enhancement system is adopted, including data preprocessing, pre-feature encoding, cross-resolution feature recombination and multi-scale detection modules. Combined with a global feature fusion processing module, collaborative attention mechanism and Cell-AIoU loss function, the robustness and accuracy of cell detection are improved through multi-level visual representation extraction, cross-resolution feature recombination and multi-scale prediction.
It significantly improves the detection range and recall rate of tiny cells, enhances the ability to distinguish dense cells, improves the localization accuracy and robustness of cell detection, and provides a reliable automated pathological analysis tool.
Smart Images

Figure CN122391716A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the interdisciplinary field of medical image processing and computer vision, specifically to a cross-head attention enhancement system and method for cell detection in medical images. Background Technology
[0002] Cell detection is the cornerstone of medical image analysis, crucial for disease diagnosis, pathological research, and drug screening. With the development of digital pathology and high-resolution microscopy, there is an urgent need for automated methods to process massive amounts of image data. Single-stage detectors based on the YOLO (You Only Look Once) series have been widely applied to medical images due to their high efficiency. However, directly applying YOLO models designed for natural images to cell detection faces significant challenges: 1) Extreme scale variations: Target sizes range from subcellular structures of a few pixels to cell clusters of hundreds of pixels, making it difficult for the limited detection heads of general models to fully cover them; 2) High density and overlap: Cells often cluster tightly with blurred boundaries, leading to feature confusion and missed detections; 3) Morphological and staining diversity: Different types and states of cells differ significantly in morphology and staining intensity; 4) Complex background interference: Tissue matrix, blood, and staining residues create complex noise, interfering with target extraction. Existing research attempts to improve medical image detection performance by introducing attention mechanisms, improving network structures, or modifying loss functions, but these still have limitations in practical applications. For example, some solutions introduce cross-head attention mechanisms to enhance feature interaction, but may still introduce irrelevant background noise in dense small target scenes; some solutions use region routing attention mechanisms for feature fusion, but their performance in utilizing global interaction of features at different semantic levels is limited; some solutions design global feature fusion modules, but do not optimize for the high complexity of channel and spatial relationships in medical cell images. In addition, most mainstream models use three detection heads, resulting in insufficient recall for detecting extremely small cells; commonly used loss functions have limited effectiveness in adapting to the constraint accuracy of irregular cell morphological changes: CIoU only constrains shape through aspect ratio linearity, and has low sensitivity to subtle morphological differences in cells; EIoU only focuses on the width-to-height difference term and does not strengthen the constraint of proportional difference; SIoU introduces angle-related constraints, which are insufficient for adapting to the diverse morphological forms of cells.
[0003] In summary, existing technologies lack a systematic integrated solution for the multi-scale, high-density, and complex background characteristics of medical cell images, especially for the collaborative optimization of global perception and local focusing at different stages of feature extraction, coupled with appropriate detection scales and loss functions. Summary of the Invention
[0004] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0005] A cross-head attention enhancement system for cell detection in medical images, comprising:
[0006] The data preprocessing module is used to perform size normalization, pixel value standardization, and data augmentation on the input medical images; the pre-feature encoding module, based on the YOLO series object detection architecture, performs multi-level visual representation extraction on the preprocessed medical images.
[0007] A cross-resolution feature recombination unit, connected to the pre-feature encoding module, is used to perform cross-resolution feature recombination and spatial resolution restoration on high-order semantic features and / or high-level features refined by the collaborative attention mechanism;
[0008] A multi-scale detection module, connected to the cross-resolution feature recombination unit, is used to perform parallel prediction of the fused multi-scale features and output cell detection results.
[0009] The pre-feature encoding module has a global feature fusion processing module in its early layer; a collaborative attention mechanism is integrated at the end of the pre-feature encoding module and before the cross-resolution feature recombination unit.
[0010] As a preferred embodiment of the cross-head attention enhancement system for cell detection in medical images described in this invention, the global feature fusion processing module includes two cascaded channel, pixel, and spatial fusion attention modules. After the two channel, pixel, and spatial fusion attention modules, the pre-feature encoding module is further configured with a pixel attention submodule and a channel attention submodule that are processed in parallel. The enhanced features are fused with the input features of the global feature fusion processing module through cross-layer identity residual connections for output.
[0011] As a preferred embodiment of the cross-head attention enhancement system for medical image cell detection described in this invention, the specific calculation process of the channel, pixel, and spatial fusion attention module is as follows:
[0012] Process 1, Channel Attention Weighting: Global average pooling is performed on the input features to obtain the channel description vector. This vector is then input into the channel weight generation network, which consists of two fully connected layers and an activation function. The output channel weights are consistent with the number of input feature channels. Feature channel recalibration is achieved by multiplying them channel by channel.
[0013] Step 2, pixel-level feature weighting: Perform a 1×1 convolution operation on the recalibrated features of the channels to generate a pixel weight matrix with the same size as the input feature space. Pixel-level feature weighting is achieved by multiplying the matrix pixel by pixel.
[0014] Step 3, Spatial Attention Weighting: After weighting the pixel features, perform max pooling and average pooling in the channel dimension respectively. Concatenate the two pooling results and input them into a 3×3 convolutional layer to generate a spatial weight map. Spatial attention weighting is achieved by multiplying position by position to highlight the cell target-related regions.
[0015] As a preferred embodiment of the cross-head attention enhancement system for cell detection in medical images according to the present invention, the collaborative attention mechanism includes cross-head attention units and two-layer routing attention units connected in series according to the data flow sequence.
[0016] The cross-head attention unit is used to achieve global feature interaction across attention heads on high-level features through learnable head tokens. The learnable head token is a feature vector with trainable parameters, dimensions and feature map channel number adaptation, used to establish semantic associations between different attention heads and complete the global context.
[0017] The dual-layer routing attention unit is used to receive the output feature map of the cross-head attention unit.
[0018] As a preferred embodiment of the cross-head attention enhancement system for cell detection in medical images described in this invention, the multi-scale detection module includes four detection heads with different spatial resolutions, and when the input image is normalized to a preset input resolution, the feature map resolutions corresponding to the four detection heads are 160×160, 80×80, 40×40 and 20×20, respectively.
[0019] As a preferred embodiment of the cross-head attention enhancement system for cell detection in medical images described in this invention, it further includes a training module for calculating the bounding box regression loss using the Cell-AIoU loss function during the model training phase.
[0020] A cross-head attention enhancement method for cell detection in medical images includes the following specific steps:
[0021] S1: Preprocess the input medical image; S2: Extract features through the pre-feature encoding module, where the initial global feature fusion module performs global enhancement: the input features are sequentially passed through two concatenated channel, pixel, and spatial fusion attention modules to perform channel, pixel, and spatial attention weighting, then fine-tuned by parallel PA and CA sub-modules, and finally fused with the original input features through cross-layer identity residual connections; the output is processed according to the data flow order of the cross-head attention unit and the dual-layer routing attention unit: the cross-head attention unit reshapes the input features to generate a learnable head token, which is then combined with position encoding and input to multi-head self-attention calculation to obtain context features; the dual-layer routing attention unit first divides the feature map output by the cross-head attention unit into G×G regions, and constructs a routing index matrix through region feature vector extraction and cosine similarity calculation to select the Top-k. S3: Construct key-value vectors for high-scoring regions and perform sparse attention computation; S4: Perform multi-scale fusion of enhanced high-order semantic features and / or high-level features through cross-resolution feature recombination units; S5: Perform parallel prediction of fused multi-scale features through multi-scale detection modules to obtain initial detection results; S6: Post-process the initial detection results and output the final cell localization and classification information.
[0022] Compared with existing technologies:
[0023] 1. By combining early global enhancement of the global feature fusion processing module with late-stage collaborative attention of IHAM+BRA tandem, robust suppression of complex backgrounds and precise enhancement of key cellular features are achieved, improving the ability to distinguish between dense and overlapping cells.
[0024] 2. The four-detection-head design, especially the introduction of the 160×160 high-resolution head, significantly improves the model's perception range and recall rate for microscale cells;
[0025] 3. The exponential shape penalty of the Cell-AIoU loss function drives the model to generate bounding boxes that better match the true shape of cells, thus improving localization accuracy;
[0026] 4. The modules work together to provide a reliable and efficient technical tool for automated pathology analysis. Attached Figure Description
[0027] Figure 1 This is a schematic diagram of the overall architecture of the present invention;
[0028] Figure 2 This is a schematic diagram of the collaborative attention mechanism structure located at the end of the pre-feature encoding module in this invention;
[0029] Figure 3 This is a schematic diagram of the global feature fusion processing module of the present invention. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
[0031] This invention provides a cross-head attention enhancement system for cell detection in medical images. Please refer to [link to relevant documentation]. Figures 1-3 ,include:
[0032] The data preprocessing module is used to perform size normalization, pixel value standardization, and data augmentation on the input medical images; the pre-feature encoding module, based on the YOLO series object detection architecture, performs multi-level visual representation extraction on the preprocessed medical images.
[0033] A cross-resolution feature recombination unit, connected to the pre-feature encoding module, is used to perform cross-resolution feature recombination and spatial resolution restoration on high-order semantic features and / or high-level features refined by the collaborative attention mechanism;
[0034] A multi-scale detection module, connected to the cross-resolution feature recombination unit, is used to perform parallel prediction of the fused multi-scale features and output cell detection results.
[0035] The pre-feature encoding module has a Global Feature Fusion Processing (GFFP) module in its early layer; a collaborative attention mechanism is integrated at the end of the pre-feature encoding module and before the cross-resolution feature recombination unit.
[0036] The global feature fusion processing module includes two cascaded channel, pixel, and spatial fusion attention modules (FCPS modules for short). After the two channel, pixel, and spatial fusion attention modules, the pre-feature encoding module is further configured with a pixel attention submodule and a channel attention submodule that are processed in parallel. The enhanced features are fused with the input features of the global feature fusion processing module through cross-layer identity residual connections. Each channel, pixel, and spatial fusion attention module sequentially performs channel attention weighting, pixel-level feature weighting, and spatial attention weighting.
[0037] The specific calculation process of the channel, pixel, and spatial fusion attention module is as follows:
[0038] Process 1, Channel Attention Weighting: Global average pooling is performed on the input features to obtain the channel description vector. This vector is then input into the channel weight generation network, which consists of two fully connected layers and an activation function. The output channel weights are consistent with the number of input feature channels. Feature channel recalibration is achieved by multiplying them channel by channel.
[0039] Step 2, pixel-level feature weighting: Perform a 1×1 convolution operation on the recalibrated features of the channels to generate a pixel weight matrix with the same size as the input feature space. Pixel-level feature weighting is achieved by multiplying the matrix pixel by pixel.
[0040] Step 3, Spatial Attention Weighting: After weighting the pixel features, perform max pooling and average pooling in the channel dimension respectively. Concatenate the two pooling results and input them into a 3×3 convolutional layer to generate a spatial weight map. Spatial attention weighting is achieved by multiplying position by position to highlight the cell target-related regions.
[0041] The collaborative attention mechanism includes cross-head attention units (IHAM) and two-layer routing attention units (BRA) that are connected in sequence according to the data flow.
[0042] The cross-head attention unit is used to achieve global feature interaction across attention heads on high-level features through learnable head tokens. The learnable head token is a feature vector with trainable parameters, dimensions, and feature map channel number adaptation. It is used to establish semantic associations between different attention heads and complete the global context. Specifically, it includes: reshaping the input features into a sequence representation, generating a preset number (8 or 16, preferably 16) of learnable head token feature vectors through a learnable parameter matrix or linear projection layer, supplementing spatial location information by combining position encoding tensors, and then inputting multi-head self-attention (MHA) to calculate and output context features.
[0043] The dual-layer routing attention unit receives the output feature map from the cross-head attention unit and performs the following operations: ① Divide the feature map into G×G regions (G is a preset integer, either 8 or 16, preferably 8); ② Perform average pooling on the features of each region to obtain a region feature vector (or obtain it by weighted aggregation); ③ Calculate the cosine similarity between the IHAM output feature and the feature vectors of each region, and construct a routing index matrix (this matrix has a dimension of 1×G², and the matrix elements are the cosine similarity values corresponding to each region, used to characterize the correlation between the region and the cell target); ④ Dynamically select the Top-k high-scoring regions from high to low scores (k is 15%–35% of the total number of regions, preferably 25%); ⑤ Construct key vectors and value vectors only based on the Top-k regions and perform sparse attention calculation. Regions not selected do not participate in key-value vector construction and attention weight calculation.
[0044] The multi-scale detection module includes four detection heads with different spatial resolutions. When the input image is normalized to a preset input resolution, the feature map resolutions corresponding to the four detection heads are 160×160, 80×80, 40×40, and 20×20, respectively. The 160×160 detection head is used to capture subcellular structures or tiny cells with a very small pixel ratio. The four detection heads work together to cover the full scale range from subcellular to cell clusters. At the same time, the outputs of the four detection heads are fused using a non-maximum suppression method to eliminate redundant detection boxes.
[0045] It also includes a training module, which is used to calculate the bounding box regression loss using the Cell-AIoU loss function during the model training phase. The value of the exponential factor ranges from 2 to 4, with a preferred value of 4; the value of the balancing weight ranges from 0.3 to 0.7, with a preferred value of 0.5.
[0046] A cross-head attention enhancement method for cell detection in medical images includes the following specific steps:
[0047] S1: Preprocess the input medical image, including at least size normalization, pixel value standardization, and data augmentation; S2: Extract features through a pre-feature encoding module, where global enhancement is performed by a global feature fusion module: the input features are sequentially passed through two concatenated channel, pixel, and spatial fusion attention modules to perform channel, pixel, and spatial attention weighting, then fine-tuned by parallel PA and CA sub-modules, and finally fused with the original input features through cross-layer identity residual connections; the output is processed according to the data flow order of the cross-head attention unit and the dual-layer routing attention unit: the cross-head attention unit reshapes the input features to generate a learnable head token (dimension adapted to the number of channels in the feature map), and after combining it with position encoding, inputs it to calculate the context features using multi-head self-attention (MHA); the dual-layer routing attention unit first divides the feature map output by the cross-head attention unit into G×G regions, and constructs a routing index matrix by extracting region feature vectors and calculating cosine similarity, and then selects the Top-k. S3: Construct key-value vectors for high-scoring regions and perform sparse attention computation; S4: Perform multi-scale fusion of enhanced high-order semantic features and / or high-level features through a cross-resolution feature reorganization unit; S5: Perform parallel prediction of the fused multi-scale features through a multi-scale detection module to obtain initial detection results, wherein the multi-scale detection module includes four detection heads with different resolutions, including at least a 160×160 detection head for detecting extremely small targets; S6: Post-process the initial detection results and output the final cell localization and classification information, wherein the post-processing preferably includes non-maximum suppression; wherein, during the model training stage, the bounding box regression loss is calculated using the Cell-AIoU loss function and jointly optimized in conjunction with the classification loss to improve the localization accuracy of cell targets in medical images.
[0048] In summary, Figure 1 The overall architecture of the system of this invention is demonstrated. Its data processing flow is as follows: Medical images, after preprocessing, are input to an improved pre-feature encoding module. Preprocessing specifically includes size normalization to a preset resolution, pixel value standardization, and data enhancement operations such as random flipping, rotation, and color jittering (including but not limited to the above methods), before being input to the improved pre-feature encoding module. In this network, features first pass through a global feature fusion processing module (…). Figure 3 (Details to follow) Early enhancement is performed. Specifically, the input features are sequentially passed through two FCPS modules (FCPS stands for "Channel-Pixel-Spatial" Fusion Attention Module). Each module performs an attention weighting process of 'channel → pixel → space', and then fine-tunes them in parallel through pixel attention (PA) and channel attention (CA) sub-modules. Finally, the output is fused with the original input through residual connections. This process emphasizes channel response, key pixels, and spatial location, effectively suppressing tissue background noise.
[0049] In one embodiment, the data preprocessing module uniformly scales the input medical image to a preset input resolution of 640×640 and performs pixel value standardization. The pre-feature encoding module and the cross-resolution feature reconstruction unit adopt a multi-scale downsampling and upsampling structure, so that the feature map scale output to the multi-scale detection module corresponds to 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the input scale, respectively. Therefore, when the input resolution is 640×640, the corresponding generated feature map resolutions are 160×160, 80×80, 40×40, and 20×20, respectively, and are connected to four detection heads for parallel prediction. Subsequently, the features are further abstracted through the intermediate layer of the pre-feature encoding module. In the final stage of the pre-feature encoding module, the features are fed into a collaborative attention mechanism (…). Figure 2 (Detailed explanation). First, define the core variable: the input feature tensor is X, with dimension 1. (B is the effective batch size, C is the number of channels, and H and W are the feature map height and width, respectively); the number of learnable head tokens (with trainable parameters, used to establish semantic associations between attention heads) is [number missing]. (Optional 8 or 16, preferred 16); Head token tensor is , dimension (D is the feature dimension); the position encoding tensor is P, used to supplement spatial position information; the layer normalization operation is denoted as... .
[0050] This collaborative attention mechanism first processes the input feature X through an inter-head attention unit (IHAM): reshaping the input feature X into... Then generated through linear projection A learnable head token ,Will After being added to the positional encoding P, it is combined with the layer-normalized input features. Multi-head self-attention computation is performed on the common input to obtain the context feature tensor. This enables global information interaction across attention heads, providing a semantically complete contextual basis for subsequent region focusing. Next, the output of IHAM... The data is fed into a two-layer routing attention unit (BRA): the feature map region partitioning size is defined as G (optional 8×8 or 16×16, preferably 8); the feature vector of the i-th query region is... (i.e., IHAM output) The local features), the routing index matrix (a scoring matrix representing the relevance of a region to a cell target) are In attention calculation, the query vector is q (derived from...). The key vector is Key (region feature), and the value vector is Value (region feature), with the feature dimensions consistent with D above. BRA will use the feature map... Divide the data into G×G regions, and construct the region by calculating the cosine similarity between q and Key. The top-k regions (k is 15%-35% of the total number of regions, preferably 25%) are dynamically selected as key-value pairs for sparse attention calculation. The attention weight calculation formula is as follows: This design achieves efficient feature focusing and significantly filters background noise irrelevant to cell regions. In this process, IHAM's global interactive features provide crucial contextual support for BRA's region selection, enabling the routing index matrix to more accurately filter cell-related regions. If the order of these two is reversed, BRA will focus on regions based on the original high-level features, lacking global contextual guidance, making it difficult to accurately identify cell regions in dense scenes, causing subsequent IHAM global interactions to lose their specificity.
[0051] The high-level features enhanced by collaborative attention are then integrated and upscaled in a cross-resolution feature reorganization unit, generating feature maps at four resolutions (160×160, 80×80, 40×40, and 20×20). Four detector heads perform parallel predictions on these feature maps, with the 160×160 detector head specifically designed for detecting extremely small targets. The initial outputs of all detector heads are fused using non-maximum suppression to obtain the final cell bounding boxes, categories, and confidence scores.
[0052] During the training phase, the difference between the predicted bounding box and the labeled bounding box is calculated using the Cell-AIoU loss function. Definition: The intersection-union ratio is... The square of the Euclidean distance between the center points of the predicted bounding box and the ground truth bounding box is... The diagonal length of the smallest bounding rectangle covering both frames is c; the balancing weight is... (Values range from 0.3 to 0.7, with 0.5 being preferred); the prediction box width and height are respectively , The actual frame width and height are respectively , The exponential factor is w (ranging from 2 to 4, preferably 4). The total loss formula for Cell-AIoU is: Among them, shape penalty item Width ratio Height ratio This design makes the model extremely sensitive to subtle shape differences in cell bounding boxes, thus enabling a more accurate fit to the actual biological morphology of cells. Experiments show that the localization accuracy is optimal when w=4.
[0053] Figure 2 details the internal data flow of the collaborative attention mechanism. It clearly shows the concatenation sequence of 'IHAM→BRA': After receiving high-level features from the pre-feature encoding module, IHAM first generates learnable head tokens and concatenates them with the original features, completing global interaction across attention heads through multi-head self-attention computation; After receiving the output of IHAM, BRA first divides the feature map into multiple regions, constructs a routing index matrix, and dynamically selects the most relevant regions for sparse attention computation, finally outputting the enhanced features.
[0054] Figure 3 details the internal structure of the global feature fusion processing module: the input features first flow sequentially through two cascaded 'channel-pixel-spatial' fusion attention (FCPS) modules (see '1st FCPS' and '2nd FCPS' in the attached figure, which are the same modules as the 'channel, pixel, and spatial fusion attention module' mentioned earlier). Each module performs the steps of 'channel attention weighting → pixel-level weighting → spatial attention weighting'. Subsequently, the features are split into pixel attention (PA) and channel attention (CA) sub-modules for parallel fine-tuning (see 'parallel processing' path in the attached figure). Finally, the output is fused with the original input through cross-layer identity residual connections (see 'residual connection' label in the attached figure) to ensure the stability of feature enhancement.
[0055] The system of this invention, through the synergistic design of the above-mentioned staged feature enhancement, full-scale detection and refined loss optimization, can effectively address the detection challenges of medical cell images in practical applications and demonstrates superior performance.
[0056] The following are the experimental test results based on publicly available medical cell datasets:
[0057] 1. Experimental Setup
[0058] Datasets: ① The MoNuSAC dataset (containing 46,000 annotated cell nuclei, covering four cell types: epithelial cells, lymphocytes, macrophages, and neutrophils) is a publicly available dataset in the field of medical cell detection; ② The CoNSeP dataset (containing 24,319 annotated colorectal cancer cells, covering seven cell types) was publicly released by the University of Warwick in 2019. Both datasets employ "case-level hierarchical partitioning" (to avoid data leakage from the same case across sets), with a partition ratio of 80% for the training set, 10% for the validation set, and 10% for the test set, ensuring a consistent distribution of cell types.
[0059] Experimental environment: Based on the PyTorch 1.18 framework, trained for 200 epochs using an NVIDIA A800 GPU, with the AdamW optimizer (initial learning rate 0.00125, weight decay 0.0005).
[0060] Evaluation metrics: Strictly follow the COCO target detection standard. ① AP50: Average precision when IoU threshold = 0.5 (calculated by integrating the precision-recall curve over different confidence thresholds); ② Localization error: 1 - IoU value between predicted bounding box and ground truth bounding box (the lower the IoU, the greater the localization error); ③ Shape matching error: |(predicted bounding box width / predicted bounding box height) -(ground truth bounding box width / ground truth bounding box height)| (the smaller the difference, the better the shape matching).
[0061] 2. Experimental Results
[0062] Using the test sets of two datasets as the evaluation objects, and comparing them with YOLOv10, IHA-YOLO, and BGF-YOLO as benchmark models, the specific results are as follows:
[0063] 1) Small cell detection performance: The invention was tested on our own experimental equipment (NVIDIA A800 GPU). YOLOv10 achieved an AP50 of 45.8% for small lymphocyte detection on the MoNuSAC dataset. The invention, through the synergistic effect of the 160×160 high-resolution detection head and the global feature fusion processing module, achieved an AP50 of 51.0%, which is 5.2 percentage points higher than the benchmark model.
[0064] 2) Dense cell localization performance: Compared with the localization error of BGF-YOLO in dense cell regions of the CoNSeP dataset (15.8%), the localization error of this invention, optimized by the collaborative attention mechanism of IHAM+BRA, is reduced to 9.5%, which is 6.3 percentage points lower than the benchmark model;
[0065] 3) Bounding box shape matching performance: Compared with the CIoU loss in the MoNuSAC dataset, the Cell-AIoU loss of this invention, through the aspect ratio exponent penalty (w=4), has a measured shape matching error of 5.1%, which is 3.2 percentage points lower than the benchmark loss function.
[0066] 4) Module Combination and Sequential Ablation Experiments: To verify the effectiveness of module combination and cascade order, the performance of five combinations was tested: "IHAM alone", "BRA alone", "IHAM→BRA", "BRA→IHAM", and "Complete solution (global feature fusion processing + IHAM→BRA + four detection heads + Cell-AIoU)". (Based on the small cell detection task of the MoNuSAC dataset):
[0067] Module combination / sequence AP50 Positioning error Shape matching error standalone IHAM 40.3% 19.7% 9.5% stand-up bra 39.8% 20.1% 9.7% BRA→IHAM (reversed order) 42.5% 17.2% 8.8% IHAM→BRA (Invention sequence) 47.3% 12.1% 6.7% Complete solution (all modules collaborate) 51.0% 9.5% 5.1%
[0068] Experimental results show that when IHAM or BRA is used alone, the AP50 is less than 41%, and the localization error and shape matching error are relatively high, making it difficult to meet the needs of dense cell detection.
[0069] After reversing the serial order (BRA→IHAM), the AP50 is only 42.5%, which is 4.8 percentage points lower than the order of the present invention (IHAM→BRA), the positioning error is 5.1 percentage points higher, and the shape matching error is 2.1 percentage points higher, proving that the serial order has a significant impact on performance. The combination performance of the "IHAM→BRA" order of the present invention is the best, with an AP50 of 47.3%, which is significantly better than other combinations. This indicates that this order is not a conventional choice, but a logical design based on "global context completion → local precise focusing", which produces a synergistic effect that is not a simple superposition. The complete solution further improves the performance based on this optimal combination, verifying the effectiveness of the collaborative adaptation of each module.
[0070] Under the experimental conditions, a performance improvement trend was observed: the global feature fusion processing module improved the feature response value of the cell region by 28% and the background noise suppression rate reached 35%; the cascaded structure of IHAM and BRA improved the feature interaction efficiency by 40% and reduced the memory usage of sparse attention computation by 22%.
[0071] The experimental data above are the results obtained under the conditions of dataset partitioning, training hyperparameters and hardware environment described in this specification. They are used to illustrate the effects of the embodiments and do not constitute a limitation on the scope of protection of this invention.
[0072] Although the present invention has been described above with reference to embodiments, various modifications can be made and components can be replaced with equivalents without departing from the scope of the invention. In particular, as long as there is no structural conflict, the features in the disclosed embodiments can be combined with each other in any manner. The lack of an exhaustive description of these combinations in this specification is merely for the sake of brevity and resource conservation. Therefore, the present invention is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.
Claims
1. A cross-head attention enhancement system for cell detection in medical images, characterized in that, include: The data preprocessing module is used to perform size normalization, pixel value standardization, and data augmentation on the input medical images; The pre-feature encoding module, based on the YOLO series target detection architecture, performs multi-level visual representation extraction on the preprocessed medical images; A cross-resolution feature recombination unit, connected to the pre-feature encoding module, is used to perform cross-resolution feature recombination and spatial resolution restoration on high-order semantic features and high-level features refined by the collaborative attention mechanism. A multi-scale detection module, connected to the cross-resolution feature recombination unit, is used to perform parallel prediction of the fused multi-scale features and output cell detection results. The pre-feature encoding module has a global feature fusion processing module in its early layer. A collaborative attention mechanism is integrated at the end of the pre-feature encoding module and before the cross-resolution feature recombination unit.
2. The cross-head attention enhancement system for cell detection in medical images according to claim 1, characterized in that, The global feature fusion processing module includes two cascaded channel, pixel, and spatial fusion attention modules. After the two channel, pixel, and spatial fusion attention modules, the pre-feature encoding module is further configured with a pixel attention submodule and a channel attention submodule that are processed in parallel. The enhanced features are fused with the input features of the global feature fusion processing module through cross-layer identity residual connections.
3. The cross-head attention enhancement system for cell detection in medical images according to claim 2, characterized in that, The specific calculation process of the channel, pixel, and spatial fusion attention module is as follows: Process 1, Channel Attention Weighting: Global average pooling is performed on the input features to obtain the channel description vector. This vector is then input into the channel weight generation network, which consists of two fully connected layers and an activation function. The output channel weights are consistent with the number of input feature channels. Feature channel recalibration is achieved by multiplying them channel by channel. Step 2, pixel-level feature weighting: Perform a 1×1 convolution operation on the recalibrated features of the channels to generate a pixel weight matrix with the same size as the input feature space. Pixel-level feature weighting is achieved by multiplying the matrix pixel by pixel. Step 3, Spatial Attention Weighting: After weighting the pixel features, perform max pooling and average pooling in the channel dimension respectively. Concatenate the two pooling results and input them into a 3×3 convolutional layer to generate a spatial weight map. Spatial attention weighting is achieved by multiplying position by position to highlight the cell target-related regions.
4. The cross-head attention enhancement system for cell detection in medical images according to claim 1, characterized in that, The collaborative attention mechanism includes cross-head attention units and two-layer routing attention units connected in sequence according to the data flow. The cross-head attention unit is used to achieve global feature interaction across attention heads on high-level features through learnable head tokens. The learnable head token is a feature vector with trainable parameters, dimensions and feature map channel number adaptation, used to establish semantic associations between different attention heads and complete the global context. The dual-layer routing attention unit is used to receive the output feature map of the cross-head attention unit.
5. A cross-head attention enhancement system for cell detection in medical images according to claim 1, characterized in that, The multi-scale detection module includes four detection heads with different spatial resolutions. When the input image is normalized to a preset input resolution, the feature map resolutions corresponding to the four detection heads are 160×160, 80×80, 40×40 and 20×20, respectively.
6. A cross-head attention enhancement system for cell detection in medical images according to claim 1, characterized in that, It also includes a training module, which is used to calculate the bounding box regression loss using the Cell-AIoU loss function during the model training phase.
7. A method for enhancing cross-head attention for cell detection in medical images, characterized in that, The specific steps are as follows: S1: Preprocess the input medical image; S2: Extract features through the pre-feature encoding module, where the initial global feature fusion module performs global enhancement: the input features are sequentially passed through two concatenated channel, pixel, and spatial fusion attention modules to perform channel, pixel, and spatial attention weighting, then fine-tuned by parallel PA and CA sub-modules, and finally fused with the original input features through cross-layer identity residual connections; the output is processed according to the data flow order of the cross-head attention unit and the dual-layer routing attention unit: the cross-head attention unit reshapes the input features to generate a learnable head token, which is then combined with position encoding and input to multi-head self-attention calculation to obtain context features; the dual-layer routing attention unit first divides the feature map output by the cross-head attention unit into G×G regions, and constructs a routing index matrix through region feature vector extraction and cosine similarity calculation to select the Top-k. S3: Construct key-value vectors for high-scoring regions and perform sparse attention computation; S4: Perform multi-scale fusion of enhanced high-order semantic features and high-level features through cross-resolution feature recombination units; S5: Perform parallel prediction of fused multi-scale features through multi-scale detection modules to obtain initial detection results; S6: Post-process the initial detection results and output the final cell localization and classification information.