A Cervical Cell Classification Method Based on Attention Mechanism and Swing Transformer

By combining channel and spatial attention mechanisms, the CFA-Former network model solves the problems of feature robustness and computational complexity in cervical cell classification, achieving efficient and accurate cervical cell classification.

CN119942214BActive Publication Date: 2025-11-11CHONGQING NORMAL UNIVERSITY +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510082217.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-20
Publication Date
2025-11-11
Estimated Expiration
2045-01-20

AI Technical Summary

Technical Problem

Existing technologies for cervical cell classification rely on manually designed features, which have poor robustness and limited generalization ability. Furthermore, deep learning models have high computational complexity and are difficult to effectively cope with differences in different imaging devices and staining methods.

Method used

A cervical cell classification method based on attention mechanism and Swing Transformer is adopted. The CFA-Former network model is combined with channel attention and spatial attention. The CDA and SFA modules are used to optimize feature extraction, and the RMSlayerNorm layer is introduced to accelerate the training process.

Benefits of technology

It improves the accuracy and robustness of cervical cell classification, reduces computational complexity, enhances the model's adaptability to different devices and staining conditions, and significantly improves classification performance and training efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119942214B_ABST
    Figure CN119942214B_ABST
Patent Text Reader

Abstract

This invention discloses a cervical cell classification method based on an attention mechanism and the Swing Transformer, belonging to the field of medical image processing technology. This invention proposes a CFA-Former network model based on a CFA module. By combining channel attention and spatial attention, it overcomes the limitations of traditional models in capturing multi-scale features. Furthermore, by strengthening the focus on important information and location, this model effectively improves the accuracy and robustness of cervical cell classification tasks. In the model design, the CFA module adaptively focuses on and suppresses important features through two learning paths, comprising two sub-modules: CDA and SFA. The CDA module optimizes information extraction in the channel dimension through a lightweight channel attention mechanism, while the SFA module enhances the model's feature representation ability in the spatial dimension through a strengthened spatial attention mechanism, demonstrating significant advantages, especially when dealing with complex cell images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical image processing technology, specifically to a cervical cell classification method based on attention mechanism and SwingTransformer. Background Technology

[0002] Cervical cancer is the fourth leading cause of cancer death among women, but its incidence can be significantly reduced through effective cervical cancer screening. However, cervical cancer screening relies on accurate cell classification, but different imaging conditions and staining methods can lead to diverse cell morphologies and sizes, significant differences within the same cell type, and very similar appearances between different cell types, increasing the difficulty of classification. Manual interpretation of slides requires a high degree of professional knowledge and extensive clinical experience, and is tedious and time-consuming. Therefore, research on automated cervical cell screening has become a hot topic in academia.

[0003] In early research, traditional machine learning algorithms, such as Support Vector Machines (SVM) and AdaBoost, were widely used for cervical cell classification. Wang et al. optimized shape, texture, and Gabor features using feature selection algorithms before classifying with SVM; Arya et al. employed various texture features, including first-order histograms, gray-level co-occurrence matrices, and local binary patterns; Win et al. used random forests for feature selection and integrated multiple classifiers through bagging to generate the final result. However, these traditional methods heavily rely on hand-designed features, which require specialized knowledge and are easily influenced by subjectivity, resulting in insufficient robustness. This leads to low classification accuracy and blurred boundaries when distinguishing cervical lesion cells, and limited generalization ability when dealing with images acquired from different devices.

[0004] With the continuous development of computer hardware and the increasing power of computing resources, deep learning is being applied more and more widely in the field of image processing. Deep learning technology can automatically extract complex high-level features from raw images, significantly improving classification performance. For example, DeepCervix achieves superior performance by integrating hybrid deep features from multiple models; Deepppap directly classifies individual cervical cells as normal or abnormal based on image patches centered on cell nuclei. Lin et al. proposed a CNN model combining cell image appearance and cell morphology for cervical cell classification; Zhao et al. designed the CCG-Taming Transformer structure, which generates images highly similar to cervical cell images by introducing a novel convolutional data augmentation architecture and a token-to-token visual transformer, thereby effectively improving classification accuracy. Zhang et al. developed a new cervical cell dataset and designed a binary tree network using dual-path fusion attention features (BTTFA) to segment cell nuclei and distinguish different lesion types; Hao et al. constructed an automatic cervical cell classification model using a feature fusion method based on VGG-16. Dong et al. combined Inception V3 with manually designed features to fully integrate domain knowledge, achieving an accuracy of over 98% on the Herlev dataset; Basak et al. used Gray Wolf Optimizer to optimize CNN dimensionality reduction features, thereby further improving classification performance.

