Histopathological section image classification method and system based on vector quantization attention

Through the combination of vector quantization attention module and multi-scale convolution module, the problem of ignoring example similarity in multi-example classification models is solved, the classification accuracy of histopathological slice images is improved, and more effective disease area detection is provided to support doctors. diagnosis.

CN118691894AActive Publication Date: 2024-09-24HUAZHONG UNIV OF SCI & TECH +1

Patent Information

Application Number
CN202410832851.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-24
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

Existing multi-example classification models ignore the similarity of examples when processing histopathological slice images, resulting in poor detection of disease areas and affecting the diagnostic efficiency of doctors.

Method used

A multi-example classification method based on vector quantized attention is used to build a model through the vector quantized attention module and multi-scale convolution module, extract and cluster the feature vectors of image blocks, and combine the attention mechanism and multi-scale structure to achieve similar examples Sexual attention and identification.

Benefits of technology

It significantly improves the classification accuracy of histopathological slice images, saves computing resources, and shows good AUC performance on the CAMELYON16 data set, providing effective diagnostic support for doctors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691894A
    Figure CN118691894A
Patent Text Reader

Abstract

The invention belongs to the related technical field of image recognition, and discloses a histopathological section image classification method and system based on vector quantization attention, and the method comprises the steps: obtaining the class labels of a plurality of histopathological section images, dividing the tissue region of each histopathological section image to obtain a plurality of image blocks, gathering the data as examples into a packet; performing feature extraction on the examples in each packet by adopting a feature extraction model to obtain a feature sequence of each packet; constructing a multi-instance classification model based on a vector quantization attention module and a multi-scale convolution module, and training the multi-instance classification model by adopting a feature sequence and a category label; obtaining a target feature sequence of the to-be-classified tissue pathological section image; and inputting the feature vectors into a trained multi-instance classification model to obtain an attention score of each feature vector, and comparing the attention scores with a preset threshold to obtain a disease region. According to the method, the problems of low tissue pathology image classification precision and low diagnosis efficiency are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field related to image recognition, and more specifically, relates to a method and system for classifying tissue pathology slice images based on vector quantization attention. Background Art

[0002] Cancer is a disease that seriously threatens human health. In recent years, there are about 20 million new cases and 10 million deaths per year worldwide. For almost all cancers, screening and early diagnosis of patients can improve the survival rate and quality of life of cancer patients and reduce the cost and complications of cancer treatment. Traditional cancer detection methods mainly rely on pathologists' microscopic observation and analysis of tissue sections. This method is not only time-consuming and labor-intensive, but also depends on the level and experience of pathology experts. It is highly subjective, has low repeatability, and lacks quantitative analysis.

[0003] In recent years, digital pathology and computer vision technologies have been widely used and developed in the field of cancer detection. Whole Slide Image (WSI) technology allows tissue pathology slice images to be digitally stored and analyzed by computer. Unlike natural images, whole-view digital slices have high resolution and can display cell structures and pathological changes at different magnifications. They contain about one trillion pixels, and the entire slice cannot be directly input into the convolutional neural network for detection, and pixel-level annotations are not easy to obtain. The diagnosis of whole-view digital slices often faces the situation where there is only the category label of the slice, but it is required to identify and detect the cancer area in the slice.

[0004] Multiple-Instance Learning (MIL) is a form of weakly supervised learning. Its classification is very suitable for solving the above problems. A full-view digital slice is defined as a "bag", and all cropped image patches are defined as "instances" of the bag. Researchers usually build models to classify bags containing multiple examples. The model can extract the features of the examples and map them to labels or scores. A threshold is set to divide the examples into two categories: cancer tissue examples and normal tissue examples. The corresponding cancer areas are visualized at the scale of the original slice. In recent research work, some researchers have used attention mechanisms, multi-scale structures, clustering algorithms, graph networks, residual connections and other methods to construct analysis of different types of cancer slices such as breast cancer and colon cancer, achieving efficient and accurate cancer detection and segmentation. However, these algorithms often only use bag-level clustering, ignoring the similarity of examples, or use traditional clustering methods when constructing similarity metrics for examples, which makes the model too cumbersome and difficult to optimize, and cannot effectively combine the attention mechanism with the similarity relationship of examples. Summary of the invention

[0005] In response to the above defects or improvement needs of the prior art, the present invention provides a method and system for classifying tissue pathology section images based on vector quantization attention, which solves the problem that when the existing multi-instance classification model processes tissue pathology section images containing only category labels, it pays little attention to the similarity of examples, resulting in poor detection of diseased areas, thereby affecting the doctor's diagnostic efficiency.

