Medical cell automatic detection method based on PANet
By improving the PANet architecture and feature fusion technology, the problems of missed detection and false detection in blood cell detection of existing models have been solved, the detection effect of platelets and overlapping red blood cells has been improved, and higher recognition accuracy and computational efficiency have been achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHONGQING UNIV OF POSTS & TELECOMM
- Filing Date
- 2026-01-08
- Publication Date
- 2026-04-21
AI Technical Summary
Existing medical cell detection models suffer from missed or false detections when detecting platelets and overlapping red blood cells, and have difficulty effectively distinguishing white blood cells that are similar in shape and size. Furthermore, existing methods suffer from semantic information loss and excessive computational cost during feature fusion.
We adopt an improved PANet architecture, combining a feature pyramid network, a high-level feature collection module, and a top-down feature fusion module. Through cross-scale feature fusion and a lightweight RepC2f module, we enhance feature representation capabilities and reduce computational complexity. We also improve detection accuracy by utilizing a global attention module and loss function optimization.
It significantly improved the model's detection accuracy for platelets and overlapping red blood cells, enhanced its recognition capabilities in complex scenarios, reduced the number of parameters and computational complexity, and improved the overall accuracy of medical cell detection.
Smart Images

Figure CN121904006A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of medical cell classification and detection, and relates to an automated medical cell detection method based on PANet. Background Technology
[0002] To more efficiently assist doctors in diagnosing illnesses, research began on automated blood cell testing technologies. These technologies utilize neural network algorithms for supervised learning training on large datasets of blood cell sample images. The network continuously learns the characteristics of different cells, ultimately acquiring training weights for automated detection. Automated blood cell testing significantly reduces repetitive tasks for doctors, making blood cell tests more accurate and allowing doctors to focus more effectively on more complex medical diagnostic work.
[0003] Currently, the main detection network architecture is PAFPN, which not only propagates high-level features to low-level features from top to bottom, but also effectively transfers detailed information from low-level features to high-level features by adding a bottom-up path. This bidirectional path aggregation design allows feature layers at different scales to complement each other and fully fuse, thereby enhancing feature representation capabilities. However, the PAFPN architecture can only fuse adjacent features at different scales, while non-adjacent features can only be indirectly fused through intermediate features. This indirect feature fusion may result in the loss of important semantic information. Unlike PAFPN, Gold-YOLO proposes two modules, Low-GD and High-GD, to address the drawbacks of indirect feature fusion. These modules are placed in two different stages, FPN and PAFPN, to directly perform cross-scale feature fusion. The Low-GD and High-GD modules are responsible for collecting and aligning features at each level to generate global features, which are then distributed to each layer for fusion. However, while low-level features are simpler than high-level features, adding Low-GD to low-level networks reduces semantic information of different categories and increases unnecessary parameters and computation. On the other hand, collecting and distributing high-level features can effectively fuse more abstract features of different scales, enrich semantic information, and make the network more lightweight.
[0004] Based on the above analysis, existing models have the following limitations in detecting different cells: white blood cells are relatively large, which is beneficial for model detection, while platelets are very small, making it difficult for models to extract semantic information from platelets, leading to missed or false detections; in the detection of leukopenia cells, the five different cell types are very similar in morphology and size, making it difficult for models to distinguish them; red blood cells are the most numerous among blood cells, but existing models have missed detections, and many overlapping red blood cells are difficult to detect.
[0005] To overcome these limitations, numerous studies in medical image analysis have attempted to apply deep learning-based object detection methods to blood cell detection. By introducing Feature Pyramid Networks (FPNs), improved attention mechanisms, loss functions, and multi-scale feature fusion techniques, the performance of small object detection has been further improved, increasing the accuracy of blood cell detection and achieving better performance in blood cell counting. While these methods have improved the performance of blood cell detection models to some extent, limitations remain, particularly in identifying overlapping red blood cells and other objects.
[0006] Against this backdrop, it is particularly important to find ways to further enrich the semantic information of features and reduce semantic loss. By enhancing the discriminative power and robustness of features, we can break through the current performance bottleneck of overlapping blood cell detection and provide a more reliable solution for precision medical image analysis. Summary of the Invention
[0007] To address the aforementioned problems in the prior art, this invention employs an automatic medical cell detection method based on PANet, comprising: acquiring a medical image to be detected; inputting the medical image into a trained medical cell detection model to obtain detection results; the medical cell detection model is an improved PANet, comprising: a feature pyramid network, a high-level feature collection module, a top-down feature fusion module, and a detection head; the training process of the medical cell detection model includes:
[0008] S1. Obtain a medical image dataset. Input the medical images in the medical image dataset into a feature pyramid network to obtain feature maps at multiple different scales.
[0009] S2. Input multiple feature maps of different scales into the high-level feature collection module to obtain multiple enhanced feature maps of different scales;
[0010] S3. Input the maximum-scale feature map output by the feature pyramid network and multiple enhanced feature maps of different scales into the top-down feature fusion module to obtain multiple fused feature maps of different scales.
[0011] S4. Input the largest-scale feature map output by the feature pyramid network and the fused feature maps of multiple different scales into the detection head to obtain the detection result;
[0012] S5. Calculate the loss function value based on the detection results, update the parameters of the medical cell detection model based on the loss function value, and obtain the trained medical cell detection model when the loss function value is minimized.
[0013] The beneficial effects of this invention are as follows:
[0014] 1. Regarding the PAFPN architecture's propagation path, during feature fusion, features at different scales can only be fused sequentially, and features without adjacency cannot be directly fused. This invention uses a high-level feature collection module to directly fuse features at different scales across scales, while fully preserving the original PAFPN architecture. This design utilizes the PAFPN architecture to obtain features at different scales, establishes long-distance dependencies between features at different scales, generates rich semantic information at different scales, and then fuses it with corresponding local features. This not only enhances the efficiency of multi-scale information transmission but also significantly enriches the semantic information of different target categories, effectively improving the model's recognition accuracy in complex scenes, especially for small targets such as platelets and red blood cells with overlapping occlusions. 2. This invention uses a lighter RepC2f module to replace standard convolutions with reparameterized convolutions. During the training phase, it maintains a multi-branch structure to enhance feature representation capabilities, while during the inference phase, it uses structural reparameterization technology to merge multiple branches into a single convolutional layer, thereby significantly reducing the number of parameters and computational complexity. Attached Figure Description
[0015] Figure 1 A structural diagram of the medical cell detection model provided in an embodiment of the present invention;
[0016] Figure 2 A structural diagram of the high-level feature collection module provided in an embodiment of the present invention;
[0017] Figure 3 This is a structural diagram of the RepC2f module provided in an embodiment of the present invention;
[0018] Figure 4 This is a structural diagram of the RepBottle branch provided in an embodiment of the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] like Figure 1 As shown, this embodiment of the invention employs a PANet-based automatic medical cell detection method, comprising: acquiring a medical image to be detected; inputting the medical image into a trained medical cell detection model to obtain detection results; the medical cell detection model is an improved PANet, comprising: a feature pyramid network, a high-level feature collection module, a top-down feature fusion module, and a detection head; the training process of the medical cell detection model includes:
[0021] S1. Obtain a medical image dataset. Input the medical images from the dataset into a feature pyramid network to obtain feature maps at multiple different scales. ;
[0022] The feature pyramid network consists of a backbone network and a bottom-up feature fusion module. The backbone network consists of a convolutional module (conv) and RepBlocks (reparameterization blocks) connected in series at layer A. The bottom-up feature fusion module includes: an Upsample module with alternating B-layer connections. and the fusion module (feature fusion module) Each layer of reparameterization block is horizontally connected to the corresponding layer's feature fusion module to fuse features from different layers.
[0023] Feature maps of multiple different scales This refers to the feature maps output by the last reparameterized block of the feature pyramid network and the upsampling modules of each layer.
[0024] S2. Input multiple feature maps of different scales into the high-level feature collection module to obtain multiple enhanced feature maps of different scales;
[0025] The high-level feature collection module includes: a feature alignment module and a global attention module; such as Figure 2 As shown, the high-level feature collection module processes feature maps of multiple different scales, including: [The text abruptly ends here, so the translation stops.] Input the feature alignment module to obtain the aligned feature map. ; Aligned feature maps Input the global attention module to obtain the global feature map. ; for global feature map Upsampling and subsampling are performed to obtain global feature maps at multiple different scales. Global feature map Scale and feature map The scales are mapped one-to-one; the global feature map at each scale is mapped... Feature maps of corresponding scales By fusing the data, multiple enhanced feature maps of different scales are obtained. .
[0026] The feature alignment module aligns feature maps at multiple different scales. The processing includes: processing feature maps at different scales. Perform upsampling and downsampling separately to obtain multiple feature maps of the same scale. Concatenate all feature maps of the same scale to obtain an aligned feature map. .
[0027] In one embodiment, three features collected at different scales are upsampled and downsampled to unify the scale. Larger-scale features are downsampled to align with the medium-scale features; smaller-scale features are upsampled (U) to align with the medium-scale features. The processing is represented as follows:
[0028]
[0029]
[0030]
[0031] ,
[0032] in, For multi-scale feature maps, These are large-scale, medium-scale, and small-scale features, respectively. This is a downsampling module with a kernel size of 3 and a stride of 2. For the upsampling module, bilinear interpolation is used for upsampling; both are aligned with a medium scale. Space dimensions alignment; For feature splicing module, This indicates a connection along the first-dimensional channel of the feature.
[0033] The global attention module includes a convolutional module, a Transformer module, and a RepC2f module. The global attention module processes the aligned feature maps by: inputting the aligned feature maps into the convolutional module to adjust the number of channels to an appropriate size, and outputting the feature maps from the convolutional module. Flatten ( Let be a one-dimensional feature vector. Input the Transformer module to perform intra-scale feature fusion to obtain the initial global features. ; Initial global features Inputting the RepC2f module yields the final global feature map. .
[0034] Preferably, the size of the convolutional module is 1. .
[0035] The processing formula for the global attention module is as follows:
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042] in, Let represent the query vector, key vector, and value vector of the Atten module, respectively, and W represent the learnable weight vector. Represents the key vector The vector dimension is defined by FFN (Fully Connected N) and Norm (Normalized N) layers. This indicates a fixed sine wave position encoding.
[0043] like Figure 3 As shown, the RepC2f module includes: a first convolutional module (with a kernel size of [missing information]). ), the second convolutional module (convolutional kernel size is The RepC2f module includes the RepBottle module; the RepBottle module consists of L sequentially connected RepBottle branches; the RepC2f module processes the initial global feature map, including:
[0044] Step 1: Input the initial global feature map into the first convolutional module for channel adjustment, and divide the features output by the first convolutional module along the channel dimension to obtain two sub-features. ;
[0045] Step 2: Input one of the sub-features into the first RepBottle branch, and input the output of the first RepBottle branch into the second RepBottle branch;
[0046] Step 3: Input the output of the previous RepBottle branch into the current RepBottle branch;
[0047] Step 4: Repeat step 3 until you get the output of the last RepBottle branch;
[0048] Step 5: Concatenate the outputs of all RepBottle branches with another sub-feature, and input the concatenated feature into the second convolutional module for channel adjustment to obtain the output of the RepC2f module, which is the final global feature map. .
[0049] The processing formula of the RepC2f module is as follows:
[0050]
[0051]
[0052]
[0053] …
[0054]
[0055] in, This means that the feature is divided into two equal parts along the channel. This is the l-th RepBottle branch.
[0056] like Figure 4 As shown, the RepBottle branch includes multiple convolutional branches; the current RepBottle branch processes the output of the previous RepBottle branch by: inputting the output of the previous RepBottle branch into each convolutional branch respectively, adding the outputs of all convolutional branches to the output (identity) of the previous RepBottle branch, and then summing the results. Perform convolution, add the convolutional features to the output of the previous RepBottle branch, and obtain the output features. .
[0057] In one embodiment, two convolutional branches are included, respectively and The specific formula for the RepBottle branch processing is as follows:
[0058]
[0059]
[0060] S3. Input the maximum-scale feature map output by the feature pyramid network and multiple enhanced feature maps of different scales into the top-down feature fusion module to obtain multiple fused feature maps of different scales.
[0061] The top-down feature fusion module includes: multiple convolutional modules and multiple feature fusion modules;
[0062] The top-down feature fusion module's processing includes:
[0063] S31. Input the feature map of the largest scale output by the feature pyramid network into the first convolutional module;
[0064] S32. Input the output of the first convolutional module and its enhanced feature map of the same scale into the first feature fusion module to obtain the fused feature map of the first scale;
[0065] S33. Input the output of the previous feature fusion module into the current convolutional module;
[0066] S34. Input the output of the current convolutional module and its enhanced feature map of the same scale into the current feature fusion module to obtain the fused feature map of the current scale;
[0067] S35. Repeat steps S33 to S34 until the fused feature map output by the last feature fusion module is obtained.
[0068] S4. Input the largest-scale feature map output by the feature pyramid network and the fused feature maps of multiple different scales into the detection head to obtain the detection result;
[0069] The detection results include the predicted bounding box and its category confidence score.
[0070] S5. Calculate the loss function value based on the detection results, update the parameters of the medical cell detection model based on the loss function value, and obtain the trained medical cell detection model when the loss function value is minimized.
[0071] This invention achieves joint optimization of classification loss. Regression loss With distribution focus loss If high-precision target detection is achieved, then the loss function... .
[0072] Classification loss :
[0073]
[0074] in, Indicates the number of predicted bounding boxes. Indicates the total number of target categories; This indicates that, based on the actual annotation, the first... Does the predicted bounding box belong to the first...? kind; This represents the Sigmoid function; Indicates the output of the detection head. The predicted bounding box is at the _th _th Class confidence score on the class, This is a modulation factor used to adjust the weights of different samples in the loss function.
[0075] Regression loss CIoU Loss is used, and its calculation form is shown in the following formula:
[0076]
[0077] in, To predict the intersection-union ratio (IoU) between the bounding box and the ground truth box, This represents the Euclidean distance between the center point of the predicted bounding box and the center point of the ground truth bounding box. Let this be the diagonal length of the smallest bounding rectangle that simultaneously encloses the predicted bounding box and the ground truth bounding box. This represents the aspect ratio consistency coefficient. This is the weighting factor used to balance the aspect ratio term.
[0078] Distribution focus loss The calculation formula is shown below:
[0079]
[0080] Where j is the discretized position index (corresponding to the discrete interval of the bounding box coordinates, for example, the coordinate range is divided into multiple small grids, and j represents the j-th grid). , This represents the discrete interval range corresponding to the target location. This represents the discrete label corresponding to the target location. This represents the discrete probability distribution predicted by the model (the probability output by the model for each discrete interval j, representing the likelihood that the predicted coordinates fall within that interval).
[0081] The above-described embodiments further illustrate the purpose, technical solution, and advantages of the present invention. It should be understood that the above-described embodiments are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made to the present invention within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for automated detection of medical cells based on PANet, characterized in that, include: Acquire the medical image to be detected, input the medical image into the trained medical cell detection model, and obtain the detection result; medicine The cell detection model is an improved PANet, including: a feature pyramid network, a high-level feature collection module, a top-down feature fusion module, and a detection head; the training process of the medical cell detection model includes: S1. Obtain a medical image dataset. Input the medical images in the medical image dataset into a feature pyramid network to obtain feature maps at multiple different scales. S2. Input multiple feature maps of different scales into the high-level feature collection module to obtain multiple enhanced feature maps of different scales; S3. Input the maximum-scale feature map output by the feature pyramid network and multiple enhanced feature maps of different scales into the top-down feature fusion module to obtain multiple fused feature maps of different scales. S4. Input the largest-scale feature map output by the feature pyramid network and the fused feature maps of multiple different scales into the detection head to obtain the detection result; S5. Calculate the loss function value based on the detection results, update the parameters of the medical cell detection model based on the loss function value, and obtain the trained medical cell detection model when the loss function value is minimized.
2. The automated medical cell detection method based on PANet according to claim 1, characterized in that, The high-level feature collection module includes a feature alignment module and a global attention module; the high-level feature collection module processes feature maps of multiple different scales, including: [the module then processes feature maps of multiple different scales]. Input the feature alignment module to obtain the aligned feature map. ; Aligned feature maps Input the global attention module to obtain the global feature map. ; for global feature map Upsampling and subsampling are performed to obtain global feature maps at multiple different scales. ; global feature maps at each scale Feature maps of corresponding scales By fusing the data, multiple enhanced feature maps of different scales are obtained. .
3. The automated medical cell detection method based on PANet according to claim 2, characterized in that... The alignment module aligns feature maps at multiple different scales. The processing includes: processing feature maps at different scales. Perform upsampling and downsampling separately to obtain multiple feature maps of the same scale. Then, concatenate all feature maps of the same scale to obtain an aligned feature map. .
4. The automated medical cell detection method based on PANet according to claim 2, characterized in that, The global attention module includes a convolutional module, a Transformer module, and a RepC2f module. The global attention module processes the aligned feature map by: inputting the aligned feature map into the convolutional module, flattening the output feature map into a one-dimensional feature vector, inputting the one-dimensional feature vector into the Transformer module to obtain the initial global features, and inputting the initial global features into the RepC2f module to obtain the final global feature map. .
5. The automated medical cell detection method based on PANet according to claim 4, characterized in that, The RepC2f module includes: a first convolutional module, a second convolutional module, and a RepBottle module; the RepBottle module includes multiple RepBottle branches connected in sequence; the RepC2f module processes the initial global feature map including: Step 1: Input the initial global feature map into the first convolutional module, and divide the features output by the first convolutional module along the channel dimension to obtain two sub-features; Step 2: Input one of the sub-features into the first RepBottle branch, and input the output of the first RepBottle branch into the second RepBottle branch; Step 3: Input the output of the previous RepBottle branch into the current RepBottle branch; Step 4: Repeat step 3 until you get the output of the last RepBottle branch; Step 5: Concatenate the outputs of all RepBottle branches with another sub-feature, and input the concatenated feature into the second convolutional module to obtain the final global feature map. .
6. The automated medical cell detection method based on PANet according to claim 5, characterized in that, The kernel sizes of the first and second convolutional modules are: .
7. The automated medical cell detection method based on PANet according to claim 5, characterized in that, The RepBottle branch includes multiple convolutional branches; The current RepBottle branch processes the output of the previous RepBottle branch by: inputting the output of the previous RepBottle branch into each convolutional branch, adding the outputs of all convolutional branches to the output of the previous RepBottle branch, convolving the summed result, and adding the convolutional features to the output of the previous RepBottle branch to obtain the output features.
8. The automated medical cell detection method based on PANet according to claim 1, characterized in that, The feature pyramid network consists of a backbone network and a bottom-up feature fusion module. The backbone network consists of a convolutional module and multiple layers of reparameterized blocks connected in series. The bottom-up feature fusion module consists of multiple layers of alternating upsampling modules and feature fusion modules. Each layer of reparameterized blocks is horizontally connected to the corresponding layer's feature fusion module. The feature maps at different scales output by the feature pyramid network are the feature maps output by the last layer of the reparameterized block and the upsampling modules of each layer.
9. The automated medical cell detection method based on PANet according to claim 1, characterized in that, The top-down feature fusion module includes: multiple convolutional modules and multiple feature fusion modules; the processing steps of the top-down feature fusion module include: S31. Input the feature map of the largest scale output by the feature pyramid network into the first convolutional module; S32. Input the output of the first convolutional module and its enhanced feature map of the same scale into the first feature fusion module to obtain the fused feature map of the first scale; S33. Input the output of the previous feature fusion module into the current convolutional module; S34. Input the output of the current convolutional module and its enhanced feature map of the same scale into the current feature fusion module to obtain the fused feature map of the current scale; S35. Repeat steps S33 to S34 until the fused feature map output by the last feature fusion module is obtained.
10. The automated medical cell detection method based on PANet according to claim 1, characterized in that, loss function ;in, These are classification loss, regression loss, and distribution focus loss, respectively.