[0005] The traditional machine learning methods mentioned above face several challenges in cervical cell classification. First, these methods heavily rely on manually designed features; feature extraction and design require extensive expertise and are easily influenced by subjectivity, resulting in poor feature robustness. Second, traditional methods exhibit vague classification boundaries and low accuracy. Furthermore, due to the diversity of imaging equipment and staining methods, these methods show poor adaptability to images acquired from different devices, limited generalization ability, and difficulty in effectively addressing challenges posed by varying imaging conditions and staining variations.

[0006] While deep learning methods have demonstrated high classification accuracy, they also have some limitations. First, training deep learning models relies on large amounts of high-quality labeled data, but many studies currently use private datasets, making the acquisition of high-quality cervical cell datasets expensive and time-consuming. Second, traditional machine learning algorithms or CNN models used by Lin, Dong, Basak, and Zhang et al., while powerful in image classification, may exhibit biases due to the complexity and diversity of cervical cell images. Although Zhao et al. used a Transformer structure capable of capturing global information, its insufficient focus on local details may limit its ability to accurately identify cancer cells, which is unacceptable in practical tasks. Furthermore, Transformer structures often involve significant computational complexity, and traditional self-attention mechanisms still have limitations in extracting local feature information and weighting channel and spatial information, especially when dealing with detailed and locally varied images like cervical cell images. Therefore, a more lightweight Transformer network structure is needed that reduces computational complexity and improves classification performance with only a few additional parameters, while better focusing on channel and spatial information.

[0007] Therefore, a new solution is needed to address the above problems. Summary of the Invention

[0008] The purpose of this invention is to provide a cervical cell classification method based on attention mechanism and Swing Transformer to solve the technical problems mentioned in the background art.

[0009] To achieve the above objectives, the present invention provides the following technical solution: a cervical cell classification method based on attention mechanism and SwinTransformer, comprising at least the following steps:

[0010] S1: Construct a cervical cell classification network framework based on attention mechanism fusion and Swing Transformer. The overall network structure is designed based on Swing Transformer and maintains the original structural characteristics of Swing Transformer, that is, it extracts image features step by step through four stages. In each stage, the number of CFA-Former blocks is consistent with the number of Swing Transformer blocks to ensure the effectiveness and consistency of the feature extraction process.

[0011] S2: Input the image into the cervical cell classification network framework. The input image is first processed by the PatchPartition module to divide it into blocks. Each 4×4 adjacent pixels is divided into a patch.

[0012] S3: The image is flattened in the channel direction. For cervical cell images, which are generally RGB three-channel images, the size of the image will change after flattening.

[0013] S4: In Stage 1, linear embedding is used for processing. Linear embedding is used to perform a linear transformation on the channel data of each pixel, transforming the image from the original dimension to a new dimension.

[0014] S5: In Stages 2 to 4, a Patch Merging layer is used for downsampling to reduce image size while retaining key information, thereby further improving feature representation capabilities;

[0015] S6: When the image passes through the CFA-Former module and then through the RMSlayerNorm layer for layer normalization and global average pooling, it finally reaches the classification head for classification. The RMSlayerNorm layer is used instead of the traditional LayerNorm layer to speed up the convergence of the network and reduce the consumption of computing resources.

[0016] Furthermore, the core components of the CFA-Former module include at least the CFA module and the W-MSA / SW-MSA module.

