A Pap smear cervical cell image classification method based on CNN-SPPF and ViT

Through methods based on CNN-SPPF and ViT, a cervical cell image classification network is constructed, using lossless downsampling and multi-head self-attention mechanism for feature extraction and fusion, solving the problems of insufficient data and over-fitting, and achieving higher cervical cancer accuracy. Cell image classification accuracy and model generalization ability.

CN118097662BActive Publication Date: 2024-09-27NORTHEASTERN UNIV CHINA +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410227380.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-29
Publication Date
2024-09-27
Estimated Expiration
2044-02-29

AI Technical Summary

Technical Problem

The existing technology has an over-fitting problem caused by insufficient data in the classification of cervical cell images, and the traditional method relies on the number of neurons in a specific fully connected layer and cannot cover the optimal selection, resulting in insufficient classification accuracy.

Method used

A method based on CNN-SPPF and ViT is used to construct a cervical cell image classification network through the Focus module, CNN-SPPF module, ViT module, feature fusion module and classification module, combined with lossless downsampling, multi-head self-attention mechanism and TransformerEncoder module to perform Feature extraction and fusion, using dynamic data enhancement to improve model generalization capabilities.

Benefits of technology

It significantly improves the performance of cervical cell image classification, reduces the amount of calculation, retains important features, reduces the risk of over-fitting, improves the robustness and learning efficiency of the model, and achieves higher classification accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118097662B
    Figure CN118097662B
Patent Text Reader

Abstract

The present invention provides a Pap smear cervical cell image classification method based on CNN-SPPF and ViT. The classification method includes: obtaining an image data set of a Pap smear of cervical cells classified into n types of sample sets under a microscope; dividing the cell images in each type of sample set into a training set, a validation set and a test set; preprocessing the training set; building a classification network model; the model includes a Focus module, a CNN-SPPF module, a ViT module, a feature fusion module and a classification module; constructing a loss function; inputting the preprocessed training set into the model, and training the model; when training the model, using a loss based on a training cycle, and using a Loss threshold to selectively enhance the data for the next round of training; inputting the validation set into the trained classification network model for optimization; inputting the test set into the finally optimized classification network model, and outputting the classification result. The present invention uses the CNN-SPPF module and the ViT module to simultaneously extract features from the cell image after lossless downsampling, and then performs feature fusion, and finally maps out the classification result of the cell image, so as to achieve the purpose of greatly improving the classification performance of cervical cell images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of medical image classification, and in particular to a Pap smear cervical cell image classification method based on CNN-SPPF and ViT. Background Art

[0002] Cervical cancer is a common malignancy worldwide, and its morbidity and mortality remain high in underdeveloped countries. Pap smear is a widely used screening technique for early detection of cervical cancer, and this manual screening method has a high rate of false positive results due to human error. To improve manual screening practices, computer-aided diagnosis (CAD) systems based on machine learning (ML) and deep learning (DL) have been widely studied to classify cervical Pap cells.

[0003] Cytopathology screening is a common method for diagnosing cervical malignancies. The Pap test is the most common method for detecting cervical cancer, with strong universality and high accuracy. However, the traditional manual analysis of the Pap test requires a lot of manpower, with doctors observing cell sections to obtain results. The manual labeling method is inefficient and prone to misdiagnosis due to fatigue, so a better solution is needed.

[0004] Traditional machine learning mainly includes three steps: cell segmentation, feature extraction, and classification. However, in the step of feature extraction, manual extraction operations cannot guarantee the optimal classification performance. At present, in the field of cell classification, deep learning methods have become mainstream, and transfer learning is one of the commonly used methods. Transfer learning can alleviate the overfitting problem caused by insufficient samples. However, transfer learning also has some disadvantages. It trains the model by using the model parameters and weights trained on other large data sets. In this way, the features of other data sets are introduced in the test phase, which may have a certain impact on the classification accuracy and cannot improve the classification accuracy.

[0005] The previous patent CN111783571A proposed a method for establishing an automatic classification model and classification of cervical cells. This method constructs a cervical cell image dataset by acquiring cervical cell images and performing preprocessing and augmentation. Then, the VGG16 model is used for improvement, and the fully connected layer of the model is redesigned, where the number of neurons in the fully connected layer FC1 is a, and the number of neurons in the fully connected layer FC2 is b, and the value range of a and b is between [256, 512, 1024, 2048]. By setting the initial weights and training the improved VGG16 model using the cervical cell image dataset, the cervical cell automatic classification model is finally obtained. However, this method also has some disadvantages. First, this method relies on the pre-acquired cervical cell image dataset, which may not be applicable in the case of a lack of sufficient training data. Secondly, this method only uses the VGG16 model as the basic model for improvement. For more complex cervical cell classification problems, a deeper or more advanced model structure may be required. In addition, this method only considers several specific value ranges when selecting the number of neurons in the fully connected layer, which may not cover the optimal number of neurons.

[0006] Therefore, we urgently need to provide a new Pap smear cervical cell image classification method to solve the technical defects existing in the above-mentioned prior art. Summary of the invention

[0007] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.

[0008] To this end, the purpose of the present invention is to propose a Pap smear cervical cell image classification method based on CNN-SPPF and ViT.

