Small sample medical image classification method based on attention mechanism and imaging method

Through a small-sample medical image classification method based on the attention mechanism, image enhancement and prototype network are used to build a model, which solves the problems of high accuracy and cost in small-sample medical image classification and achieves a classification effect with high reliability and high precision.

CN119649152BActive Publication Date: 2025-10-10CENT SOUTH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411890615.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-10-10
Estimated Expiration
2044-12-20

AI Technical Summary

Technical Problem

Existing small-sample learning methods in medical image classification have problems such as high model accuracy and annotation cost, limited data, and annotation is easily affected by subjective factors, resulting in reduced classification performance.

Method used

A small-sample medical image classification method based on the attention mechanism was adopted. A medical image classification model was constructed through image enhancement and prototype network, including a feature extraction module and a similarity calculation module. Pseudo-label optimization loss function was used for training and verification.

Benefits of technology

It improves the reliability and accuracy of small sample medical image classification, reduces the dependence on labeled data, and adapts to the classification needs of different categories of images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119649152B_ABST
    Figure CN119649152B_ABST
Patent Text Reader

Abstract

The application discloses a small sample medical image classification method based on an attention mechanism, comprising the following steps: acquiring existing medical image data and preprocessing the medical image data to obtain a data set; constructing a medical image classification initial model based on a prototype network and an attention mechanism, and training, optimizing and verifying the medical image classification initial model to obtain a medical image classification model; and using the obtained medical image classification model to classify actual small sample medical images. The application further discloses an imaging method comprising the small sample medical image classification method based on the attention mechanism. The application realizes the enhancement of small sample medical image data through a data preprocessing process, and constructs and trains a medical image classification model based on a prototype network and an attention mechanism, so that the application can realize the classification and imaging of small sample medical images, and has higher reliability and better accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of image processing, and particularly relates to a small sample medical image classification method based on an attention mechanism and an imaging method. BACKGROUND

[0002] In the medical field, whether it is clinical medicine or basic medicine, the classification of medical images is extremely important basic data. Therefore, the accurate and reliable classification of medical images has always been the research focus of researchers.

[0003] In the medical field, the classification of small sample medical images has always been a focus and difficulty of research. Since small sample learning has achieved remarkable success in other fields, researchers have begun to apply small sample learning to the medical field in order to achieve accurate and reliable classification of small sample medical images.

[0004] At present, common small sample learning methods include metric learning and meta-learning. The object of metric learning is usually the distance of the sample feature vector, and by training and learning, the distance between samples of the same class is reduced or limited, while the distance between samples of different classes is increased. The meta-learning method usually involves training on a few sample task derived from the base class in the training phase. This process mainly revolves around optimizing two key loops: meta-training and meta-testing. In the classification task, multiple support samples are usually used to classify new samples. In meta-training, the neural network parameters are updated by the training data points of each task. Then in the meta-testing phase, the data of each task is adaptively tested, so that the model can quickly adapt to new tasks and classify between tasks.

[0005] Although small sample learning performs well in new class tasks with limited data, it still requires a considerable number of base class labels in the meta-training phase. This makes small sample learning perform poorly in the actual medical research environment for the classification of medical images. The annotation of medical images requires domain expertise and is easily affected by subjective factors, and the accuracy of the model is positively correlated with the accuracy of the annotation. However, providing sufficient annotation labels in the training process of the model is costly. In addition, due to privacy and security considerations, researchers can only access a relatively limited number of samples. At present, the common solution is to use unsupervised small sample learning methods to obtain pseudo-class data through data augmentation and metric learning to reduce the label requirements of the base class dataset. However, this method can mislead the model with real data and pseudo-class data, resulting in a decline in the performance of the classification scheme. SUMMARY

[0006] One of the purposes of the present application is to provide a small sample medical image classification method based on an attention mechanism with high reliability and good accuracy.

[0007] A second object of the present invention is to provide an imaging method that includes the small-sample medical image classification method based on the attention mechanism.

[0008] The small sample medical image classification method based on the attention mechanism provided by the present invention includes the following steps:

[0009] S1. Acquire existing medical image data;