[0017] Furthermore, the CFA module is a parallel attention mechanism that effectively combines channel attention and spatial attention, i.e., the effective combination of CDA and SFA, thereby enhancing the model's feature learning ability. This parallel structure design allows the model to simultaneously evaluate the criticality of both the channel and spatial dimensions, thus avoiding the risk that a single attention mechanism might overlook certain important dimensions. Through weighted fusion, a more accurate feature representation can ultimately be obtained.

[0018] Furthermore, the CFA module generates a corresponding 3D attention map for the input 3D graph, highlighting important features;

[0019] The process of generating a 3D attention map is broken down into two lightweight branches, each using simplified components, thereby effectively reducing computation and parameter consumption.

[0020] Each element of a feature map can be viewed as a feature detector. Therefore, the two branches of channel attention and spatial attention can clearly learn "which features to pay attention to" and "where to focus", further optimizing the feature extraction process.

[0021] The information transmission process of the CFA module is as follows:

[0022] CFAM = σ(CDA + SFA)

[0023] CFA = (x * CFAM) + x

[0024] Wherein, CFAM represents the attention feature map output after fusing channel attention and spatial attention, σ represents the Sigmoid function, CFA represents the output of the CFA module, and x represents the feature vector of the input CFA module.

[0025] Furthermore, the CDA employs a lightweight and efficient channel attention mechanism, which models the importance of each channel through adaptive pooling and adaptive convolution operations. This eliminates the need for complex fully connected layers, significantly reducing computational complexity and the number of parameters that need to be learned, ensuring that the network can still maintain high computational performance when processing high-dimensional feature spaces.

[0026] The CDA internally has a convolution operation that can adaptively select the kernel size based on the channel dimension of the input feature map;

[0027] Where k represents the amount of information transmitted between the current channel and k other different channels. This value is dynamically determined by a non-linear mapping related to the number of channels, so that the convolution operation can be flexibly adjusted to adapt to the information interaction needs between different channels.

[0028] Since cervical cell images typically have 3 input channels, this number increases to 96 after the first stage of liner embedding, and the number of channels doubles in each subsequent stage, resulting in an even number of channels in each stage. As the subject of the mapping;

[0029] Therefore, the mapping rules are given as follows:

[0030]

[0031] Where log(C) represents the natural logarithm of the number of channels C, and b represents the offset in the general linear mapping, which is set to 1 in this paper. This means rounding down to the nearest odd number; the kernel size is generally set to an odd number.

[0032] The overall process within the CDA is shown below:

[0033]

[0034] Where AAP stands for Adaptive Average Pooling. This represents an adaptive k×k convolution, where σ represents the Sigmoid function, and expand() expands the output to the same size as the input.

[0035] Furthermore, the SFA adopts the Bottleneck structure in ResNet, that is, SFA uses dilated convolution to expand the receptive field in a low-overhead and high-efficiency way, which can save both the number of parameters and the computational cost.

[0036] Furthermore, the application of the SFA includes at least the following steps:

[0037] First, a 1×1 convolution is used to reduce the dimension of the feature map C×H×W projection to [value missing]. Feature maps are integrated and compressed across the channel dimension, with a compression ratio of 16 set in this paper;

[0038] After dimensionality reduction, two dilated convolutions are applied to effectively capture and utilize contextual information;

[0039] Finally, a 1×1 convolution is used to compress the feature map into 1×H×W;

[0040] For adjusting the final output scale, expand() is used at the end to expand the feature map to the same size as the CDA branch so that the two branches can be fused.

[0041] The calculation process of the SFA is as follows:

[0042]

[0043] Among them, f 1xl This represents a convolution operation with a kernel size of 1×1. This represents a 3×3 dilated convolution, where d is the dilation parameter of the dilated convolution, set to 4, and the padding is also set to 4.

[0044] Compared with the prior art, the beneficial effects of the present invention are:

[0045] 1. This invention proposes a CFA-Former network model based on the CFA (Cross Focus Attention) module. By combining channel attention and spatial attention, it solves the limitations of traditional models in capturing multi-scale features. Furthermore, by strengthening the attention to important information and location, this model can effectively improve the accuracy and robustness of cervical cell classification tasks.