[0006] To achieve the above-mentioned purpose, according to one aspect of the present invention, a method for classifying tissue pathology slice images based on vector quantization attention is provided, comprising: training stage S1: obtaining category labels of multiple tissue pathology slice images, extracting the tissue area of ​​each tissue pathology slice image, dividing the tissue area to obtain multiple image blocks, and combining the multiple image blocks as examples into a package, so that multiple tissue pathology slice images correspond to multiple packages; S2: using a feature extraction model to extract features from the examples in each package, thereby obtaining a feature vector of each example in each package, and obtaining a feature sequence of each package according to the position of the example in the package; S3: based on the vector quantization attention module and the multiple The scale convolution module constructs a multi-instance classification model, takes the feature sequence of each package as input, and trains the multi-instance classification model with the category label corresponding to the package as the optimization target to obtain a trained multi-instance classification model; in the application stage, the pathological slice image to be classified executes steps S1 and S2 to obtain the target feature sequence of the pathological slice image to be classified; the target feature sequence is input into the trained multi-instance classification model to obtain the attention score of the example corresponding to each feature vector in the target feature sequence, and the attention score of each example is compared with a preset threshold to obtain normal examples and abnormal examples, and the disease area is determined according to the position of the abnormal example in the pathological slice image to be classified.

[0007] Preferably, the step S1 of extracting the tissue region for each of the tissue pathology slice images specifically comprises: obtaining a mask of the tissue region of each of the tissue pathology slice images, cropping the tissue pathology slice images and their masks to generate a plurality of image blocks and corresponding masks, calculating the proportion of cell tissue in each image block based on the mask, and screening out image blocks whose proportions are greater than a preset threshold as examples and grouping them into a package.

[0008] Preferably, the mask of the tissue area of ​​each tissue pathology section image is obtained by: using one of the Otsu algorithm, histogram bimodal method, iterative threshold segmentation, watershed algorithm, seed region growing, region splitting and merging, active contour method, HSV color space segmentation, LAB color space segmentation, and clustering in color space to segment the tissue pathology section image into tissue area and background area.

[0009] Preferably, the feature extraction model sequentially includes a ResNet50 network structure with the last convolution module removed, and an adaptive average pooling layer that pools image features of a dimension of 1024×14×14 into a 1024-dimensional feature vector.

[0010] Preferably, step S3 also includes performing a linear transformation on the feature sequence to achieve dimensionality reduction, and dividing the feature sequence after dimensionality reduction into subsequences in order of position, and using the subsequences to train the multi-instance classification model; in a further preferred solution, the subsequences are mutually non-intersecting.

[0011] Preferably, the vector quantization attention module includes a marking submodule and an attention calculation submodule. The marking submodule is used to add a marking vector before the first feature vector of the subsequence to form a combined sequence, and the combined sequence is input into the attention calculation submodule in sequence to obtain the corresponding vector quantization loss, the marked vector and the attention score of each example in the combined sequence.

[0012] Preferably, the vector quantization attention module also includes a post-processing submodule, which is used to concatenate multiple labeled vectors to form a feature matrix, average multiple vector quantization losses to obtain an average vector quantization loss, and combine multiple attention scores to obtain a target attention score for the corresponding example.

[0013] Preferably, the multi-scale convolution module includes three one-dimensional convolution layers, the number of input channels of each one-dimensional convolution layer is the same as the number of subsequences divided from the feature sequence of each packet, the number of input and output channels is 1, the step size is 1, the convolution kernel sizes of the three one-dimensional convolution layers are 7, 5, and 3, respectively, and the padding sizes are 3, 2, and 1, respectively.

[0014] Preferably, the weighted total loss L of the multi-instance classification model is:

[0015] L = a·L CE +(1-a)·L VQ '

[0016] Among them, a is the coefficient of cross entropy loss, L VQ ′ is the average vector quantization loss, L CE is the cross entropy loss.

