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

By adopting a small sample medical image classification method based on attention mechanism in small sample medical image classification, using prototype networks and attention mechanisms to build classification models, perform data preprocessing and image enhancement, the problem of misleading the dependence of base class labels and unsupervised learning in the existing technology is solved, and higher classification reliability and accuracy are achieved.

CN119649152AActive Publication Date: 2025-03-18CENT SOUTH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing small sample medical image classification method requires a large number of base class labels in the meta-training stage, resulting in poor performance in actual medical theory research environments. Unsupervised small sample learning methods will lead to misleading the model and degrading classification performance.

Method used

A small sample medical image classification method based on attention mechanism is adopted to construct an initial model of medical image classification through prototype networks and attention mechanisms, perform data preprocessing and image enhancement, reduce dependence on base class labels, and calculate the classification results of images through attention mechanisms.

Benefits of technology

It improves the reliability and accuracy of small-sample medical image classification, reduces the need for base class labels, avoids the misleading of real data and pseudo-class data in unsupervised learning, and significantly improves classification performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119649152A_ABST
    Figure CN119649152A_ABST
Patent Text Reader

Abstract

The invention discloses a small sample medical image classification method based on an attention mechanism. The method comprises the steps that existing medical image data are acquired and preprocessed to obtain a data set; constructing a medical image classification initial model based on the prototype network and the attention mechanism, and performing training, optimization and verification to obtain a medical image classification model; and carrying out actual small sample medical image classification by adopting the obtained medical image classification model. The invention further discloses an imaging method comprising the small sample medical image classification method based on the attention mechanism. According to the method, enhancement of small sample medical image data is realized through a data preprocessing process, and the medical image classification model is constructed and trained based on the prototype network and the attention mechanism, so that classification and imaging of small sample medical images can be realized, the reliability is higher, and the accuracy is better.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[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 focus of researchers.

[0003] In the medical field, the classification of small sample medical images has always been a research focus and difficulty. Given that small sample learning has achieved remarkable results 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 between sample feature vectors. Through training and learning, the distance between samples of the same type is reduced or limited, while the distance between samples of different categories is increased. Meta-learning methods usually involve training on small sample tasks derived from the base class during the training phase. This process mainly revolves around optimizing two key loops: meta-training and meta-testing. In classification tasks, multiple support samples are usually used to classify new samples. In meta-training, the neural network parameters are updated through the training data points of each task. Subsequently, 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 few-shot learning performs well in new tasks with limited data, it still requires a considerable number of base class labels in the meta-training stage. This makes few-shot learning perform poorly in the classification of medical images in actual medical theoretical research environments. 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, it is very costly to provide enough annotation labels during the training of the model. In addition, due to privacy and security considerations, the number of samples that researchers can publicly access is relatively limited. At present, the common solution is to use unsupervised few-shot learning methods to obtain pseudo-class data and metric learning through data enhancement to reduce the label requirements of the base class dataset. However, this method will cause the real data and pseudo-class data to mislead the model, resulting in a decrease in the performance of the classification scheme. Summary of the invention

[0006] One of the purposes of the present invention is to provide a small sample medical image classification method based on 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 comprises the following steps:

[0009] S1. Acquire existing medical image data;

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

[0011] S3. Construct an initial model for medical image classification based on 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 preprocesses the medical image data acquired in step S1 to obtain a data set, which specifically includes the following steps:

[0017] The medical image data obtained in step S1 is randomly sampled to obtain a plurality of sample images;

[0018] Perform image enhancement on sample images;

[0019] Crop the enhanced image to the set size and normalize it;

[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 process is repeated several times to obtain several support sets and query sets.

[0021] The image enhancement specifically comprises 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) 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);

[0024] Equalize(0,1) is used to apply 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.

[0025] Color inversion Invert(0,1) is used to invert the color of the image in the range of 0-1;

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

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

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

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

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

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

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

[0033] 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;

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

[0035] 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;

[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] Vertical translation 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 in 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] Wherein 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; and min is the minimum amplitude of the corresponding image enhancement operation.

[0043] The step S3 described in which the initial model for medical image classification is constructed based on the prototype network and the attention mechanism 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 result 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 initially 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 layer of 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 through 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 through 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 through 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 feature vector of the center point; φ() is the result predicted by the model; 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 data set 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. Using 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 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. 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 The figure is a schematic diagram of the method flow of the classification method of the present invention.