[0046] 2. In the model design of this invention, the CFA module adaptively focuses on and suppresses important features through two learning paths. It includes two sub-modules: CDA (Channel DimFocus Attention) and SFA (Spatial Focus Attention). The CDA module can optimize the information extraction of the network in the channel dimension through a lightweight channel attention mechanism; while the SFA module improves the feature representation ability of the model in the spatial dimension through an enhanced spatial attention mechanism, showing significant advantages, especially when dealing with complex cell images.

[0047] 3. This invention also introduces RWSLayerNorm to replace the traditional LayerNorm layer, further improving the training efficiency of the model. This optimization not only accelerates the training process but also effectively avoids common gradient vanishing and convergence problems, making the network more stable when processing large-scale data.

[0048] 4. This invention underwent comprehensive experimental validation on multiple different datasets, including quantitative evaluation of labeled datasets and qualitative analysis of model results. Experimental results show that this invention significantly outperforms existing methods on multiple evaluation metrics, validating its effectiveness in cervical cell classification. Through reasonable architecture design and module innovation, this invention successfully achieves efficient extraction and fusion of global and local features of cervical cell images, overcoming the limitations of traditional methods and single deep learning models. In practical applications, this invention not only provides more accurate classification support for cervical cancer screening but also offers valuable reference for medical image classification tasks. Attached Figure Description

[0049] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0050] Figure 1 This is a diagram of the overall network framework of the present invention;

[0051] Figure 2 This is a structural diagram of the CFA of the present invention;

[0052] Figure 3 This is a comparison chart showing the results of porting the modules from this invention to other models;

[0053] Figure 4 This is a comparison chart of FLOPs when the modules in this invention are ported to other models;

[0054] Figure 5 This is a comparison chart of the classification results of this invention and other networks for specific categories. Detailed Implementation

[0055] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0056] This invention proposes a CFA (Cross Focus Attention) module and designs a CFA-Former network model based on this module. As the core component of CFA-Former, CFA aims to enhance the network's representational capabilities. This module efficiently identifies and focuses on content and locations that need emphasis or suppression through two different learning paths, thereby effectively refining intermediate features. The CFA module comprises two sub-modules: CDA (Channel DimFocus Attention) and SFA (Spatial Focus Attention). CDA is a lightweight channel attention module, while SFA is a reinforced spatial attention module. Furthermore, the model uses RWSLayerNorm instead of the traditional LayerNorm layer, significantly improving the network's training efficiency.

[0057] A cervical cell classification method based on attention mechanism and Swing Transformer includes at least the following steps:

[0058] S1: Constructing a cervical cell classification network framework based on attention mechanism fusion and Swing Transformer (see...) Figure 1 The overall network structure is designed based on the Swing Transformer and retains the original structural characteristics of the Swing Transformer, namely, extracting image features step by step through four stages. In each stage, the number of CFA-Former blocks is consistent with the number of Swing Transformer blocks to ensure the effectiveness and consistency of the feature extraction process.

[0059] S2: Input the image into the cervical cell classification network framework. The input image is first processed by the PatchPartition module to divide it into blocks. Each 4×4 adjacent pixels is divided into a patch.

[0060] S3: The image is flattened in the channel direction. For cervical cell images, which are generally RGB three-channel images, the size of the image will change after flattening.

[0061] S4: In Stage 1, linear embedding is used for processing. Linear embedding is used to perform a linear transformation on the channel data of each pixel, transforming the image from the original dimension to a new dimension.

[0062] S5: In Stages 2 to 4, a Patch Merging layer is used for downsampling to reduce image size while retaining key information, thereby further improving feature representation capabilities;

[0063] S6: When the image passes through the CFA-Former module and then through the RMSlayerNorm layer for layer normalization and global average pooling, it finally reaches the classification head for classification. The RMSlayerNorm layer is used instead of the traditional LayerNorm layer to speed up the convergence of the network and reduce the consumption of computing resources.

[0064] Furthermore, the core components of the CFA-Former module include at least the CFA module and the W-MSA / SW-MSA module.