[0009] In order to achieve the above-mentioned purpose, the technical solution of the present invention provides a Pap smear cervical cell image classification method based on CNN-SPPF and ViT, comprising: step S1: obtaining an image data set of a Pap smear of cervical cells under a microscope; wherein the image data set is classified into n types of sample sets; step S2: dividing the cervical cell images in each type of sample set into a training set, a validation set and a test set according to a preset ratio; step S3: preprocessing the training set to obtain a preprocessed training set; step S4: constructing a classification network model for cervical cell images; wherein the classification network model comprises: a Focus module, a CNN-SPPF module, a ViT module, a feature fusion module and a classification module; the CNN-SPPF module comprises a first convolutional layer, a first depthwise separable convolutional module, a first maximum pooling layer, a second convolutional layer, a second depthwise separable convolutional module, a second maximum pooling layer, a third convolutional layer, a third depthwise separable convolutional module, a third ... A separable convolution module, a third maximum pooling layer, a fourth convolution layer, a fourth depth-separable convolution module, a fourth maximum pooling layer, a fifth convolution layer, an SPPF module, and a fifth depth-separable convolution module; the ViT module includes an Embedding layer, a TransformerEncoder module group, and a Reshape module; the Embedding layer includes a sixth convolution layer, a LinearProjection module, and a PositionEmbedding module; the TransformerEncoder module group includes a first TransformerEncoder module, a second TransformerEncoder module, ... an Nth TransformerEncoder module connected in series, N ≥ 2; each TransformerEncoder module includes an MLP module and an attention module Block module; the attention Block module includes a multi-head self-attention module and a feedforward neural network; step S5: constructing the loss function of the classification network model; step S6: inputting the preprocessed training set into the classification network model, and training the classification network model based on the loss function; step S7: when training the classification network model, adopting the Loss threshold based on the training cycle to train, and in the training process of each training cycle, calculating the loss difference between two consecutive training cycles; if the loss difference is less than the given Loss threshold, then entering the training of the next training cycle, otherwise, performing selective data enhancement processing on the training set input into the classification network model, until the loss difference between two consecutive training cycles is less than the Loss threshold, then entering the training of the next training cycle; step S8: inputting the verification set into the trained classification network model for optimization, and saving the finally optimized classification network model;Step S9: input the test set into the finally optimized classification network model, and output the classification result of the cervical cell image corresponding to the test set; wherein the Focus module is used to receive the cervical cell images corresponding to the preprocessed training set, validation set or test set, and losslessly downsample the cervical cell images corresponding to the preprocessed training set, validation set or test set; the cervical cell images after lossless downsampling are sequentially connected to each other through a first convolutional layer, a first depthwise separable convolutional module, a first maximum pooling layer, a second convolutional layer, a second depthwise separable convolutional module, a second maximum pooling layer, a third convolutional layer, a third depthwise separable convolutional module, and a third maximum pooling layer. The fourth convolution layer, the fourth depth-separable convolution module, the fourth maximum pooling layer, the fifth convolution layer, the SPPF module and the fifth depth-separable convolution module perform local multi-level feature extraction to extract the first feature vector of M dimension; and the Embedding layer is specifically used to: divide the cervical cell image after lossless downsampling into a plurality of non-intersecting patches of fixed size through the sixth convolution layer; map each Pacth to a one-dimensional vector through the LinearProjection module to flatten each patch into a corresponding one-dimensional vector to output the corresponding feature map C1; add position information to the feature map C1 through the Position Embedding module to output the feature map C2 after adding the position information; add the feature map C1 and the feature map C2 through the add operation to output the feature map C3; and;

[0010] The first TransformerEncoder module in the TransformerEncoder module group is specifically used for: performing three different linear mappings on the input feature map C3 through the first LayerNorm layer to obtain the Query matrix, Key matrix and Value matrix respectively; dividing the Query matrix, Key matrix and Value matrix into H groups in the channel dimension through the multi-head self-attention module, performing multi-head self-attention calculation in each group, and obtaining the feature map of each group after the multi-head self-attention calculation, so as to splice the feature map of each group in the channel dimension later to form the final feature map C4; performing nonlinear transformation and mapping on the feature map C4 through the feedforward neural network to output the feature map C5; adding the feature map C3 and the feature map C5 through the add operation to output the feature map C6; receiving the feature map C6 through the second LayerNorm layer to output the feature map C7; The feature map C7 is received through the MLP module to output the feature map C8; the feature map C6 and the feature map C8 are added through the add operation to output the feature map C9; the feature map C9 is sequentially input into the second TransformerEncoder module, ... the Nth TransformerEncoder module in the TransformerEncoder module group, so that the TransformerEncoder module group outputs the final feature map C10; the Reshape module is used to receive the feature map C10 and adjust the shape of the feature map C10 to extract the N-dimensional second feature vector; the feature fusion module is used to serially fuse the N-dimensional second feature vector and the M-dimensional first feature vector to obtain an (M+N)-dimensional feature vector; the classification module is used to perform convolution and global pooling operations on the (M+N)-dimensional feature vector in sequence, and then output the classification result of the cervical cell image.

[0011] Preferably, the calculation formula for multi-head self-attention is performed in each group:

[0012]

[0013] Where Q, K, and V are the Query matrix, Key matrix, and Value matrix respectively; d head The dimension of the feature subset processed by each attention head; The calculation result is expressed as a dot product attention score; the Softmax function is used to normalize the dot product attention score to convert the dot product attention score into a corresponding probability distribution.

[0014] Preferably, each of the depth-separable convolution modules specifically includes: a first SeparableConv2d layer, a second SeparableConv2d layer, a SeparableBottleneck layer, a seventh convolution layer, and a first channel dimension splicing module; the first SeparableConv2d layer is used to receive the feature map output by the first convolution layer, the second convolution layer, the third convolution layer, the fourth convolution layer, or the fifth convolution layer or the feature map output by the SPPF module, and perform feature extraction on the received feature map to reduce the number of channels of the received feature map to output the feature map C1 1, and at the same time, the received feature map adjusts its own channel number through the seventh convolution layer to output the feature map C12; the SeparableBottleneck layer is used to extract features from the feature map C11 to output the feature map C13; the first channel dimension splicing module is used to splice the feature map C12 and the feature map C13 on the channel dimension to output the feature map C14; the second SeparableConv2d layer is used to receive the feature map C14 and extract features from the feature map C14 to generate the feature map finally output by each of the depth-separable convolution modules.

[0015] Preferably, the SPPF module specifically includes: an eighth convolutional layer, a first MaxPool2d layer, a second MaxPool2d layer, a third MaxPool2d layer, a second channel dimension splicing module and a ninth convolutional layer; wherein the eighth convolutional layer is used to receive the feature map output by the fifth convolutional layer, and reduce the number of channels of the feature map output by the fifth convolutional layer to output a feature map C15; the first MaxPool2d layer is used to receive the feature map C15, and pool the feature map C15 to increase the receptive field of the feature map C15, and capture the contextual information of different scales of the feature map C15 to output a feature map C16; the second MaxPool2d layer is used to receive the feature map C16, and pool the feature map C16 Pooling is used to increase the receptive field of the feature map C16 and capture the contextual information of different scales of the feature map C16 to output the feature map C17; the third MaxPool2d layer is used to receive the feature map C17 and pool the feature map C17 to increase the receptive field of the feature map C17 and capture the contextual information of different scales of the feature map C17 to output the feature map C18; the second channel dimension splicing module is used to splice the feature map C16, the feature map C17 and the feature map C18 with the feature map C15 in the channel dimension to output the feature map C19; the convolution layer 9 is used to receive the feature map C19 and adjust the number of channels of the feature map C19 to generate the feature map finally output by the SPPF module.