[0010] S2. Preprocess the medical image data obtained in step S1 to obtain a data set;

[0011] S3. Build an initial model for medical image classification based on the prototype network and attention mechanism;

[0012] S4. Using the data set obtained in step S2, the initial medical image classification model constructed in step S3 is trained, optimized, and verified to obtain a medical image classification model;

[0013] S5. Use the medical image classification model obtained in step S4 to classify actual small sample medical images.

[0014] The acquisition of existing medical image data in step S1 specifically includes the following steps:

[0015] The acquired existing medical image data includes cell image data, or organ tissue image data, or organ CT image data.

[0016] Step S2 of preprocessing the medical image data obtained in step S1 to obtain a data set specifically includes the following steps:

[0017] Randomly sampling the medical image data obtained in step S1 to obtain a number of sample images;

[0018] Perform image enhancement on the sample image;

[0019] Crop the enhanced image to the set size and perform normalization;

[0020] For the processed medical image data, several images are randomly selected as support sets in each round, and several images are randomly selected as query sets; this is repeated several times to obtain several support sets and query sets.

[0021] The image enhancement specifically includes the following steps:

[0022] Construct an image enhancement operation search space; the image enhancement operation search space includes the following image enhancement operations:

[0023] AutoContrast(0, 255) for re-mapping the image on the 0 to 255 grayscale values so that the darkest pixel becomes the 0 grayscale value (i.e. black) and the brightest pixel becomes the 255 grayscale value (i.e. white);

[0024] Equalize(0, 1) for applying a non-linear mapping to the input image on the 0-1 amplitude in order to create a uniform distribution of grayscale values in the output image;

[0025] Invert(0, 1) for inverting the colors of the image on the 0-1 amplitude;

[0026] Rotate(0, 30) for randomly rotating the image by an angle in the 0° ~ 30° angle range;

[0027] Solarize(0, 255) for flipping the pixels in the image that are above a certain value in the 0 ~ 255 range;

[0028] SolarizeAdd(0, 110) for flipping the pixels in the image that are above a certain value in the 0 ~ 110 range and adding the flipped image to the original image;

[0029] Color(0.1, 1.9) for enhancing the colors in the range of 0.1 ~ 1.9;

[0030] Posterize(0, 4) for reducing the number of colors in the image in the 0 ~ 4 color scale range;

[0031] CutoutAbs(0, 40) for randomly cropping a 0 ~ 40% portion of the image;

[0032] Contrast(0.1, 1.9) for re-mapping the image contrast on the 0.1 ~ 1.9 amplitude;

[0033] Brightness(0.1, 1.9) for adjusting the brightness of the image on the 0.1 ~ 1.9 amplitude;

[0034] Sharpness(0.1, 1.9) for sharpening the image on the 0.1 ~ 1.9 amplitude;

[0035] ShearX(0, 0.3) for performing a horizontal affine transformation of the image on the 0 ~ 0.3 amplitude;

[0036] Vertical affine transformation ShearY(0,0.3) is used to perform vertical affine transformation of the image in the range of 0 to 0.3;

[0037] Horizontal translation TranslateX(0,100) is used to translate the image horizontally in the range of 0 to 100 pixels;

[0038] TranslateY(0,100) is used to translate the image vertically in the range of 0 to 100 pixels.

[0039] For each image, several image enhancement methods are randomly selected from the constructed image enhancement operation search space to perform image enhancement;

[0040] When performing image enhancement, the following formula is used to calculate the adjusted parameters of the image enhancement operation:

[0041] val=x×(max-min)+min

[0042] Where val is the adjusted parameter of the image enhancement operation; x is the parameter before adjustment of the image enhancement operation; max is the maximum amplitude of the corresponding image enhancement operation; min is the minimum amplitude of the corresponding image enhancement operation.

[0043] The initial model for medical image classification based on the prototype network and attention mechanism described in step S3 specifically includes the following steps:

[0044] The constructed initial model for medical image classification includes a feature extraction module and a similarity calculation module;

[0045] Construct a feature extraction module based on the prototype network; the feature extraction module is used to extract image features of the input image;