[0065] Furthermore, the CFA module (see...) Figure 2 This is a parallel attention mechanism. The CFA module effectively combines channel attention and spatial attention, that is, the effective combination of CDA and SFA, thereby enhancing the model's feature learning ability. This parallel structure design allows the model to evaluate the criticality of both channel and spatial dimensions at the same time, thereby avoiding the risk that a single attention mechanism may ignore some important dimensions. Through weighted fusion, a more accurate feature representation can be obtained in the end.

[0066] Furthermore, the CFA module generates a corresponding 3D attention map for the input 3D graph, highlighting important features;

[0067] The process of generating a 3D attention map is broken down into two lightweight branches, each using simplified components, thereby effectively reducing computation and parameter consumption.

[0068] Each element of a feature map can be viewed as a feature detector. Therefore, the two branches of channel attention and spatial attention can clearly learn "which features to pay attention to" and "where to focus", further optimizing the feature extraction process.

[0069] The information transmission process of the CFA module is as follows:

[0070] CFAM = σ(CDA + SFA)

[0071] CFA = (x * CFAM) + x

[0072] Wherein, CFAM represents the attention feature map output after fusing channel attention and spatial attention, σ represents the Sigmoid function, CFA represents the output of the CFA module, and x represents the feature vector of the input CFA module.

[0073] Furthermore, the CDA employs a lightweight and efficient channel attention mechanism, which models the importance of each channel through adaptive pooling and adaptive convolution operations. This eliminates the need for complex fully connected layers, significantly reducing computational complexity and the number of parameters that need to be learned, ensuring that the network can still maintain high computational performance when processing high-dimensional feature spaces.

[0074] The CDA internally has a convolution operation that can adaptively select the kernel size based on the channel dimension of the input feature map;

[0075] Where k represents the amount of information transmitted between the current channel and k other different channels. This value is dynamically determined by a non-linear mapping related to the number of channels, so that the convolution operation can be flexibly adjusted to adapt to the information interaction needs between different channels.

[0076] Since cervical cell images typically have 3 input channels, this number increases to 96 after the first stage of liner embedding, and the number of channels doubles in each subsequent stage, resulting in an even number of channels in each stage. As the subject of the mapping;

[0077] Therefore, the mapping rules are given as follows:

[0078]

[0079] Where log(C) represents the natural logarithm of the number of channels C, b represents the offset in a general linear mapping, which is set to 1 in this paper, and the kernel size is generally set to an odd number. This means rounding up to the nearest odd number.

[0080] The overall process within the CDA is shown below:

[0081]

[0082] Where AAP stands for Adaptive Average Pooling. This represents an adaptive k×k convolution, where σ represents the Sigmoid function, and expand() expands the output to the same size as the input.

[0083] Furthermore, the SFA adopts the Bottleneck structure in ResNet, that is, SFA uses dilated convolution to expand the receptive field in a low-overhead and high-efficiency way, which can save both the number of parameters and the computational cost.

[0084] In the SFA, a spatial attention map is ultimately generated to emphasize features at different spatial locations or suppress features at unimportant locations. Contextual information is crucial for identifying which spatial locations require attention. To efficiently utilize this contextual information, a large receptive field is needed. However, using excessively large convolutional kernels leads to excessive computational overhead. Therefore, SFA employs dilated convolutions to expand the receptive field in a low-cost, high-efficiency manner. Compared to standard convolutions, dilated convolutions can more easily construct effective spatial mappings because the receptive field can be expanded exponentially through the arrangement of dilated convolutions, enabling the SFA module to efficiently summarize and integrate contextual information.

[0085] Furthermore, the application of the SFA includes at least the following steps:

[0086] First, a 1×1 convolution is used to reduce the dimension of the feature map C×H×W projection to [value missing]. Feature maps are integrated and compressed across the channel dimension, with a compression ratio of 16 set in this paper;

[0087] After dimensionality reduction, two dilated convolutions are applied to effectively capture and utilize contextual information;

[0088] Finally, a 1×1 convolution is used to compress the feature map into 1×H×W;

[0089] For adjusting the final output scale, expand() is used at the end to expand the feature map to the same size as the CDA branch so that the two branches can be fused.