[0016] Preferably, the training set is preprocessed, specifically including: changing the scale and enhancing the data of the training set.

[0017] Beneficial effects of the present invention:

[0018] (1) The Pap smear cervical cell image classification method based on CNN-SPPF and ViT provided by the present invention uses the CNN-SPPF module and the ViT module to simultaneously extract features of the cervical cell image after lossless downsampling, and then performs serial fusion on the extracted features, and then performs convolution and global pooling operations on the fused features, thereby mapping the final classification result, thereby achieving the purpose of greatly improving the cervical cell image classification performance.

[0019] (2) The Pap smear cervical cell image classification method based on CNN-SPPF and ViT provided by the present invention performs lossless downsampling on the cervical cell images corresponding to the preprocessed training set, validation set or test set. The lossless downsampling operation reduces the amount of calculation while minimizing the loss of cervical cell image information, retaining the important features of the cervical cell image, and preparing for subsequent feature extraction.

[0020] (3) The present invention adds the SPPF module to extract key features at different scales to avoid the key features affecting the classification results. At the same time, the separable C3 convolution module is used to reduce the number of parameters and calculations, and reduce the risk of overfitting.

[0021] (4) The Pap smear cervical cell image classification method based on CNN-SPPF and ViT provided by the present invention introduces the ViT module, expands the receptive field of the image, and makes the constructed cervical cell image classification network model pay more attention to the global information of the image.

[0022] (5) The present invention proposes a dynamic data enhancement method based on training loss, which can significantly improve the generalization ability of the model, reduce overfitting, and enhance the robustness and learning efficiency of the model by continuously introducing new samples with random transformations.

[0023] Additional aspects and advantages of the invention will become apparent from the following description, or may be learned by practice of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 A schematic flow chart of a method for classifying cervical cell images of Pap smears based on CNN-SPPF and ViT according to an embodiment of the present invention is shown;

[0025] Figure 2 A schematic diagram of the structure of a classification network model for cervical cell images based on a CNN-SPPF module and a ViT module constructed according to an embodiment of the present invention is shown;

[0026] Figure 3 A schematic diagram showing the structure of a first depth-separable convolution module, a second depth-separable convolution module, a third depth-separable convolution module, a fourth depth-separable convolution module, or a fifth depth-separable convolution module in a CNN-SPPF module of a classification network model for cervical cell images according to an embodiment of the present invention;

[0027] Figure 4 A schematic diagram showing the structure of an SPPF module in a CNN-SPPF module of a classification network model for cervical cell images according to an embodiment of the present invention;

[0028] Figure 5 A schematic flow chart of a Pap smear cervical cell image classification method based on CNN-SPPF and ViT according to another embodiment of the present invention is shown. DETAILED DESCRIPTION

[0029] In order to more clearly understand the above-mentioned objectives, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0030] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.

[0031] Figure 1 FIG. 1 is a schematic flow chart of a method for classifying cervical cell images of a Pap smear based on CNN-SPPF and ViT according to an embodiment of the present invention. Figure 1 As shown, the classification method includes:

[0032] Step S1: obtaining an image dataset of a Pap smear of cervical cells under a microscope; the image dataset is classified into n types of sample sets;

[0033] Step S2: Dividing the cervical cell images in each type of sample set into a training set, a validation set, and a test set according to a preset ratio;

[0034] Step S3: preprocessing the training set to obtain a preprocessed training set;

[0035] Step S4: constructing a classification network model for cervical cell images; the classification network model includes: a Focus module, a CNN-SPPF module, a ViT module, a feature fusion module and a classification module;

[0036] Step S5: constructing a loss function of the classification network model;

[0037] Step S6: inputting the preprocessed training set into the classification network model, and training the classification network model based on the loss function;

[0038] Step S7: When training the classification network model, a Loss threshold based on a training cycle is used for training, and in the training process of each training cycle, the loss difference between two consecutive training cycles is calculated; if the loss difference is less than the given Loss threshold, then the training of the next training cycle is entered; otherwise, selective data enhancement processing is performed on the training set input to the classification network model until the loss difference between two consecutive training cycles is less than the Loss threshold, then the training of the next training cycle is entered;

[0039] Step S8: input the validation set into the trained classification network model for optimization, and save the final optimized classification network model;

[0040] Step S9: input the test set into the finally optimized classification network model, and output the classification results of the cervical cell images corresponding to the test set.

[0041] In this embodiment, if Figure 2 As shown, the CNN-SPPF module includes a first convolution layer, a first depth-separable convolution module, a first maximum pooling layer, a second convolution layer, a second depth-separable convolution module, a second maximum pooling layer, a third convolution layer, a third depth-separable convolution module, a third maximum pooling layer, a fourth convolution layer, a fourth depth-separable convolution module, a fourth maximum pooling layer, a fifth convolution layer, an SPPF module, and a fifth depth-separable convolution module, which are sequentially connected to each other;

[0042] The ViT module includes an Embedding layer, a TransformerEncoder module group and a Reshape module; the Embedding layer includes a sixth convolutional layer, a LinearProjection module and a Position Embedding module; the TransformerEncoder module group includes a first TransformerEncoder module, a second TransformerEncoder module and a third TransformerEncoder module connected in series; each TransformerEncoder module includes an MLP module and an attention Block module; the attention Block module includes a multi-head self-attention module and a feedforward neural network;

[0043] The Focus module is used to receive the cervical cell images corresponding to the preprocessed training set, validation set or test set, and perform lossless downsampling on the cervical cell images corresponding to the preprocessed training set, validation set or test set; the cervical cell images after lossless downsampling are subjected to local multi-level feature extraction through the first convolution layer, the first depthwise separable convolution module, the first maximum pooling layer, the second convolution layer, the second depthwise separable convolution module, the second maximum pooling layer, the third convolution layer, the third depthwise separable convolution module, the third maximum pooling layer, the fourth convolution layer, the fourth depthwise separable convolution module, the fourth maximum pooling layer, the fifth convolution layer, the SPPF module and the fifth depthwise separable convolution module which are sequentially connected to each other to extract the first feature vector of M dimension; and