[0017] The second aspect of the present application provides a tissue pathology slice image classification system based on vector quantization attention, including: a training unit, a package acquisition module: used to obtain category labels of multiple tissue pathology slice images, extract the tissue area of ​​each tissue pathology slice image, divide the tissue area to obtain multiple image blocks, and use the multiple image blocks as examples to form a package, so that multiple tissue pathology slice images correspond to multiple packages; a feature sequence acquisition module: used to use a feature extraction model to extract features from the examples in each package, so as to obtain a feature vector of each example in each package, and obtain a feature sequence of each package according to the position of the example in the package; a training module: used to extract features from the examples in each package based on the vector quantization attention module and the multiple The scale convolution module constructs a multi-instance classification model, takes the feature sequence of each package as input, and trains the multi-instance classification model with the category label corresponding to the package as the optimization target to obtain a trained multi-instance classification model; the application unit, the pathological slice image to be classified executes the package acquisition module and the feature sequence acquisition module to obtain the target feature sequence of the pathological slice image to be classified; the target feature sequence is input into the trained multi-instance classification model to obtain the attention score of the example corresponding to each feature vector in the target feature sequence, the attention score of each example is compared with the preset threshold, normal examples and abnormal examples are obtained, and the disease area is determined according to the position of the abnormal example in the pathological slice image to be classified.

[0018] In general, compared with the prior art, the above technical solution conceived by the present invention provides a method for classifying tissue pathology slice images based on vector quantization attention, which mainly has the following beneficial effects:

[0019] 1. This application constructs a multi-instance classification model based on a vector quantization attention module and a multi-scale convolution module. The vector quantization attention module uses a vector quantization method to express the feature vectors of all examples as nearest neighbors, thereby focusing on and identifying the similarities of examples in the same package or different packages, and realizing implicit clustering and feature expression between similar features, which significantly improves the classification accuracy.

[0020] 2. This application adopts the method of dividing long sequence features into subsequences and calculating them separately, and uses a marking sub-module to mark them, generate a learnable marking vector, and use the marking vector to represent the information of different subsequences, saving computing resources.

[0021] 3. The multi-scale convolution module of the present application includes three one-dimensional convolution layers. The number of input channels of each one-dimensional convolution layer is the same as the number of subsequences divided by the feature sequence of each packet. The multi-scale structure is used to realize information transmission and feature fusion of different subsequences. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1It is a schematic diagram of the steps of the tissue pathology section image classification method based on vector quantization attention in an embodiment of the present application;

[0023] Figure 2 It is a flowchart of a method for classifying tissue pathology slice images based on vector quantized attention according to an embodiment of the present application;

[0024] Figure 3 It is a training diagram of the classification model of the embodiment of the present application;

[0025] Figure 4 The image data of a breast tissue pathological section image in the embodiment of the present application;

[0026] Figure 5 is an attention visualization diagram of a breast tissue pathology section image in an embodiment of the present application;

[0027] Figure 6 This is a schematic diagram of the mechanism of the vector quantization attention module in an embodiment of the present application. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0029] The first aspect of the present application provides a method for classifying tissue pathology slice images based on vector quantization attention, such as Figure 1 and Figure 2 As shown, it includes a training phase and an application phase.

[0030] The training phase includes the following steps S1 to S3.

[0031] S1: Obtain category labels of multiple tissue pathology slice images, extract the tissue area of ​​each tissue pathology slice image, divide the tissue area to obtain multiple image blocks, and group the multiple image blocks as examples into a package, so that the multiple tissue pathology slice images correspond to multiple packages.

[0032] Multiple histopathology slice images can be from histopathology slices of the same organ from different or the same patient, and the histopathology slices are recorded as electronic images through a magnifying glass. Whether there is diseased tissue in the histopathology slice or what kind of diseased tissue is present can be used as a category label, and the category labeling can be performed by manual annotation.

[0033] In a further preferred solution, the step of extracting the tissue region from each of the tissue pathology slice images is as follows:

[0034] Obtain a mask of the tissue area of ​​each tissue pathology section image, crop the tissue pathology section image and its mask to generate multiple image blocks and corresponding masks, calculate the proportion of cell tissue in each image block based on the mask, and filter out image blocks with a proportion greater than a preset threshold as examples and collect them into a package.

[0035] In a further preferred embodiment, the tissue pathology section image is segmented into tissue area and background area by using one of the Otsu algorithm, histogram bimodal method, iterative threshold segmentation, watershed algorithm, seed region growing, region splitting and merging, active contour method, HSV color space segmentation, LAB color space segmentation, and clustering in color space.

[0036] The tissue area is cropped by sliding window to generate multiple image blocks, the proportion of cell tissue in each image block is calculated, and the image blocks with a proportion greater than a preset threshold are screened out as examples.

[0037] This embodiment preferably uses the Otsu algorithm to segment the tissue pathology slice image, which is defined as follows:

[0038] g=w O w 1 (u 0 -u 1 ) 2

[0039] Among them, g is the inter-class variance, which corresponds to the cell tissue area and the background area in this embodiment, and w 0 and w 1 are the proportion of pixels in the cell tissue area and the background area to the total image, u 0 and u 1 are the average grayscale values ​​of the cell tissue area and the background area, respectively. The Otsu method seeks an optimal threshold value so that g reaches the maximum value, and the values ​​less than and greater than this threshold value are the cell tissue area and the background area, respectively. The optimal threshold value can be obtained by traversing all possible grayscale values, calculating the inter-class variance g corresponding to each grayscale value, and then selecting the grayscale value corresponding to the largest inter-class variance g as the optimal threshold value.

[0040] After the histopathological slice image is segmented by the Otsu algorithm, the histopathological slice image can be converted into a binary image by using the above-mentioned optimal threshold for binarization operation, and the binary image is used as the mask of the histopathological slice image. The histopathological slice image can be cropped by using an L×L sliding window to obtain a plurality of image blocks of size L×L, and its mask is also cropped to L×L. If the mask corresponding to a certain image block contains all black pixels, then the image block only contains the background and should be removed. Otherwise, if it is all white, it only contains cell tissue and is retained. For the image block including both the background and cell tissue, the proportion of white pixels in the mask to all pixels is calculated to determine whether to keep or remove. In this embodiment, the proportion is set to 85%.

[0041] Image blocks in which the ratio of cell tissue pixels to the pixels of the entire image block is greater than a preset ratio are taken as examples and collected into a package. Therefore, multiple tissue pathology slice images correspond to multiple packages, and the number of examples N contained in each package is not necessarily the same.

[0042] S2: Use the feature extraction model to extract features from the examples in each package, so as to obtain the feature vector of each example in each package, and obtain the feature sequence of each package according to the position of the example in the package.

[0043] Using the feature extraction model f(x), input each package example into f(x) for feature extraction to obtain N feature vectors. The dimension of each feature vector is D, then the feature sequence x∈N×D of the package.

[0044] In a further preferred scheme, the feature extraction model f(x) is a ResNet50 pre-trained and modified on the natural image dataset ImageNet, the modified network structure is a ResNet50 network structure with the last convolution module removed, and an adaptive average pooling layer that can pool image features of dimension 1024×14×14 into a 1024-dimensional feature vector, then D is 1024.

[0045] S3: constructing a multi-instance classification model based on a vector quantization attention module and a multi-scale convolution module, taking the feature sequence of each package as input, and training the multi-instance classification model with the category label corresponding to the package as an optimization target to obtain a trained multi-instance classification model;

[0046] like Figure 3 As shown, the multi-instance classification model g(x) of the present application includes a feature encoding module e(x), a vector quantization attention module a(x) and a multi-scale convolution module c(x)

[0047] The feature encoding module e(x) consists of a linear layer, an activation function layer and a random dropout layer, where the dropout probability of the random dropout layer is 0.25. e(x) encodes the feature sequence H∈N×D into a feature sequence h∈N×E.

[0048] The vector quantization attention module includes a marking submodule and an attention calculation submodule. The marking submodule is used to add a marking vector before the first feature vector of the subsequence to form a combined sequence, and the combined sequence is input into the attention calculation submodule in sequence to obtain the corresponding vector quantization loss, the marked vector and the attention score of each example in the combined sequence.

[0049] like Figure 6 As shown, the input of the vector quantization attention module a(x) is the feature sequence h∈N×E. First, the feature sequence h∈N×E is divided into NS subsequences of basically the same length and mutually exclusive. Assume that the number of feature vectors contained in the subsequence is S. If N cannot be divided by NS, the number of feature vectors S contained in the last subsequence may be different from that in other subsequences, but this application will use S to represent the number of feature vectors in the subsequence; define a trainable tag matrix token, where token∈NS×E, the tag matrix token can be decomposed into separate trainable tag vectors tokeni, each tokeni∈1×E, and the tag submodule adds the corresponding tokeni before the first feature vector of each subsequence hi∈S×E to form a combined sequence hi′∈(S+1)×E.

[0050] The combined sequence hi′ is input sequentially, and the attention submodule outputs the attention score Ai∈S×1 of the subsequence feature vector corresponding to the combined sequence hi′, the labeled vector tokeni′∈1×E of the subsequence, and the vector quantization loss L of the subsequence VQ , where tokeni′ is the labeled vector separated from the head of hi′ after the vector quantization attention module extracts the feature information of the subsequence.