[0046] A similarity calculation module is constructed based on the attention mechanism; the similarity calculation module is used to calculate the classification results of the input image.

[0047] The step S3 specifically includes the following steps:

[0048] The constructed feature extraction module includes a 1×1 convolution kernel, the first BatchNorm 2d layer, the first ReLU layer, and the feature extraction layer;

[0049] The input image data is processed by a 1×1 convolution kernel to fuse high-level network features with low-level network features;

[0050] The fused feature data is normalized by the first BatchNorm 2d layer and then filtered by the first ReLU layer;

[0051] The filtered feature data is input into the feature extraction layer for feature extraction to obtain feature extraction data information; the feature extraction layer includes four layers of feature extraction sublayers connected in series; the structure of each feature extraction sublayer is the same, including a 3×3 convolution kernel, a BatchNorm 2d sublayer and a ReLU sublayer connected in series, the 3×3 convolution kernel is used to extract the features of the input data, the BatchNorm The 2d sublayer is used for normalization, and the ReLU sublayer is used for feature screening. The input of the first feature extraction sublayer is the input of the feature extraction layer. The input of the first feature extraction sublayer is dimensionally adjusted by a 1×1 convolution kernel, and then superimposed with the output of the first feature extraction sublayer as the input of the second feature extraction sublayer. The input of the second feature extraction sublayer is dimensionally adjusted by a 1×1 convolution kernel, and then superimposed with the output of the second feature extraction sublayer as the input of the third feature extraction sublayer. The input of the third feature extraction sublayer is dimensionally adjusted by a 1×1 convolution kernel, and then superimposed with the output of the first feature extraction sublayer as the input of the fourth feature extraction sublayer. The output of the fourth feature extraction sublayer is directly used as the output of the feature extraction layer and directly input into the similarity calculation module.

[0052] The constructed similarity calculation module is used to calculate the category confidence of the input image data to achieve the classification result of the input image data;

[0053] During the model training and model verification process, the similarity calculation module uses the following formula to calculate the similarity α of the input image data i :

[0054]

[0055] Where softmax i () is the activation function; W Q is the center point feature vector; φ() is the result of model prediction; W K is the input image feature vector; d is the vector dimension; x is the center point image; x i The output of the feature extraction module obtained after the image in the input image dataset passes through the feature extraction module;

[0056] During the model optimization process, the similarity calculation module uses the following formula to calculate the similarity sim of the input image data sns :

[0057]

[0058] Where P n is the center point, and k is the number of images in the image dataset input during optimization; y iis a pseudo label; n is the category of the image dataset input during optimization; x j The output of the feature extraction module is obtained after the image in the image data set input during optimization passes through the feature extraction module;

[0059] Finally, the similarity value is determined:

[0060] If the similarity value of the i-th category is the highest, the input image data is determined to belong to the i-th category image, and the final classification result is obtained;

[0061] The training described in step S4 specifically includes the following steps:

[0062] During training, the following formula is used as the loss function:

[0063]

[0064] Where N is the number of training samples; y i is a pseudo label; p i is the probability value of the predicted pixel; M is the total number of image categories; c is the identifier of the image category.

[0065] The present invention also provides an imaging method including the small sample medical image classification method based on the attention mechanism, comprising the following steps:

[0066] A. Use the small sample medical image classification method based on the attention mechanism to classify the actual target medical image;

[0067] B. The classification result obtained in step A is marked and re-imaged on the target medical image to obtain a medical image with the classification result.

[0068] The small-sample medical image classification method and imaging method based on the attention mechanism provided by the present invention enhances small-sample medical image data through a data preprocessing process, and constructs and trains a medical image classification model based on a prototype network and an attention mechanism. Therefore, the present invention can not only realize the classification and imaging of small-sample medical images, but also has higher reliability and better accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 Schematic diagram of the process flow of the classification method of the present invention.

[0070] Figure 2 Schematic diagram of the process flow of the imaging method of the present invention. DETAILED DESCRIPTION

[0071] like Figure 1The figure shows a flow chart of the classification method of the present invention: The small sample medical image classification method based on the attention mechanism disclosed in the present invention comprises the following steps:

[0072] S1. Acquire existing medical image data; specifically, the following steps are included:

[0073] Acquired existing medical image data, including cell image data, organ tissue image data, or organ CT image data;

[0074] In specific implementation, if cell image data is used, the model of the present invention can classify cell images; if organ tissue image data is used, the model of the present invention can classify organ tissue images; if organ CT image data is used, the model of the present invention can classify organ CT images;

[0075] S2. Preprocess the medical image data obtained in step S1 to obtain a data set; specifically, the steps include:

[0076] Randomly sampling the medical image data obtained in step S1 to obtain a number of sample images;

[0077] Perform image enhancement on the sample image;

[0078] Crop the enhanced image to the set size and perform normalization;

[0079] For the processed medical image data, several images are randomly selected as the support set and several images are randomly selected as the query set in each round; this process is repeated several times to obtain several support sets and query sets.

[0080] Image enhancement is an important step in the present invention to achieve small sample medical image classification. The process of image enhancement is the process of data enhancement. Through image enhancement, the classification model of the present invention can better cope with various unknown or rare small sample data during training.

[0081] Construct an image enhancement operation search space; the image enhancement operation search space includes the following image enhancement operations:

[0082] Automatically optimize the contrast AutoContrast(0,255), which is used to remap the image on the grayscale value of 0 to 255, so that the darkest pixel becomes 0 grayscale value (ie black) and the brightest pixel becomes 255 grayscale value (ie white);

[0083] Equalize(0,1) applies a nonlinear mapping to the input image on a scale of 0-1 to create a uniform distribution of grayscale values ​​in the output image.

[0084] Color inversion Invert(0,1) is used to invert the color of the image on the amplitude of 0-1;

[0085] Center rotation Rotate(0,30) is used to randomly rotate the image within the range of 0° to 30°;

[0086] High threshold inversion Solarize(0,255) is used to flip the pixels in the image that are higher than a value between 0 and 255;

[0087] High threshold inversion enhancement SolarizeAdd(0,110) is used to flip the pixels in the image that are higher than a value between 0 and 110, and add the inverted image to the original image;

[0088] Grayscale image coloring Color(0.1,1.9) is used to enhance the color in the range of 0.1 to 1.9;

[0089] Simplify the image color Posterize(0,4), which is used to reduce the number of image colors in the color scale range of 0 to 4;

[0090] Random cropping CutoutAbs(0,40) is used to randomly crop 0 to 40% of the image;

[0091] Contrast enhancement Contrast(0.1,1.9), used to remap the image contrast in the range of 0.1 to 1.9;

[0092] Brightness adjustment Brightness (0.1, 1.9) is used to adjust the brightness of the image in the range of 0.1 to 1.9;

[0093] Sharpness adjustment Sharpness (0.1, 1.9) is used to sharpen the image in the range of 0.1 to 1.9;

[0094] Horizontal affine transformation ShearX(0,0.3) is used to perform horizontal affine transformation of the image in the range of 0 to 0.3;

[0095] Vertical affine transformation ShearY(0,0.3) is used to perform vertical affine transformation of the image in the range of 0 to 0.3;

[0096] Horizontal translation TranslateX(0,100) is used to translate the image horizontally in the range of 0 to 100 pixels;

[0097] TranslateY(0,100) is used to translate the image vertically in the range of 0 to 100 pixels.

[0098] For each image, several image enhancement methods are randomly selected from the constructed image enhancement operation search space to perform image enhancement;

[0099] When performing image enhancement, the following formula is used to calculate the adjusted parameters of the image enhancement operation:

[0100] val=x×(max-min)+min

[0101] Where val is the adjusted parameter of the image enhancement operation; x is the parameter before the adjustment of the image enhancement operation; max is the maximum amplitude of the corresponding image enhancement operation; min is the minimum amplitude of the corresponding image enhancement operation;

[0102] S3. Build an initial model for medical image classification based on the prototype network and attention mechanism. This includes the following steps:

[0103] The constructed initial model for medical image classification includes a feature extraction module and a similarity calculation module;

[0104] Construct a feature extraction module based on the prototype network; the feature extraction module is used to extract image features of the input image;