[0044] The Embedding layer is specifically used to: divide the losslessly downsampled cervical cell image into a plurality of non-intersecting fixed-size patches through the sixth convolutional layer; map each patch to a one-dimensional vector through the LinearProjection module, so as to flatten each patch into a corresponding one-dimensional vector, so as to output a corresponding feature map C1; add position information to the feature map C1 through the Position Embedding module, so as to output a feature map C2 with added position information; add the feature map C1 and the feature map C2 through an add operation, so as to output a feature map C3; and

[0045] The first TransformerEncoder module in the TransformerEncoder module group is specifically used to: perform three different linear mappings on the input feature map C3 through the first LayerNorm layer to obtain a Query matrix, a Key matrix and a Value matrix respectively; divide the Query matrix, the Key matrix and the Value matrix into H groups in the channel dimension through the multi-head self-attention module, perform multi-head self-attention calculations in each group, and obtain the feature maps of each group after the multi-head self-attention calculations. The feature maps of each group are subsequently concatenated in the channel dimension to form a final feature map C4; the feature map C4 is nonlinearly transformed and mapped through the feedforward neural network to output a feature map C5; the feature map C3 and the feature map C5 are added through an add operation to output a feature map C6; the feature map C6 is received through the second LayerNorm layer to output a feature map C7; the feature map C7 is received through the MLP module to output a feature map C8; the feature map C6 and the feature map C8 are added through an add operation to output a feature map C9;

[0046] The feature map C9 is sequentially input into the second TransformerEncoder module and the third TransformerEncoder module in the TransformerEncoder module group, so that the TransformerEncoder module group outputs the final feature map C10; the Reshape module is used to receive the feature map C10 and adjust the shape of the feature map C10 to extract the N-dimensional second feature vector; the feature fusion module is used to serially fuse the N-dimensional second feature vector and the M-dimensional first feature vector to obtain an (M+N)-dimensional feature vector; the classification module is used to sequentially perform convolution and global pooling operations on the (M+N)-dimensional feature vector, and output the classification result of the cervical cell image.

[0047] In this embodiment, the Pap smear cervical cell image classification method based on CNN-SPPF and ViT provided by the present invention obtains an image data set of Pap smears of cervical cells classified into n types of sample sets under a microscope, divides the cervical cell images in each type of sample set into a training set, a validation set and a test set according to a preset ratio, preprocesses the training set, and increases the diversity and robustness of the training set samples through image preprocessing to obtain a preprocessed training set. Then, the cervical cell images corresponding to the preprocessed training set, validation set or test set are received through the Focus module, and the cervical cell images corresponding to the preprocessed training set, validation set or test set are losslessly downsampled. The lossless downsampling operation reduces the amount of calculation while minimizing the loss of cervical cell image information, retains the important features of the cervical cell image, and prepares for subsequent feature extraction. The losslessly downsampled cervical cell image is then input into the CNN-SPPF module and the ViT module in parallel to realize local multi-level feature extraction and global multi-level feature extraction of the losslessly downsampled cervical cell image, respectively, to extract the first feature vector of M dimension and the second feature vector of N dimension, respectively. The first feature vector of M dimension extracted by the CNN-SPPF module and the second feature vector of N dimension extracted by the ViT module are serially fused through the feature fusion module (Feature Fusion module, referred to as FFN module) to obtain the feature vector of (M+N) dimension, and then the feature vector of (M+N) dimension is convoluted and globally pooled to map the final classification result.

[0048] In this embodiment, during each training cycle of the classification network model, the model needs to perform a training cycle-based loss training on the input preprocessed training data set. Its specific meaning is to monitor the loss difference between two consecutive training cycles. When the loss difference is lower than the set threshold (such as the set threshold a=0.07), the model is considered to have been fully trained, and then enter the next training cycle. When the loss difference is not lower than the set threshold (such as the set threshold a=0.07), the training set input to the classification network model is selectively data enhanced until the loss difference between two consecutive training cycles is less than the set threshold. At this time, it is considered to be fully trained and enter the next training cycle. Similarly, the same method is used to determine whether it has been fully trained. If it has not been fully trained, it is necessary to selectively give more data enhancement multiples or methods to make the training samples richer to achieve the purpose of sufficient training. This is the meaning of selective data enhancement.

[0049] Furthermore, the CNN-SPPF module in this embodiment is introduced. Specifically, in the CNN-SPPF module, 5 convolutional layers, 5 depth-separable convolutional modules, 4 maximum pooling layers and 1 SPPF module (Spatial PyramidPooling–Fast module, referred to as SPPF module) are used to extract features at different levels. Among them, the 5 convolutional layers in the CNN-SPPF module are: the first convolutional layer, the second convolutional layer, the third convolutional layer, the fourth convolutional layer and the fifth convolutional layer. These 5 convolutional layers are responsible for automatically learning and extracting effective features from their respective input cervical cell images. Through convolution operations, these layers can capture the local features of cervical cell images (such as edges, textures, shapes, etc.), which are crucial for distinguishing different types of cervical cells. Among them, the five depth-separable convolution modules in the CNN-SPPF module are: the first depth-separable convolution module, the second depth-separable convolution module, the third depth-separable convolution module, the fourth depth-separable convolution module and the fifth depth-separable convolution module. The five depth-separable convolution modules (Separable C3 modules) are used, which can greatly reduce the number of parameters and the amount of calculation, and reduce the risk of overfitting. Among them, the four maximum pooling layers in the CNN-SPPF module are: the first maximum pooling layer, the second maximum pooling layer, the third maximum pooling layer and the fourth maximum pooling layer. These four maximum pooling layers increase the insensitivity of the model to small position changes. For cervical cell image classification, even if the position, rotation or scaling of the cells changes slightly in the image through the data preprocessing step, the model can effectively identify and classify, while reducing the computational burden by reducing the dimension of each feature map and retaining the most important feature information. This operation helps to reduce the number of parameters and the amount of calculation in the network and improve the operation efficiency of the model. By reducing the spatial size of features, the max pooling layer helps control overfitting, making the model more generalizable and better able to handle unseen cervical cell images.