[0051] Through the calculation of each subsequence by the attention calculation submodule, we get NS Ai, NS tokeni′ and NS vector quantization loss L VQ , combine NS Ai and NS tokeni′ to get the target attention score A∈N×1 of the feature vector of the feature sequence and the feature matrix T∈NS×E of the feature sequence, and quantize the loss L VQ The average vector quantization loss L of the feature sequence is obtained by averaging VQ ′.

[0052] The attention calculation submodule calculates the vector quantized attention of each subsequence as follows:

[0053] Y=A′*X

[0054] A′=M″W A

[0055] M″=LN(M′)+X

[0056] M′=MV+DWC(V)

[0057]

[0058] Z, L VQ =VQ(K)

[0059] V=XW V

[0060] K=XW K

[0061] Q=XW Q

[0062] Where X is the input subsequence with feature dimension E, W Q , W K , W V ∈R E×E and W A ∈r E×1 is a trainable parameter matrix, Q, K, and V are the query, key, and value matrices after linear transformation, Z is the discrete encoding matrix after vector quantization encoding VQ(·), and d k is the dimension size of the key, B is a trainable uniform band matrix, DWC(·) is a depthwise convolution, LN(·) is a layer normalization, A′ is the attention score of the unmarked vector, M′ is the attention output matrix, M" is the result of residual connection of the attention output matrix after layer normalization and the input vector, and Y is the output of the vector quantized attention calculation on the subsequence, and the marked vector can be separated from its head.

[0063] The vector quantization attention module also includes a post-processing submodule, which is used to concatenate multiple labeled vectors to form a feature matrix, average multiple vector quantization losses to obtain an average vector quantization loss, and combine multiple attention scores to obtain a target attention score for the corresponding example.

[0064] The core idea of ​​vector quantized attention is to use a finite set of codes to represent the key matrix, thereby reducing the scale and complexity of the Softmax operation in the attention calculation, and performing implicit clustering. In order to solve the low-rank problem of the matrix after clustering, a banded trainable matrix is ​​added as the bias item of attention to focus on the sequence relationship within a finite length, which has the function of position encoding. The feature representation of the attention output matrix is ​​enriched by performing a deep separable convolution on the value matrix as a compensation item. Finally, the attention score is calculated through a linear layer and multiplied by the input to achieve weighting of the input vector. In the actual calculation process, to obtain the example attention score Ai∈S×1 and the tag information tokeni∈1×E of the corresponding subsequence of the combined sequence hi∈(S+1)×E, it is necessary to remove the first value of A′, that is, the value corresponding to the tag vector, and retain only the first vector of Y, that is, the vector corresponding to the tag vector.

[0065] The vector quantization code VQ(·) is defined as:

[0066] y ki =e i , i = argmin j ||x ki -e j ||,e j ∈C B , C B ={e 1 , e 2 , ..., e NC}

[0067] Among them, x ki is the input vector, which in this embodiment is the key matrix K, y ki is the output vector, which in this embodiment is the discrete coding matrix Z, e i is the coding vector in the vector quantization coding table, C B is a trainable vector quantization coding table, NC is the number of codes in the vector quantization coding table, and ||·|| is the norm of the vector, usually the Euclidean norm. The process of vector quantization is to find the coding vector closest to the input vector and use it to replace the input vector.

[0068] The vector quantization attention module calculates the Euclidean distance between the feature vector after vector quantization encoding and the original feature vector as the vector quantization loss L VQ , so the vector quantization loss L VQ is defined as follows:

[0069]

[0070] L VQ =0 Verification or testing

[0071] Wherein, Num is the number of input vectors, which in this embodiment is the number of eigenvectors contained in the key matrix, which is also equivalent to the number of eigenvectors contained in the combination sequence, that is, S+1, X ki is x k The i-th input vector, x k In this embodiment, K, y in the calculation process of the vector quantization attention of each subsequence ki is x ki The output vector after vector quantization, y ki Press x ki In x k The order in can be combined into y k ,y k In this embodiment, Z is the calculation process of the vector quantization attention for each subsequence, sg(·) is the gradient truncation, d(·) is the distance metric which is usually the Euclidean distance or the square error, β is the coefficient of the second term, and the first term of the loss represents that y ki Follow x ki Closer, the second term means to let X ki Follow y ki Closer.

