Word index model and method, system, device and medium for generating medical report
Through the deep fusion and adaptive optimization of the word index model, the semantic gap problem caused by cross-modal feature interaction in medical report generation is solved, and the accuracy of the report and the efficiency of diagnosis are improved.
Patent Information
- Application Number
- CN202410804636.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-06-21
AI Technical Summary
Existing medical report generation methods have low accuracy in generated medical reports due to the semantic gap in the interaction process of cross-modal features.
Using a word index model, medical terminology is used as a bridge to deeply fuse medical image features and text features. Attention mechanism and weighted fusion are used to generate aligned fusion features, and model parameters are updated through an adaptive mechanism to optimize report generation.
It effectively eliminates the semantic gap between cross-modal features and improves the accuracy of medical report generation and diagnostic efficiency.
Smart Images

Figure CN118398154B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of report generation, and in particular to a word index model and a method, system, device and medium for generating a medical report. Background Art
[0002] Medical images are an important basis for doctors to make clinical diagnoses and write medical reports. However, the massive amount of radiological images in hospitals every day is undoubtedly a huge workload for radiologists. At the same time, in order to ensure the accuracy of medical reports, one report usually needs to be diagnosed by two radiologists, which is undoubtedly adding insult to injury. The existing mainstream medical report generation methods are mostly inspired by image caption generation methods. These models usually follow the indexer-decoder paradigm, with convolutional neural networks as visual feature extractors and recursive neural networks or Transformers as text generation decoders, thereby establishing a cross-modal mapping relationship between text features and image features. However, due to the semantic gap in the process of cross-modal feature interaction, the accuracy of the medical reports generated by the existing report generation methods is not high. Therefore, it is necessary to provide a word indexing model and a method, system, device and medium for generating medical reports. Summary of the invention
[0003] The present invention provides a word index model and a method, system, device and medium for generating a medical report, so as to solve the problem in the prior art that the generated medical report has low accuracy due to semantic barriers in the process of cross-modal feature interaction.
[0004] The present invention provides a method for generating a word index model, comprising: obtaining a medical image set and a corresponding medical report set, as well as a text index table and a medical term set; wherein the text index table is established based on a mapping relationship between text words and text sequences in a medical report, and the text words include medical terms; indexing the medical report set and the medical term set respectively according to the text index table to obtain a medical report index set and a medical term index set; inputting the medical image set into a feature extraction network of a word index model to extract medical image features; inputting the medical term index set and a preset initial text into a word embedding network of the word index model to obtain text features and medical term features; forming a term-text feature pair with the text features and forming an image-term feature pair with the medical image features and the medical term features, and inputting them into a fusion network of the word index model to obtain an aligned fusion feature; inputting the aligned fusion feature into a prediction network of the word index model to obtain a predicted text sequence set of the medical report; updating the parameters of the word index model according to the difference between the predicted text sequence set and the corresponding indexed medical report in the medical report index set to obtain a trained word index model.
[0005] In one embodiment of the present invention, the process of constructing the text index table includes: cleaning the medical report set; performing word segmentation processing on each medical report in the cleaned medical report set to generate multiple text words; counting the word frequency of each text word, and deleting the text words whose word frequency is less than a preset threshold; establishing a mapping relationship between the remaining text words and the text sequence to construct a text index table.
[0006] In one embodiment of the present invention, the step of inputting the medical image set into a feature extraction network of a word index model to extract medical image features includes: downsampling the medical images in the medical image set; normalizing the size of each medical image after the downsampling process; and inputting each normalized medical image into the feature extraction network to extract medical image features.
[0007] In one embodiment of the present invention, the fusion network includes a first mapping layer, a second mapping layer and an alignment fusion layer, and the text features and medical term features are combined into term-text feature pairs, and the medical image features and medical term features are combined into image-term feature pairs, which are input into the fusion network of the word index model to obtain aligned fusion features, including: combining text features and medical term features into term-text feature pairs, and combining medical image features and medical term features into image-term feature pairs; inputting the image-term feature pairs into the first mapping layer to obtain comprehensive features of medical images and medical terms; inputting the term-text feature pairs into the second mapping layer to obtain comprehensive features of text words and medical terms; inputting the comprehensive features of text words and medical terms, as well as the comprehensive features of medical images and medical terms into the alignment fusion layer, and obtaining aligned fusion features based on the attention mechanism and weighted fusion.
[0008] In one embodiment of the present invention, the comprehensive features of text words and medical terms, and the comprehensive features of medical images and medical terms are input into the alignment fusion layer, and aligned fusion features are obtained based on an attention mechanism and weighted fusion, including: taking the comprehensive features of medical images and medical terms as query features, and fusing them with the comprehensive features of text words and medical terms based on the attention mechanism to obtain preliminary fusion features; and weightedly fusing the preliminary fusion features with the comprehensive features of medical images and medical terms to obtain aligned fusion features.
[0009] In one embodiment of the present invention, the prediction network includes a parallel decoding layer, a gated fusion layer and a linear layer, and the aligned fusion features are input into the prediction network of the word index model to obtain a text sequence of the medical report, including: inputting the text features, the aligned fusion features and the medical image features into the parallel decoding layer respectively to obtain discrete space features and continuous space features; inputting the discrete space features and the continuous space features into the gated fusion layer to obtain fusion features; inputting the fusion features into the linear layer to obtain a text sequence set of the medical report.
[0010] In one embodiment of the present invention, a method for generating a medical report is also provided, the method comprising: acquiring a medical image; inputting the medical image, a pre-stored medical terminology set and a preset initial text into a word index model trained by any of the above-mentioned word index model generation methods, and predicting a text sequence set of the medical report corresponding to the medical image; searching for each text word corresponding to the text sequence set of the medical report from the text index table, and generating a medical report based on all the searched text words.
[0011] In one embodiment of the present invention, a system for generating a word index model is also provided, the system comprising: a data acquisition module, used to acquire a medical image set and a corresponding medical report set, as well as a text index table and a medical term set; wherein the text index table is established based on a mapping relationship between text words and text sequences in a medical report, and the text words include medical terms; an indexing module, used to index the medical report set and the medical term set respectively according to the text index table to obtain a medical report index set and a medical term index set; an image feature extraction module, used to input the medical image set into a feature extraction network of a word index model to extract medical image features; a text feature extraction module, used to convert the medical term set into a text index network; The index set and the preset initial text are input into the word embedding network of the word index model to obtain text features and medical term features; an alignment fusion feature acquisition module is used to combine text features and medical term features into term-text feature pairs, and combine medical image features and medical term features into image-term feature pairs, and input them into the fusion network of the word index model to obtain alignment fusion features; a text sequence generation module is used to input the alignment fusion features into the prediction network of the word index model to obtain a set of predicted text sequences of medical reports; a parameter updating module is used to update the parameters of the word index model according to the difference between the predicted text sequence set and the corresponding indexed medical report in the medical report index set to obtain a trained word index model.
[0012] In one embodiment of the present invention, an electronic device is also provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements any of the above-described methods for generating a word index model or a medical report.
[0013] In one embodiment of the present invention, a computer-readable storage medium is also provided, on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer executes any of the above-mentioned methods for generating a word index model or a medical report.
[0014] The present invention proposes a word indexing model and a method, system, device and medium for generating a medical report. When the text features of a medical report are integrated with the features of medical terms and the features of medical images, medical terms are used as a bridge to achieve deep integration of different data sources of text and images at the semantic level. As a result, the aligned fusion features after integration can effectively eliminate the semantic gap between cross-modal features. By continuously updating the model parameters based on the difference between the text sequence and the indexed medical report, the model performance is continuously optimized using an adaptive mechanism, so that the medical report finally generated is more accurate. This solves the problem in the prior art that due to the semantic gap between cross-modal features, it is difficult to align and fuse the features of different modalities during feature fusion, resulting in the low accuracy of the finally generated medical report. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A schematic flow chart of a method for generating a word index model provided in an embodiment of the present invention;
[0016] Figure 2 Shown is a model architecture diagram of a word index model in one embodiment of the present invention;
[0017] Figure 3 Shown is a structural block diagram of a system for generating a word index model provided by an embodiment of the present invention;
[0018] Figure 4 Shown is a structural schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0019] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0020] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0021] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.
[0022] The existing generative model for medical reports constructed using the encoder-decoder approach has solved many difficult problems in the chest X-ray medical report generation task, but there are still some problems. One of the important problems is the semantic gap in the cross-modal feature interaction process. Unlike the visual features extracted by convolutional neural networks, which are in a continuous feature space, the text features encoded by word vectors are in a discrete feature space. It is obviously unreliable to learn the corresponding relationship between features in different spaces in the decoder in a data-driven manner. However, the features of different modalities are semantically unified from the doctor's perspective. For example, medicine can see a disease in an image and can also describe the disease in words. Therefore, using medical prior knowledge to guide the alignment of cross-modal features is of great significance for generating higher quality medical reports.
[0023] The present invention provides a method for generating a word index model, which adopts a dual-branch parallel decoding structure, wherein text features and fused features and image features are decoded in parallel respectively, and then the outputs of discrete space and continuous space are adaptively fused through a gated fusion layer, thereby enhancing the richness and accuracy of the overall feature representation. Finally, the fused output is processed through a linear layer and a Softmax activation function to generate a prediction report of the model. This method not only improves the quality of report generation, but also improves the efficiency and accuracy of diagnosis by accurately aligning and fusing cross-modal features.
[0024] See also Figure 1 and Figure 2 , the method for generating a word index model includes the following steps:
[0025] S1. Obtain a medical image set and a corresponding medical report set, as well as a text index table and a medical term set; wherein the text index table is established based on a mapping relationship between text words and text sequences in the medical report, and the text words include medical terms.
[0026] The medical images in the medical image set and the medical reports in the medical report set have a one-to-one correspondence, that is, each medical image corresponds to a unique medical report. The medical image set includes multiple different medical images, which include both medical images under normal conditions and medical images under abnormal conditions. The medical image at least includes the patient's front view. In order to enhance data diversity, it may also include images from other perspectives such as the patient's side view. The types of medical images include but are not limited to X-rays, magnetic resonance imaging (MRI) or computed tomography (CT), etc. The technicians in this field can adaptively select the corresponding medical image type based on actual needs, which is not limited here. The medical report set includes multiple different medical reports, and the medical reports record the observation and diagnosis results of the corresponding medical images, which include normal and abnormal findings. The acquisition method of medical images and their corresponding medical reports includes but is not limited to obtaining from the database of historical archives and obtaining from the database of network open source. In this embodiment, medical images and their corresponding medical reports are obtained from the MIMIC data set.
[0027] A text index table is a data structure that associates text words with text sequences. Text words include general words and medical terms. Each word has a unique numeric index as a text sequence. The text index table converts specific text into numbers that can be processed by the word index model so that the word index model can perform subsequent processing.
[0028] Specifically, in one embodiment of the present invention, the process of constructing the text index table includes:
[0029] cleaning the medical report set;
[0030] Performing word segmentation processing on each medical report in the cleaned medical report set to generate a plurality of text words;
[0031] Count the frequency of each text word, and delete the text words whose frequency is less than a preset threshold;
[0032] A mapping relationship between the remaining text words and the text sequence is established to construct a text index table.
[0033] By cleaning the medical report set and removing irrelevant information (such as non-text elements, meaningless characters, etc.), the subsequent text analysis can be made more accurate and efficient through text cleaning. Each medical report in the cleaned medical report set is segmented, and the text content in the medical report is split into multiple text words. Through word segmentation, continuous text expressions can be decomposed into multiple text words for subsequent language conversion. The basis for word segmentation can be set based on the adaptability of the text form of the medical report. As an example, for medical reports in English, the basis for word segmentation is a single English space, and for medical reports in Chinese, the basis for word segmentation is a single Chinese character. In one example, after all medical reports are segmented, multiple text words are generated, and the frequency of each text word obtained by word segmentation is counted, and the text words with a frequency less than a preset threshold are deleted. The text index table only includes text words with a frequency greater than or equal to the preset threshold. By deleting text words with too low a frequency, rare or unimportant words can be removed to reduce noise and improve the efficiency of the text index table. The generation rate of medical reports is accelerated at the expense of slightly sacrificing the accuracy of report generation. In another example, the text index table includes all text words, wherein text words with a frequency less than a preset threshold are marked as special words, and special word symbols are added. <unk>, the choice of threshold can be adaptively set based on the actual model accuracy needs. Exemplarily, the threshold is 4. By incorporating all text words into the text index table, the accuracy of medical report generation can be improved at the expense of report generation rate. Those skilled in the art can comprehensively weigh the report generation rate and accuracy and select an appropriate method, which is not limited here. Furthermore, a unique corresponding index is assigned to each remaining text word (which can be a text word with a frequency greater than or equal to a preset threshold, or all text words) to establish a mapping relationship between each text word and a text sequence, thereby realizing the construction of a text index table.
[0034] In the present invention, the medical term set is a subset of the text index table, which specifically contains terms related to the medical field. Specifically, each medical report in the medical report set is processed by sentence segmentation, and the medical terms appearing in each sentence are extracted. The extracted medical terms are arranged in descending order according to their respective word frequencies, so as to select a preset number of high-frequency medical terms to form a medical term set. For example, 240 medical terms are extracted to form a medical term set. Furthermore, in order to ensure the professionalism and accuracy of the medical term set, text words (such as modal particles, etc.) that do not have substantive meaning can also be removed by manual screening.
[0035] S2. Indexing the medical report set and the medical term set respectively according to the text index table to obtain a medical report index set and a medical term index set.
[0036] For each medical report in the medical report set: For each sentence, add a sentence start symbol at the beginning and end of the sentence. <bos>and statement terminator <eos>, and for statements whose length is less than the preset length threshold, add placeholders to the remaining positions of the statement <pad>After the above processing, for each medical report, indexing processing is performed according to the content in the text index table, so that the text content in the medical report is converted into a sequence composed of indexes in the text index table, and a start symbol and an end symbol are added at the beginning and end of the sequence. In this way, the medical report set is converted into a medical report index set, and the medical report index set includes multiple index sequences, and each index sequence corresponds to a medical report. The medical term set is indexed in the same way. By searching the text index table, the index value corresponding to each medical term is obtained, and a medical term index set is constructed, in which each medical term corresponds to a specific index value.
[0037] S3. Input the medical image set into the feature extraction network of the word index model to extract medical image features.
[0038] The medical image set is input into the feature extraction network for forward propagation to extract the medical image features of each medical image. The feature extraction network uses the backbone network of the mainstream natural image classification model as an image feature extractor, wherein the mainstream natural image classification model includes but is not limited to VGG, ResNet, DenseNet, VisionTransformer, etc. The architecture of each model is different. Those skilled in the art need to make appropriate modifications and adjustments according to actual needs. It is only necessary to keep the dimension of the output features of the classification layer of the model consistent for subsequent data processing. The feature extraction network can use a pre-trained model or an untrained model. Preferably, in this embodiment, in order to improve the processing rate of the model, ResNet101 is used as a pre-trained feature extraction network, and the trained parameters are loaded and further fine-tuned on the MIMIC data set to more efficiently extract medical image features. Among them, fine-tuning can be performed throughout the entire training process of the word index model, or it can be performed on the feature extraction network alone. Preferably, in this embodiment, fine-tuning is achieved throughout the entire training process of the word index model, thereby improving the generalization performance of the model and ensuring that the feature extraction network can work more closely with other parts of the model.
[0039] In one embodiment of the present invention, the step of inputting the medical image set into a feature extraction network of a word indexing model to extract medical image features includes:
[0040] Downsampling the medical images in the medical image set;
[0041] Performing size normalization on each medical image after downsampling;
[0042] Each normalized medical image is input into the feature extraction network to extract the medical image features.
[0043] Each medical image is downsampled, and the data scale is reduced by reducing the number of pixels in the image, which speeds up the model processing speed. The medical images after downsampling are normalized to ensure that the sizes of all medical images are consistent and meet the input requirements of the feature extraction network. The normalized medical images are input into the feature extraction network, and the shapes, textures, edges, etc. are extracted as key medical image features by analyzing the images. Exemplarily, the medical images are downsampled to a matrix size of K*K (K can be any natural number greater than 32, such as 224), and normalized to generate a standard matrix form as the input of the feature extraction network. It can be understood that when the image size is cropped, if the cropping size used is larger than the original image size, the downsampling here is changed to an upsampling operation. Furthermore, in this embodiment, the medical image is also reversed or rotated to improve the robustness of the model. As an example, this instance uses center cropping to downsample medical images to a size of 224*224, and a single medical image has a 50% probability of being flipped, and is normalized using the parameters provided by ImageNet to optimize model performance.
[0044] S4. Input the medical term index set and the preset initial text into the word embedding network of the word index model to obtain text features and medical term features.
[0045] The medical term index set and the preset initial text (such as the start symbol) are input into the randomly initialized word embedding network to obtain the corresponding text features and medical term features. Specifically, the word embedding network is composed of a learnable fully connected layer, which can convert the input word index into a corresponding feature vector, so that the model can understand the deep semantic relationship in the text, so as to generate more accurate medical reports later. During the training of the word index model, the parameters of the word embedding network will be continuously updated, and clustering will be completed according to the meaning of the word, so as to more accurately reflect the relationship between words. Furthermore, in this embodiment, the dimension of each feature vector is 512 dimensions, so that each word generates a 512-dimensional feature vector through the conversion of the word embedding network.
[0046] S5. Combining text features and medical term features into term-text feature pairs, and combining medical image features and medical term features into image-term feature pairs, and inputting them into the fusion network of the word index model to obtain aligned fusion features.
[0047] Text features and medical term features are combined to form term-text feature pairs by capturing the relationship between medical report text and corresponding medical terms. Medical image features extracted by the feature extraction network are combined with medical term features to form image-term feature pairs by capturing the relationship between medical images and corresponding medical terms. These two feature pairs are input into the fusion network. By integrating the text features of medical reports and the image features of medical images, and incorporating the influence of medical terms, the aligned fusion features generated in the end can integrate information features from different sources to obtain a more comprehensive feature representation.
[0048] In one embodiment of the present invention, the fusion network includes a first mapping layer, a second mapping layer and an alignment fusion layer, and the text features and medical term features are combined into a term text feature pair, and the medical image features and medical term features are combined into an image term feature pair, which are input into the fusion network of the word index model to obtain the alignment fusion features, including:
[0049] Combining text features and medical term features into term-text feature pairs, and combining medical image features and medical term features into image-term feature pairs;
[0050] Inputting the image-term feature pair into the first mapping layer to obtain comprehensive features of medical images and medical terms;
[0051] Inputting the term-text feature pair into the second mapping layer to obtain comprehensive features of text words and medical terms;
[0052] The comprehensive features of text words and medical terms, as well as the comprehensive features of medical images and medical terms are input into the alignment fusion layer, and the alignment fusion features are obtained based on the attention mechanism and weighted fusion method.
[0053] The text features extracted from the medical report and the medical term features are combined into a term-text feature pair so that the word index model can analyze the relationship between the text content and the corresponding related medical terms in context. Similarly, the medical term features and the impact features extracted from the medical image are combined into an image term feature pair so that the word index model can capture the interaction between the medical image and the corresponding related medical terms. The first mapping layer includes an encoder, a decoder, and a Softmax layer. After the image term feature pair is input into the first mapping layer, the input medical image features are processed by the encoder to further mine the global relationship between these image features and are converted into key vectors and value vectors to be input into the decoder. In addition, the medical term features are also input into the decoder as query vectors. The similarity between the medical term features and the medical image features is captured through the attention mechanism inside the decoder, and the attention score of each medical term on the features of each region in the medical image is obtained. These attention scores are input into the Softmax layer, and the medical term features and medical image features are aggregated using the attention scores. Considering that medical terms only provide guidance, when performing feature aggregation, the direct impact of medical term features can be reduced by adjusting weights (such as being deleted in the first residual connection), thereby increasing the proportion of medical image features in the aggregated comprehensive features and retaining the relevant information of medical terms and medical image features. Finally, the image feature representation of medical terms in the image space is obtained, which is the comprehensive feature of medical images and medical terms. The comprehensive feature contains both medical term features and their corresponding image region features, so as to determine the relationship between medical terms and different medical image regions.
[0054] Similarly, the second mapping layer has the same structure as the first mapping layer, which is also composed of an encoder, a decoder, and a Softmax layer. Considering that the text features and medical term features share the same encoding space, the text features are processed by the encoder and converted into key vectors and value vectors and input into the decoder. The medical term features are also input into the decoder as query vectors. The generated comprehensive features of text words and medical terms can effectively capture the representation of medical terms in the text space. The comprehensive features include the text features of medical terms and their corresponding report descriptions. By setting the first mapping layer and the second mapping layer, the visual information and text information are mapped into a unified semantic space to break the semantic gap and improve the accuracy of subsequent report generation. The comprehensive features of text words and medical terms, and the comprehensive features of medical images and medical terms are input into the alignment fusion layer. Through the attention mechanism and weighted fusion strategy, the information from different sources can be fused to capture the comprehensive relationship between medical reports, medical terms, and medical images, so that the medical terms can be used to guide the correspondence between different modal information in the subsequent report generation, and the deep semantic consistency and information alignment between different modalities can be achieved.
[0055] In one embodiment of the present invention, the comprehensive features of text words and medical terms, and the comprehensive features of medical images and medical terms are input into the alignment fusion layer, and the alignment fusion features are obtained based on the attention mechanism and weighted fusion method, including:
[0056] The comprehensive features of medical images and medical terms are used as query features, and are fused with the comprehensive features of text words and medical terms based on the attention mechanism to obtain preliminary fusion features;
[0057] The preliminary fusion features are weightedly fused with the comprehensive features of medical images and medical terms to obtain the aligned fusion features.
[0058] The comprehensive features of medical images and medical terms represent the representation of medical terms in the image space, and the comprehensive features of text words and medical terms reflect the representation of medical terms in the text space. These two comprehensive features are unified in the semantic space. Considering the sparsity of text features, the comprehensive features of medical images and medical terms are used as query features, and the comprehensive features of text words and medical terms are used as key features and value features, and feature fusion is performed based on the attention mechanism. This method takes the comprehensive features of medical images and medical terms with higher information richness as the main body, organically fuses these two comprehensive features, and generates preliminary fusion features, which combine text and image information. In order to further increase the proportion of image information in the fusion features and prevent the problem of reduced accuracy of the final generated medical report due to information sparsity, this embodiment adopts a strategy similar to the residual unit, and further weights and fuses the comprehensive features of medical images and medical terms with the preliminary fusion features to obtain aligned fusion features, wherein the weighting factor of the preliminary fusion feature is set to α, and the weighting factor of the comprehensive features of medical images and medical terms is set to 1-α. This alignment and fusion feature can more comprehensively reflect the relationship between medical images, text content and medical terminology, and comprehensively consider the importance and contribution of different features, achieving deep semantic alignment between different modalities, thereby ensuring the robustness of the model.
[0059] S6. Inputting the aligned fusion features into the prediction network of the word index model to obtain a set of predicted text sequences of the medical report.
[0060] The aligned fusion features are input into the prediction network, where a set of predicted text sequences is gradually constructed. Each time, the next word in the medical report is generated by combining the current context information. The whole process continues, and when the prediction network generates an end symbol, the medical report prediction is complete.
[0061] Specifically, in one embodiment of the present invention, the prediction network includes a parallel decoding layer, a gated fusion layer and a linear layer, and the aligned fusion features are input into the prediction network of the word index model to obtain a text sequence set of the medical report, including:
[0062] Inputting the text features, the alignment fusion features, and the medical image features into the parallel decoding layer respectively to obtain discrete space features and continuous space features;
[0063] Inputting the discrete spatial features and the continuous spatial features into the gated fusion layer to obtain fused features;
[0064] The fused features are input into the linear layer to obtain a text sequence set of medical reports.
[0065] Considering that medical terms are discrete, the comprehensive features obtained by the first mapping layer and the second mapping layer are also discrete in the semantic space. Although such discrete features can clearly identify the key information in the image analysis process and are significant in feature analysis, they will also lack some continuous information. Therefore, only using discrete features will affect the continuity and integrity of subsequent visual feature analysis and text generation, resulting in low accuracy of the final generated report. In order to make up for this information loss, the parallel decoding layer in the present invention includes two decoding branches, one of which is a continuous space, taking medical image features as input, and the other is a discrete space, and taking alignment fusion features as input. In addition, the text features are input as queries into the two branches respectively, and the discrete space output and continuous space output of the two spaces at the current moment are obtained through the decoder. In this way, the discrete space can focus on generating key words, and the continuous space can provide more comprehensive context information for the discrete space. The two complement each other and enhance the accuracy of the generated report.
[0066] The gated fusion layer includes a continuous gate and a discrete gate, which can adaptively utilize the discrete spatial output and the continuous spatial output of the input to obtain the fused output. Specifically, the discrete spatial features of the discrete spatial output are multiplied by the discrete gating unit to obtain the discrete gate output, and the continuous temporal features of the continuous spatial output are multiplied by the continuous gating unit to obtain the continuous gate output. The discrete gate output and the continuous gate output are shown in formulas (1) and (2):
[0067] (1)
[0068] (2)
[0069] in, is the discrete gate output at the tth time step, is the continuous gate output at the tth time step, is the vocabulary generated at the previous time step, and is the learnable weight matrix of the discrete gating unit, and is the learnable weight matrix of the continuous gating unit, is the discrete spatial feature at the tth time step, is the continuous spatial feature of the tth time step. After obtaining the continuous gate output and the discrete gate output, the two are fused through formula (3):
[0070] (3)
[0071] in, is the fusion feature of the tth time step, is the Sigmoid activation function, is the hyperbolic tangent activation function. By combining continuous space features and discrete space features and adaptively adjusting the contribution of the two through the gating mechanism, the fusion features finally generated can achieve a dynamic balance between discrete space features and continuous space features to improve the accuracy of subsequent report generation. The fusion features are input into the linear layer, and the output of the model at the current time step t is obtained through the Softmax activation function, that is, the word index of the next position in the medical report is predicted. This index and all the above indexes constitute a text sequence set, which includes multiple text sequences, each of which is an index value.
[0072] S7. According to the difference between the predicted text sequence set and the corresponding indexed medical report in the medical report index set, the parameters of the word index model are updated to obtain a trained word index model.
[0073] The predicted word index and the real word index of the position in the indexed medical report are compared to obtain the difference between the two, and the model parameters are updated accordingly. The model is continuously iterated until the training is completed. Specifically, the average loss value loss in the present invention is composed of the cross entropy loss and contrastive learning loss It consists of two parts, such as The accuracy of the output words at the current time step is constrained by the cross entropy loss, and the cross-modal feature alignment guided by the contrastive learning loss is ensured to ensure that similar features are closer in the feature space and dissimilar features are farther away. Specifically, the cross entropy loss and contrastive learning loss As shown in formulas (4) and (5):
[0074] (4)
[0075] (5)
[0076] in, is the total number of words in the indexed medical reports, is the word index predicted at the tth time step, is the real word index at time step t in the indexed medical report, q is the comprehensive feature of medical images and medical terms, is the comprehensive features of the text words and medical terms of the positive samples, is the comprehensive feature of the text words and medical terms of the negative samples, τ is the preset temperature parameter, and K is the total number of negative samples. After calculating the average loss, back propagate layer by layer based on the gradient descent method to update the model parameters. Iterate the training until the calculated average loss converges, and the model training is completed.
[0077] It should be noted that during the training phase of the model, the model will predict the index of the N+1th word in the medical report based on the first N words in the indexed medical report received as the context information. The predicted index is compared with the index of the N+1th word in the indexed medical report, and the parameters of the model are updated accordingly. In the next round of training, the model will predict the next (i.e., the N+2th) word based on the first N+1 words in the indexed medical report received as the context information. Repeat this process until the model outputs the terminator, and the prediction of the entire medical report is completed.
[0078] See also Figure 2 The overall training process of the word indexing model of the present invention is as follows: inputting medical images into the feature extraction network (CNN) to obtain medical image features (Image Feature). Inputting the indexed medical term set (MedicalTerms) and the indexed medical report set (Report) into the word embedding layer (Embedding Layer), and obtaining the medical term feature (Medical Terms Feature) and the text feature (Report Feature) respectively. Inputting the medical image feature into the first mapping layer Mapping1, using the features encoded by the encoder (Encoder) as the key feature (K) and the value feature (V), using the medical term feature as the query feature (Q), and using the cross-modal mapping (Cross Model Mapping) to obtain the comprehensive feature (IK Feature) of medical images and medical terms. Similarly, using the medical term feature as the query feature (Q), using the text feature as the key feature (K) and the value feature (V), a similar process is performed in the second mapping layer Mapping2 to obtain the comprehensive feature (RK Feature) of text terms and medical terms. In the alignment fusion layer (Alignment Fusion), the multi-head attention mechanism (MHA) is used to realize the alignment fusion of the two comprehensive features to generate the alignment fusion feature. The text features are input into the parallel decoding layer (Parallel Decoding) together with the alignment fusion features and medical image features, and the discrete space features (Discrete Space) and continuous space features (Continuous Space) are generated accordingly. The two spatial features are fused through the gated fusion layer (Gated Fusion) to generate the fusion features (Fusion Space). The fusion features are input into the linear layer and passed through the Softmax function to finally obtain a text sequence set, which includes a series of text sequences, each of which represents an index value in the text index table.
[0079] In one embodiment of the present invention, a method for generating a medical report is also provided, comprising:
[0080] Access to medical images;
[0081] Inputting the medical image, a pre-stored medical terminology set and a preset initial text into a word index model trained by any of the above-mentioned word index model generation methods, and predicting a text sequence set of a medical report corresponding to the medical image;
[0082] The text words corresponding to the text sequence set of the medical report are searched in the text index table, and a medical report is generated according to all the searched text words.
[0083] Obtain the medical images of the patient to be diagnosed, the types of which include but are not limited to X-rays, CT or MRI scan images, etc. The medical images to be diagnosed, the medical terminology set generated above, and the initial text are input into the above-mentioned trained word index model to predict the text sequence set in the medical report. During the prediction process, the word index model will gradually generate the predicted index value of each word in the report based on the input above information and the input features. These predicted index values are arranged in the order in which they appear in the medical report, and finally form a text sequence set. Since there are special identifiers such as start and end symbols in the text sequence set, after removing these special identifiers, the real text meaning corresponding to the index value of each word in the text sequence set is searched from the pre-stored text index table, so as to convert the index sequence of the text words into actual text words, and the converted text words are spliced one by one to generate a complete medical report.
[0084] See also Figure 3 , the generation system 100 of the word index model includes: a data acquisition module 110, an indexing module 120, an image feature extraction module 130, a text feature extraction module 140, an alignment fusion feature acquisition module 150, a text sequence generation module 160 and a parameter update module 170. The data acquisition module 110 is used to acquire a medical image set and a corresponding medical report set, as well as a text index table and a medical term set; wherein the text index table is established based on the mapping relationship between text words and text sequences in the medical report, and the text words include medical terms. The indexing module 120 is used to index the medical report set and the medical term set according to the text index table to obtain a medical report index set and a medical term index set. The medical image set is input into the feature extraction network of the word index model by the feature extraction module 130 to extract medical image features. The medical term index set and the preset initial text are input into the word embedding network of the word index model by the feature extraction module 140 to obtain text features and medical term features. The fusion feature acquisition module 150 combines text features and medical term features into term-text feature pairs, and combines medical image features and medical term features into image-term feature pairs, and inputs them into the fusion network of the word index model to obtain aligned fusion features. The text sequence generation module 160 is used to input the aligned fusion features into the prediction network of the word index model to obtain a set of predicted text sequences of medical reports. The parameter update module 170 is used to update the parameters of the word index model according to the difference between the predicted text sequence set and the corresponding indexed medical report in the medical report index set, and obtain a trained word index model.
[0085] For the specific limitations of the generation system of the word index model, please refer to the limitations of the generation method of the word index model in the above text, which will not be repeated here. Each module in the generation system of the above-mentioned word index model can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware format, or can be stored in the memory of the computer device in software format, so that the processor can call the operations corresponding to the above modules.
[0086] It should be noted that, in order to highlight the innovative part of the present invention, the present embodiment does not introduce modules that are not closely related to solving the technical problem proposed by the present invention, but this does not mean that there are no other modules in the present embodiment.
[0087] See also Figure 4 The electronic device 1 may include a memory 12, a processor 13 and a bus, and may also include a computer program stored in the memory 12 and executable on the processor 13, such as a program for generating a word index model or a medical report.
[0088] Among them, the memory 12 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 1, such as a mobile hard disk of the electronic device 1. In other embodiments, the memory 12 can also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. Further, the memory 12 can also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 12 can not only be used to store application software and various types of data installed in the electronic device 1, such as the code for generating a word index model or generating a medical report, but can also be used to temporarily store data that has been output or is to be output.
[0089] In some embodiments, the processor 13 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 13 is the control core (Control Unit) of the electronic device 1, and uses various interfaces and lines to connect various components of the entire electronic device 1, and executes or executes programs or modules stored in the memory 12 (such as a program for generating a word index model or a medical report, etc.), and calls data stored in the memory 12 to execute various functions of the electronic device 1 and process data.
[0090] The processor 13 executes the operating system and various installed applications of the electronic device 1. The processor 13 executes the applications to implement the steps in the above-mentioned method for generating a word index model or a medical report.
[0091] Exemplarily, the computer program may be divided into one or more modules, which are stored in the memory 12 and executed by the processor 13 to complete the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the electronic device 1. For example, the computer program may be divided into a data acquisition module 110, an indexing module 120, an image feature extraction module 130, a text feature extraction module 140, an alignment fusion feature acquisition module 150, a text sequence generation module 160, and a parameter update module 170.
[0092] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium, and the computer-readable storage medium can be non-volatile or volatile. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a computer device, or a network device, etc.) or a processor to perform part of the functions of the method for generating a word index model or a medical report described in each embodiment of the present application.
[0093] In summary, the present invention discloses a word index model and a method, system, device and medium for generating a medical report, which guides the alignment and fusion of cross-modal information through a priori medical terminology to enhance the quality of medical reports and improve the diagnostic effect of medical images. The present invention first constructs a medical terminology set based on an existing data set, and uses the medical terms in the medical terminology set to explicitly align and fuse at the semantic level, thereby breaking the semantic gap between cross-modal features. Through this medical terminology-guided approach, cross-modal feature interaction is achieved, and text and image features are effectively connected, making the generated medical report more accurate. Therefore, the present invention effectively overcomes the various shortcomings of the prior art and has a high industrial utilization value.
[0094] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.< / pad> < / eos> < / bos> < / unk>
Claims
1. A method for generating a word index model, characterized in that: The method comprises: Acquire a medical image set and a corresponding medical report set, as well as a text index table and a medical term set; wherein the text index table is established based on a mapping relationship between text words and text sequences in the medical report, and the text words include medical terms; Indexing the medical report set and the medical term set respectively according to the text index table to obtain a medical report index set and a medical term index set; Inputting the medical image set into a feature extraction network of a word indexing model to extract medical image features; Inputting the medical term index set and the preset initial text into the word embedding network of the word index model to obtain text features and medical term features; Combining text features and medical term features into term-text feature pairs, and combining medical image features and medical term features into image-term feature pairs, and inputting them into the fusion network of the word index model to obtain aligned fusion features; Inputting the aligned fusion features into the prediction network of the word index model to obtain a set of predicted text sequences of the medical report; According to the difference between the predicted text sequence set and the corresponding indexed medical report in the medical report index set, the parameters of the word index model are updated to obtain a trained word index model.
2. The method for generating a word index model according to claim 1, characterized in that: The process of constructing the text index table includes: cleaning the medical report set; Performing word segmentation processing on each medical report in the cleaned medical report set to generate a plurality of text words; Count the frequency of each text word, and delete the text words whose frequency is less than a preset threshold; A mapping relationship between the remaining text words and the text sequence is established to construct a text index table.
3. The method for generating a word index model according to claim 1, characterized in that: The step of inputting the medical image set into a feature extraction network of a word indexing model to extract medical image features comprises: Downsampling the medical images in the medical image set; Performing size normalization on each medical image after downsampling; Each normalized medical image is input into the feature extraction network to extract the medical image features.
4. The method for generating a word index model according to claim 1, characterized in that: The fusion network includes a first mapping layer, a second mapping layer and an alignment fusion layer. The text features and medical term features are combined into term text feature pairs, and the medical image features and medical term features are combined into image term feature pairs, which are input into the fusion network of the word index model to obtain the alignment fusion features, including: Combining text features and medical term features into term-text feature pairs, and combining medical image features and medical term features into image-term feature pairs; Inputting the image-term feature pair into the first mapping layer to obtain comprehensive features of medical images and medical terms; Inputting the term-text feature pair into the second mapping layer to obtain comprehensive features of text words and medical terms; The comprehensive features of text words and medical terms, as well as the comprehensive features of medical images and medical terms are input into the alignment fusion layer, and the alignment fusion features are obtained based on the attention mechanism and weighted fusion method.
5. The method for generating a word index model according to claim 4, characterized in that: The comprehensive features of text words and medical terms, as well as the comprehensive features of medical images and medical terms are input into the alignment fusion layer, and the alignment fusion features are obtained based on the attention mechanism and weighted fusion method, including: The comprehensive features of medical images and medical terms are used as query features, and are fused with the comprehensive features of text words and medical terms based on the attention mechanism to obtain preliminary fusion features; The preliminary fusion features are weightedly fused with the comprehensive features of medical images and medical terms to obtain the aligned fusion features.
6. The method for generating a word index model according to claim 1, characterized in that: The prediction network includes a parallel decoding layer, a gated fusion layer and a linear layer. The aligned fusion features are input into the prediction network of the word index model to obtain a set of predicted text sequences of the medical report, including: Inputting the text features, the alignment fusion features, and the medical image features into the parallel decoding layer respectively to obtain discrete space features and continuous space features; Inputting the discrete spatial features and the continuous spatial features into the gated fusion layer to obtain fused features; The fused features are input into the linear layer to obtain a set of predicted text sequences of the medical report.
7. A method for generating a medical report, characterized in that: The method comprises: Access to medical images; Inputting the medical image, a pre-stored medical terminology set and a preset initial text into a word index model trained by the method for generating a word index model according to any one of claims 1 to 6, and predicting a text sequence set of a medical report corresponding to the medical image; The text words corresponding to the text sequence set of the medical report are searched in the text index table, and a medical report is generated according to all the searched text words.
8. A system for generating a word index model, characterized in that: The system comprises: A data acquisition module, used to acquire a medical image set and a corresponding medical report set, as well as a text index table and a medical term set; wherein the text index table is established based on a mapping relationship between text words and text sequences in the medical report, and the text words include medical terms; An indexing module, used to index the medical report set and the medical term set respectively according to the text index table to obtain a medical report index set and a medical term index set; An image feature extraction module, used for inputting the medical image set into a feature extraction network of a word indexing model to extract medical image features; A text feature extraction module, used for inputting the medical term index set and the preset initial text into the word embedding network of the word index model to obtain text features and medical term features; An alignment fusion feature acquisition module is used to combine text features and medical term features into term-text feature pairs, and combine medical image features and medical term features into image-term feature pairs, and input them into the fusion network of the word index model to obtain alignment fusion features; A text sequence generation module, used for inputting the aligned fusion features into the prediction network of the word index model to obtain a set of predicted text sequences of the medical report; The parameter updating module is used to update the parameters of the word index model according to the difference between the predicted text sequence set and the corresponding indexed medical report in the medical report index set to obtain a trained word index model.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the method for generating a word index model as described in any one of claims 1 to 6 or the method for generating a medical report as described in claim 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the method for generating a word index model as described in any one of claims 1 to 6 or the method for generating a medical report as described in claim 7.