[0090] The calculation process of the SFA is as follows:

[0091]

[0092] Among them, f 1xl This represents a convolution operation with a kernel size of 1×1. This represents a 3×3 dilated convolution, where d is the dilation parameter of the dilated convolution, set to 4, and the padding is also set to 4.

[0093] The following technical assessment is proposed:

[0094] Quantitative assessment

[0095] We evaluate the performance of this invention through quantitative measurements. To effectively evaluate the proposed method, we use several commonly used evaluation metrics in the field of image classification as evaluation results: accuracy, precision, recall, F1 score, AUC, sensitivity, and specificity. Sensitivity and specificity are only used as evaluation metrics for binary classification. Accuracy assesses the probability of a correct prediction among all samples; precision assesses the proportion of actually positive samples out of those predicted as positive, reflecting the accuracy of the model's predictions; recall assesses the proportion of actually positive samples that were predicted as positive, reflecting the comprehensiveness of the model's predictions; and the F1 score is used to balance precision and recall, representing the harmonic mean of the two. The AUC value is the area under the ROC (Receiver Operating Characteristic) curve, representing the model's ability to distinguish between positive and negative samples. The closer the value is to 1, the stronger the model's classification ability. Sensitivity and Recall are calculated using the same formula, both reflecting the comprehensiveness of the model's predictions. Specificity is used to measure the model's ability to correctly identify negative samples, that is, the proportion of samples that are actually negative that are correctly identified as negative by the model.

[0096] In addition to basic classification metrics, this invention also employs FLOPs, Throughout, and Params to more comprehensively evaluate model performance. FLOPs represent the number of floating-point operations required by the model during execution, used to measure the computational complexity of an algorithm or model. Its value is related to the model's complexity and the set batch size, but is generally a multiple of the batch size of 1. Params represent the number of parameters in the model and are also used to evaluate the complexity of the algorithm or model. Throughput (images / s) represents the number of images processed by the model per second, used to measure model efficiency, and under the same hardware conditions, it reveals the model's inference speed.

[0097] Tables 1 and 2 show the performance metrics of this invention compared with other methods on the LBC dataset and the Tianchi Cervical Cell Challenge dataset, respectively. The LBC dataset is a four-class classification dataset, and the Tianchi Cervical Cell Challenge dataset is a two-class classification dataset. The experimental results show that this invention exhibits superior performance, outperforming other methods on most metrics.

[0098] Since the CFA-Former is based on the Swing Transformer, it was selected as the baseline model for this experiment. Based on different Swing Transformer structural designs, different CFA-Former structures were designed accordingly. Table 1 shows the corresponding CFA-Former structural designs. Due to hardware limitations, the Tiny structure was used for the experiment.

[0099] Table 1 Different Structures of the CFA-Former Model

[0100]

[0101] Table 2 shows the quantitative measurement results on the LBC dataset. The mainstream and advanced Transformer architecture network was selected in recent years. CFA-Former achieved the best performance compared to the baseline model in terms of both accuracy and F1 score. The number of parameters increased by only 0.16M, and the number of FLOPs remained almost unchanged, but the performance was greatly improved, highlighting the superiority of CFA-Former.

[0102] Table 2 shows the quantitative measurement results on the Mendeley LBC dataset.

[0103]

[0104] Table 3 records the comparison with the baseline model, proving that the model has a certain degree of generalization and outperforms the baseline model on different datasets.

[0105] Table 3. Quantitative measurement results from the Tianchi Cervical Cell Challenge dataset.

[0106]

[0107] Table 4 illustrates the effectiveness of the CFA module and RMSlayerNorm. Experiments were first conducted with and without the CDA module and with and without the SFA module. The results showed that removing the CDA and SFA modules resulted in a slight decrease in accuracy, while adding both CDA and SFA resulted in a significant increase in accuracy. Next, experiments were conducted to see if the RMSlayerNorm layer was replaced. It was evident that the inference speed of the model increased. Finally, CDA and SFA were added to the baseline model (i.e., the CFA module was added), but the RMSlayerNorm layer was not replaced. It was evident that the accuracy was not significantly different, but the inference speed was significantly slower than CFA-Former.