[0072] The trainable uniform banded matrix B can be defined as:

[0073] a ij =cori>j+b or j>i+b else 0

[0074] Among them, a ij is the B matrix r S×S The element of the i-th row and j-th column, b represents the bandwidth, and c represents the trainable parameter.

[0075] Assume that the depthwise separable convolution DWC(·) includes the depthwise convolution part and the pointwise convolution part. The input of the depthwise separable convolution is X I , the output is X P , then it can be defined as:

[0076]

[0077] Among them, X I is the input feature map, whose shape is C1×H×W, C1 is the number of input channels, H and W are the height and width of the feature map respectively, Indicates that the output channel is C D , a depthwise convolution operation with a kernel size of N×N and a padding size of N divided by 2; B D It is the bias term of the depthwise convolution, and its shape is 1×C D ;X D is the output of the depthwise convolution, whose shape is C D×H×W; The output channel is C p , a point-by-point convolution operation with a kernel size of 1×1 and a padding size of 0; B P It is the bias term of the depthwise convolution, and its shape is 1×C P ;X P is the output of point-wise convolution, whose shape is C P ×H×W; BN is layer batch normalization, which can make feature output smoother and model training more stable. I The dimension of is converted from 1×S×E to 1×E×S to adapt to the calculation of depth-separable convolution. After the calculation result is obtained, it is converted back to the original dimension and the depth convolution is performed. Here X I This is equivalent to expanding the first dimension of V. In the process of calculating the vector quantized attention of each subsequence, V calculates the output X by DWC(·) P Need to be converted to V's original shape.

[0078] In a further preferred scheme, the multi-scale convolution module adopts three one-dimensional convolution layers, whose input channel number is NS, output channel is 1, step size is 1, convolution kernel sizes are 7, 5, and 3 respectively, and padding sizes are 3, 2, and 1. This numerical design ensures that the feature dimension of the feature matrix T remains unchanged after passing through the multi-scale convolution module, and is only compressed to 1 in the sequence dimension, thereby realizing sub-sequence information transmission and feature fusion.

[0079] In a further preferred solution, step S3 can also be divided into the following steps S31 to S33.

[0080] S31: Select feature sequences of multiple packages and their true category labels as training sets. When performing a single iteration on the training set, select a feature sequence of a package and input it into a multi-instance classification model to obtain the attention score of each example vector in the package, the predicted classification probability of the package, and the average vector quantization loss.

[0081] S32: Calculate the cross entropy between the predicted classification probability of the package and the true category label to obtain the cross entropy loss L CE ;

[0082] S33: Obtain a weighted total loss L according to the following formula, and perform reverse gradient propagation training on the classification model according to the weighted total loss when performing a single iteration on the training set.

[0083] L = a·L CE +(1-a)·L VQ '

[0084] Among them, a is the coefficient of cross entropy loss, L VQ ′ is the average vector quantization loss, L CEis the cross entropy loss.

[0085] After obtaining the weighted total loss L, reverse gradient propagation is performed to train the multi-instance classification model. The network is trained for one cycle using the training set and then verified on the validation set. The average loss on the validation set is calculated and recorded. If the average loss of the current multi-instance classification model on the validation set is smaller than the average loss of the previous multi-instance classification model, the multi-instance classification model is saved and recorded. Otherwise, no record is made and training is continued until no multi-instance classification model has an average loss on the validation set that is smaller than the previous multi-instance classification model within a certain period. The training is terminated, and the weights of the multi-instance classification model with the best performance on the validation set are saved.

[0086] In a further preferred scheme, a multi-instance classification model is trained, stochastic gradient descent is used for back propagation, an Adam optimizer is used, the initial learning rate is 0.00001, the weight decay coefficient is 0.0001, the batch size is 1, and the verification loss observation period is 50.

[0087] Application Phase

[0088] Pathological slice images of tissues to be classified (e.g. Figure 4 The breast tissue pathology section image in the sample) executes steps S1 and S2 to obtain a target feature sequence of the tissue pathology section image to be classified; the tissue pathology section image to be classified executes step S1 to obtain a target package, and the target package executes step S2 to obtain a target feature sequence;

[0089] The target feature sequence is input into the trained multi-instance classification model to obtain the attention score of the example corresponding to each feature vector in the target feature sequence, and the attention score of each example is compared with a preset threshold to obtain normal examples and abnormal examples, and the disease area is determined according to the position of the abnormal example in the pathological section image of the tissue to be classified.