[0050] Furthermore, the ViT module in this embodiment is introduced. The ViT module in this embodiment is different from the traditional ViT module and has been modified. The ViT module in this embodiment includes an Embedding layer, a TransformerEncoder module group and a Reshape module. Let us first explain the purpose of using the Embedding layer. Since the ViT module is actually a variant of the Transformer, the original Transformer is designed to process sequence data, that is, a token sequence in the form of a two-dimensional matrix. However, the image is essentially in the form of a three-dimensional matrix, which does not meet the direct input requirements of the Transformer model. Therefore, this embodiment first uses an Embedding layer to transform the data. The Embedding layer in this embodiment includes the sixth convolutional layer, the LinearProjection module and the Position Embedding module. Specifically, a convolutional layer, that is, the sixth convolutional layer is first used to divide the losslessly downsampled cervical cell image into a number of non-intersecting fixed-size patches. Then, through the LinearProjection module, each Pacth is mapped to a one-dimensional vector to flatten each patch into a corresponding one-dimensional vector to output the corresponding feature map C1. Given that each patch in the image is similar to a word in a text sequence and has a fixed order, it is not suitable to randomly shuffle them. Therefore, position information must be introduced for each vector (token). This purpose is achieved through the Position Embedding module, which is responsible for adding position information to each vector in the feature map C1, thereby generating a feature map C2 carrying position information. Subsequently, the feature map C1 without position information added and the feature map C2 with position information added are merged through the addition operation to produce the final feature map C3. The above content is the role and process of the Embedding layer.

[0051] Furthermore, the TransformerEncoder module group in the ViT module is introduced. The TransformerEncoder module group includes the first TransformerEncoder module, the second TransformerEncoder module, and the third TransformerEncoder module which are connected in series; each TransformerEncoder module includes an MLP module and an attention Block module; the attention Block module includes a multi-head self-attention module and a feedforward neural network. The multi-head self-attention module (Multi-Head Attention module) models the correlation between different positions of the input features by calculating the self-attention weights of the input features. The multi-head representation module uses multiple attention heads for parallel calculation to better capture different focus points and features. The feedforward neural network (Feed-Forward Neural Network), this submodule performs nonlinear transformation and mapping on the features output by the multi-head self-attention. It consists of two fully connected layers, and an activation function is used between them for nonlinear transformation. (The feedforward neural network is generally not drawn, that is, Figure 2 not shown in the figure).

[0052] The TransformerEncoder module group in the present embodiment includes 3 TransformerEncoder modules, and the number 3 is set in the present embodiment, and the number may be different for different models. These 3 TransformerEncoder modules, namely the first TransformerEncoder module, the second TransformerEncoder module, and the third TransformerEncoder module connected in series, are stacked together in hierarchical order. This series connection method enhances the ability of the model, enabling it to capture complex patterns and long-distance dependencies in the input data, which is particularly important for processing high-dimensional data such as images. Each TransformerEncoder module pays attention to different parts of the input sequence through a self-attention mechanism, and is further processed by a feedforward neural network, thereby gradually improving the representation ability of the entire model. Each TransformerEncoder module processes the input image block and generates a series of feature representations. When analyzing the present embodiment, you only need to look at one TransformerEncoder module because their functions are the same.

[0053] In this embodiment, the first TransformerEncoder module in the TransformerEncoder module group is specifically used to: perform three different linear mappings on the input feature map C3 through the first LayerNorm layer to obtain the Query matrix, the Key matrix and the Value matrix respectively. The first LayerNorm layer helps to stabilize the training process and ensure that the inputs of different layers have similar distributions, thereby helping to avoid the problem of gradient disappearance or explosion, so that the model can converge faster and improve the training effect. Then, through the multi-head self-attention module, the Query matrix, the Key matrix and the Value matrix are divided into H groups in the channel dimension, and the multi-head self-attention calculation is performed in each group to obtain the feature map of each group after the multi-head self-attention calculation, so as to splice the feature map of each group in the channel dimension later to form the final feature map C4; then, through the feedforward neural network, the feature map C4 is nonlinearly transformed and mapped to output the feature map C5; then, through the add operation, the feature map C3 and the feature map C5 are added to output the feature map C6; then, through the second LayerNorm layer, the feature map C6 is received to output the feature map C7; then, through the MLP module, the feature map C 7, to output feature map C8; then through the add operation, the feature map C6 and the feature map C8 are added to output the feature map C9; then the feature map C9 is sequentially input into the second TransformerEncoder module and the third TransformerEncoder module in the TransformerEncoder module group, so that the TransformerEncoder module group can output the final feature map C10; finally, through the Reshape module, the feature map C10 is received, and the shape of the feature map C10 is adjusted to extract the N-dimensional second feature vector, that is, the feature map C10 output by the Transformer Encoder module group is reorganized into a specific dimension or shape through the Reshape module to extract the N-dimensional second feature vector suitable for the final classification task.

[0054] Furthermore, through the feature fusion module, the N-dimensional second eigenvector and the M-dimensional first eigenvector are serially fused to obtain a (M+N)-dimensional feature vector; then through the classification module, the (M+N)-dimensional feature vector is sequentially convolved and globally pooled, and the classification result of the cervical cell image is output, achieving higher classification accuracy than traditional machine learning or shallow deep learning models.

[0055] In one embodiment of the present invention, the calculation formula for multi-head self-attention is performed in each group:

[0056]

[0057] Where Q, K, and V are the Query matrix, Key matrix, and Value matrix respectively; d head The dimension of the feature subset processed by each attention head; The calculation result is expressed as a dot product attention score; the Softmax function is used to normalize the dot product attention score to convert the dot product attention score into a corresponding probability distribution.

[0058] In this embodiment, in the context of cervical cell image classification, the Query matrix represents the feature representation of the current cervical cell image region (or Patch), which is used to match the features of other regions (Key matrix). This comparison helps the model understand which regions' features are important to the current region, so as to focus on the features that have the greatest impact on the classification results. The Key matrix contains the feature representations of other regions of the cervical cell image, which are matched with the Query matrix. This process determines the relative importance of different parts of the image, helping the model capture the complex structures and relationships within the image. The Value matrix contains the actual content information corresponding to the Key matrix, i.e., the features of each region in the cervical cell image. Once the Query is matched with the Key, the associated Value will be used to construct an attention-weighted output, which reflects the contribution of different parts of the image to the current processing region. head represents the dimension of the feature subset processed by each attention head. By adjusting d head The size of can control the granularity of the model in processing cell image features. head The scaling of It helps to avoid excessively large values ​​in dot product calculations, making gradient updates more stable, which helps the model learn more delicate and accurate feature representations. The Softmax function is used to normalize the dot product attention scores and convert them into corresponding probability distributions. In the cervical cell classification network, this ensures that the output features of each region are obtained by weighted average of the features of all regions in the input image, where the weights represent the relative importance of other regions to the current region. This mechanism enables the model to adaptively focus on those image regions that are most critical for distinguishing different types of cervical cells.