[0070] Figure 2 The figure is a schematic diagram of the method flow of the imaging method of the present invention. DETAILED DESCRIPTION

[0071] like Figure 1The method flow chart of the classification method of the present invention is shown as follows: 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 includes the following steps:

[0073] The acquired existing medical image data includes cell image data, or 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] The medical image data obtained in step S1 is randomly sampled to obtain a plurality of sample images;

[0077] Perform image enhancement on sample images;

[0078] Crop the enhanced image to the set size and normalize it;

[0079] 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; repeat several rounds to obtain several support sets and query sets;

[0080] Among them, image enhancement is an important step in the scheme of 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] AutoContrast(0,255) 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) is used to apply 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 in the range 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 certain 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 certain 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 image colors 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] Vertical translation 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 in 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. Based on the prototype network and attention mechanism, the initial model of medical image classification is constructed; the specific steps include:

[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 result 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 initially filtered by the first ReLU layer;

[0110] 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 layer of 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 through 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 through 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 through 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;

[0111] 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;

[0112] 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 :

[0113]

[0114] Where softmax i () is the activation function; W Q is the feature vector of the center point; φ() is the result predicted by the model; 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 data set passes through the feature extraction module;

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

[0116]

[0117] 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;

[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 data set (some data can be selected from the data set to construct the optimized data set, and the selected data is only used in the optimization process) to achieve the optimization adjustment of the trained model;

[0125] During verification, the optimized model is verified on the verification data set (some 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 in conjunction with embodiments:

[0128] The data sets used in this embodiment are BLOOD (single cell images of 8 types of blood cells), PATHOLOGY (HC-stained tissue slides of colorectal cancer patients), and CHEST (ChestX-ray8 frontal chest radiographs);

[0129] The BLOOD dataset includes single cell images of 8 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 colon mucosa as validation sets.

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

[0132] The method of the present invention and the existing scheme were respectively tested for classification on the above three data sets, and 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

[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 data set 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] From Tables 1 to 3, it can be seen that the classification method of the present invention has achieved very good classification results on the 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 schematic diagram of the method flow 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. Using 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 CT machines, or MRI machines, etc.), or directly applied to a terminal (such as a computer); in specific application, the existing scheme 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 classification result of the actual medical image according to the imaging method disclosed in the present invention, and display the classification result on the original image through different types of representation (such as color), and then perform secondary imaging and output; at this time, the output image is the image of the medical image classification result, which can reflect the category of the actual medical image, thereby greatly facilitating clinical medical personnel and laboratory experimenters to carry out subsequent work.

Claims

1. A small sample medical image classification method based on attention mechanism, comprising the following steps: S1. Acquire existing medical image data; S2. Preprocessing the medical image data obtained in step S1 to obtain a data set; S3. Construct an initial model for medical image classification based on prototype network and attention mechanism; 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 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 attention mechanism according to claim 2 is characterized in that Step S2 preprocesses the medical image data acquired in step S1 to obtain a data set, which specifically includes the following steps: The medical image data obtained in step S1 is randomly sampled to obtain a plurality of sample images; Perform image enhancement on sample images; Crop the enhanced image to the set size and normalize it; 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 process is repeated several times to obtain several support sets and query sets.

4. The small sample medical image classification method based on attention mechanism according to claim 3 is characterized in that The image enhancement specifically comprises the following steps: Construct an image enhancement operation search space; the image enhancement operation search space includes the following image enhancement operations: AutoContrast(0,255) 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) is used to apply 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 in the range 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 certain 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 certain 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 image colors 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; Vertical translation 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 in 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 Wherein 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; and min is the minimum amplitude of the corresponding image enhancement operation.

5. The small sample medical image classification method based on attention mechanism according to claim 4 is characterized in that The step S3 described in which the initial model for medical image classification is constructed based on the prototype network and the attention mechanism specifically 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 result of the input image.

6. The small sample medical image classification method based on attention mechanism according to claim 5 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 initially filtered by the first ReLU layer; Input 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; the structure of each layer of 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 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 through 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 through 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 through 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; 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 feature vector of the center point; φ() is the result predicted by the model; 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 data set 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; 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.

7. The small sample medical image classification method based on attention mechanism according to claim 6 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.

8. An imaging method comprising the small sample medical image classification method based on the attention mechanism according to any one of claims 1 to 7, characterized in that The steps include: A. Using 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