[0090] In a further preferred solution, the attention scores of the examples of the target package are normalized by using the maximum and minimum values, and the attention scores of the examples of the target package are visualized by using a color table mapping method, for example Figure 5 Attention visualization of breast tissue pathology slide images in .

[0091] In this embodiment, the image size in the hyperparameters of the feature extraction model f(x) is set to 256; the hyperparameters of the classification model g(x) are set to:

[0092]

[0093] The automatic classification algorithm for histopathological slice images is still in the theoretical stage. Most of the diagnostic algorithms for histopathological slice images of the target are based on single attention pooling and have high hardware requirements. This application has been improved on the basis of the original deep learning method, using vector quantization method to improve the attention mechanism, implicitly clustering the examples, dividing multiple subsequences for calculation and using trainable labeling matrix to record subsequence information when performing attention calculation, and finally using multi-scale structure for subsequence information transmission and feature fusion. With less hardware memory, the model is trained and a better classification accuracy is obtained. The AUC performance on the CAMELYON16 dataset used in the experiment is 0.9301. It can provide effective help for doctors.

[0094] The second aspect of the present application provides a tissue pathology section image classification system based on vector quantization attention, comprising:

[0095] Training Unit

[0096] Package acquisition module: used to acquire category labels of multiple tissue pathology slice images, extract the tissue area of ​​each tissue pathology slice image, divide the tissue area to obtain multiple image blocks, and take the multiple image blocks as examples to form a package, so that multiple tissue pathology slice images correspond to multiple packages;

[0097] Feature sequence acquisition module: used to extract features from the examples in each package using a feature extraction model, thereby obtaining a feature vector for each example in each package, and obtaining a feature sequence for each package based on the position of the example in the package;

[0098] Training module: used to build a multi-instance classification model based on the vector quantization attention module and the multi-scale convolution module, taking the feature sequence of each package as input and taking the category label corresponding to the package as the optimization target to train the multi-instance classification model to obtain a trained multi-instance classification model;

[0099] Application Unit

[0100] The pathological slice image of the tissue to be classified executes the package acquisition module and the feature sequence acquisition module to obtain the target feature sequence of the pathological slice image of the tissue to be classified;

[0101] The target feature sequence is input into the trained multi-instance classification model to obtain the attention score of the example corresponding to each feature vector in the target feature sequence, and the attention score of each example is compared with a preset threshold to obtain normal examples and abnormal examples, and the disease area is determined according to the position of the abnormal example in the pathological section image of the tissue to be classified.

[0102] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for classifying tissue pathology slice images based on vector quantization attention, characterized in that: include: Training phase S1: Obtain category labels of multiple tissue pathology slice images, extract the tissue region of each tissue pathology slice image, divide the tissue region to obtain multiple image blocks, and use the multiple image blocks as examples to form a package, so that the multiple tissue pathology slice images correspond to multiple packages; S2: Use the feature extraction model to extract features from the examples in each package, so as to obtain the feature vector of each example in each package, and obtain the feature sequence of each package according to the position of the example in the package; S3: constructing a multi-instance classification model based on a vector quantization attention module and a multi-scale convolution module, taking the feature sequence of each package as input, and training the multi-instance classification model with the category label corresponding to the package as an optimization target to obtain a trained multi-instance classification model; Application Phase Execute steps S1 and S2 on the tissue pathology section image to be classified to obtain a target feature sequence of the tissue pathology section image to be classified; The target feature sequence is input into the trained multi-instance classification model to obtain the attention score of the example corresponding to each feature vector in the target feature sequence, and the attention score of each example is compared with a preset threshold to obtain normal examples and abnormal examples, and the disease area is determined according to the position of the abnormal example in the pathological section image of the tissue to be classified.

2. The method for classifying tissue pathology slice images based on vector quantization attention according to claim 1, characterized in that: The specific steps of extracting the tissue region from each tissue pathology slice image in step S1 are as follows: Obtain a mask of the tissue area of ​​each tissue pathology section image, crop the tissue pathology section image and its mask to generate multiple image blocks and corresponding masks, calculate the proportion of cell tissue in each image block based on the mask, and filter out image blocks with a proportion greater than a preset threshold as examples and collect them into a package.

3. The method for classifying tissue pathology slice images based on vector quantization attention according to claim 2, characterized in that: The specific mask for obtaining the tissue area of ​​each tissue pathology section image is: The tissue pathology section image is segmented into tissue area and background area by using one of the following algorithms: Otsu algorithm, histogram bimodal method, iterative threshold segmentation, watershed algorithm, seed region growing, region splitting and merging, active contour method, HSV color space segmentation, LAB color space segmentation, and clustering in color space.