[0059] In one embodiment of the present invention, Figure 3As shown, each of the depth-separable convolution modules specifically includes: a first SeparableConv2d layer, a second SeparableConv2d layer, a SeparableBottleneck layer, a seventh convolution layer, and a first channel dimension splicing module; the first SeparableConv2d layer is used to receive the feature map output by the first convolution layer, the second convolution layer, the third convolution layer, the fourth convolution layer, or the fifth convolution layer or the feature map output by the SPPF module, and perform feature extraction on the received feature map to reduce the number of channels of the received feature map to output the feature map C11 At the same time, the received feature map adjusts its own channel number through the seventh convolution layer to output the feature map C12; the SeparableBottleneck layer is used to extract features from the feature map C11 to output the feature map C13; the first channel dimension splicing module is used to splice the feature map C12 and the feature map C13 on the channel dimension to output the feature map C14; the second SeparableConv2d layer is used to receive the feature map C14 and extract features from the feature map C14 to generate the feature map finally output by each of the depth-separable convolution modules.

[0060] In one embodiment of the present invention, Figure 4As shown, the SPPF module specifically includes: an eighth convolutional layer, a first MaxPool2d layer, a second MaxPool2d layer, a third MaxPool2d layer, a second channel dimension splicing module and a ninth convolutional layer; wherein the eighth convolutional layer is used to receive the feature map output by the fifth convolutional layer, and reduce the number of channels of the feature map output by the fifth convolutional layer to output a feature map C15; the first MaxPool2d layer is used to receive the feature map C15, and pool the feature map C15 to increase the receptive field of the feature map C15, and capture the contextual information of different scales of the feature map C15 to output a feature map C16; the second MaxPool2d layer is used to receive the feature map C16, and pool the feature map C16 Pooling is used to increase the receptive field of the feature map C16 and capture the contextual information of different scales of the feature map C16 to output the feature map C17; the third MaxPool2d layer is used to receive the feature map C17 and pool the feature map C17 to increase the receptive field of the feature map C17 and capture the contextual information of different scales of the feature map C17 to output the feature map C18; the second channel dimension splicing module is used to splice the feature map C16, the feature map C17 and the feature map C18 with the feature map C15 in the channel dimension to output the feature map C19; the convolution layer 9 is used to receive the feature map C19 and adjust the number of channels of the feature map C19 to generate the feature map finally output by the SPPF module.

[0061] In one embodiment of the present invention, the training set is preprocessed, specifically including: changing the scale and enhancing the data of the training set.

[0062] In this embodiment, the scale change is to rescale the size of all images to (224×224) pixels and perform tensor conversion. By rescaling the images, it is possible to ensure that the same input image size is used during training and testing, so that the model can learn and predict accurately.

[0063] In a specific embodiment, the data enhancement method can be divided into two types. First, the first method is used to perform basic geometric transformation and cropping on the image, including random horizontal flipping, random vertical flipping, random cropping and scaling, random rotation and random affine transformation; at the same time, the second image enhancement method is used to enhance the image in terms of color, filtering, elastic transformation, etc., including color jitter, brightness, contrast adjustment, elastic deformation, etc. These methods help to increase the diversity of training samples, improve the robustness of the model to different image changes, and enhance its ability to understand and process different features in the image.

[0064] In one embodiment of the present invention, the TransformerEncoder module group includes only one TransformerEncoder module.

[0065] In one embodiment of the present invention, the MLP module is composed of a linear layer, a Gelu activation function, a LayerNorm layer, and a linear layer.

[0066] The technical solution of the present invention will be demonstrated with a specific embodiment below.

[0067] Figure 5 The development process of a Pap smear cervical cell image classification method based on CNN-SPPF and ViT is shown in the present invention, from image data acquisition, preprocessing, feature extraction, feature fusion, to model training, enhancement processing, testing, and finally the complete process of verifying the model effect through performance evaluation indicators. Figure 5 As shown, the specific implementation steps of the Pap smear cervical cell image classification method based on CNN-SPPF and ViT in this embodiment are as follows:

[0068] (1) Retrieve a dataset of images of cervical cell Pap smears under a microscope from an accessible database (e.g., SIPaKMeD) and use it as the original dataset. 80% of the dataset in each class in the dataset is used as a training set, 10% is used as a validation set, and 10% is used as a test set.

[0069] This example uses the public cervical cell image dataset SIPaKMeD for training and testing. The SIPaKMeD dataset consists of 4049 annotated cervical Pap smear cell images. According to the morphology of the cells, the images are divided into five categories according to the Bethesdas system: keratinized cells, parasitic cells, metaplastic cells, parabasal cells, and superficial-intermediate cells.

[0070] (2) Preprocessing the training set, including scale change and data augmentation, to obtain the preprocessed training set. The preprocessing step is to improve the performance and generalization ability of the model, and also help the model overcome the problem of easy overfitting.

[0071] In the preprocessing step, we first performed image size normalization and tensor conversion, that is, rescaling all images to (224×224) pixels and performing tensor conversion. By rescaling the images, we can ensure that the same input image size is used during training and testing, so that the model can learn and predict accurately.

[0072] Then, two data augmentation methods were performed on the training set. First, we used the first method to perform basic geometric transformations and cropping on the images, including random horizontal flipping, random vertical flipping, random cropping and scaling, random rotation, and random affine transformation; at the same time, we used the second image enhancement method to enhance the images in terms of color, filtering, elastic transformation, etc., including color jittering, brightness and contrast adjustment, elastic deformation, etc. The purpose of these operations is to increase the diversity and robustness of the training samples.

[0073] (3) After the preprocessing step, a classification network model of cervical cell images is constructed. The classification network model includes: Focus module, CNN-SPPF module, ViT module, feature fusion module and classification module. The CNN-SPPF module includes a first convolution layer, a first depth-separable convolution module, a first maximum pooling layer, a second convolution layer, a second depth-separable convolution module, a second maximum pooling layer, a third convolution layer, a third depth-separable convolution module, a third maximum pooling layer, a fourth convolution layer, a fourth depth-separable convolution module, a fourth maximum pooling layer, a fifth convolution layer, an SPPF module and a fifth depth-separable convolution module, which are connected in sequence; the ViT module includes an Embedding layer, a TransformerEncoder module group and a Reshape module; the Embedding layer includes a sixth convolution layer, a LinearProjection module and a PositionEmbedding module; the TransformerEncoder module group includes a first TransformerEncoder module, a second TransformerEncoder module and a third TransformerEncoder module connected in series; each TransformerEncoder module includes an MLP module and an attention Block module; the attention Block module includes a multi-head self-attention module and a feedforward neural network.