[0108] Table 4 shows the quantitative measurement results on the Mendeley LBC dataset.

[0109]

[0110]

[0111] 2) Qualitative assessment

[0112] Based on the characteristics of the CFA module and RMSlayerNorm, and considering their portability, this paper merges the designed CFA module into some common Transformer structures, such as DeiT, T2T, PerViT, TNT, and PVT, which has achieved good results. Figure 3 The figures show the results of training these models from scratch on the LBC dataset, as well as the results after combining them with the CFA module proposed in this paper. Figure 4 These are the FLOPs of the Transformer architecture. These diagrams illustrate that the CFA module is portable, reusable, and can effectively reduce model complexity while significantly improving network performance.

[0113] Figure 4 and Figure 5 This paper compares the accuracy of CFA-Former with T2T, Focal, DeiT, and PerViT on various categories (HSIL, LSIL, NILM, SCC) in the dataset. As shown in the figure, all networks achieve very high accuracy for normal negative cells (NILM), demonstrating excellent classification ability. However, in the more difficult categories of HSIL and SCC, the accuracy of all networks decreases, but CFA-Former significantly outperforms the other networks, achieving an accuracy of 99.38% for HSIL and 99.91% for SCC, both being the best performance. For the LSIL category, the accuracy of CFA-Former, PerViT, and Focal networks is similar, showing comparable performance, reaching 99.97% (CFA-Former), 99.87% (PerViT), and 99.88% (Focal), respectively.

[0114] In summary:

[0115] (1) This invention innovatively designs a CFA module based on attention mechanism fusion and constructs a CFA-Former network architecture based on the SwinTransformer structure, specifically for efficient classification of cervical cells. This architecture fully utilizes the advantages of the Swin Transformer, effectively integrating it with the attention mechanism to achieve an efficient combination of channel attention and spatial attention within the model. The CFA module contains two sub-modules: CDA (Channel DimFocusAttention) and SFA (Spatial Focus Attention). CDA is a lightweight channel attention module that focuses on improving classification performance by enhancing the features of important channels; while SFA is an enhanced spatial attention module that can focus on key spatial regions in the image. The synergistic effect of the two sub-modules greatly enhances the feature extraction capability of the model, thereby significantly improving the overall classification performance.

[0116] (2) This invention is the first to successfully integrate RMSLayerNorm (Root Mean Square Layer Normalization) technology into the Swing Transformer framework, aiming to improve model performance in cervical cell classification tasks. RMSLayerNorm, as a novel normalization method, is more effective than traditional LayerNorm in adapting to different input data distributions, especially exhibiting stronger generalization ability in deep learning. Experimental results show that RMSLayerNorm significantly improves the inference speed of the Swing Transformer while reducing overfitting. In the specific task of cervical cell classification, the introduction of RMSLayerNorm not only optimizes the training process but also further improves the accuracy and efficiency of the model in processing cervical cell images, providing a feasible and superior solution for this task.

[0117] (3) This invention conducted extensive experiments on two different cervical cell image datasets to verify the effectiveness and advantages of the CFA-Former architecture and its CFA module. Experimental results show that the CFA module not only significantly improves the classification performance of cervical cells, but also has strong portability and scalability, and can be used in conjunction with other mainstream deep learning network frameworks (such as ResNet, VGG, etc.). By embedding the CFA module into the existing network architecture, the network model can still achieve a significant performance improvement with a small parameter increment, demonstrating significant flexibility. This feature enables the CFA module to be widely used in various classification tasks, especially in fields requiring high-precision classification, such as medical image analysis.

[0118] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

Claims