[0105] A similarity calculation module is constructed based on the attention mechanism; the similarity calculation module is used to calculate the classification results of the input image;

[0106] When implementing:

[0107] The constructed feature extraction module includes a 1×1 convolution kernel, the first BatchNorm 2d layer, the first ReLU layer, and the feature extraction layer;

[0108] The input image data is processed by a 1×1 convolution kernel to fuse high-level network features with low-level network features;

[0109] The fused feature data is normalized by the first BatchNorm 2d layer and then filtered by the first ReLU layer;

[0110] The feature data screened is input to a feature extraction layer for feature extraction to obtain feature extraction data information; the feature extraction layer comprises four feature extraction sub-layers connected in series; each feature extraction sub-layer has the same structure and comprises a 3*3 convolution kernel, a BatchNorm 2d sub-layer and a ReLU sub-layer connected in series; the 3*3 convolution kernel is used for extracting features of input data, the BatchNorm 2d sub-layer is used for normalization processing, and the ReLU sub-layer is used for feature screening; the input of the first feature extraction sub-layer is the input of the feature extraction layer; after the input of the first feature extraction sub-layer is adjusted in dimension by a 1*1 convolution kernel and is superimposed with the output of the first feature extraction sub-layer, the result is taken as the input of the second feature extraction sub-layer; after the input of the second feature extraction sub-layer is adjusted in dimension by a 1*1 convolution kernel and is superimposed with the output of the second feature extraction sub-layer, the result is taken as the input of the third feature extraction sub-layer; after the input of the third feature extraction sub-layer is adjusted in dimension by a 1*1 convolution kernel and is superimposed with the output of the third feature extraction sub-layer, the result is taken as the input of the fourth feature extraction sub-layer; the output of the fourth feature extraction sub-layer is directly taken as the output of the feature extraction layer and is directly input to a similarity calculation module.

[0111] The constructed similarity calculation module is used for calculating the class confidence of the input image data to realize the classification result of the input image data.

[0112] In the model training and model verification process, the similarity calculation module calculates the similarity of the input image data as follows i :

[0113]

[0114] In the formula, softmax i () is an activation function; W Q is a center point feature vector; φ() is a model prediction result; W K is an input image feature vector; d is a vector dimension; x is a center point image; x i The output of the feature extraction module obtained after the image in the input image data set is subjected to the feature extraction module;

[0115] In the model optimization process, the similarity calculation module calculates the similarity of the input image data as follows sns :

[0116]

[0117] In the formula, P n is a center point, and k is the number of images in the input image data set in the optimization; y iis a pseudo label; n is the category of the image dataset input during optimization; x j The output of the feature extraction module is obtained after the image in the image data set input during optimization passes through the feature extraction module;

[0118] Finally, the similarity value is determined:

[0119] If the similarity value of the i-th category is the highest, the input image data is determined to belong to the i-th category image, and the final classification result is obtained;

[0120] S4. Using the data set obtained in step S2, the initial medical image classification model constructed in step S3 is trained, optimized, and verified to obtain a medical image classification model;

[0121] During training, the following formula is used as the loss function:

[0122]

[0123] Where N is the number of training samples; y i is a pseudo label; p i is the probability value of the predicted pixel; M is the total number of image categories; c is the identifier of the image category;

[0124] During optimization, the trained model is optimized on the optimized dataset (some data can be selected from the dataset to construct the optimized dataset, and the selected data is only used for the optimization process) to achieve optimized adjustment of the trained model;

[0125] During verification, the optimized model is verified on the verification data set (a number of data can be selected from the data set to construct the verification data set, and the selected data is only used for the verification process) to verify the optimized model and ensure the reliability of the model;

[0126] S5. Use the medical image classification model obtained in step S4 to classify the actual small sample medical image; in specific implementation, it is necessary to crop the actual small sample medical image to a set pixel size and normalize it, and then use the medical image classification model obtained in step S4 to classify it to obtain the classification result.

[0127] The classification method of the present invention is further described below with reference to the following embodiments:

[0128] The datasets used in this example are BLOOD (single cell images of 8 types of blood cells), PATHOLOGY (HC-stained tissue slides of colorectal cancer patients), and CHEST (Chest X-ray 8 frontal chest radiographs).

[0129] The BLOOD dataset includes single cell images of eight types of blood cells, including neutrophils, eosinophils, erythroblasts, and basophils as training sets, immature granulocytes (promyelocytes, myelocytes, and metamyelocytes) as optimization sets, and lymphocytes, monocytes, and platelets as validation sets.

[0130] The PATHOLOGY dataset includes HC-stained tissue slide data from patients with colorectal cancer, with lymphocytes, smooth muscle, and epithelial tissues as training sets, background, debris, and cancer-related matrix as optimization sets, and adipose tissue, mucus, and normal colonic mucosa as validation sets.

[0131] The CHEST dataset includes lung X-ray and CT image data, with atelectasis, pulmonary effusion, pulmonary infiltration, lung mass and nodule as training set, cardiomegaly, pulmonary consolidation, emphysema, pleural thickening and pneumothorax as optimization set, and edema, fibrosis, hernia and pneumonia as validation set;

[0132] The method of the present invention and the existing scheme were tested on the above three data sets respectively. The comparative data are shown in Tables 1 to 3:

[0133] Table 1. Comparison data of BLOOD dataset

[0134] plan 1-shot 5-shot 10-shot MAML 54.37±0.18 56.54±0.21 57.69±0.13 ProtNet 57.4±0.22 71.40±0.28 73.23±0.14 RelatoionNet 56.62±0.18 61.14±0.15 66.79±0.13 Versa 59.63±0.16 62.79±0.10 64.63±0.12 R2D2 55.93±0.16 68.06±0.12 82.66±0.10 ANTL 61.28±0.16 72.62±0.12 74.36±0.13 MTL 59.07±0.26 69.36±0.13 70.55±0.11 The present invention 62.04±0.27 71.45±0.27 74.30±0.26

[0135] Table 2 Schematic diagram of PATHOLOGY dataset comparison data

[0136] plan 1-shot 5-shot 10-shot MAML 56.45±0.16 74.16±0.12 75.71±0.11 ProtNet 60.03±0.22 74.06±0.11 79.30±0.09 RelatoionNet 63.70±0.07 61.14±0.09 66.79±0.13 Versa 63.04±0.12 74.98±0.13 75.55±0.11 R2D2 61.71±0.13 71.44±0.10 74.35±0.10 ANTL 48.24±0.17 64.29±0.14 68.15±0.14 MTL 57.55±0.18 66.43±0.13 70.20±0.11 The present invention 66.11±0.15 79.07±0.15 82.75±0.15

[0137] Table 3 CHEST dataset comparison data diagram

[0138] plan 1-shot 5-shot 10-shot MAML 39.96±0.14 46.83±0.15 48.69±0.14 ProtNet 38.42±0.19 46.43±0.20 49.37±0.14 RelatoionNet 40.23±0.15 42.8±0.14 43.11±0.12 Versa 37.94±0.16 45.81±0.02 47.13±0.02 R2D2 41.46±0.15 46.11±0.14 51.23±0.15 ANTL 33.43±0.11 35.89±0.15 38.58±0.13 MTL 39.86±0.13 46.53±0.14 50.09±0.14 The present invention 41.80±0.19 49.97±0.18 53.51±0.17

[0139] As can be seen from Tables 1 to 3, the classification method of the present invention has achieved very good classification results on all three data sets. The comprehensive performance (reliability and accuracy) of the classification method of the present invention is far superior to the existing solutions.

[0140] like Figure 2 The figure shows a flow chart of the imaging method of the present invention: the imaging method disclosed in the present invention, including the small sample medical image classification method based on the attention mechanism, comprises the following steps:

[0141] A. Use the small sample medical image classification method based on the attention mechanism to classify the actual target medical image;

[0142] B. The classification result obtained in step A is marked and re-imaged on the target medical image to obtain a medical image with the classification result.

[0143] The imaging method provided by the present invention,