[0074] Specifically, a Focus mechanism is introduced into the cervical cell image that is input into the classification network model of the cervical cell image, and the losslessly downsampled data enters two parallel feature extraction modules: the CNN-SPPF module and the ViT module, so as to realize local multi-level feature extraction and global multi-level feature extraction of the losslessly downsampled cervical cell image, so as to extract the M-dimensional first feature vector and the N-dimensional second feature vector, respectively.

[0075] Furthermore, the M-dimensional first feature vector extracted by the CNN-SPPF module and the N-dimensional second feature vector extracted by the ViT module are serially fused through the feature fusion module (Feature Fusion module, referred to as FFN module) to obtain an (M+N)-dimensional feature vector, and then convolution and global pooling operations are performed on the (M+N)-dimensional feature vector. After convolution and global pooling, the (M+N)-dimensional feature vector will be mapped to a classification.

[0076] (4) Add a loss function and an optimizer to the classification network model of the cervical cell image. First, the cross entropy loss function defined in this embodiment is as follows:

[0077]

[0078] In the formula, Loss ce is the cross entropy loss function, which is a loss function used to evaluate the difference between the model output and the true label. The number of samples is n. The true label probability distribution p(z i ) represents the probability that each sample belongs to each category, and the predicted label probability distribution q(z i ) represents the model’s predicted probability that each sample belongs to each category.

[0079] Secondly, define the optimization algorithm: use the AdamW optimization algorithm to adjust the update process of model parameters through parameters such as learning rate and weight decay. It combines the ideas of the Adam algorithm and weight decay to effectively optimize the performance of deep learning models. After the training sample set is input into the cervical cell classification network for training, the back propagation algorithm is used to optimize the cross entropy loss function to update the weight parameters in the cervical cell classification network model.

[0080] (5) Use the training set to train the cervical cell classification network, load the cross entropy loss into the optimization algorithm, and use the cross entropy loss function to optimize the classification accuracy of the model. During the training process, this embodiment proposes a training loss-oriented data enhancement method to improve model performance. Specifically, if the absolute difference of Loss is lower than the threshold a during two consecutive training cycles, the model is considered to have been fully trained. Based on this observation, random image transformation and enhancement are performed to simulate more training samples. In this way, the model will examine different samples in each cycle, thereby improving generalization ability. In this embodiment, the threshold a=0.07 is set.

[0081] The present invention proposes a method of using an improved Loss-based data enhancement method to effectively improve the robustness of the model. Specifically, a training loss-oriented data enhancement method is used to improve the performance and generalization ability of the model. The method monitors the loss difference between two consecutive training cycles. When the difference is lower than a set threshold (such as setting a threshold a=0.07), the model is considered to have been fully trained. At this time, more diverse training samples are simulated by performing random image transformation and enhancement operations such as rotation, scaling, translation, and flipping. This approach ensures that the model is exposed to different samples in each training cycle, thereby enhancing its generalization ability. By expanding the diversity of training data, this method also helps the model learn various visual features and patterns more effectively, while also helping to alleviate the overfitting problem, because the training samples in each cycle are transformed and enhanced, reducing the model's dependence on specific samples.

[0082] The various data augmentation techniques mentioned above are used. At the beginning of each data augmentation, random transformations such as rotation, scaling, translation, or flipping are performed on the training samples. Through these transformations, a large number of new training samples are generated and used as the training set of the current cycle, replacing the previous training set. Therefore, the model will face different samples and transformations in each cycle, further improving its generalization ability.

[0083] During the training of the cervical cell classification network, the network parameters with the highest accuracy during the training process are saved. These parameters will be used for subsequent model prediction tasks until the entire data set has been fully used for 100 iterations of training the network.

[0084] (6) After the model is fully trained, the model is tested using the pre-set untrained images, and the performance of the proposed model is evaluated by calculating the weighted Accuracy, Precision, Recall and F1 score, as shown in the following table.

[0085] Evaluation metrics

[0086]

[0087] The method was experimented with the public dataset SIPaKMeDj and obtained 98.02%, 98.09%, 98.03% and 98.02% accuracy, precision, recall and F1 score, which are better than previous methods. The Pap smear cervical cell image classification method based on CNN-SPPF and ViT provided by the present invention achieves higher classification accuracy than traditional machine learning or shallow deep learning models.