4. The method for classifying tissue pathology slice images based on vector quantization attention according to claim 1, characterized in that: The feature extraction model includes, in sequence, a ResNet50 network structure with the last convolutional module removed, and an adaptive average pooling layer that converts image feature pooling of dimensions 1024×14×14 into a 1024-dimensional feature vector.

5. The method for classifying tissue pathology slice images based on vector quantization attention according to claim 1, characterized in that: Step S3 also includes performing a linear transformation on the feature sequence to achieve dimensionality reduction, and dividing the feature sequence after dimensionality reduction into subsequences in order of position, and using the subsequences to train the multi-instance classification model; in a further preferred embodiment, the subsequences are mutually non-intersecting.

6. The method for classifying tissue pathology slice images based on vector quantization attention according to claim 5, characterized in that: The vector quantization attention module includes a marking submodule and an attention calculation submodule. The marking submodule is used to add a marking vector before the first feature vector of the subsequence to form a combined sequence, and the combined sequence is input into the attention calculation submodule in sequence to obtain the corresponding vector quantization loss, the marked vector and the attention score of each example in the combined sequence.

7. The method for classifying tissue pathology slice images based on vector quantization attention according to claim 6, characterized in that: The vector quantization attention module also includes a post-processing submodule, which is used to concatenate multiple labeled vectors to form a feature matrix, average multiple vector quantization losses to obtain an average vector quantization loss, and combine multiple attention scores to obtain a target attention score for the corresponding example.

8. The method for classifying tissue pathology slice images based on vector quantization attention according to claim 1, characterized in that: The multi-scale convolution module includes three one-dimensional convolution layers. The number of input channels of each one-dimensional convolution layer is the same as the number of subsequences divided from the feature sequence of each packet. The number of input and output channels is 1, the step size is 1, and the convolution kernel sizes of the three one-dimensional convolution layers are 7, 5, and 3, respectively, and the padding sizes are 3, 2, and 1, respectively.

9. The method for classifying tissue pathology slice images based on vector quantization attention according to claim 1, characterized in that: The weighted total loss L of the multi-instance classification model is: L=a·L CE +(1-a)·L VQ ′ Among them, a is the coefficient of cross entropy loss, L VQ ′ is the average vector quantization loss, L CE is the cross entropy loss.

10. A tissue pathology slice image classification system based on vector quantization attention, characterized in that: include: Application Unit Execute the packet acquisition module and the feature sequence acquisition module on the pathological slice image to be classified to obtain the target feature sequence of the pathological slice image to be classified; Input the target feature sequence into the trained multi-instance classification model to obtain the attention score of the example corresponding to each feature vector in the target feature sequence, compare the attention score of each example with a preset threshold, obtain normal examples and abnormal examples, and determine the disease area according to the position of the abnormal example in the pathological section image of the tissue to be classified; In a further preferred solution, a training unit is also included: Package acquisition module: used to acquire category labels of multiple tissue pathology slice images, extract the tissue area of ​​each tissue pathology slice image, divide the tissue area to obtain multiple image blocks, and take the multiple image blocks as examples to form a package, so that multiple tissue pathology slice images correspond to multiple packages; Feature sequence acquisition module: used to extract features from the examples in each package using a feature extraction model, thereby obtaining a feature vector for each example in each package, and obtaining a feature sequence for each package based on the position of the example in the package; Training module: used to build a multi-instance classification model based on the vector quantization attention module and the multi-scale convolution module, taking the feature sequence of each package as input, and training the multi-instance classification model with the category label corresponding to the package as the optimization target to obtain a trained multi-instance classification model.

Citation Information

Patent Citations

  • Fundus image automatic labeling method based on cross-media features

    CN112215285A

  • SAR image change detection method based on multi-scale differential feature attention mechanism

    CN114926746A

  • Model quantization for software engineering tasks

    US20230222334A1

Cited By

  • Inflammatory bowel disease image detection method, device and equipment based on weak supervised learning

    CN119832321A

  • Two-dimensional mixed position coding system and method, medium, terminal and program product

    CN121982310A

  • Information processing method and device for medical tissue morphological image analysis, equipment and medium

    CN122335896A

  • Multi-slice pathological image diagnosis method based on double-layer attention

    CN122511553A