[0144] The imaging method provided by the present invention can be directly applied to existing medical imaging equipment (such as a CT machine or an MRI machine, etc.) or directly applied to a terminal (such as a computer); in specific applications, an existing solution is used to obtain actual medical images, and then the obtained data is input into the corresponding machine equipment (CT machine, MRI machine, etc.) or terminal. At this time, the machine equipment or terminal can obtain the actual classification results of the medical image according to the imaging method disclosed by the present invention, and display the classification results on the original image through different types of representations (such as color), and then perform secondary imaging and output; at this time, the output image is an image of the medical image classification result, which can reflect the category of the actual medical image, thereby greatly facilitating the subsequent work of clinical medical staff and laboratory experimenters.

Claims

1. A small sample medical image classification method based on an attention mechanism, comprising the following steps: S1. Acquire existing medical image data; S2. Preprocess the medical image data obtained in step S1 to obtain a data set; S3. Build an initial model for medical image classification based on the prototype network and attention mechanism. This includes the following steps: The constructed initial model for medical image classification includes a feature extraction module and a similarity calculation module; Construct feature extraction module based on prototype network; The feature extraction module is used to extract image features of the input image; A similarity calculation module is constructed based on the attention mechanism; the similarity calculation module is used to calculate the classification results of the input image; The constructed similarity calculation module is used to calculate the category confidence of the input image data to achieve the classification result of the input image data; During the model training and model verification process, the similarity calculation module uses the following formula to calculate the similarity α of the input image data i : Where softmax i () is the activation function; W Q is the center point feature vector; φ() is the result of model prediction; W K is the input image feature vector; d is the vector dimension; x is the center point image; x i The output of the feature extraction module obtained after the image in the input image dataset passes through the feature extraction module; During the model optimization process, the similarity calculation module uses the following formula to calculate the similarity sim of the input image data sns : Where P n is the center point, and k is the number of images in the image dataset input during optimization; y i is a pseudo label; n is the category of the image dataset input during optimization; x j The output of the feature extraction module is obtained after the image in the image data set input during optimization passes through the feature extraction module; S4. Using the data set obtained in step S2, the initial medical image classification model constructed in step S3 is trained, optimized, and verified to obtain a medical image classification model; S5. Use the medical image classification model obtained in step S4 to classify actual small sample medical images.

2. The small sample medical image classification method based on the attention mechanism according to claim 1 is characterized in that The acquisition of existing medical image data in step S1 specifically includes the following steps: The acquired existing medical image data includes cell image data, or organ tissue image data, or organ CT image data.

3. The small sample medical image classification method based on the attention mechanism according to claim 2 is characterized in that Step S2 of preprocessing the medical image data obtained in step S1 to obtain a data set specifically includes the following steps: Randomly sampling the medical image data obtained in step S1 to obtain a number of sample images; Perform image enhancement on the sample image; Crop the enhanced image to the set size and perform normalization; For the processed medical image data, several images are randomly selected as support sets in each round, and several images are randomly selected as query sets; this is repeated several times to obtain several support sets and query sets.