[0088] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A Pap smear cervical cell image classification method based on CNN-SPPF and ViT, It is characterized in that include: Step S1: obtaining an image dataset of a Pap smear of cervical cells under a microscope; wherein the image dataset is classified into n types of sample sets; Step S2: Dividing the cervical cell images in each type of sample set into a training set, a validation set, and a test set according to a preset ratio; Step S3: preprocessing the training set to obtain a preprocessed training set; Step S4: constructing a classification network model for cervical cell images; wherein the classification network model includes: a Focus module, a CNN-SPPF module, a ViT module, a feature fusion module and a classification module; The CNN-SPPF module includes a first convolutional layer, a first depth-separable convolutional module, a first maximum pooling layer, a second convolutional layer, a second depth-separable convolutional module, a second maximum pooling layer, a third convolutional layer, a third depth-separable convolutional module, a third maximum pooling layer, a fourth convolutional layer, a fourth depth-separable convolutional module, a fourth maximum pooling layer, a fifth convolutional layer, an SPPF module, and a fifth depth-separable convolutional module, which are sequentially connected to each other; The ViT module includes an Embedding layer, a TransformerEncoder module group and a Reshape module; the Embedding layer includes a sixth convolutional layer, a LinearProjection module and a Position Embedding module; the TransformerEncoder module group includes a first TransformerEncoder module, a second TransformerEncoder module, ... the Nth TransformerEncoder module connected in series, N≥2; each TransformerEncoder module includes an MLP module and an attention Block module; the attentionBlock module includes a multi-head self-attention module and a feedforward neural network; Step S5: constructing a loss function of the classification network model; Step S6: inputting the preprocessed training set into the classification network model, and training the classification network model based on the loss function; Step S7: When training the classification network model, a Loss threshold based on a training cycle is used for training, and in the training process of each training cycle, the loss difference between two consecutive training cycles is calculated; if the loss difference is less than the given Loss threshold, then the training of the next training cycle is entered; otherwise, selective data enhancement processing is performed on the training set input to the classification network model until the loss difference between two consecutive training cycles is less than the Loss threshold, then the training of the next training cycle is entered; Step S8: inputting the verification set into the trained classification network model for optimization, and saving the final optimized classification network model; Step S9: inputting the test set into the finally optimized classification network model, and outputting the classification result of the cervical cell image corresponding to the test set; The Focus module is used to receive the preprocessed cervical cell images corresponding to the training set, validation set or test set, and perform lossless downsampling on the preprocessed cervical cell images corresponding to the training set, validation set or test set; The cervical cell image after lossless downsampling is subjected to local multi-level feature extraction through a first convolution layer, a first depthwise separable convolution module, a first maximum pooling layer, a second convolution layer, a second depthwise separable convolution module, a second maximum pooling layer, a third convolution layer, a third depthwise separable convolution module, a third maximum pooling layer, a fourth convolution layer, a fourth depthwise separable convolution module, a fourth maximum pooling layer, a fifth convolution layer, an SPPF module and a fifth depthwise separable convolution module which are sequentially connected to each other to extract a first feature vector of M dimension; and The Embedding layer is specifically used for: Dividing the losslessly downsampled cervical cell image into a plurality of non-intersecting patches of fixed size through the sixth convolutional layer; Through the LinearProjection module, each Pacth is mapped to a one-dimensional vector to flatten each patch into a corresponding one-dimensional vector to output the corresponding feature map C1; By means of the Position Embedding module, position information is added to the feature map C1 to output a feature map C2 after the position information is added; By means of an add operation, the feature map C1 and the feature map C2 are added to output a feature map C3; and The first TransformerEncoder module in the TransformerEncoder module group is specifically used for: Through the first LayerNorm layer, the input feature map C3 is subjected to three different linear mappings to obtain a Query matrix, a Key matrix and a Value matrix respectively; The Query matrix, the Key matrix and the Value matrix are divided into H groups in the channel dimension through the multi-head self-attention module, and the multi-head self-attention calculation is performed in each group to obtain the feature map of each group after the multi-head self-attention calculation, so as to subsequently splice the feature map of each group in the channel dimension to form the final feature map C4; By means of the feedforward neural network, the feature map C4 is nonlinearly transformed and mapped to output a feature map C5; By performing an add operation, the feature map C3 and the feature map C5 are added to output a feature map C6; Receiving the feature map C6 through a second LayerNorm layer to output a feature map C7; Receiving the feature map C7 through the MLP module to output a feature map C8; By an add operation, the feature map C6 and the feature map C8 are added to output a feature map C9; Inputting the feature map C9 into the second TransformerEncoder module, ... the Nth TransformerEncoder module in the TransformerEncoder module group in sequence, so that the TransformerEncoder module group outputs a final feature map C10; The Reshape module is used to receive the feature map C10 and adjust the shape of the feature map C10 to extract an N-dimensional second feature vector; The feature fusion module is used to serially fuse the N-dimensional second feature vector and the M-dimensional first feature vector to obtain a (M+N)-dimensional feature vector; The classification module is used to perform convolution and global pooling operations on the (M+N)-dimensional feature vector in sequence, and then output the classification result of the cervical cell image.

2. According to the Pap smear cervical cell image classification method based on CNN-SPPF and ViT in claim 1, the calculation formula for multi-head self-attention is performed in each group: In the formula, , , They are Query matrix, Key matrix and Value matrix respectively; The dimension of the feature subset processed by each attention head; The calculation result of is expressed as the dot product attention score; The Softmax function is used to normalize the dot product attention score to convert the dot product attention score into a corresponding probability distribution.

3. The Pap smear cervical cell image classification method based on CNN-SPPF and ViT according to claim 1, It is characterized in that Each of the depth-separable convolution modules specifically includes: a first SeparableConv2d layer, a second SeparableConv2d layer, a SeparableBottleneck layer, a seventh convolution layer, and a first channel dimension splicing module; The first SeparableConv2d layer is used to receive the feature map output by the first convolutional layer, the second convolutional layer, the third convolutional layer, the fourth convolutional layer, or the fifth convolutional layer or the feature map output by the SPPF module, and perform feature extraction on the received feature map to reduce the number of channels of the received feature map to output a feature map C11, and The received feature map adjusts the number of channels thereof through the seventh convolutional layer to output a feature map C12; The SeparableBottleneck layer is used to extract features from the feature map C11 to output a feature map C13; The first channel dimension splicing module is used to splice the feature map C12 and the feature map C13 in the channel dimension to output a feature map C14; The second SeparableConv2d layer is used to receive the feature map C14 and perform feature extraction on the feature map C14 to generate a feature map that is finally output by each of the depth-separable convolution modules.

4. The Pap smear cervical cell image classification method based on CNN-SPPF and ViT according to claim 1, It is characterized in that The SPPF module specifically includes: an eighth convolutional layer, a first MaxPool2d layer, a second MaxPool2d layer, a third MaxPool2d layer, a second channel dimension splicing module and a ninth convolutional layer; The eighth convolutional layer is used to receive the feature map output by the fifth convolutional layer, and reduce the number of channels of the feature map output by the fifth convolutional layer to output the feature map C15; The first MaxPool2d layer is used to receive the feature map C15, and pool the feature map C15 to increase the receptive field of the feature map C15, and capture context information of different scales of the feature map C15 to output a feature map C16; The second MaxPool2d layer is used to receive the feature map C16, and pool the feature map C16 to increase the receptive field of the feature map C16, and capture context information of different scales of the feature map C16 to output a feature map C17; The third MaxPool2d layer is used to receive the feature map C17, and pool the feature map C17 to increase the receptive field of the feature map C17, and capture context information of different scales of the feature map C17 to output a feature map C18; The second channel dimension splicing module is used to splice the feature map C16, the feature map C17 and the feature map C18 with the feature map C15 in the channel dimension to output a feature map C19; The ninth convolutional layer is used to receive the feature map C19 and adjust the number of channels of the feature map C19 to generate the feature map finally output by the SPPF module.

5. The Pap smear cervical cell image classification method based on CNN-SPPF and ViT according to any one of claims 1 to 4, It is characterized in that The training set is preprocessed, specifically including: The training set is scaled and augmented.