Training method and device of improved YOLO model for cell detection, cell detection method and device based on improved YOLO model, equipment and computer program product
Patent Information
- Application Number
- CN202610798659.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-04
- Publication Date
- 2026-10-20
AI Technical Summary
[0004]然而,在面对真实世界中复杂多变的显微图像时,尤其是在处理病理切片、细胞培养皿等高密度、高难度场景时,相关技术仍存在一些关键缺陷,例如对不规则形态细胞的特征提取能力不足、微小细胞的检测漏检率高、密集粘连细胞的区分与识别困难以及特征融合机制不够智能而造成信息损失等
本申请实施例通过在骨干网络深层引入C2f-MAA模块增强模型对不规则细胞形态的自适应感知能力,在颈部网络中新增P2高分辨率分支并采用GCF门控融合方式保留微小目标特征与浅层细节,同时引入排斥损失以增强对密集粘连细胞的分离学习能力,因而有助于提高细胞检测的精度、鲁棒性及对复杂场景的适应能力。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This application relates to the fields of biomedical image processing and artificial intelligence technology, specifically to a training method and apparatus for an improved YOLO model for cell detection, a cell detection method and apparatus based on the improved YOLO model, equipment, and computer program products. Background Technology
[0002] In modern clinical medical diagnosis (such as hematological analysis and pathological slide examination) and life science research, quantitative (counting) and qualitative (morphological, size) analysis of cells are fundamental to obtaining key biological information. Traditional manual microscopic examination methods are not only inefficient and labor-intensive, but also prone to being influenced by the observer's subjective experience, resulting in poor consistency. Therefore, developing rapid, accurate, and objective automated cell detection technologies has significant application value.
[0003] In recent years, single-stage object detection models, represented by the YOLO (You Only Look Once) series of algorithms, have become a research hotspot in this field due to their excellent balance between detection speed and accuracy. The core idea of these technologies is typically to leverage the powerful feature extraction and regression prediction capabilities of the YOLO algorithm to achieve end-to-end detection of cellular targets. These schemes modify the standard YOLO architecture to varying degrees to adapt to the unique challenges of cellular images, such as small target size, irregular shape, and dense adhesion.
[0004] However, when faced with complex and varied microscopic images in the real world, especially when dealing with high-density and high-difficulty scenarios such as pathological sections and cell culture dishes, the relevant technologies still have some key shortcomings. For example, the ability to extract features of irregularly shaped cells is insufficient, the detection rate of tiny cells is high, it is difficult to distinguish and identify densely adhered cells, and the feature fusion mechanism is not intelligent enough, resulting in information loss. Summary of the Invention
[0005] In view of this, this application proposes a training method and apparatus for an improved YOLO model for cell detection, a cell detection method and apparatus based on the improved YOLO model, equipment, and computer program products, to improve the accuracy, robustness, and adaptability to irregular shapes, small targets, and densely adhered scenarios in cell detection. Specifically, this application achieves this through the following technical solutions: According to a first aspect of the embodiments of this specification, a method for training an improved YOLO model for cell detection is provided, the method comprising the following steps: Step S11: Construct a training dataset for the improved YOLO model, wherein the training dataset includes cell images and cell image annotation information; Step S12: Construct an improved YOLO model based on the original YOLOv8 network. The improved YOLO model is a unified detection network that integrates a hybrid-scale C2f-MAA backbone network, an MFE-Neck network, a detection head network, and a predefined loss function. Step S13: Input the cell image into the hybrid-scale C2f-MAA backbone network for multi-scale feature extraction to obtain the multi-scale feature extraction result; Step S14: Based on the multi-scale feature extraction results, the MFE-Neck network is used to perform neck feature fusion and multi-scale prediction to obtain multi-scale predicted features. Step S15: Based on the multi-scale prediction features, perform cell detection using the detection head network and output the cell detection results; Step S16: Based on the cell detection results and the annotation information of the cell image, calculate the loss value of the improved YOLO model using the predefined loss function, and iteratively update the network parameters of the improved YOLO model based on the loss value until the model converges.
[0006] According to a second aspect of the embodiments of this specification, a cell detection method based on an improved YOLO model is provided, the cell detection method based on the improved YOLO model comprising the following steps: Step S21: Obtain an image of the cell to be detected; Step S22: Input the cell image to be detected into the improved YOLO model for cell detection to obtain cell detection results, which include cell location, category and count information; The improved YOLO model for cell detection is trained based on the training method of the improved YOLO model for cell detection described in any of the preceding claims.
[0007] According to a third aspect of the embodiments of this specification, a training apparatus for an improved YOLO model for cell detection is provided, the training apparatus for the improved YOLO model for cell detection comprising: The first building unit is used to build a training dataset for the improved YOLO model, wherein the training dataset includes cell images and cell image annotation information; The second building unit is used to build an improved YOLO model based on the original YOLOv8 network. The improved YOLO model is a unified detection network that integrates a hybrid-scale C2f-MAA backbone network, an MFE-Neck network, a detection head network, and a predefined loss function. A multi-scale feature extraction unit is used to input the cell image into the hybrid-scale C2f-MAA backbone network to perform multi-scale feature extraction and obtain multi-scale feature extraction results. The multi-scale prediction unit is used to perform neck feature fusion and multi-scale prediction using the MFE-Neck network based on the multi-scale feature extraction results, so as to obtain multi-scale prediction features. The first cell detection unit is used to perform cell detection using the detection head network based on the multi-scale prediction features and output the cell detection results. The iterative update unit is used to calculate the loss value of the improved YOLO model using the predefined loss function based on the cell detection results and the annotation information of the cell image, and to iteratively update the network parameters of the improved YOLO model based on the loss value until the model converges.
[0008] According to a fourth aspect of the embodiments of this specification, a cell detection device based on an improved YOLO model is provided, the cell detection device based on the improved YOLO model comprising: An acquisition unit is used to acquire images of the cells to be detected; The second cell detection unit is used to input the cell image to be detected into an improved YOLO model for cell detection to obtain cell detection results, which include cell location, category and count information; The improved YOLO model for cell detection is trained based on the training method of the improved YOLO model for cell detection described in any of the preceding claims.
[0009] According to a fifth aspect of the embodiments of this specification, an apparatus is provided, comprising: A processor; and a computer-readable storage medium storing computer program instructions that, when executed by the processor, cause the processor to perform the training method for the improved YOLO model for cell detection described in any of the preceding claims, and / or the aforementioned cell detection method based on the improved YOLO model.
[0010] According to a sixth aspect of the embodiments of this specification, a computer program product is provided, the computer program product comprising a computer program / instruction, which, when executed by a processor, implements the training method for the improved YOLO model for cell detection as described in any of the preceding claims, and / or implements the aforementioned cell detection method based on the improved YOLO model.
[0011] The embodiments of this application have at least the following technical effects: This application's embodiments enhance the model's adaptive perception capability for irregular cell morphology by introducing a C2f-MAA module into the deep layers of the backbone network. A new P2 high-resolution branch is added to the neck network, and GCF-gated fusion is used to retain small target features and shallow details. At the same time, a repulsion loss is introduced to enhance the separation and learning capability for densely adhered cells. Therefore, it helps to improve the accuracy, robustness, and adaptability to complex scenarios of cell detection. Attached Figure Description
[0012] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart illustrating a training method for an improved YOLO model used for cell detection, as described in an embodiment of this application. Figure 2 This is a schematic diagram of the overall framework of an improved YOLO model in an embodiment of this application; Figure 3 This is a schematic diagram of the internal structure of a C2f-MAA module in an embodiment of this application; Figure 4 This is a schematic diagram of the internal structure of a GCF module in an embodiment of this application; Figure 5 This is a schematic flowchart of a cell detection method based on an improved YOLO model in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of a training device for an improved YOLO model for cell detection, as described in an embodiment of this application. Figure 7 This is a schematic diagram of the structure of a cell detection device based on an improved YOLO model in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of a device according to an embodiment of this application. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0014] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0015] The main cell detection solutions based on YOLO networks in related technologies include: Chinese patent application CN107527009A discloses a video object detection method based on a YOLO network. This approach represents a general technical path for applying the standard YOLO framework to specific detection tasks. Its core technical measures include: (1) Model Training: First, an image dataset containing the targets to be detected is constructed, and the targets are manually labeled to obtain the category label and location coordinates of each target. Then, the dataset is used to perform supervised training on the pre-set YOLO neural network model. During the training process, the model continuously optimizes its internal weights through the backpropagation algorithm and learns the complex mapping relationship from image pixels to "target category + location".
[0016] (2) Real-time detection and filtering: After training, the video frames or images to be detected are input into the model. In one forward pass, the YOLO network can simultaneously predict the bounding boxes, confidence scores (i.e., the probability that the box contains the target) and class probabilities of all possible targets in the image.
[0017] (3) Post-processing: Finally, most of the background predictions are filtered out by setting a confidence threshold, and the non-maximum suppression (NMS) algorithm is used to merge multiple repeated prediction boxes pointing to the same target, and the final detection result is output.
[0018] This scheme demonstrates a basic YOLO application process, which verifies the feasibility of the YOLO algorithm in specific target detection tasks, but it does not perform in-depth optimization for the characteristics of biological cells, such as their variable morphology and large size differences.
[0019] A research paper titled "TW-YOLO: An Innovative Blood Cell Detection Model Based on Multi-Scale Feature Fusion" (published in Sensors, 2024, 24(12), 3848) proposes a TW-YOLO model deeply customized for blood cell detection tasks. Based on the YOLOv8 framework, this approach makes several refined improvements to address the challenges in cell detection, representing a representative advanced solution in the current technology. Its technical components are as follows: (1) Optimized backbone network: To extract the geometric and texture features of cells more effectively, this approach replaces some of the standard convolutions in the YOLOv8 backbone network with a module called RFAConv (Receptive Field Attention Convolution). The core mechanism of RFAConv is to capture multi-scale contextual information by using multiple convolutional kernels with different dilation rates in parallel, and to use an attention mechanism to dynamically assign weights to the features of these different receptive fields. This enables the network to adaptively focus on the feature scales most important for current cell recognition, improving the ability to express the features of cells with different morphologies.
[0020] (2) Enhanced Multi-Scale Feature Fusion Neck Layer: YOLO's Neck layer is responsible for fusing deep semantic features and shallow detail features extracted by the backbone network. To improve fusion efficiency, this scheme has made two improvements: First, an EMA (Efficient Multi-scale Attention) module is integrated into the top-down path of the feature pyramid to more efficiently capture long-range dependencies between different feature maps before cross-scale feature fusion. Second, an additional CBAM (Convolutional Block Attention Module) is added to the final detection head used for prediction. This module sequentially applies channel attention and spatial attention, allowing the network to perform a final feature refinement on the feature map before outputting the detection result, further focusing on the most informative feature channels and spatial regions.
[0021] (3) Lightweighting and Training Optimization: To balance accuracy and speed, this scheme introduces GhostModule to replace part of the standard convolution. By generating feature maps, it significantly reduces the number of model parameters and computational complexity while maintaining performance. In addition, the PGI-Ghost (Post-processing Gradient Information-Ghost) strategy is adopted. This strategy aims to optimize the gradient propagation path during training, ensuring that the model can still be trained stably and efficiently even after using the lightweight module, and obtain better detection accuracy.
[0022] However, when faced with the complex and varied microscopic images in the real world, especially when dealing with high-density and high-difficulty scenarios such as pathological sections and cell culture dishes, the above-mentioned technologies still have the following key shortcomings: (1) Insufficient ability to extract features from irregularly shaped cells: Key research subjects such as cancer cells and activated immune cells often exhibit highly irregular and non-rigid morphologies. Existing technical solutions (including RFAConv used in TW-YOLO) mostly rely on convolution kernels with fixed rectangular shapes for feature extraction. When encountering irregular cell boundaries, this rigid sampling method inevitably captures a large amount of irrelevant background information or interference information from neighboring cells, causing feature aliasing and ultimately leading to inaccurate cell localization and misclassification.
[0023] (2) High false negative rate for detecting tiny cells: In the standard YOLO architecture (such as YOLOv8), the input image is downsampled through multiple layers of the backbone network (usually at least 8 times) before entering the detection head. For tiny cells that are only a few pixels in size, their already weak feature information is easily diluted or even completely lost in this process. Therefore, even improved models such as TW-YOLO still have structural defects that ignore tiny targets because their network structure does not fundamentally change the way they utilize high-resolution feature maps, leading to serious false negative problems.
[0024] (3) Difficulty in distinguishing and identifying densely clustered cells: This is the most critical bottleneck in automated cell detection. When cells are densely packed or adhered to each other, the predicted bounding boxes of different cells will highly overlap. Existing technical solutions heavily rely on the Non-Maximum Suppression (NMS) algorithm for post-processing. NMS only uses the single geometric criterion of Intersection over Union (IoU) to eliminate redundant boxes. When the IoU value of the correct predicted boxes of two adjacent different cells is too high, NMS will arbitrarily delete one of them, directly leading to cell counting errors. This strategy of relying entirely on the post-processing stage to solve the adhesion problem is the root cause of poor detection performance in dense scenes.
[0025] (4) The feature fusion mechanism is not intelligent enough, resulting in information loss: In the neck layer of YOLO, it is crucial to fuse deep semantic information with shallow positional information. Existing solutions generally adopt a simple upsampling and concatenation operation, which is a non-adaptive fusion that cannot intelligently weigh the importance of semantics and details according to the actual needs of different regions. This crude fusion method often leads to information conflicts. For example, the strong semantics of deep features may suppress important cell edge details in shallow features, and vice versa, thereby reducing the final localization accuracy.
[0026] Based on this, embodiments of this application provide a training method for an improved YOLO model for cell detection, such as... Figure 1 As shown, Figure 1This is a flowchart illustrating a training method for an improved YOLO model for cell detection according to an embodiment of this application. The training method for the improved YOLO model for cell detection includes the following steps S11 to S16: Step S11: Construct a training dataset for the improved YOLO model, which includes cell images and their annotation information.
[0027] First, microscopic cell images are acquired, and the cells in the images are labeled with categories and bounding boxes. The labeled dataset is then divided into training, validation, and test sets according to a certain ratio for subsequent model training, tuning, and performance evaluation.
[0028] Step S12: Construct an improved YOLO model based on the original YOLOv8 network. The improved YOLO model is a unified detection network that integrates a hybrid-scale C2f-MAA backbone network, an MFE-Neck network, a detection head network, and a predefined loss function.
[0029] Combination Figure 2 This application provides a schematic diagram of the overall framework of an improved YOLO model according to an embodiment of the present application. The improved YOLO model in this embodiment is based on YOLOv8 architecture and integrates the hybrid-scale C2f-MAA backbone network (replacing the standard Bottleneck with Bottleneck-MAA in deep nodes), the MFE-Neck network (introducing a high-resolution P2 branch and replacing hard stitching fusion with GCF), the detection head network (expanded to four detection heads: P2 / P3 / P4 / P5), and the TAR-Loss loss function into a unified cell-yolo detection network.
[0030] Step S13: Input the cell image into the hybrid-scale C2f-MAA backbone network for multi-scale feature extraction to obtain the multi-scale feature extraction result.
[0031] The cell image is input into the mixed-scale C2f-MAA backbone network. The shallow nodes use the standard C2f to extract low-level features such as edge texture, while the deep nodes use the DCNv2 deformable convolution and DA deformable attention in C2f-MAA to dynamically fit the cell contour and extract multi-scale features, outputting a deep feature map carrying morphological perception information.
[0032] Step S14: Based on the multi-scale feature extraction results, the MFE-Neck network is used to perform neck feature fusion and multi-scale prediction to obtain multi-scale predicted features.
[0033] After being aggregated by SPPF, the deep feature maps are fed into the top-down path of MFE-Neck. At each fusion node, the deep semantics and shallow details are softly fused at the pixel level through the GCF gated context fusion module. At the same time, the top-down path extends to the newly added P2 high-resolution branch, and finally outputs multi-scale prediction features for micro cells and conventional-scale cells.
[0034] Step S15: Based on the multi-scale prediction features, perform cell detection using the detection head network and output the cell detection results.
[0035] The four detection heads P2 / P3 / P4 / P5 independently predict on the feature map of their respective scales, outputting the class probability, target confidence and bounding box coordinates of each candidate box, and obtaining the cell detection results.
[0036] Step S16: Based on the cell detection results and the annotation information of the cell image, calculate the loss value of the improved YOLO model using the predefined loss function, and iteratively update the network parameters of the improved YOLO model based on the loss value until the model converges.
[0037] The detection results are compared with the labeled information, and the classification loss term, regression loss term and TAR-Loss loss term are jointly calculated (TAR-Loss applies a repulsive force to the adjacent positive sample prediction box when the condition is met). The three are weighted and summed to obtain the total loss value. All network parameters of the backbone network, neck network and detection head are updated iteratively through backpropagation until the loss converges.
[0038] This application's embodiments endow the model with adaptive perception capabilities for irregular cell morphology by introducing a C2f-MAA module deep into the backbone network. A new P2 high-resolution branch is added to the neck network, and GCF-gated soft fusion is used to replace hard stitching, thereby effectively preserving the features of small targets and shallow details. At the same time, a rejection loss is introduced to actively expand the prediction boxes of densely adhered cells during the training phase. The synergistic effect of these three factors significantly improves the model's detection accuracy for irregularly shaped cells, greatly reduces the false negative rate for small-sized cells, effectively solves the problem of detecting densely adhered cells, reduces post-processing dependence, and achieves high-precision and highly robust cell detection.
[0039] In some embodiments of this application, the hybrid-scale C2f-MAA backbone network is constructed as follows: based on the original backbone network of the original YOLOv8 network, the original C2f modules in the shallow network of the original backbone network are retained; the original C2f modules in the deep network of the original backbone network are replaced with C2f-MAA modules, wherein the C2f-MAA module refers to a morphological perception feature extraction module improved based on the original C2f module, and the C2f-MAA module is implemented based on deformable convolution and deformable attention mechanisms.
[0040] In this embodiment, the hybrid-scale C2f-MAA backbone network is constructed through deep customization based on the original YOLOv8 network backbone, aiming to address the core pain point of low feature extraction efficiency in traditional convolutional neural networks (CNNs) when dealing with irregularly shaped cells. In the specific construction of the hybrid-scale C2f-MAA backbone network, this application does not replace all C2f modules with C2f-MAA, but instead adopts a more efficient hybrid-scale deployment strategy: For shallow networks, the original C2f module is retained. This is because shallow layers primarily learn general low-level features such as edges and textures, for which standard convolutions are sufficient. For deep networks, the C2f-MAA module designed in this application is used. This is because deep layers are responsible for combining low-level features into high-level semantics, a crucial stage for understanding cell morphology, thus requiring the powerful morphological perception capabilities provided by the C2f-MAA module.
[0041] Combination Figure 3 This application provides a schematic diagram of the internal structure of a C2f-MAA module according to an embodiment. The core internal unit of the C2f-MAA module is the improved bottleneck layer, Bottleneck-MAA. This bottleneck layer integrates two key technologies: The first feature is Deformable Convolution (DCNv2), which replaces the standard 3x3 convolution in the bottleneck layer with deformable convolution. Unlike fixed-shape sampling, DCNv2 learns a spatial offset for each sampling point of the convolution kernel based on the input data. When processing cell images, this means that the receptive field of the convolution kernel can dynamically adjust its shape, allowing its sampling points to adaptively fit the true boundaries and key internal structures of the cell. In this way, the network can extract purer feature representations that are highly correlated with the actual morphology of the cell.
[0042] The second aspect is the Deformable Attention (DA) mechanism. To more efficiently focus on key information regions in an image, this application introduces an efficient Deformable Attention mechanism. Unlike traditional attention mechanisms that compute weights across the entire feature map, the Deformable Attention mechanism computes attention only for a small subset of sampled points around a reference point and dynamically learns the offsets of these sampled points. This allows attention to be focused on the most informative regions, regardless of the target's scale or shape.
[0043] The core idea of deformable attention is that for each query location on the feature map, it's unnecessary to compare it with all the keys. Instead, a small set (e.g., 4 or 8) of learnable sampling points are defined on the feature map. The network predicts offsets for these sampling points, allowing them to flexibly move to the positions most important to the current recognition task. Attention weights are calculated only on these offset, sparse sampling points, which significantly reduces computational complexity and improves the ability to capture key features.
[0044] This application integrates a Deformable Attention Module (DA) into the bottleneck layer, which works in conjunction with Deformable Convolution. After extracting morphologically adaptive features from DCNv2, the DA module further refines these features, enabling them to span different scales and focus on the regions most critical for cell recognition, effectively addressing the challenges of varying cell sizes and shapes.
[0045] A deformable attention mechanism (DA) is introduced to achieve a balance between computational efficiency and performance. It enables the model to flexibly focus on sparse feature points in an image in a data-driven manner, making it particularly suitable for processing cell images with complex backgrounds and uneven target distribution. This mechanism enhances the model's adaptability to multi-scale targets and improves its ability to extract key features from irregularly shaped cells.
[0046] This application's embodiments strategically deploy C2f-MAA modules deep within the backbone network, utilizing deformable convolution to dynamically fit the receptive field to irregular cell contours, and combining this with a deformable attention mechanism to efficiently focus on the most informative regions at sparse key sampling points. The synergy of these two mechanisms endows the network with powerful morphological perception capabilities. This design effectively solves the problem of traditional fixed rectangular convolution kernels encoding a large amount of irrelevant background or neighboring cell interference information into features when processing highly non-rigid morphological cells (such as cancer cells or activated immune cells), thereby significantly improving the model's feature expression ability and recognition accuracy for complex cell morphologies.
[0047] In some embodiments of this application, step S13 includes: inputting the cell image into the hybrid-scale C2f-MAA backbone network, extracting features using the shallow network of the hybrid-scale C2f-MAA backbone network to obtain shallow features, wherein the shallow network of the hybrid-scale C2f-MAA backbone network includes multiple alternating convolutional modules and C2f modules; and extracting features using the deep network of the hybrid-scale C2f-MAA backbone network based on the shallow feature extraction results to obtain deep features, wherein the deep network of the hybrid-scale C2f-MAA backbone network includes a first C2f-MAA module, a convolutional module, a second C2f-MAA module, and an SPPF module connected in sequence.
[0048] Continue to refer to Figure 2 The specific execution flow of step S13 is as follows: Shallow Feature Extraction: The cell image is input into the shallow network of the hybrid-scale C2f-MAA backbone network. This network consists of multiple alternating cascaded convolutional modules (Conv) and standard C2f modules. In this stage, after initial downsampling, the standard C2f module extracts basic visual features such as edges and textures to generate a shallow feature map.
[0049] Deep Feature Extraction: Shallow feature maps are input into the deep network of the backbone network. This network sequentially connects the first C2f-MAA module, the convolutional module, the second C2f-MAA module, and the SPPF module. In this stage, the feature map first passes through the first C2f-MAA module, which uses its internal deformable convolution and attention mechanisms to perceive and enhance irregular cell morphology; then it passes through the convolutional module for channel adjustment and downsampling; next, it enters the second C2f-MAA module to further deepen the extraction of high-level semantic features; finally, the feature map is fed into the SPPF module, which aggregates spatial context information through multi-scale pooling, ultimately outputting a deep feature map containing rich morphological information.
[0050] This application embodiment constructs a hybrid-scale backbone network of "shallow standard C2f + deep C2f-MAA". While ensuring the efficiency of shallow basic feature extraction, it utilizes deformable convolution and attention mechanisms in the deep C2f-MAA module to enable the network to adaptively fit the irregular contours of cells and focus on key structures, thereby significantly enhancing the model's feature expression ability for complex cell morphologies and laying a solid feature foundation for subsequent high-precision detection.
[0051] In some embodiments of this application, the MFE-Neck network is constructed as follows: based on the original YOLOv8 network, the feature fusion method based on upsampling and concatenation in the top-down path of the original neck network is replaced with a GCF module, which is used to perform gated fusion processing on the upsampled deep features and the corresponding shallow features; in the top-down path of the original neck network, the feature fusion process is extended one level up to construct a new fusion path composed of a GCF module and a C2f module.
[0052] The second technical challenge addressed in this application involves two levels. First, the cell sizes in microscopic images vary greatly, with some cells occupying only a few pixels. In standard detectors such as YOLOv8, due to the multiple downsampling of feature maps, the feature information of these tiny cells is largely lost by the time it reaches the detection head (e.g., starting from the P3 layer with 8x downsampling), leading to severe missed detections. Second, in the feature pyramid fusion process, the simple upsampling followed by concat operation is a rigid fusion that cannot intelligently balance deep high-level semantics with shallow fine structures, easily leading to information conflicts and detail dilution.
[0053] To simultaneously address the challenges of small target detection and intelligent feature fusion, this application systematically modifies the structure and modules of the YOLOv8 neck, constructing a new MFE-Neck, and adds a new detection head to the detection head network: (1) Structural innovation: A new fusion path consisting of the GCF module and the C2f module is added, which together with the newly added detection head in the detection head network constitutes the P2 high-resolution detection branch. To fundamentally improve the network's ability to perceive and locate small targets, this application extends the original detection head structure. Based on the original three detection heads of YOLOv8, which are based on P3, P4, and P5 feature maps, this embodiment adds a P2 high-resolution detection branch targeting a 4x downsampled feature map. This P2 high-resolution detection branch corresponds to... Figure 2 The topmost high-resolution detection branch, the P2 high-resolution detection branch, includes a newly added GCF and C2f fusion path at the top of the MFE-Neck, and a P2 detection head connected to the output of this fusion path, specifically designed for the detection of tiny cells. This design provides the network with the physical basis for making predictions at higher resolutions.
[0054] (2) Module-level innovation: Gated Context Fusion Module (GCF) To address the issues of information conflict and detail dilution during feature fusion, this application designs a novel, learnable GCF module to replace the upsampled and concatenated feature fusion method in the original neck network's top-down path. The core idea of the GCF module is to allow the network to adaptively learn how to fuse features from different levels in a data-driven manner, rather than simply upsampling and concatenating them. For each GCF fusion node, a set of deep features F is input. deep and a set of shallow features F shallow F deep (Carrying high-level semantics) refers to feature maps from deeper semantic branches that have undergone upsampling processing, F shallow (Carrying fine structure) refers to the shallower, high-resolution feature map from the corresponding lateral connection.
[0055] This application's embodiments introduce a P2 high-resolution detection branch, preserving the feature information of tiny cells from a physical structural perspective, thus solving the problem of missed detection of tiny targets caused by multiple downsampling in standard YOLO. Simultaneously, by replacing traditional hard stitching with a GCF module, adaptive intelligent fusion of deep semantics and shallow details is achieved, effectively avoiding feature conflicts and detail dilution. These two improvements work synergistically to significantly enhance the model's ability to capture tiny cells and the accuracy of cell boundary localization in complex backgrounds.
[0056] In some embodiments of this application, the MFE-Neck network is deployed with a first GCF module, a second GCF module, a first C2f module, a second C2f module, and a third C2f module. The newly added fusion path is composed of the second GCF module and the third C2f module. Step S14 includes: in the top-down path of the MFE-Neck network, inputting the deep features output by the SPPF module in the hybrid scale C2f-MAA backbone network and the shallower features of the corresponding layer into the first GCF module for fusion to obtain the output of the first GCF module. The fusion features output by the first GCF module are passed up through the first C2f module and the second C2f module in sequence and then input to the second GCF module. A high-resolution P2 layer feature map is extracted from the shallow network of the hybrid scale C2f-MAA backbone network and input to the second GCF module to obtain the fusion features output by the second GCF module. The fusion features output by the second GCF module are input to the third C2f module to generate a new feature map containing high-resolution details and contextual information, which is used as the input of the new detection head in the detection head network.
[0057] Continue to refer to Figure 2A high-resolution P2 layer feature map is extracted from the shallow layers of the mixed-scale C2f-MAA backbone network, which is the feature map output by the second convolutional module (Conv) above the mixed-scale C2f-MAA backbone network. For example, for a 640x640 input, the P2 size is 160x160. In the top-down path of the MFE-Neck network, the feature fusion process is extended one level up until it is fused with the P2 layer feature map, thereby generating a new feature map N2 rich in high-resolution details and contextual information. Here, "extending one level up" means adding one more fusion node to the higher resolution end based on the original P3, P4, P5 top-down fusion chain, that is, corresponding to Figure 2 The newly added GCF and C2f fusion path at the top of the MFE-Neck; the new feature map N2 is the output feature of this newly added fusion node at the top. Finally, after the bottom-up path, an independent detection head is configured for this new feature map N2, which contains high-resolution details and contextual information, i.e., the newly added detection head in the detection head network.
[0058] Continue to refer to Figure 2 Enter the F of the first GCF module below. deep F represents the deep features output from the backbone network ends via the SPPF module and fed into the neck network. shallow These are lateral features extracted from shallower layers of the backbone; the upper GCF is the F of the second GCF module. deep F is a feature that continues to be uploaded after the first GCF module is merged. shallow Features for higher resolution shallow branch output.
[0059] from Figure 2 From a structural perspective, both GCF modules are located on the top-down fusion main chain on the left side of the MFE-Neck: the output of the first GCF module is fed upwards into the middle C2f module (in order, the first C2f module and the second C2f module) for further fusion, and the output of the second GCF module is fed into the top C2f module and then connected to the newly added detection head at the top; at the same time, the fused mid-to-high-level features are further refined by the Conv (convolution), Concat (separation), and C2f / C2f-MAA branches on the right side before being fed into the remaining detection heads.
[0060] This application's embodiments successfully incorporate high-resolution P2 layer features into the fusion system by extending the fusion process one level upwards in the top-down path of the neck network. Two GCF modules are then used to intelligently and softly fuse deep semantics and shallow details respectively. This design not only preserves the high-resolution details of microcells but also adaptively balances semantic and structural information through a gating mechanism, thereby generating new feature maps rich in high-resolution details and contextual information, providing a high-quality feature foundation for subsequent microcell detection.
[0061] In some embodiments of this application, step S14 includes: within the GCF module, generating a pixel-level gating map using a lightweight gating network based on the deep and shallow features input to the GCF module; and using the pixel-level gating map to perform weighted fusion of the deep and shallow features input to the GCF module to obtain the fused features output by the GCF module.
[0062] Combination Figure 4 This application provides a schematic diagram of the internal structure of a GCF module according to an embodiment. First, the deep features (F) input to the GCF module are... deep (typically features that have undergone upsampling) and shallow features (F) shallow The features are typically high-resolution features derived from lateral connections. These features are then combined. The combined features are then fed into a lightweight gating network, which can be composed of a cascaded 3×3 convolution, a SiLU activation function, a 1×1 convolution, and a Sigmoid activation function. After processing, this network generates a pixel-level gated map G, where each pixel has a value between 0 and 1.
[0063] Finally, the generated gated graph G is used to perform weighted fusion of the input deep and shallow features to obtain the fused features F output by the GCF module. fused Its specific fusion calculation method can be expressed as follows: F fused =G·F deep +(1-G)·F shallow (1) This means that at pixel locations where the G value in the gating image is close to 1, the fusion result mainly retains deep semantic features; while at locations where the G value is close to 0, it mainly retains shallow fine structural details.
[0064] This application's embodiments introduce a lightweight gating network to generate pixel-level gating maps, achieving adaptive weighted fusion between deep semantic features and shallow structural details. This soft fusion mechanism effectively solves the feature conflict and detail dilution problems caused by traditional hard stitching, enabling the network to inject high-level semantic information while maximally protecting edge and texture details crucial for accurate localization, thereby significantly improving the model's accuracy in locating cell boundaries in complex backgrounds.
[0065] In some embodiments of this application, the cell detection result includes a predicted bounding box, the annotation information of the cell image includes a reference bounding box, the predefined loss function consists of a standard classification and regression loss term and an exclusion loss term, and step S16 includes: for each predicted bounding box, in the remaining reference bounding boxes other than the target reference bounding box corresponding to the predicted bounding box, calculating the straight-line distance between the geometric center point of the predicted bounding box and the geometric center point of each of the remaining reference bounding boxes, and determining the nearest neighbor reference bounding box corresponding to the predicted bounding box; calculating the intersection-union ratio (IU) between the predicted bounding box and the corresponding nearest neighbor reference bounding box; if the IU between the predicted bounding box and the corresponding nearest neighbor reference bounding box exceeds a set IU threshold, then activating the exclusion loss term, and calculating the loss value according to the standard classification and regression loss term and the activated exclusion loss term, wherein the exclusion loss term consists of an overlap penalty term and a distance penalty term; otherwise, calculating the loss value according to the standard classification and regression loss term.
[0066] The third technical challenge addressed in this application lies in the density and adhesion of cells. In scenarios such as culture dishes or pathological sections, cells often exhibit a tightly stacked and adhered state. This poses a significant challenge to the post-processing stage of target detection, namely non-maximum suppression (NMS). NMS eliminates redundant detections based solely on the intersection-over-union (IoU) ratio between predicted bounding boxes, which can easily lead to the mistaken deletion of one of two correctly predicted bounding boxes belonging to different cells but closely attached. This is the core bottleneck causing serious missed detections in this scenario using traditional detection methods.
[0067] The solution proposed in this application is to avoid placing all the pressure on the post-processing stage to solve the adhesion problem. Starting with the model's learning objective, i.e., the loss function, a novel topology-aware repulsion loss, TAR-Loss, is designed. Its core idea is to proactively guide the model to learn how to separate adhered individuals during the training phase.
[0068] In addition to standard classification and regression losses, TAR-Loss adds a "rejection term" to the total loss function. This rejection term is activated under specific conditions, penalizing predicted boxes that spatially overlap with baseline boxes of nearby targets. This forces the model to not only bring the predicted boxes close to their corresponding targets during optimization, but also to actively move them away from other targets.
[0069] The TAR-Loss design in this application has the following characteristics: Feature 1: Precise Target-Oriented Repulsion. The repulsion force in this application is precisely targeted, rather than acting on all overlapping prediction boxes. It only acts on a single positive prediction box P. i With one and P i The nearest neighbor bounding box G that has no corresponding relationship to it. k This design avoids unnecessary calculations and makes the optimization objective clearer: to get close to its own target while not encroaching on the area of neighboring targets.
[0070] Feature 2: Topology-aware two-stage activation mechanism. TAR-Loss does not apply to all predicted boxes, but is activated through an intelligent two-stage mechanism to ensure that the repulsive force is precisely applied only to areas where adhesion is truly at risk: Phase 1 (Distance Awareness): For each prediction box P i Within the remaining reference frames outside the target reference frame corresponding to the predicted frame, the "nearest neighbor" of the predicted frame is found by calculating the straight-line distance between the geometric center point of the predicted frame and the geometric center points of all other reference frames outside the target reference frame. G k .
[0071] Phase Two (Overlapping Perception): Only when the predicted bounding box... P i Its nearest neighbor reference box G k The repulsion loss is activated only when the intersection-to-union ratio (IoU) exceeds a set low threshold τ (e.g., 0.05). If the threshold is not reached, the repulsion loss term corresponding to the predicted box is not included in the total loss calculation and can be considered as 0. This means that the repulsion loss term is only activated when the predicted box has begun to invade the target area. G k It is only when it is territory that it needs to be pushed away.
[0072] Feature 3: Repulsive force function jointly optimized by distance and overlap. The repulsive loss designed in this application simultaneously optimizes two objectives: pushing away distance and reducing overlap. Its specific form can be composed of an overlap penalty term and a distance penalty term. Repulsive Loss L Rep For example, it can be represented in the following form: (2) Among them, the first item L Iou For example, the overlap penalty term can be represented as follows: (3) Overlap penalty term is used to characterize the prediction box P i Nearest Neighbor Baseline G k The degree of overlap between the predicted boxes is penalized by an overlap penalty term that directly affects the predicted boxes. P i Baseline frame with neighbor G k The goal is to minimize the IoU between the two overlapping regions to 0.
[0073] The second item is the distance penalty. Distance penalty term is used to characterize the predicted bounding box. P i Nearest Neighbor Baseline G k The distance between the center points. When P i and G k When the center points are close together, the distance penalty term increases, thus prompting the model to optimize by... P i The center point from G k The center point is pushed away. This design helps alleviate the problem of insufficient gradients in traditional IoU loss when there is no overlap.
[0074] This application's embodiments introduce a topology-aware repulsion loss to guide the model in learning to separate adherent individuals during the training phase. This loss function, through a precise target-oriented repulsion mechanism and a two-stage activation strategy, penalizes only when the predicted bounding box infringes upon the territory of neighboring targets, thereby helping to reduce the false negative rate and improve detection robustness in scenarios with densely adherent cells.
[0075] This application also provides a cell detection method based on an improved YOLO model, such as... Figure 5 The diagram shows a flowchart of a cell detection method based on an improved YOLO model according to an embodiment of this application. The cell detection method based on the improved YOLO model includes the following steps S21 to S22: Step S21: Obtain an image of the cell to be detected; Step S22: Input the cell image to be detected into the improved YOLO model for cell detection to obtain cell detection results, which include cell location, category and count information; The improved YOLO model for cell detection is trained based on the training method of the improved YOLO model for cell detection described in any of the preceding claims.
[0076] During the model inference phase, images of the cells to be detected, such as microscopic cell images, are first acquired. These images are then input into an improved YOLO model for cell detection, namely the cell-yolo model obtained using the aforementioned training method. This model, through forward propagation via Backbone and MFE-Neck, generates candidate detection results on multi-scale feature maps such as P2, P3, P4, and P5.
[0077] After each detection head outputs cell type, confidence level, and bounding box coordinates, low-quality candidate boxes are first filtered out according to the confidence threshold, followed by non-maximum suppression (NMS) processing to finally obtain the cell detection results. This result includes cell location, type, and count information.
[0078] This application provides a cell detection inference method. By inputting the image to be tested into a trained improved YOLO model, the method utilizes the multi-scale feature fusion capability and the separation capability formed by TAR-Loss training to output the cell location, category, and count information. This method is suitable for cell detection scenarios with irregular morphology, small size, and dense adhesion.
[0079] In summary, the key points of this application are mainly as follows: (1) Innovative Hybrid-Scale Morphological Perception Backbone: One of the key features of this application is the design of a novel C2f-MAA module, deployed in the deep layers of the backbone network using a hybrid-scale strategy. This module integrates Deformable Convolution (DCNv2) and Deformable Attention, giving it two core capabilities: 1) The receptive field of the convolution kernel can be dynamically adjusted to fit the irregular shape of the cell, extracting more accurate morphological features; 2) The attention mechanism can efficiently focus on key sparse feature points in an image in a data-driven manner. This design fundamentally solves the problem of inaccurate feature extraction when traditional CNNs encounter irregular cells.
[0080] (2) Neck network designed for small targets and efficient fusion (MFE-Neck): The second key point of this application is the dual systematic modification of the YOLOv8 neck network.
[0081] 1) Structurally, by adding a P2 high-resolution detection branch oriented towards the 4x downsampled feature map, the network is provided with a physical basis for detecting tiny cells, thus solving the problem of easy loss of feature information of tiny targets at the structural level.
[0082] 2) In terms of modules, a brand-new Gated Context Fusion (GCF) module was designed to replace the traditional "upsampling + stitching" operation. GCF achieves pixel-level intelligent adaptive fusion of deep semantics and shallow details through a learnable gating mechanism, which maximizes the preservation of detailed information that is crucial for accurate positioning and solves the information conflict and dilution problems of traditional fusion methods.
[0083] (3) A novel topology-aware repulsion loss function (TAR-Loss): The third key point of this application is the design of TAR-Loss, a loss function component that can actively separate densely clustered cells during the training phase. Its key features are: 1) Precision guidance and two-stage activation: The repulsive force is not applied blindly, but is intelligently activated through two stages of "distance perception" and "overlap perception". It only takes effect when the predicted box is spatially sufficient to affect its nearest neighbor reference box (Ground Truth), thus achieving precise and efficient repulsion.
[0084] 2) Joint Optimization of Distance and Overlap: The loss function itself penalizes both the overlap (IoU) between the predicted box and its neighboring reference boxes and the distance to the center point. This not only reduces overlap but also provides a strong physical impetus, solving the problem that the gradient of traditional IoU loss is 0 when there is no overlap. This design fundamentally solves the problem of false deletion of dense cells from the perspective of model learning objectives, reducing the dependence on the post-processing NMS algorithm.
[0085] This application has achieved at least the following technical effects: (1) Significantly improved the detection accuracy of irregularly shaped cells. The fixed rectangular convolution kernels used in related technologies introduce significant background noise when processing irregularly shaped cells, leading to inaccurate feature representation. The C2f-MAA module designed in this application combines deformable convolution and deformable attention, enabling its receptive field to adaptively fit the actual contours of the cell. This morphological perception capability allows the model to extract features with higher purity and greater correlation to the target morphology, resulting in more precise localization and higher recognition accuracy when dealing with irregular targets such as cancer cells and activated immune cells.
[0086] (2) It significantly reduced the false negative rate for tiny cells.
[0087] The standard YOLO architecture in related technologies suffers from the loss of feature information of tiny cells before they reach the detection head due to multiple downsampling steps. This application addresses this by structurally introducing a higher-resolution P2 high-resolution detection branch, ensuring the preservation and utilization of feature information of tiny targets. Simultaneously, the Gated Context Fusion (GCF) module, through pixel-level intelligent soft fusion, maximizes the preservation of fine structural details in shallow feature maps while injecting high-level semantics. These two improvements work synergistically, enabling this application to effectively capture and locate tiny cells occupying only a few pixels, contributing to improved detection performance compared to background techniques.
[0088] (3) It effectively solves the problem of detecting densely adhered cells and reduces the dependence on post-processing.
[0089] Related technologies heavily rely on the NMS post-processing algorithm. However, when dealing with densely clustered cells, this algorithm is prone to mistakenly deleting correctly identified bounding boxes of adjacent cells due to excessively high IoU, which is the core bottleneck leading to missed detections. This application introduces Topology-Aware Repulsion Loss (TAR-Loss), which introduces an active repulsion force during the model training phase, guiding the model to actively separate predicted boxes belonging to different but adjacent targets. This approach, addressing the problem at its source, enables the model to inherently distinguish densely clustered cells, fundamentally reducing missed detections caused by NMS deletion and lowering the sensitivity and dependence on NMS threshold settings.
[0090] This application also provides a training device 600 for an improved YOLO model used in cell detection, such as... Figure 6 The diagram provided illustrates the structure of a training device 600 for an improved YOLO model used in cell detection, as described in an embodiment of this application. The training device 600 includes: The first building unit 610 is used to build a training dataset for the improved YOLO model, wherein the training dataset includes cell images and cell image annotation information; The second building unit 620 is used to build an improved YOLO model based on the original YOLOv8 network. The improved YOLO model is a unified detection network that integrates a hybrid-scale C2f-MAA backbone network, an MFE-Neck network, a detection head network, and a predefined loss function. The multi-scale feature extraction unit 630 is used to input the cell image into the hybrid-scale C2f-MAA backbone network to perform multi-scale feature extraction and obtain multi-scale feature extraction results. The multi-scale prediction unit 640 is used to perform neck feature fusion and multi-scale prediction using the MFE-Neck network based on the multi-scale feature extraction results to obtain multi-scale prediction features. The first cell detection unit 650 is used to perform cell detection and output cell detection results based on the multi-scale prediction features and the detection head network. The iterative update unit 660 is used to calculate the loss value of the improved YOLO model using the predefined loss function based on the cell detection results and the annotation information of the cell image, and to iteratively update the network parameters of the improved YOLO model based on the loss value until the model converges.
[0091] This application also provides a cell detection device 700 based on an improved YOLO model, such as... Figure 7 The diagram shows a structural schematic of a cell detection device based on an improved YOLO model according to an embodiment of this application. The cell detection device 700 based on the improved YOLO model includes: Acquisition unit 710 is used to acquire an image of the cell to be detected; The second cell detection unit 720 is used to input the cell image to be detected into an improved YOLO model for cell detection to obtain cell detection results, which include cell location, category and count information; The improved YOLO model for cell detection is trained based on the training method of the improved YOLO model for cell detection described in any of the preceding claims.
[0092] It is understood that the training system for the improved YOLO model for cell detection described above can implement all the steps of the training method for the improved YOLO model for cell detection provided in the foregoing embodiments. The relevant explanations regarding the training method for the improved YOLO model for cell detection are applicable to the training system for the improved YOLO model for cell detection, and will not be repeated here.
[0093] Figure 8 This is a schematic diagram of the structure of a device according to an embodiment of this application. For example... Figure 8 As shown, the device includes one or more processors (or processing units), and may also include one or more memories coupled to the processors, and may also include a communication module coupled to the processors.
[0094] A communication module can be used to communicate with other devices or apparatuses, such as sending or receiving data and / or signals. A communication module may have at least one communication module for communication. A communication module may include any interface necessary for communicating with other devices. Exemplarily, a communication module may be a transceiver, circuit, bus, module, or other type of communication module.
[0095] The processor may include, but is not limited to, one or more of the following: a general-purpose computer, a special-purpose computer, a microcontroller, a digital signal processor (DSP), or a controller-based multi-core controller architecture. The device may have multiple processors, such as application-specific integrated circuit (ASIC) chips, which are time-dependent on a clock synchronized with the main processor.
[0096] The memory may include one or more non-volatile memories and one or more volatile memories. Examples of non-volatile memories include, but are not limited to, at least one of the following: read-only memory (ROM), electrically programmable read-only memory (EPROM), flash memory, hard disk, compact disc (CD), digital video disc (DVD), or other magnetic and / or optical storage. Examples of volatile memories include, but are not limited to, at least one of the following: random access memory (RAM), or other volatile memories that do not persist during the duration of a power outage.
[0097] A computer program consists of computer-executable instructions that are executed by an associated processor. Programs can be stored in ROM. A processor can perform any appropriate action and processing by loading the program into RAM.
[0098] Possible implementations of this application can be achieved through a program, enabling the communication device to execute any of the processes discussed in the foregoing embodiments. Possible implementations of this application can also be achieved through hardware or a combination of software and hardware.
[0099] In some implementations, the program may be tangibly contained in a computer-readable storage medium, which may include in a device (such as in memory) or other storage device accessible by the device. The program may be loaded from the computer-readable storage medium into RAM for execution. The computer-readable storage medium may include any type of tangible non-volatile memory, such as ROM, EPROM, flash memory, hard disk, CD, DVD, etc.
[0100] This application also provides a computer-readable storage medium storing computer instructions or program code thereon, which, when executed by a processor, causes the processor to perform the methods and functions involved in any of the above embodiments. A computer-readable medium can be any tangible medium that contains or stores a program for or relating to an instruction execution system, apparatus, or device. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. More detailed examples of computer-readable storage media include electrical connections with one or more wires, magnetic media (e.g., disks, floppy disks, hard disks, magnetic tapes, magnetic storage devices), optical media (e.g., optical storage devices, DVDs), semiconductor media (e.g., solid-state drives), random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), or any suitable combination thereof.
[0101] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. Embodiments of this application also provide at least one computer program product tangibly stored on a non-transitory computer-readable storage medium. This computer program product includes one or more computer-executable instructions, such as instructions included in a program module, which execute in a device on a target real or virtual processor to perform the processes, methods, and functions involved in any of the above embodiments. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0102] This application also proposes a computer program product, including a computer program or instructions that, when run on a computer, cause the computer to perform the processes, methods, and functions described in the above embodiments. Typically, program modules include routines, programs, libraries, objects, classes, components, data structures, etc., that perform specific tasks or implement specific abstract data types. In various embodiments, the functionality of program modules can be combined or divided as needed. The machine-executable instructions for the program modules can be executed locally or in a distributed device. In a distributed device, the program modules can reside in both local and remote storage media.
[0103] Generally, the various embodiments of this application can be implemented in hardware or dedicated circuitry, software, logic, or any combination thereof. Some aspects can be implemented in hardware, while others can be implemented in firmware or software, which can be executed by a controller, microprocessor, or other computing device. Although various aspects of the embodiments of this disclosure are shown and described as block diagrams, flowcharts, or represented using some other illustration, it should be understood that the blocks, apparatuses, systems, techniques, or methods described herein can be implemented as, as non-limiting examples, in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.
[0104] It should be noted that although embodiments of this application have been described above with reference to the accompanying drawings, these embodiments are not independent of each other, and they can be combined to obtain other embodiments. The methods, situations, categories, and classifications of embodiments in this application are only for the convenience of description and should not constitute a special limitation. Various methods, categories, situations, and features in embodiments can be combined with each other if logically consistent. The various embodiments of this application can be arbitrarily combined to achieve different technical effects. The embodiments of this application will not list various combinations.
[0105] Furthermore, although the operation of the methods of this disclosure is described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all of the operations shown must be performed to achieve the desired result. Rather, the steps depicted in the flowcharts may be performed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps. It should also be noted that the features and functions of two or more devices according to this disclosure may be embodied in one device. Conversely, the features and functions of one device described above may be further divided and embodied by multiple devices.
[0106] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0107] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A training method for an improved YOLO model for cell detection, characterized in that, The training method for the improved YOLO model used for cell detection includes the following steps: Step S11: Construct a training dataset for the improved YOLO model, wherein the training dataset includes cell images and cell image annotation information; Step S12: Construct an improved YOLO model based on the original YOLOv8 network. The improved YOLO model is a unified detection network that integrates a hybrid-scale C2f-MAA backbone network, an MFE-Neck network, a detection head network, and a predefined loss function. Step S13: Input the cell image into the hybrid-scale C2f-MAA backbone network for multi-scale feature extraction to obtain the multi-scale feature extraction result; Step S14: Based on the multi-scale feature extraction results, the MFE-Neck network is used to perform neck feature fusion and multi-scale prediction to obtain multi-scale predicted features. Step S15: Based on the multi-scale prediction features, perform cell detection using the detection head network and output the cell detection results; Step S16: Based on the cell detection results and the annotation information of the cell image, calculate the loss value of the improved YOLO model using the predefined loss function, and iteratively update the network parameters of the improved YOLO model based on the loss value until the model converges.
2. The training method for the improved YOLO model for cell detection according to claim 1, characterized in that, The hybrid-scale C2f-MAA backbone network was constructed in the following manner: Based on the original backbone network of the original YOLOv8 network, the original C2f modules in the shallow network of the original backbone network are retained. The original C2f module in the deep network of the original backbone network is replaced by the C2f-MAA module. The C2f-MAA module is a morphological perception feature extraction module improved based on the original C2f module. The C2f-MAA module is implemented based on deformable convolution and deformable attention mechanisms.
3. The training method for the improved YOLO model for cell detection according to claim 2, characterized in that, Step S13 includes: The cell image is input into the hybrid-scale C2f-MAA backbone network, and the shallow network of the hybrid-scale C2f-MAA backbone network is used to extract features to obtain shallow features. The shallow network of the hybrid-scale C2f-MAA backbone network includes multiple alternating convolutional modules and C2f modules. Based on the shallow feature extraction results, feature extraction is performed using the deep network of the hybrid-scale C2f-MAA backbone network to obtain deep features. The deep network of the hybrid-scale C2f-MAA backbone network includes a first C2f-MAA module, a convolutional module, a second C2f-MAA module, and an SPPF module connected in series.
4. The training method for the improved YOLO model for cell detection according to claim 1, characterized in that, The MFE-Neck network is constructed as follows: Based on the original neck network of the original YOLOv8 network, the feature fusion method based on upsampling and concatenation in the top-down path of the original neck network is replaced with the GCF module. The GCF module is used to perform gated fusion processing on the upsampled deep features and the corresponding shallow features. In the top-down path of the original neck network, the feature fusion process is extended one level up to construct a new fusion path consisting of the GCF module and the C2f module.
5. The training method for the improved YOLO model for cell detection according to claim 4, characterized in that, The MFE-Neck network is deployed with a first GCF module, a second GCF module, a first C2f module, a second C2f module, and a third C2f module. The newly added fusion path is composed of the second GCF module and the third C2f module. Step S14 includes: In the top-down path of the MFE-Neck network, the deep features output by the SPPF module in the hybrid scale C2f-MAA backbone network and the shallower features of the corresponding layer are input into the first GCF module for fusion to obtain the fused features output by the first GCF module. The fusion features output by the first GCF module are sequentially passed up through the first C2f module and the second C2f module and then input to the second GCF module. High-resolution P2 layer feature maps are extracted from the shallow network of the hybrid scale C2f-MAA backbone network and input to the second GCF module to obtain the fusion features output by the second GCF module. The fused features output by the second GCF module are input into the third C2f module to generate a new feature map containing high-resolution details and contextual information, which is then used as input to a new detection head in the detection head network.
6. The training method for the improved YOLO model for cell detection according to claim 5, characterized in that, Step S14 includes: Inside the GCF module, a pixel-level gating map is generated using a lightweight gating network based on the deep and shallow features input to the GCF module. The pixel-level gated map is used to perform weighted fusion of the deep and shallow features input to the GCF module to obtain the fused features output by the GCF module.
7. The training method for the improved YOLO model for cell detection according to claim 5, characterized in that, The cell detection result includes a predicted bounding box, the cell image annotation information includes a baseline bounding box, the predefined loss function consists of standard classification and regression loss terms and an exclusion loss term, and step S16 includes: For each predicted bounding box, in the remaining reference boxes other than the target reference box corresponding to the predicted bounding box, calculate the straight-line distance between the geometric center point of the predicted bounding box and the geometric center point of each of the remaining reference boxes, and determine the nearest neighbor reference box corresponding to the predicted bounding box. Calculate the intersection-union ratio (IUU) between the predicted bounding box and the nearest neighbor reference box; If the intersection-union ratio (CUI) of the predicted bounding box and the nearest neighbor reference box exceeds the set CUI threshold, the exclusion loss term is activated, and the loss value is calculated based on the standard classification and regression loss terms and the activated exclusion loss term. The exclusion loss term is composed of an overlap penalty term and a distance penalty term. Otherwise, the loss value is calculated based on the classification and regression loss terms of the stated criteria.
8. A cell detection method based on an improved YOLO model, characterized in that, The cell detection method based on the improved YOLO model includes the following steps: Step S21: Obtain an image of the cell to be detected; Step S22: Input the cell image to be detected into the improved YOLO model for cell detection to obtain cell detection results, which include cell location, category and count information; The improved YOLO model for cell detection is trained based on the training method of the improved YOLO model for cell detection according to any one of claims 1 to 7.
9. A training device for an improved YOLO model for cell detection, characterized in that, The training device for the improved YOLO model used for cell detection includes: The first building unit is used to build a training dataset for the improved YOLO model, wherein the training dataset includes cell images and cell image annotation information; The second building unit is used to build an improved YOLO model based on the original YOLOv8 network. The improved YOLO model is a unified detection network that integrates a hybrid-scale C2f-MAA backbone network, an MFE-Neck network, a detection head network, and a predefined loss function. A multi-scale feature extraction unit is used to input the cell image into the hybrid-scale C2f-MAA backbone network to perform multi-scale feature extraction and obtain multi-scale feature extraction results. The multi-scale prediction unit is used to perform neck feature fusion and multi-scale prediction using the MFE-Neck network based on the multi-scale feature extraction results, so as to obtain multi-scale prediction features. The first cell detection unit is used to perform cell detection using the detection head network based on the multi-scale prediction features and output the cell detection results. The iterative update unit is used to calculate the loss value of the improved YOLO model using the predefined loss function based on the cell detection results and the annotation information of the cell image, and to iteratively update the network parameters of the improved YOLO model based on the loss value until the model converges.
10. A cell detection device based on an improved YOLO model, characterized in that, The cell detection device based on the improved YOLO model includes: An acquisition unit is used to acquire images of the cells to be detected; The second cell detection unit is used to input the cell image to be detected into an improved YOLO model for cell detection to obtain cell detection results, which include cell location, category and count information; The improved YOLO model for cell detection is trained based on the training method of the improved YOLO model for cell detection according to any one of claims 1 to 7.
11. A device, characterized in that, include: processor; And a computer-readable storage medium storing computer program instructions, which, when executed by the processor, cause the processor to perform the training method for an improved YOLO model for cell detection as described in any one of claims 1 to 7 and / or the cell detection method based on an improved YOLO model as described in claim 8.
12. A computer program product, characterized in that, The computer program product includes computer program instructions that, when executed by a processor, implement the training method for the improved YOLO model for cell detection as described in any one of claims 1 to 7 and / or implement the cell detection method based on the improved YOLO model as described in claim 8.
Citation Information
Patent Citations
YOLO target detection-based hangover detection method
CN107527009A