4. The small sample medical image classification method based on the attention mechanism according to claim 3 is characterized in that The image enhancement specifically includes the following steps: Construct an image enhancement operation search space; the image enhancement operation search space includes the following image enhancement operations: Automatically optimize the contrast AutoContrast(0,255), which is used to remap the image on the grayscale value of 0 to 255, so that the darkest pixel becomes 0 grayscale value and the brightest pixel becomes 255 grayscale value; Equalize(0,1) applies a nonlinear mapping to the input image on a scale of 0-1 to create a uniform distribution of grayscale values ​​in the output image. Color inversion Invert(0,1) is used to invert the color of the image on the amplitude of 0-1; Center rotation Rotate(0,30) is used to randomly rotate the image within the range of 0° to 30°; High threshold inversion Solarize(0,255) is used to flip the pixels in the image that are higher than a value between 0 and 255; High threshold inversion enhancement SolarizeAdd(0,110) is used to flip the pixels in the image that are higher than a value between 0 and 110, and add the inverted image to the original image; Grayscale image coloring Color(0.1,1.9) is used to enhance the color in the range of 0.1 to 1.9; Simplify the image color Posterize(0,4), which is used to reduce the number of image colors in the color scale range of 0 to 4; Random cropping CutoutAbs(0,40) is used to randomly crop 0 to 40% of the image; Contrast enhancement Contrast(0.1,1.9), used to remap the image contrast in the range of 0.1 to 1.9; Brightness adjustment Brightness (0.1, 1.9) is used to adjust the brightness of the image in the range of 0.1 to 1.9; Sharpness adjustment Sharpness (0.1, 1.9) is used to sharpen the image in the range of 0.1 to 1.9; Horizontal affine transformation ShearX(0,0.3) is used to perform horizontal affine transformation of the image in the range of 0 to 0.3; Vertical affine transformation ShearY(0,0.3) is used to perform vertical affine transformation of the image in the range of 0 to 0.3; Horizontal translation TranslateX(0,100) is used to translate the image horizontally in the range of 0 to 100 pixels; TranslateY(0,100) is used to translate the image vertically in the range of 0 to 100 pixels. For each image, several image enhancement methods are randomly selected from the constructed image enhancement operation search space to perform image enhancement; When performing image enhancement, the following formula is used to calculate the adjusted parameters of the image enhancement operation: val=x×(max-min)+min Where val is the adjusted parameter of the image enhancement operation; x is the parameter before adjustment of the image enhancement operation; max is the maximum amplitude of the corresponding image enhancement operation; min is the minimum amplitude of the corresponding image enhancement operation.

5. The small sample medical image classification method based on the attention mechanism according to claim 1 is characterized in that The step S3 specifically includes the following steps: The constructed feature extraction module includes a 1×1 convolution kernel, the first BatchNorm 2d layer, the first ReLU layer, and the feature extraction layer; The input image data is processed by a 1×1 convolution kernel to fuse high-level network features with low-level network features; The fused feature data is normalized by the first BatchNorm 2d layer and then filtered by the first ReLU layer; Inputting the filtered feature data into the feature extraction layer for feature extraction to obtain feature extraction data information; the feature extraction layer includes four layers of feature extraction sublayers connected in series; each layer of feature extraction sublayer has the same structure, including a 3×3 convolution kernel, a BatchNorm 2d sublayer, and a ReLU sublayer connected in series, wherein the 3×3 convolution kernel is used to extract features of the input data, the BatchNorm 2d sublayer is used for normalization processing, and the ReLU sublayer is used for feature screening; The input of the first feature extraction sublayer is the input of the feature extraction layer; The input of the first feature extraction sublayer is dimensionally adjusted by a 1×1 convolution kernel, and then superimposed with the output of the first feature extraction sublayer as the input of the second feature extraction sublayer; the input of the second feature extraction sublayer is dimensionally adjusted by a 1×1 convolution kernel, and then superimposed with the output of the second feature extraction sublayer as the input of the third feature extraction sublayer; the input of the third feature extraction sublayer is dimensionally adjusted by a 1×1 convolution kernel, and then superimposed with the output of the third feature extraction sublayer as the input of the fourth feature extraction sublayer; the output of the fourth feature extraction sublayer is directly used as the output of the feature extraction layer and directly input into the similarity calculation module; Finally, the similarity value is determined: If the similarity value of the i-th category is the highest, it is determined that the input image data belongs to the i-th category image, and the final classification result is obtained.

6. The small sample medical image classification method based on the attention mechanism according to claim 5 is characterized in that The training described in step S4 specifically includes the following steps: During training, the following formula is used as the loss function: Where N is the number of training samples; y i is a pseudo label; p i is the probability value of the predicted pixel; M is the total number of image categories; c is the identifier of the image category.

7. An imaging method comprising the small sample medical image classification method based on the attention mechanism according to any one of claims 1 to 6, characterized in that The steps include: A. Use the small sample medical image classification method based on the attention mechanism to classify the actual target medical image; B. The classification result obtained in step A is marked and re-imaged on the target medical image to obtain a medical image with the classification result.

Citation Information

Patent Citations

  • Medical image classification method based on improved attention mechanism

    CN117409232A

  • Small sample medical image classification method based on unsupervised meta learning

    CN118657996A