1. A cervical cell classification method based on attention mechanism and Swing Transformer, characterized in that: At least the following steps are included: S1: Construct a cervical cell classification network framework based on attention mechanism fusion and Swing Transformer. The overall network structure is designed based on Swing Transformer and maintains the original structural characteristics of Swing Transformer, that is, it extracts image features step by step through four stages. In each stage, the number of CFA-Former blocks is consistent with the number of Swing Transformer blocks to ensure the effectiveness and consistency of the feature extraction process. The core components of the CFA-Former module include at least the CFA module and the W-MSA / SW-MSA module; The CFA module is a parallel attention mechanism that effectively combines channel attention and spatial attention, i.e., the effective combination of CDA and SFA, thereby enhancing the model's feature learning ability. This parallel structure design allows the model to evaluate the criticality of both the channel and spatial dimensions simultaneously, thus avoiding the risk that a single attention mechanism might overlook some important dimensions. Through weighted fusion, a more accurate feature representation can be obtained in the end. The CFA module generates a corresponding 3D attention map for the input 3D graph, highlighting important features; The process of generating a 3D attention map is broken down into two lightweight branches, each using simplified components, thereby effectively reducing computation and parameter consumption. Each element of a feature map can be viewed as a feature detector. Therefore, the channel attention and spatial attention branches can clearly learn "which features to pay attention to" and "where to focus," further optimizing the feature extraction process. The information transmission process of the CFA module is as follows: ; ; in, This represents the attention feature map output after fusing channel attention and spatial attention. This represents the Sigmoid function. This represents the output of the CFA module. The feature vector representing the input CFA module; The CDA internally has a convolution operation that can adaptively select the kernel size based on the channel dimension of the input feature map; k represents the amount of information transmitted between the current channel and other different channels. This value is dynamically determined through a non-linear mapping related to the number of channels, so that the convolution operation can be flexibly adjusted to adapt to the information interaction needs between different channels. Since cervical cell images typically have 3 input channels, this number increases to 96 after the first stage of liner embedding, and the number of channels doubles in each subsequent stage, resulting in an even number of channels in each stage. As the subject of the mapping; The overall process within the CDA is shown below: ; in, Indicates adaptive average pooling. This represents an adaptive k×k convolution. This represents the Sigmoid function. This means expanding the output to a shape with the same size as the input; S2: Input the image into the cervical cell classification network framework. The input image is first processed by the patch segmentation module, and each 4×4 adjacent pixels are divided into a patch. S3: The image is flattened in the channel direction. For cervical cell images, which are generally RGB three-channel images, the size of the image will change after flattening. S4: In Stage 1, linear embedding is used for processing. Linear embedding is used to perform a linear transformation on the channel data of each pixel, transforming the image from the original dimension to a new dimension. S5: In Stage 2 to Stage 4, a patch merging layer is used for downsampling to reduce image size while retaining key information, thereby further improving feature representation capabilities; S6: When the image passes through the CFA-Former module and then through the RMSlayerNorm layer for layer normalization and global average pooling, it finally reaches the classification head for classification. The RMSlayerNorm layer is used instead of the traditional LayerNorm layer to speed up the convergence of the network and reduce the consumption of computing resources.

2. The cervical cell classification method based on attention mechanism and Swing Transformer according to claim 1, characterized in that: The SFA adopts the Bottleneck structure in ResNet, that is, SFA uses dilated convolution to expand the receptive field in a low-overhead and high-efficiency way, which can save both parameters and computational cost.

3. The cervical cell classification method based on attention mechanism and Swing Transformer according to claim 2, characterized in that: The application of the SFA includes at least the following steps: First, a 1×1 convolution is used to concatenate the feature map. Projection dimensionality reduction The feature maps are integrated and compressed across the channel dimension, and the compression ratio reduction is set to 16 in this paper. After dimensionality reduction, two dilated convolutions are applied to effectively capture and utilize contextual information; Finally, a 1×1 convolution is used to compress the feature map again. ; For adjusting the final output scale, use at the end. Expand the feature map to the same size as the CDA branch so that the two branches can be fused; The calculation process of the SFA is as follows: ; in, This represents a convolution operation with a kernel size of 1×1. This represents a dilated convolution of size 3×3, where d is the dilation parameter of the dilated convolution, set to 4, and the padding is also set to 4.

Citation Information

Patent Citations

  • Abnormal cell identification method and system based on cervical cytology image

    CN112215117A

  • Cervical cell image classification method based on fine granularity

    CN112990118A