Brain CT image processing method and related equipment based on self-attention mechanism fusion
Through a brain CT image processing method based on the self-attention mechanism, combined with brain CT images and Glasgow coma score data, accurate analysis of brain CT images is achieved, solving the problem of inaccurate brain CT image analysis in the existing technology, and improving Diagnostic objectivity and accuracy.
Patent Information
- Application Number
- CN202310820285.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-05
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2043-07-05
AI Technical Summary
Existing technology cannot accurately analyze brain CT images, causing the diagnosis of cerebral hemorrhage to rely on the experience and subjective judgment of clinicians, lacking efficient AI-assisted analysis methods.
Using a brain CT image processing method based on the self-attention mechanism, by building a processing model including a feature extraction module, a feature fusion module and a classification head, and combining brain CT images and Glasgow Coma Score data, feature extraction, fusion and inference calculations are implemented to achieve Precise analysis of brain CT images.
It achieves precise analysis of brain CT images, reduces dependence on the experience of clinicians, and improves the objectivity and accuracy of diagnosis.
Smart Images

Figure CN117011657B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a brain CT image processing method, system, terminal and computer-readable storage medium based on self-attention mechanism fusion. Background Art
[0002] Intracerebral hemorrhage (ICH) is caused by rupture of blood vessels in the brain parenchyma, leading to bleeding in brain tissue. In the diagnosis of ICH, important indicators include bleeding, Glasgow Coma Scale (GCS), presence or absence of intraventricular hemorrhage, etc. CT is widely used in the field of ICH due to its image reconstruction technology and readability, but the traditional method is to determine the patient's GCS score through CT; however, the interpretation of CT requires qualified clinicians, so it is easily affected by the experience and subjective judgment of clinicians. Although the use of artificial intelligence (AI) can help overcome some defects, the application of AI in the field of ICH is mainly focused on the identification and volume measurement of bleeding, and it is impossible to accurately analyze brain CT images.
[0003] Therefore, the prior art still needs to be improved and developed. Summary of the invention
[0004] The main purpose of the present invention is to provide a brain CT image processing method and related equipment based on self-attention mechanism fusion, aiming to solve the problem that brain CT images cannot be accurately analyzed in the prior art.
[0005] To achieve the above object, the present invention provides a brain CT image processing method based on self-attention mechanism fusion, and the brain CT image processing method based on self-attention mechanism fusion comprises the following steps:
[0006] Constructing a processing model, wherein the processing model includes a feature extraction module, a feature fusion module and a classification head, and obtaining a brain CT image and Glasgow Coma Score data of the user;
[0007] Converting the brain CT image into a data sequence, processing the data sequence to obtain a grayscale image of a brain tissue region, and denoising the grayscale image to obtain a denoised grayscale image;
[0008] Based on the feature extraction module, feature extraction is performed on the denoised grayscale image and the Glasgow Coma Score data to obtain CT slice features and domain knowledge related features respectively;
[0009] Based on the feature fusion module, the CT slice features and the domain knowledge related features are fused to obtain fused features, and based on the classification head, the fused features are inferred and calculated to obtain target results.
[0010] Optionally, the brain CT image processing method based on self-attention mechanism fusion, wherein the brain CT image is format converted to obtain a data sequence, the data sequence is processed to obtain a grayscale image of the brain tissue area, and the grayscale image is denoised to obtain a denoised grayscale image, specifically includes:
[0011] Converting the brain CT image into a data sequence, processing the data sequence to obtain a grayscale image of a brain tissue region, and denoising the grayscale image to obtain a denoised grayscale image;
[0012] Performing table extraction on the brain CT image to obtain a data table in DICOM format, and reading the data table to obtain original image data, wherein the original image data includes a pixel sequence of the data table;
[0013] Obtaining a target window level and a target window width of the brain CT image based on the original image data, and obtaining a grayscale image of a brain tissue region based on the target window level and the target window width;
[0014] Threshold segmentation and morphological operation are performed on the grayscale image to obtain a denoised grayscale image.
[0015] Optionally, the brain CT image processing method based on self-attention mechanism fusion, wherein the feature extraction module is used to extract features from the denoised grayscale image and the Glasgow Coma Score data to obtain CT slice features and domain knowledge related features, respectively, specifically including:
[0016] Obtaining the backbone part of the feature extraction module, performing feature extraction on the denoised grayscale image according to the backbone part, obtaining CT slice features, and connecting to a multi-layer perceptron;
[0017] The Glasgow Coma Score data is sent to the feature extraction module based on the multilayer perceptron, and the Glasgow Coma Score data is calculated in a fully connected manner based on the feature extraction module to obtain domain knowledge related features.
[0018] Optionally, the brain CT image processing method based on self-attention mechanism fusion, wherein the feature fusion module is used to perform feature fusion on the CT slice features and the domain knowledge related features to obtain fused features, and the classification head is used to perform reasoning calculation on the fused features to obtain the target result, specifically including:
[0019] Inputting the CT slice features and the domain knowledge related features into the feature fusion module, the feature fusion module connects the CT slice features and the domain knowledge related features according to a first formula to obtain a mixed feature vector;
[0020] Calculating the potential information between the CT slice feature and the domain knowledge related feature according to the second formula, and fusing the mixed feature vector according to the potential information to obtain a fused feature;
[0021] The fused features are input into the classification head, and the classification head calculates the fused features according to the cross entropy function to obtain the result loss, and obtains the target result based on the result loss.
[0022] Optionally, in the brain CT image processing method based on self-attention mechanism fusion, the first formula is:
[0023] f global =Concat(Conv(X i ), wg i + b);
[0024] Among them, f global is the feature concatenated by brain CT images and Glasgow Coma Scale data, Concat is the combination function, w is the weight of the linear layer, b is the bias of the linear layer, i is the index of the individual in the dataset, and X i is the CT slice of the i-th individual, g i is the GCS score of the i-th individual, Conv(X i ) is for X i Perform convolution operation.
[0025] Optionally, in the brain CT image processing method based on self-attention mechanism fusion, the second formula is:
[0026] f mix =Concat(head1, ..., head j )W O ;
[0027] Among them, f mix is a mixed feature, Concat is a combination function, head j is the jth attention head, W O is the output weight matrix, j is the index of different attention heads;
[0028] in, Q j , and V j Both are f globalThe result obtained by multiplying the weight matrix in with different attention heads, d k is the dimension of the vector key.
[0029] Optionally, in the brain CT image processing method based on self-attention mechanism fusion, the multilayer perceptron comprises a first hidden layer, a second hidden layer and a third hidden layer, wherein the first hidden layer, the second hidden layer and the third hidden layer have 32, 128 and 256 neurons respectively.
[0030] Optionally, the brain CT image processing method based on self-attention mechanism fusion, wherein the brain CT image processing system based on self-attention mechanism fusion includes:
[0031] A model building module, used to build a processing model, wherein the processing model includes a feature extraction module, a feature fusion module and a classification head;
[0032] A data acquisition module, used to acquire the user's brain CT image and Glasgow Coma Score data;
[0033] A data processing module, used for converting the format of the brain CT image to obtain a data sequence, processing the data sequence to obtain a grayscale image of the brain tissue area, and denoising the grayscale image to obtain a denoised grayscale image;
[0034] A feature extraction module, used to extract features from the denoised grayscale image and the Glasgow Coma Scale data, respectively, to obtain CT slice features and domain knowledge related features;
[0035] A feature fusion module, used for fusing the CT slice features and the domain knowledge related features to obtain fused features;
[0036] The classification head is used to perform inference calculation on the fusion feature based on the classification head to obtain a target result.
[0037] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a program stored in the memory and executable on the processor, and when the program is executed by the processor, the steps of the brain CT image processing method based on self-attention mechanism fusion as described above are implemented.
[0038] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a brain CT image processing program based on self-attention mechanism fusion, and when the brain CT image processing program based on self-attention mechanism fusion is executed by a processor, the steps of the brain CT image processing method based on self-attention mechanism fusion as described above are implemented.
[0039] In the present invention, a processing model is constructed, wherein the processing model includes a feature extraction module, a feature fusion module and a classification head, and the user's brain CT image and Glasgow Coma Score data are obtained; the brain CT image is formatted to obtain a data sequence, the data sequence is processed to obtain a grayscale image of the brain tissue area, and the grayscale image is denoised to obtain a denoised grayscale image; based on the feature extraction module, feature extraction is performed on the denoised grayscale image and the Glasgow Coma Score data respectively to obtain CT slice features and domain knowledge related features respectively; based on the feature fusion module, feature fusion is performed on the CT slice features and the domain knowledge related features to obtain fused features, and based on the classification head, the fused features are inferred and calculated to obtain the target result. The present invention completes accurate analysis of brain CT images by integrating multimodal data of brain CT images and GCS scores as domain knowledge. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a flow chart of a preferred embodiment of the brain CT image processing method based on self-attention mechanism fusion in the present invention;
[0041] Figure 2 It is a schematic diagram of the overall structure of the processing model in the preferred embodiment of the present invention;
[0042] Figure 3 It is a schematic diagram of the result of the brain CT image processing method based on the fusion of the self-attention mechanism in the present invention;
[0043] Figure 4 It is a schematic diagram of the overall process of the brain CT image processing method based on the fusion of the self-attention mechanism in the present invention;
[0044] Figure 5 It is a schematic diagram of the principle of a preferred embodiment of a brain CT image processing system based on self-attention mechanism fusion in the present invention;
[0045] Figure 6 It is a schematic diagram of the operating environment of a preferred embodiment of the terminal of the present invention. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0047] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0048] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0049] The brain CT image processing method based on self-attention mechanism fusion described in the preferred embodiment of the present invention is as follows: Figure 1 As shown, the brain CT image processing method based on self-attention mechanism fusion includes the following steps:
[0050] Step S10: construct a processing model, wherein the processing model includes a feature extraction module, a feature fusion module and a classification head, and obtains the user's brain CT image and Glasgow Coma Score data.
[0051] Specifically, a feature extraction module, a feature fusion module and a classification head are obtained, wherein the feature extraction module is a two-dimensional convolutional neural network, including the backbone of ResNet-50; the feature fusion module includes multi-head self-attention, and fusion is achieved through a multi-head attention mechanism; the classification head is a one-dimensional convolutional neural network, the main body of which is DenseNet-121, and the final classification result can be output; a processing model is constructed based on the feature extraction module, the feature fusion module and the classification head, wherein the overall structure diagram of the processing model is as shown in Figure 2 As shown, Figure 2 The source files in include brain CT images and FCS scores. The processing model is used to process brain CT images. The brain CT images of users are obtained through CT hardware, and the Glasgow Coma Scale data of the user is obtained through the GCS (Glasgow Coma Scale) scoring standard. The GCS scoring standard is shown in Table 1.
[0052] Table 1: Glasgow Coma Scale
[0053]
[0054]
[0055] In an embodiment of the present invention, for example, 286 cases of spontaneous cerebral hemorrhage collected from Shenzhen Longgang Central Hospital are used as experimental data sets, and all cases have completed the clinical treatment cycle. Inclusion criteria: confirmed spontaneous cerebral hemorrhage; complete plain scan CT images completed within 24 hours after complete hemorrhage; complete GCS score information at admission; clinical information (age, gender, and bleeding site, etc.). Patients cannot be included if they have secondary cerebral hemorrhage due to the following conditions: arteriovenous malformation, cerebral aneurysm, traumatic brain injury, brain tumor, and cerebral infarction. Because the bleeding area, size, and shape of different patients are different, in order to ensure that the training data is concentrated in the bleeding area of the patient and does not contain too much invalid information, the images are manually screened under the guidance of clinicians to ensure that each brain CT image contains a bleeding area. However, due to the different ranges of bleeding among patients, some patients with excessive bleeding account for a larger proportion in the image dataset. In order to diversify the dataset, an upper limit is set on the number of slices of the selected images, for example, 5 and 10 slices are selected as the maximum number of slices for each patient respectively; this number of slices is selected for each patient to ensure that the bleeding area is included in the training data while avoiding too much irrelevant information; for patients with a larger proportion of bleeding, only the most relevant images are selected instead of all; the selected data are standardized by calculating the mean and standard deviation, and the validity of the dataset is checked.
[0056] Furthermore, to ensure that CT slices from the same patient are in the same file, the selected data are first randomly divided into 80% and 20% for training and testing, respectively, and then the corresponding CT slices of each patient are placed in their respective datasets; for example, the dataset contains a total of 286 patients, of which 232 are used for training and 54 are used for testing. The 10-slice dataset contains 1536 CT slices (1267 for training and 269 for testing), while the 5-slice dataset contains 1301 CT slices (1062 for training and 239 for testing).
[0057] Step S20: convert the format of the brain CT image to obtain a data sequence, process the data sequence to obtain a grayscale image of the brain tissue area, and denoise the grayscale image to obtain a denoised grayscale image.
[0058] The step S20 comprises:
[0059] Step S21, performing table extraction on the brain CT image to obtain a data table in DICOM format, and reading the data table to obtain original image data, wherein the original image data includes a pixel sequence of the data table;
[0060] Step S22, obtaining a target window level and a target window width of the brain CT image based on the original image data, and obtaining a grayscale image of a brain tissue region based on the target window level and the target window width;
[0061] Step S23: performing threshold segmentation and morphological operations on the grayscale image to obtain a denoised grayscale image.
[0062] Specifically, after acquiring a brain CT image, a table is extracted from the brain CT image to obtain a data table in DICOM format containing patient metadata, and a pixel sequence of the data table in DICOM format is read, and the pixel sequence is used as the original image data; then, a window position and window width specific to the brain CT are set for the brain CT image through a window selection method, and the original image data is filtered out according to the window position and the window width, thereby obtaining a grayscale image of the brain tissue area, and the grayscale image of the brain tissue area is converted into a common image format file for storage, which is convenient for subsequent model training. Because there is a large amount of irrelevant information in the brain CT image, this irrelevant information may cause deviations and mislead the classification results, so it is necessary to denoise the grayscale image to obtain a denoised grayscale image; in order to reduce interference from non-brain tissue areas, these areas are isolated by adopting multi-threshold segmentation and connected component screening. Specifically, the OpenCV library is used for threshold segmentation to separate the bone slices and CT slices, retaining the hemorrhage area and normal brain tissue; in order to eliminate excess noise and ensure the accuracy of the results, connected component screening is performed in batches, and the final image only contains information belonging to the brain tissue area, that is, unnecessary pixels such as the skull area and CT ring area are removed, and only the brain tissue is retained. The brain tissue includes the hemorrhage area, gray matter and normal brain tissue, that is, the denoised grayscale image; by denoising the brain CT image, the excess noise of the brain CT image is eliminated and the accuracy of the results is ensured.
[0063] Step S30: Based on the feature extraction module, feature extraction is performed on the denoised grayscale image and the Glasgow Coma Scale data to obtain CT slice features and related features of domain knowledge.
[0064] The step S30 comprises:
[0065] Step S31, obtaining the Backbone part of the feature extraction module, performing feature extraction on the denoised grayscale image according to the Backbone part, obtaining CT slice features, and connecting to a multilayer perceptron;
[0066] Step S32: sending the Glasgow Coma Score data to the feature extraction module based on the multilayer perceptron, and performing full-connection calculation on the Glasgow Coma Score data based on the feature extraction module to obtain domain knowledge related features.
[0067] Specifically, the ImageNet database in the feature extraction module is obtained, the ResNet-50 pre-trained in the ImageNet database is extracted, and the Backbone part of ResNet-50 is used to extract features from the denoised grayscale image; and ResNet-50 is used because it can help prevent potential overfitting problems caused by insufficient data. After the Backbone part, multiple linear layers and Dropout layers are combined to convert and calculate the Backbone part to obtain a tensor, and the final CT slice features adapted to the feature fusion module are obtained through the tensor, and these CT slice features form a one-dimensional vector with a length of 128. In order to obtain domain knowledge related features, the Glasgow Coma Score data (GCS score) is sent to the feature extraction module using MLP (Multi-LayerPerceptron, multi-layer perceptron), and the text modality data of the GCS score is calculated by full connection and other methods to obtain a tensor, and the final domain knowledge related features adapted to the feature fusion module are obtained through the tensor. The MLP contains three hidden layers with 32, 128, and 256 neurons respectively, and finally produces a one-dimensional vector of length 64.
[0068] Step S40: Based on the feature fusion module, the CT slice features and the domain knowledge related features are fused to obtain fused features, and based on the classification head, the fused features are inferred and calculated to obtain target results.
[0069] The step S40 comprises:
[0070] Step S41, inputting the CT slice features and the domain knowledge related features into the feature fusion module, and the feature fusion module connects the CT slice features and the domain knowledge related features according to a first formula to obtain a mixed feature vector;
[0071] Step S42, calculating the potential information between the CT slice feature and the domain knowledge related feature according to the second formula, and fusing the mixed feature vector according to the potential information to obtain a fused feature;
[0072] Step S43: input the fused features into the classification head, the classification head calculates the fused features according to the cross entropy function to obtain the result loss, and obtains the target result based on the result loss.
[0073] Specifically, the CT slice features and the domain knowledge related features are input into the feature fusion module. In the feature fusion module, the CT slice features and the domain knowledge related features are first connected by a first formula to obtain a mixed feature vector; wherein the first formula is: globdl=Concat(Conv(X i ), wg i +b);f global is the feature concatenated by brain CT images and Glasgow Coma Scale data, Concat is the combination function, w is the weight of the linear layer, b is the bias of the linear layer, i is the index of the individual in the dataset, and X i is the CT slice of the i-th individual, g i is the GCS score of the i-th individual, Conv(X i ) is for X i Convolution operation is performed; then the mixed feature vector is input into a self-attention module composed of 16 attention heads, and the self-attention module captures the potential relationship between the CT slice features and the domain knowledge-related features according to the second formula by using the self-attention mechanism to obtain the fusion features of the two modalities of GCS score and brain CT image; the second formula is: mix =Concat(head1, ..., head j )W O ; Among them, f mix is a mixed feature, Concat is a combination function, head j is the jth attention head, W O is the output weight matrix, j is the index of different attention heads; where, Q j , and V j Both are f global The result obtained by multiplying the weight matrix in with different attention heads, d k is the dimension of the vector key. Finally, the fused features are passed to the classification head 1D DenseNet-121 to prevent overfitting and generalize well; during the training process, the classification head 1D DenseNet-121 uses Adam as the optimizer (AdaptiveMoment Estimation, Adam optimizer is an optimization algorithm based on gradient descent), calculates the result loss of the fused features through the cross entropy function, and obtains the target result based on the result loss, such as Figure 3 As shown, the gradient changes of a CT slice in the dataset are displayed through visualization. It can be noticed that the processing model pays attention to the characteristics of the cerebral hemorrhage area in the CT slice during the reasoning process and has a high sensitivity to the cerebral hemorrhage area.
[0074] Furthermore, if Figure 4 As shown in the figure, the overall process diagram of the brain CT image processing method based on the fusion of the self-attention mechanism is as follows:
[0075] Step S1, constructing a processing model, the processing model includes a feature extraction module, a feature fusion module and a classification head, obtaining a user's source file, the source file includes a brain CT image and Glasgow Coma Score data, and converting the brain CT image into a pixel sequence;
[0076] Step S2, taking the pixel sequence as the original image data, and then filtering the original image data by setting a window position and a window width specific to the brain CT by a window selection method, so as to obtain a grayscale image of the brain tissue area, converting the grayscale image into a file of a common image format and saving it, and performing denoising on the grayscale image to obtain a denoised grayscale image; if the Glasgow Coma Score data is subjected to feature extraction to obtain domain knowledge related features, then proceeding to step S31; if the denoised grayscale image is subjected to feature extraction to obtain CT slice features, then proceeding to step S32;
[0077] Step S31, accessing a multilayer perceptron, sending the Glasgow Coma Score data to the feature extraction module based on the multilayer perceptron, and performing a fully connected calculation on the Glasgow Coma Score data based on the feature extraction module to obtain domain knowledge related features;
[0078] Step S32, obtaining the Backbone part of the feature extraction module, and performing feature extraction on the denoised grayscale image according to the Backbone part to obtain CT slice features;
[0079] Step S4, based on the feature fusion module, the CT slice feature and the domain knowledge related feature are fused to obtain a fused feature;
[0080] Step S5, performing inference calculation on the fusion feature based on the classification head to obtain a target result.
[0081] Furthermore, if Figure 5 As shown, based on the above-mentioned brain CT image processing method based on self-attention mechanism fusion, the present invention also provides a brain CT image processing system based on self-attention mechanism fusion, and the brain CT image processing system based on self-attention mechanism fusion includes:
[0082] A model building module 51, used to build a processing model, wherein the processing model includes a feature extraction module, a feature fusion module and a classification head;
[0083] A data acquisition module 52, used to acquire a user's brain CT image and Glasgow Coma Scale data;
[0084] A data processing module 53 is used to convert the format of the brain CT image to obtain a data sequence, process the data sequence to obtain a grayscale image of the brain tissue area, and perform denoising on the grayscale image to obtain a denoised grayscale image;
[0085] A feature extraction module 54 is used to extract features from the denoised grayscale image and the Glasgow Coma Scale data to obtain CT slice features and domain knowledge related features respectively;
[0086] A feature fusion module 55 is used to fuse the CT slice features and the domain knowledge related features to obtain fused features;
[0087] The classification head 56 is used to perform inference calculation on the fusion feature based on the classification head to obtain a target result.
[0088] Furthermore, if Figure 6 As shown, based on the above-mentioned brain CT image processing method based on self-attention mechanism fusion, the present invention also provides a terminal accordingly, and the terminal includes a processor 10, a memory 20 and a display 30. Figure 6 Only some components of the terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0089] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code of the installation terminal. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a brain CT image processing program 40 based on self-attention mechanism fusion is stored on the memory 20, and the brain CT image processing program 40 based on self-attention mechanism fusion can be executed by the processor 10, thereby realizing the brain CT image processing method based on self-attention mechanism fusion in the present application.
[0090] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run the program code or process data stored in the memory 20, such as executing the building information processing method of the combined InSAR and lidar.
[0091] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 30 is used to display information on the terminal and to display a visual user interface. The components 10-30 of the terminal communicate with each other via a system bus.
[0092] In one embodiment, when the processor 10 executes the brain CT image processing program 40 based on the self-attention mechanism fusion in the memory 20, the following steps are implemented:
[0093] Constructing a processing model, wherein the processing model includes a feature extraction module, a feature fusion module, and a classification head, and obtaining a brain CT image and Glasgow Coma Score data of the user;
[0094] Converting the brain CT image into a data sequence, processing the data sequence to obtain a grayscale image of a brain tissue region, and denoising the grayscale image to obtain a denoised grayscale image;
[0095] Based on the feature extraction module, feature extraction is performed on the denoised grayscale image and the Glasgow Coma Score data to obtain CT slice features and domain knowledge related features respectively;
[0096] Based on the feature fusion module, the CT slice features and the domain knowledge related features are fused to obtain fused features, and based on the classification head, the fused features are inferred and calculated to obtain target results.
[0097] The step of converting the format of the brain CT image to obtain a data sequence, processing the data sequence to obtain a grayscale image of a brain tissue region, and denoising the grayscale image to obtain a denoised grayscale image specifically includes:
[0098] Converting the brain CT image into a data sequence, processing the data sequence to obtain a grayscale image of a brain tissue region, and denoising the grayscale image to obtain a denoised grayscale image;
[0099] Performing table extraction on the brain CT image to obtain a data table in DICOM format, and reading the data table to obtain original image data, wherein the original image data includes a pixel sequence of the data table;
[0100] Obtaining a target window level and a target window width of the brain CT image based on the original image data, and obtaining a grayscale image of a brain tissue region based on the target window level and the target window width;
[0101] Threshold segmentation and morphological operation are performed on the grayscale image to obtain a denoised grayscale image.
[0102] The feature extraction module is used to extract features from the denoised grayscale image and the Glasgow Coma Score data to obtain CT slice features and domain knowledge related features, specifically including:
[0103] Obtaining the backbone part of the feature extraction module, performing feature extraction on the denoised grayscale image according to the backbone part, obtaining CT slice features, and connecting to a multi-layer perceptron;
[0104] The Glasgow Coma Score data is sent to the feature extraction module based on the multilayer perceptron, and the Glasgow Coma Score data is calculated in a fully connected manner based on the feature extraction module to obtain domain knowledge related features.
[0105] The step of fusing the CT slice features and the domain knowledge related features based on the feature fusion module to obtain fused features, and performing reasoning calculation on the fused features based on the classification head to obtain the target result specifically includes:
[0106] Inputting the CT slice features and the domain knowledge related features into the feature fusion module, the feature fusion module connects the CT slice features and the domain knowledge related features according to a first formula to obtain a mixed feature vector;
[0107] Calculating the potential information between the CT slice feature and the domain knowledge related feature according to the second formula, and fusing the mixed feature vector according to the potential information to obtain a fused feature;
[0108] The fused features are passed to the classification head for input, and the classification head calculates the fused features according to the cross entropy function to obtain the result loss, and obtains the target result based on the result loss.
[0109] Among them, the first formula is:
[0110] f global =Concat(Conv(X i), wg i + b);
[0111] Among them, f global is the feature concatenated by brain CT images and Glasgow Coma Scale data, Concat is the combination function, w is the weight of the linear layer, b is the bias of the linear layer, i is the index of the individual in the dataset, and X i is the CT slice of the i-th individual, g i is the GCS score of the i-th individual, Cony(X i ) is for X i Perform convolution operation.
[0112] Among them, the brain CT image processing method based on self-attention mechanism fusion, wherein the second formula is:
[0113] f mix =Concat(head1, ..., head j )W O ;
[0114] Among them, f mix is a mixed feature, Concat is a combination function, head j is the jth attention head, W O is the output weight matrix, j is the index of different attention heads;
[0115] in, Q j , and V j Both are f global The result obtained by multiplying the weight matrix in with different attention heads, d k is the dimension of the vector key.
[0116] Among them, the brain CT image processing method based on self-attention mechanism fusion, wherein the second formula is:
[0117] f mix =Concat(head1, ..., head j )W O ;
[0118] Among them, f mix is a mixed feature, Concat is a combination function, head j is the jth attention head, W O is the output weight matrix, j is the index of different attention heads;
[0119] in, Q j , and Vj Both are f global The result obtained by multiplying the weight matrix in with different attention heads, d k is the dimension of the vector key.
[0120] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a brain CT image processing program based on self-attention mechanism fusion, and when the brain CT image processing program based on self-attention mechanism fusion is executed by a processor, the steps of the brain CT image processing method based on self-attention mechanism fusion as described above are implemented.
[0121] In summary, a processing model is constructed, wherein the processing model includes a feature extraction module, a feature fusion module and a classification head, and the user's brain CT image and Glasgow Coma Score data are obtained; the brain CT image is formatted to obtain a data sequence, the data sequence is processed to obtain a grayscale image of the brain tissue area, and the grayscale image is denoised to obtain a denoised grayscale image; based on the feature extraction module, feature extraction is performed on the denoised grayscale image and the Glasgow Coma Score data respectively to obtain CT slice features and domain knowledge related features respectively; based on the feature fusion module, feature fusion is performed on the CT slice features and the domain knowledge related features to obtain fused features, and based on the classification head, the fused features are inferred and calculated to obtain the target result. The present invention completes accurate analysis of brain CT images by integrating multimodal data of brain CT images and GCS scores as domain knowledge.
[0122] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0123] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the program can be stored in a computer-readable storage medium that can be read by a computer, and the program can include the processes of the above-mentioned method embodiments when executed. The computer-readable storage medium can be a memory, a disk, an optical disk, etc.
[0124] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A brain CT image processing method based on self-attention mechanism fusion, characterized in that: The brain CT image processing method based on self-attention mechanism fusion includes: Constructing a processing model, wherein the processing model includes a feature extraction module, a feature fusion module, and a classification head, and obtaining a brain CT image and Glasgow Coma Scale data of the user; Converting the brain CT image into a data sequence, processing the data sequence to obtain a grayscale image of a brain tissue region, and denoising the grayscale image to obtain a denoised grayscale image; Based on the feature extraction module, feature extraction is performed on the denoised grayscale image and the Glasgow Coma Scale data to obtain CT slice features and domain knowledge related features respectively; Based on the feature fusion module, the CT slice features and the domain knowledge related features are fused to obtain fused features, and based on the classification head, the fused features are inferred and calculated to obtain target results; The step of fusing the CT slice features and the domain knowledge-related features based on the feature fusion module to obtain fused features, and performing inference calculation on the fused features based on the classification head to obtain target results specifically includes: Inputting the CT slice features and the domain knowledge related features into the feature fusion module, the feature fusion module concatenating the CT slice features and the domain knowledge related features according to a first formula to obtain a mixed feature vector; Calculating potential information between the CT slice features and the domain knowledge related features according to a second formula, and fusing the mixed feature vector according to the potential information to obtain a fused feature; Inputting the fused features into the classification head, the classification head calculates the fused features according to the cross entropy function to obtain a result loss, and obtains the target result based on the result loss; The first formula is: f global =Concat(Conv(X i ),wg i +b); Among them, f global is the feature concatenated by brain CT images and Glasgow Coma Scale data, Concat is the combination function, w is the weight of the linear layer, b is the bias of the linear layer, i is the index of the individual in the dataset, X i is the CT slice of the i-th individual, g i is the GCS score of the i-th individual, Conv(X i ) is for X i Perform convolution operation; The second formula is: f mix =Concat(head1,...,head j )W O ; Among them, f mix is a mixed feature, Concat is a combination function, head j is the jth attention head, W O is the output weight matrix, j is the index of different attention heads; in, Q j 、 and V j Both are f global The result obtained by multiplying the weight matrix in different attention heads, d k is the dimension of the vector key.
2. The brain CT image processing method based on self-attention mechanism fusion according to claim 1 is characterized in that: The step of converting the format of the brain CT image to obtain a data sequence, processing the data sequence to obtain a grayscale image of a brain tissue region, and denoising the grayscale image to obtain a denoised grayscale image specifically includes: Performing table extraction on the brain CT image to obtain a data table in DICOM format, and reading the data table to obtain original image data, wherein the original image data includes a pixel sequence of the data table; obtaining a target window level and a target window width of the brain CT image based on the original image data, and obtaining a grayscale image of a brain tissue region based on the target window level and the target window width; Threshold segmentation and morphological operations are performed on the grayscale image to obtain a denoised grayscale image.
3. The brain CT image processing method based on self-attention mechanism fusion according to claim 1, characterized in that: The feature extraction module is used to extract features from the denoised grayscale image and the Glasgow Coma Scale data, respectively, to obtain CT slice features and domain knowledge-related features, specifically including: Obtaining the backbone part of the feature extraction module, performing feature extraction on the denoised grayscale image according to the backbone part to obtain CT slice features, and connecting the features to a multilayer perceptron; The Glasgow Coma Score data is sent to the feature extraction module based on the multilayer perceptron, and the Glasgow Coma Score data is calculated in a fully connected manner based on the feature extraction module to obtain domain knowledge related features.
4. The brain CT image processing method based on self-attention mechanism fusion according to claim 3 is characterized in that: The multilayer perceptron comprises a first hidden layer, a second hidden layer and a third hidden layer, wherein the first hidden layer, the second hidden layer and the third hidden layer have 32, 128 and 256 neurons respectively.
5. A brain CT image processing system based on self-attention mechanism fusion, characterized in that: The brain CT image processing system based on self-attention mechanism fusion includes: A model building module, configured to build a processing model, wherein the processing model includes a feature extraction module, a feature fusion module, and a classification head; A data acquisition module, used to obtain the user's brain CT image and Glasgow Coma Scale data; a data processing module, configured to convert the format of the brain CT image to obtain a data sequence, process the data sequence to obtain a grayscale image of the brain tissue region, and perform denoising on the grayscale image to obtain a denoised grayscale image; a feature extraction module, configured to extract features from the denoised grayscale image and the Glasgow Coma Scale data, respectively, to obtain CT slice features and domain knowledge-related features; A feature fusion module, configured to fuse the CT slice features and the domain knowledge related features to obtain fused features; A classification head, configured to perform inference calculation on the fusion features based on the classification head to obtain a target result; The step of fusing the CT slice features and the domain knowledge-related features to obtain fused features, and performing inference calculation on the fused features based on the classification head to obtain a target result specifically includes: Inputting the CT slice features and the domain knowledge related features into the feature fusion module, the feature fusion module concatenating the CT slice features and the domain knowledge related features according to a first formula to obtain a mixed feature vector; Calculating potential information between the CT slice features and the domain knowledge related features according to a second formula, and fusing the mixed feature vector according to the potential information to obtain a fused feature; Inputting the fused features into the classification head, the classification head calculates the fused features according to the cross entropy function to obtain a result loss, and obtains the target result based on the result loss; The first formula is: f global =Concat(Conv(X i ),wg i +b); Among them, f global is the feature concatenated by brain CT images and Glasgow Coma Scale data, Concat is the combination function, w is the weight of the linear layer, b is the bias of the linear layer, i is the index of the individual in the dataset, X i is the CT slice of the i-th individual, g i is the GCS score of the i-th individual, Conv(X i ) is for X i Perform convolution operation; The second formula is: f mix =Concat(head1,...,head j )W O ; Among them, f mix is a mixed feature, Concat is a combination function, head j is the jth attention head, W O is the output weight matrix, j is the index of different attention heads; in, Q j 、 and V j Both are f global The result obtained by multiplying the weight matrix in different attention heads, d k is the dimension of the vector key.
6. A terminal, characterized in that: The terminal includes a memory, a processor, and a program stored in the memory and executable on the processor. When the program is executed by the processor, the steps of the brain CT image processing method based on self-attention mechanism fusion as described in any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a brain CT image processing program based on self-attention mechanism fusion. When the brain CT image processing program based on self-attention mechanism fusion is executed by a processor, the steps of the brain CT image processing method based on self-attention mechanism fusion as described in any one of claims 1 to 4 are implemented.
