A CT report generation method based on Transformer
Through the CT report generation method based on Transformer, using visual feature extraction and multi-head attention mechanism, the problem of time-consuming and high error rate in writing lung CT image reports is solved, automatic generation of accurate and rich medical reports is achieved, and radiation is reduced. physician workload and promote clinical automation.
Patent Information
- Application Number
- CN202110795676.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-14
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-07-14
AI Technical Summary
In the existing technology, writing diagnostic reports on lung CT images is time-consuming and inexperienced radiologists are prone to errors, resulting in heavy workload and low automation.
The CT report generation method based on Transformer is used to automatically generate medical reports by obtaining the visual feature sequence of CT images, encoding and decoding, and generating word probabilities corresponding to CT images. The method includes visual feature extraction, encoder and decoder, uses multi-head attention mechanism and relational memory network to establish relationships between different objects and model similar patterns of different medical reports.
Generate accurate and informative medical reports, reducing radiologist workload and promoting clinical automation.
Smart Images

Figure CN113724359B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a Transformer-based CT report generation method. Background Art
[0002] Computed tomography (CT) imaging is often used for diagnosis and treatment in clinical practice and experiments, and lung CT images have become an important basis for diagnosing lung virus infection. The rapid spread of a disease has led to a large number of infected people, greatly increasing the workload of radiologists. Writing diagnostic reports based on lung CT images is very time-consuming, and inexperienced radiologists are prone to errors. Therefore, there is a great need for methods to automatically generate medical CT reports to reduce the workload of frontline radiologists and promote clinical automation.
[0003] Therefore, the existing technology still needs to be improved and developed. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a Transformer-based CT report generation method in response to the above-mentioned defects of the prior art, aiming to solve the problem in the prior art that writing a diagnostic report based on lung CT images is very time-consuming and inexperienced affine doctors are prone to make mistakes.
[0005] The technical solution adopted by the present invention to solve the problem is as follows:
[0006] In a first aspect, an embodiment of the present invention provides a method for generating a CT report based on a Transformer, wherein the method comprises:
[0007] Acquire a CT image, and extract a visual feature sequence of the CT image based on a preset CT report generation model;
[0008] Encoding the visual feature sequence to obtain a hidden layer feature sequence;
[0009] Decoding the hidden layer feature sequence to obtain word probabilities corresponding to the CT image, wherein the word probabilities are used to represent word recognition probabilities when the CT image is converted into text;
[0010] A CT medical report text is generated according to the word probabilities.
[0011] In one implementation, the CT report generation model includes a visual feature extractor, an encoder, and a decoder; extracting the visual feature sequence of the CT image based on the preset CT report generation model includes:
[0012] Based on the visual feature extractor, visual features are obtained;
[0013] The visual features are time-sequence adjusted to obtain a visual feature sequence.
[0014] In one implementation, the step of encoding the visual feature sequence to obtain a hidden layer feature sequence includes:
[0015] Based on the encoder, a fusion encoding module is obtained;
[0016] The visual feature sequence is input into the fusion coding module to obtain a hidden layer feature sequence.
[0017] In one implementation, the step of obtaining a fusion coding module based on the encoder includes:
[0018] Obtaining model parameters of the encoder;
[0019] According to the encoder, a multi-head attention is obtained;
[0020] According to the model parameters and the multi-head attention, an information vector and an attention gate vector are obtained;
[0021] Constructing a multiple attention mechanism module according to the information vector and the attention gate vector;
[0022] The multiple attention mechanism module is fused with the encoder to obtain a fused encoding module.
[0023] In one implementation, the decoding of the hidden layer feature sequence to obtain word probabilities corresponding to the CT image includes:
[0024] Based on the decoder, a fusion decoder is obtained;
[0025] The hidden layer feature sequence is input into the fusion decoder to obtain the word probability corresponding to the CT image.
[0026] In one implementation, the obtaining of a fusion decoder based on the decoder includes:
[0027] Building relational memory networks;
[0028] Constructing a conditional normalization layer based on the relational memory network;
[0029] The decoder, the relational memory network, and the conditional normalization layer are fused to obtain a fused decoder.
[0030] In one implementation, the step of constructing a relational memory network includes:
[0031] Obtain the multi-head attention mechanism output matrix in the encoder;
[0032] Obtaining a real sample label corresponding to the CT image and an output embedding feature corresponding to the real sample label;
[0033] According to the output embedding features at the preset interval time, the multi-head attention mechanism output matrix and the preset initial relational memory network, a relational memory network output matrix is obtained;
[0034] According to the relational memory network output matrix, the initial relational memory network is iterated to obtain a relational memory network.
[0035] In one implementation, the step of obtaining the relational memory network output matrix according to the output embedding features at the preset interval, the multi-head attention mechanism output matrix, and the preset initial relational memory network includes:
[0036] Obtaining a forget gate matrix and an information gate matrix according to the output embedding features at the preset interval and the relational memory network output matrix at the preset interval;
[0037] Obtaining an intermediate iteration matrix according to the multi-head attention mechanism output matrix, the initial relational memory network, and the relational memory network output matrix at a preset interval;
[0038] The relational memory network output matrix is obtained according to the forget gate matrix, the information gate matrix, the intermediate iteration matrix and the relational memory network output matrix at the preset interval time.
[0039] In one implementation, the step of constructing a conditional normalization layer based on the relational memory network includes:
[0040] Get the scaling parameters and mobile learning parameters in the decoder;
[0041] According to the relational memory network output matrix, a scaling parameter change and a mobile learning parameter change are obtained;
[0042] Obtaining a target scaling parameter and a target mobile learning parameter according to the scaling parameter, the mobile learning parameter, the scaling parameter change amount, and the mobile learning parameter change amount;
[0043] A conditional normalization layer based on the relational memory network is obtained according to the target scaling parameter, the target shift learning parameter, and the hidden layer feature sequence.
[0044] In one implementation, the step of obtaining a conditional normalization layer based on the relational memory network according to the target scaling parameter, the target mobile learning parameter, and the hidden layer feature sequence includes:
[0045] According to the hidden layer feature sequence, a hidden layer feature mean value and a hidden layer feature standard error corresponding to the hidden layer feature sequence are obtained;
[0046] A conditional normalization layer based on the relational memory network is obtained according to the target scaling parameter, the target mobile learning parameter, the hidden layer feature average value and the hidden layer feature standard error.
[0047] In one implementation, the step of generating a CT medical report text according to the word probability includes:
[0048] Generate a model based on the CT report and the word probability to obtain a probability set;
[0049] Obtaining a target medical report word according to the real sample label and the probability set;
[0050] According to the target medical report word, a CT medical report text is obtained.
[0051] In a second aspect, an embodiment of the present invention further provides a Transformer-based CT report generation device, wherein the device comprises: a visual feature sequence acquisition unit, configured to acquire a CT image and extract a visual feature sequence of the CT image based on a preset CT report generation model;
[0052] A hidden layer feature sequence acquisition unit, used for encoding the visual feature sequence to obtain a hidden layer feature sequence;
[0053] A word probability acquisition unit, used for decoding the hidden layer feature sequence to obtain word probabilities corresponding to the CT image, wherein the word probabilities are used to represent word recognition probabilities when the CT image is converted into text;
[0054] The CT medical report text generating unit is used to generate the CT medical report text according to the word probability.
[0055] In a third aspect, an embodiment of the present invention further provides an intelligent terminal, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include a method for executing a Transformer-based CT report generation method as described in any one of the above.
[0056] In a fourth aspect, an embodiment of the present invention further provides a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the Transformer-based CT report generation method as described in any one of the above.
[0057] Beneficial effects of the present invention: The embodiment of the present invention first acquires a CT image, and extracts a visual feature sequence of the CT image based on a preset CT report generation model; then encodes the visual feature sequence to obtain a hidden layer feature sequence; then decodes the hidden layer feature sequence to obtain a word probability corresponding to the CT image, wherein the word probability is used to characterize the word recognition probability when converting the CT image into text; finally, a CT medical report text is generated based on the word probability. It can be seen that the present invention generates accurate and content-rich medical reports by establishing relationships between different objects during image encoding and modeling and storing similar patterns of different medical reports during decoding, thereby reducing the workload of radiologists and helping to promote clinical automation. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0059] Figure 1 A schematic flow chart of a method for generating a CT report based on Transformer provided in an embodiment of the present invention.
[0060] Figure 2 A schematic diagram of a lung CT image and a diagnostic report text provided in an embodiment of the present invention.
[0061] Figure 3 A schematic diagram of an encoder module provided in an embodiment of the present invention.
[0062] Figure 4 A schematic diagram of a decoder module provided in an embodiment of the present invention.
[0063] Figure 5 This is a functional block diagram of a Transformer-based CT report generation device provided in an embodiment of the present invention.
[0064] Figure 6 This is a block diagram of the internal structure principle of the intelligent terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0065] The present invention discloses a Transformer-based CT report generation method, device, intelligent terminal, and storage medium. In order to make the purpose, technical solution, and effect of the present invention clearer and more specific, the present invention is further described in detail 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.
[0066] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0067] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as herein.
[0068] In the existing technology, CT diagnostic reports are lengthy records consisting of multiple sentences (including medical observations, normal and abnormal features, the most likely diagnosis, etc.), while traditional image description generation methods usually only design models to briefly describe the visual scene content. Therefore, there is a big difference between CT diagnostic report generation and traditional image description generation. At the same time, CT diagnostic reports have very high requirements for the accuracy of the corresponding clinical descriptions, which adds challenges to the task of generating radiology reports.
[0069] Existing methods have designed various retrieval-based methods based on the highly patterned nature of radiology reports and have achieved good performance, but these methods are limited to the preparation of large data sets or the explicit construction of template lists to determine the embedded patterns in different reports. At the same time, as a complex image, the relationship between different objects in lung CT is not well modeled when encoding lung CT. Therefore, there is an urgent need for a model that can establish the relationship between different objects in lung CT images and can model the relationship between similar patterns of different medical reports over a long distance, so as to generate rich and accurate lung CT diagnostic reports.
[0070] In order to solve the problems of the prior art, the present invention provides a CT report generation method based on Transformer. The present invention generates accurate and content-rich medical reports by establishing the relationship between different objects during image encoding and modeling and storing similar patterns of different medical reports during decoding, thereby reducing the workload of radiologists and promoting clinical automation. In specific implementation, a CT image is first acquired, and a visual feature sequence of the CT image is extracted based on a preset CT report generation model; then the visual feature sequence is encoded to obtain a hidden layer feature sequence; then the hidden layer feature sequence is decoded to obtain the word probability corresponding to the CT image, wherein the word probability is used to characterize the word recognition probability when the CT image is converted into text; finally, a CT medical report text is generated based on the word probability.
[0071] Exemplary Methods
[0072] This embodiment provides a method for generating a CT report based on a Transformer, which can be applied to an intelligent terminal for image processing. Figure 1 As shown, the method includes:
[0073] Step S100, acquiring a CT image, and extracting a visual feature sequence of the CT image based on a preset CT report generation model;
[0074] CT is a computerized tomography scan, and a CT image is an image obtained by a computerized tomography scan. CT images are often used for diagnosis and treatment in clinical practice and experiments. Figure 2As shown, the CT image is a lung CT image, which is an important basis for diagnosing whether an epidemic lung disease is infected. When the epidemic lung disease is rampant, it will cause a large number of infections and increase the workload of the originally busy radiologists. It is very time-consuming to write a diagnostic report for lung CT images, and inexperienced affine doctors may make mistakes. Therefore, there is a great need for a model that automatically generates medical reports to reduce the workload of front-line radiologists and promote clinical automation accordingly. Generating medical reports through models requires obtaining CT images and extracting visual feature sequences of the CT images. In this embodiment, the model is a CT report generation model, and the CT report generation model includes a visual feature extractor, an encoder and a decoder; accordingly, extracting the visual feature sequence of the CT image based on the preset CT report generation model includes the following steps: obtaining visual features based on the visual feature extractor; and adjusting the visual features in time sequence to obtain a visual feature sequence.
[0075] Specifically, the visual feature extractor uses a convolutional neural network Resnet 101. In this embodiment, the convolutional neural network Resnet 101 is pre-trained. In practice, given a lung CT image Img, the lung CT image Img is input into the convolutional neural network Resnet 101 to obtain a visual feature X, and then the visual feature X is time-series adjusted, that is, relational encoding is performed to encode the relatively chaotic visual feature X into a visual feature sequence {x1, x2, ..., x ... s}, the above process can be expressed as {x1,x2,…,x S} = f v (Img), where f v (.) represents the visual feature extractor ResNet 101 and the relation encoding process.
[0076] After obtaining the visual feature sequence of the CT image, the following can be performed: Figure 1 The following steps are shown: S200, encoding the visual feature sequence to obtain a hidden layer feature sequence;
[0077] Specifically, Figure 3 As shown in the figure, after obtaining the visual feature sequence of the lung CT image, the visual feature sequence {x1, x2, ..., x S} is encoded, and the relationship between different objects is established by encoding to obtain a hidden layer feature sequence. In one embodiment of the present invention, encoding the visual feature sequence to obtain a hidden layer feature sequence includes the following steps:
[0078] S201, obtaining a fusion coding module based on the encoder;
[0079] S202, input the visual feature sequence into the fusion coding module to obtain a hidden layer feature sequence. In step S201, correspondingly, the fusion coding module obtained based on the encoder includes the following steps: obtaining the model parameters of the encoder; inputting the visual feature sequence into the encoder to obtain multi-head attention; obtaining an information vector and an attention gate vector based on the model parameters and the multi-head attention; constructing a multi-attention mechanism module based on the information vector and the attention gate vector; fusing the multi-attention mechanism module with the encoder to obtain a fusion coding module.
[0080] Specifically, the model parameters of the encoder are obtained, such as: Then the visual feature sequence is input into the encoder to obtain a multi-head attention In this embodiment, the encoder uses a transformer encoder, which is composed of a stack of 6 identical layers, each of which is a multi-attention mechanism layer. Each multi-attention layer in the encoder multi-attention layer uses a residual connection, and then performs layer normalization to obtain the output according to the visual feature extractor and the visual feature sequence x after relation encoding. i , for the visual feature sequence x i Encode to get the hidden state h i , using the following formula:
[0081] {h1,h2,…,h s} = f e (x1,x2,…,x S )
[0082] Among them, f e (.) refers to the transformer encoder function. The multi-attention mechanism is an improvement on the multi-head attention mechanism. The traditional multi-head attention mechanism first measures the similarity between the query vector Query (Q) and the answer vector Key (K), and then uses the similarity score to calculate the weighted average vector on the weight vector (Value). However, there is a problem with the above method. Regardless of whether Q and K / V are related, the attention module will output a weighted average for each query, even if the two vectors are not related. Therefore, the present invention proposes a multi-attention mechanism, and uses a multi-attention mechanism module to measure the correlation between the attention structure and the query to implement the multi-attention mechanism. Then, according to the model parameters of the encoder b i , b g And the multi-head attention Get the information vector i and the attention gate vector g. For example, the multi-attention mechanism module generates an information vector i and an attention gate vector g through two separate linear transformations, which are all based on the attention structure and the current context as query conditions:
[0083]
[0084] Among them, σ is the sigmoid type activation function.
[0085] Then, based on the information vector i and the attention gate vector g, a multiple attention mechanism module is constructed. For example, the multiple attention mechanism uses element-by-element multiplication to apply the attention gate to the information vector to add another attention to obtain the attention information:
[0086]
[0087] Among them, ⊙ refers to the element-by-element multiplication, so the overall structure of the multi-attention mechanism module is:
[0088]
[0089]
[0090] Among them, AoA refers to the multiple attention mechanism, f att Refers to the traditional multi-head attention mechanism module. The multi-attention mechanism module is fused with the encoder to obtain a fused encoding module; that is, the multi-attention mechanism is applied to the Transformer encoder to find the relationship between different objects in the original CT image, and only the fused encoding module is used to measure the degree of association between them. In this way, the visual feature sequence is input into the fused encoding module to obtain a hidden layer feature sequence, thereby obtaining a more refined image representation.
[0091] After obtaining the hidden layer feature sequence, we can perform the following Figure 1 The following steps are shown: S300, decoding the hidden layer feature sequence to obtain the word probability corresponding to the CT image, wherein the word probability is used to characterize the word recognition probability when the CT image is converted into text; in an implementation of the present invention, decoding the hidden layer feature sequence to obtain the word probability corresponding to the CT image includes the following steps:
[0092] S301, obtaining a fusion decoder based on the decoder;
[0093] S302, input the hidden layer feature sequence into the fusion decoder to obtain the word probability corresponding to the CT image. In practice, the decoder is a Transformer decoder, which consists of a stack of 6 identical layers. In addition to the two sublayers in each encoder layer, the decoder also inserts a third layer, which performs multiple attentions on the output of the encoder stack. Similar to the encoder, we use residual connections for each sublayer, then perform layer normalization, and finally output the word probability of each step.
[0094] In step S301, accordingly, the fusion decoder obtained based on the decoder includes the following steps: constructing a relational memory network; constructing a conditional normalization layer based on the relational memory network; fusing the decoder, the relational memory network, and the conditional normalization layer to obtain a fusion decoder.
[0095] Specifically, a relational memory network is first constructed, and the construction of the relational memory network includes the following steps: obtaining the output matrix of the multi-head attention mechanism in the encoder; obtaining the real sample label corresponding to the CT image, and the output embedding feature corresponding to the real sample label; obtaining the relational memory network output matrix according to the output embedding feature at a preset interval time and the multi-head attention mechanism output matrix and a preset initial relational memory network; according to the relational memory network output matrix, iterating the initial relational memory network to obtain a relational memory network.
[0096] In one implementation of the present invention, the output data of the multi-head attention mechanism in the encoder is first obtained to obtain the multi-head attention mechanism output matrix Z. For example, the multi-head attention mechanism output matrix Z can be modeled as:
[0097]
[0098] Among them, d kis the dimension of K, Z is the output of the multi-head attention mechanism, Q, K, V are similar to those in the encoder, Q is the query vector, K is the correlation vector between the query information and other information, and V is the vector of the queried information. Then, according to the output embedding features at the preset interval, the multi-head attention mechanism output matrix and the preset initial relational memory network, the relational memory network output matrix is obtained; correspondingly, according to the output embedding features at the preset interval, the multi-head attention mechanism output matrix and the preset initial relational memory network, the relational memory network output matrix is obtained, including the following steps: according to the output embedding features at the preset interval and the relational memory network output matrix at the preset interval, the forget gate matrix and the information gate matrix are obtained; according to the multi-head attention mechanism output matrix, the initial relational memory network and the relational memory network output matrix at the preset interval, the intermediate iteration matrix is obtained; according to the forget gate matrix, the information gate matrix, the intermediate iteration matrix and the relational memory network output matrix at the preset interval, the relational memory network output matrix is obtained.
[0099] In practice, the output embedding feature Y of the output text at a preset interval time (i.e., the previous time) is first t-1 and the relational memory network output matrix M at the preset interval time (i.e. the previous time) t-1 , get the forget gate matrix and information gate matrix For example: Forget gate matrix and information gate matrix It can be modeled as:
[0100]
[0101]
[0102] Among them, W f and W i is a trainable weight, which is related to the output embedding feature Y of the output text at the preset interval time (i.e., the previous time). t-1 Each forms a gate mechanism. Similarly, U f and U i It is also a trainable weight parameter, which is related to the relational memory network output matrix M at the preset interval time (i.e., the previous time) t-1 Then, according to the multi-head attention mechanism output matrix Z, the initial relational memory network and the relational memory network output matrix M at the preset interval (i.e., the previous moment), t-1 , and get the intermediate iteration matrix For example:
[0103] Use the residual structure and gate mechanism to compare the output Z of the multi-head attention mechanism and the relational memory network output matrix M at the preset interval moment (i.e., the previous moment) t-1 For modeling, the process can be expressed as:
[0104]
[0105] where f mlp (.) refers to the multilayer perceptron in the initial relational memory network. Finally, the relational memory network output matrix M is obtained based on the forget gate matrix, the information gate matrix, the intermediate iteration matrix and the relational memory network output matrix at the preset interval (i.e., the previous moment). t For example: the relational memory network output matrix M t for:
[0106]
[0107] Among them, σ refers to the sigmoid activation function, ⊙ is the Hadamard product, is the forget gate matrix, is the information gate matrix, M t-1 is the relational memory network output matrix at a preset interval (i.e., the previous moment), is the intermediate iteration matrix. Get the relational memory network output matrix M t After that, the matrix M can be output according to the relational memory network. t , iterate the initial relational memory network to obtain a relational memory network.
[0108] After obtaining the relational memory network, a conditional normalization layer based on the relational memory network can be constructed; accordingly, the construction of the conditional normalization layer based on the relational memory network includes the following steps: obtaining the scaling parameters and mobile learning parameters in the decoder; obtaining the scaling parameter change and the mobile learning parameter change according to the relational memory network output matrix; obtaining the target scaling parameter and the target mobile learning parameter according to the scaling parameter, the mobile learning parameter, the scaling parameter change and the mobile learning parameter change; obtaining the conditional normalization layer based on the relational memory network according to the target scaling parameter, the target mobile learning parameter and the hidden layer feature sequence.
[0109] In one implementation, the present invention proposes a conditional normalization layer based on a relational memory network, which can be used to merge relational memory to enhance decoding effect. The implementation details of this method are to combine the two parameters γ and β used for scaling and moving learning representations in the Transformer decoding layer with the relational memory network output matrix M t Together they serve as a merged relation memory. Figure 4 As shown in the figure, in each Transformer decoding layer, there are three memory-based conditional normalization layers, where the output of the first memory-based conditional normalization layer is used as the query, and together with the hidden layer feature sequence from the encoder hidden layer, it is input into the subsequent multi-head attention model as the query, and the output is obtained as the key and value. In order to feedback each memory-based conditional normalization layer, as time t changes (t is a natural number from 1 to N), the relational memory network output matrix M in all iterative layers is converted into t Connect and expand to vector m t , and then use a multilayer perceptron to predict m t The change of γ at time t and the change of β at time t, that is, first obtain the scaling parameter γ and the mobile learning parameter β in the Transformer decoder, and then obtain the scaling parameter change Δγ according to the relational memory network output matrix t and the mobile learning parameter change Δβ t ,For example:
[0110] Δγ t =f mlp (m t )
[0111] Δβ t =f mlp (m t )
[0112] Among them, f mlp (.) refers to the multilayer perceptron in the Transformer decoder.
[0113] Then, according to the scaling parameter γ, the mobile learning parameter β, the scaling parameter change Δγ t and the mobile learning parameter change Δβ t , get the target scaling parameter and target shift learning parameters For example:
[0114]
[0115] During decoding, the matrix M is output through the relational memory network. t Dynamically updated target scaling parameters and target shift learning parameters Finally, according to the target scaling parameter, the target mobile learning parameter, and the hidden layer feature sequence, a conditional normalization layer based on the relational memory network is obtained. Correspondingly, according to the target scaling parameter, the target mobile learning parameter, and the hidden layer feature sequence, the conditional normalization layer based on the relational memory network is obtained, including the following steps: according to the hidden layer feature sequence, obtaining the hidden layer feature mean value and the hidden layer feature standard error corresponding to the hidden layer feature sequence; according to the target scaling parameter, the target mobile learning parameter, the hidden layer feature mean value and the hidden layer feature standard error, obtaining the conditional normalization layer based on the relational memory network.
[0116] In one implementation, according to the hidden layer feature sequence, the hidden layer feature mean μ and the hidden layer feature standard error v corresponding to the hidden layer feature sequence are obtained, and then according to the target scaling parameter The target shift learning parameters The hidden layer feature average μ and the hidden layer feature standard error v are used to obtain a conditional normalization layer based on the relational memory network. The conditional normalization layer can be expressed as:
[0117]
[0118] where f mdn (.) refers to the memory-based conditional normalization process, and r represents the output of the Transform encoder module.
[0119] After constructing a relational memory network and a conditional normalization layer based on the relational memory network, the decoder, the relational memory network, and the conditional normalization layer are fused to obtain a fused decoder; in this embodiment, the decoder is a Transformer decoder, that is, the decoder, the relational memory network, and the conditional normalization layer are fused to obtain a fused decoder. Finally, the hidden layer feature sequence is input into the fused decoder to obtain the word probability corresponding to the CT image. That is, the fused decoder designed by the present invention can be expressed as:
[0120] y t =f d (h1,…,h s ,MCLN(RM(y1,…,y t-1 )))
[0121] Among them, f d(.) is the fusion decoder function, RM (Relational Memory) is the relational memory network, and MCLN (Memory-driven Conditional LayerNorm) is the conditional normalization layer based on the relational memory network. In this way, similar patterns in different medical reports can be implicitly modeled and stored during the decoding generation process, thereby generating accurate and rich medical reports.
[0122] In one implementation of the present invention, the preset CT report generation model is trained. In practice, a training CT image and a real sample label corresponding to the training CT image are first obtained, and the training CT image is input into the initial CT report generation model to obtain model output data. The initial CT report generation model is trained according to the model output data and the real sample label. When certain training conditions are met, the CT report generation model can be obtained. Since the training process belongs to the prior art, it will not be described here.
[0123] After obtaining the word probability corresponding to the CT image, perform the following Figure 1 The following steps are shown: S400, generating a CT medical report text according to the word probability.
[0124] Specifically, the medical report words to be outputted can be found in the dictionary according to the word probabilities shown, and then a medical report can be formed. Alternatively, a CT medical report text can be generated according to a preset network model. In this embodiment, the CT medical report text is generated according to the word probabilities. Accordingly, the generation of the CT medical report text according to the word probabilities includes the following steps:
[0125] S401, obtaining a probability set according to the word probability;
[0126] S402, obtaining a target medical report word according to the real sample label and the probability set;
[0127] S403: Obtain a CT medical report text according to the target medical report word.
[0128] Specifically, according to the CT report generation model and the word probability P, a probability set is obtained. For example, according to the CT report generation model and the word probability p(y t |y1,…,y t-1 ,Img), and obtain the probability set p(Y|Img). The entire diagnostic report generation process can be expressed as a recursive formula of the chain rule:
[0129]
[0130] Among them, y trepresents the next medical report word to be generated, Y = {Y1, Y2, ..., Y T} is the target text sequence (i.e., the diagnostic report text sequence). Then, according to the real sample label and the probability set, the target medical report word is obtained; that is, given the image Img, the probability set p(Y|Img) is maximized by the negative log-likelihood of the real sample label Y to obtain the maximum probability, and the medical report word to be output is found in the dictionary according to the maximum probability, that is, the target medical report word is obtained:
[0131]
[0132] Among them, θ is the parameter of the model, T is the time step of generating each medical report word, and the time step refers to the length of time it takes to generate each word. The process is adaptive. If a word is generated <eos>(special terminator), that is, end. According to the target medical report word, according to the time sequence of generating each medical report word, the CT medical report text can be obtained.
[0133] Exemplary Devices
[0134] like Figure 5 As shown in , an embodiment of the present invention provides a CT report generation device based on Transformer, which includes a visual feature sequence acquisition unit 501, a hidden layer feature sequence acquisition unit 502, a word probability acquisition unit 503, and a CT medical report text generation unit 504, wherein:
[0135] A visual feature sequence acquisition unit 501 is used to acquire a CT image and extract a visual feature sequence of the CT image based on a preset CT report generation model;
[0136] A hidden layer feature sequence acquisition unit 502 is used to encode the visual feature sequence to obtain a hidden layer feature sequence;
[0137] A word probability acquisition unit 503 is used to decode the hidden layer feature sequence to obtain word probabilities corresponding to the CT image, wherein the word probabilities are used to represent word recognition probabilities when the CT image is converted into text;
[0138] The CT medical report text generating unit 504 is used to generate a CT medical report text according to the word probability.
[0139] Based on the above embodiments, the present invention further provides an intelligent terminal, whose principle block diagram can be shown as follows: Figure 6 As shown. The intelligent terminal includes a processor, a memory, a network interface, a display screen, and a temperature sensor connected through a system bus. Among them, the processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the intelligent terminal is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a Transformer-based CT report generation method is implemented. The display screen of the intelligent terminal can be a liquid crystal display screen or an electronic ink display screen, and the temperature sensor of the intelligent terminal is pre-set inside the intelligent terminal to detect the operating temperature of the internal device.
[0140] Those skilled in the art will understand that Figure 6 The schematic diagram in the figure is only a block diagram of a part of the structure related to the scheme of the present invention, and does not constitute a limitation on the smart terminal to which the scheme of the present invention is applied. The specific smart terminal may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0141] In one embodiment, a smart terminal is provided, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations: acquiring a CT image, and extracting a visual feature sequence of the CT image based on a preset CT report generation model;
[0142] Encoding the visual feature sequence to obtain a hidden layer feature sequence;
[0143] Decoding the hidden layer feature sequence to obtain word probabilities corresponding to the CT image, wherein the word probabilities are used to represent word recognition probabilities when the CT image is converted into text;
[0144] A CT medical report text is generated according to the word probabilities.
[0145] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0146] In summary, the present invention discloses a Transformer-based CT report generation method, device, intelligent terminal, and storage medium, the method comprising: acquiring a CT image, and extracting a visual feature sequence of the CT image based on a preset CT report generation model; encoding the visual feature sequence to obtain a hidden layer feature sequence; decoding the hidden layer feature sequence to obtain a word probability corresponding to the CT image, wherein the word probability is used to characterize the word recognition probability when converting the CT image into text; and generating a CT medical report text according to the word probability. The present invention generates accurate and content-rich medical reports by establishing relationships between different objects during image encoding and modeling and storing similar patterns of different medical reports during decoding, thereby reducing the workload of radiologists and helping to promote clinical automation.
[0147] Based on the above embodiments, the present invention discloses a Transformer-based CT report generation method. It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, it can be improved or transformed according to the above description. All these improvements and transformations should fall within the scope of protection of the claims attached to the present invention.< / eos>
Claims
1. A CT report generation method based on Transformer, characterized in that: The method comprises: Acquire a CT image, and extract a visual feature sequence of the CT image based on a preset CT report generation model; Encoding the visual feature sequence to obtain a hidden layer feature sequence; Decoding the hidden layer feature sequence to obtain word probabilities corresponding to the CT image, wherein the word probabilities are used to represent word recognition probabilities when the CT image is converted into text; Generate a CT medical report text according to the word probability; Wherein, the CT report generation model includes a visual feature extractor, an encoder and a decoder; The decoding of the hidden layer feature sequence to obtain word probabilities corresponding to the CT image includes: Based on the decoder, a fusion decoder is obtained; Inputting the hidden layer feature sequence into the fusion decoder to obtain word probabilities corresponding to the CT image; The obtaining of a fusion decoder based on the decoder comprises: Building relational memory networks; Constructing a conditional normalization layer based on the relational memory network; fusing the decoder, the relational memory network, and the conditional normalization layer to obtain a fused decoder; The constructing of the relational memory network comprises: Obtain the multi-head attention mechanism output matrix in the encoder; Obtaining a real sample label corresponding to the CT image and an output embedding feature corresponding to the real sample label; Obtaining a relational memory network output matrix according to the output embedding features at the preset interval, the multi-head attention mechanism output matrix and the preset initial relational memory network; Iterating the initial relational memory network according to the relational memory network output matrix to obtain a relational memory network; The output embedding feature at the preset interval, the multi-head attention mechanism output matrix and the preset initial relational memory network are used to obtain the relational memory network output matrix, including: Obtaining a forget gate matrix and an information gate matrix according to the output embedding features at the preset interval and the relational memory network output matrix at the preset interval; Obtaining an intermediate iteration matrix according to the multi-head attention mechanism output matrix, the initial relational memory network, and the relational memory network output matrix at a preset interval; Obtaining a relational memory network output matrix according to the forget gate matrix, the information gate matrix, the intermediate iteration matrix and the relational memory network output matrix at a preset interval; The step of constructing a conditional normalization layer based on the relational memory network includes: Get the scaling parameters and mobile learning parameters in the decoder; According to the relational memory network output matrix, a scaling parameter change and a mobile learning parameter change are obtained; Obtaining a target scaling parameter and a target mobile learning parameter according to the scaling parameter, the mobile learning parameter, the scaling parameter change amount, and the mobile learning parameter change amount; A conditional normalization layer based on the relational memory network is obtained according to the target scaling parameter, the target shift learning parameter, and the hidden layer feature sequence.
2. The Transformer-based CT report generation method according to claim 1, characterized in that: The step of extracting the visual feature sequence of the CT image based on the preset CT report generation model includes: Based on the visual feature extractor, visual features are obtained; The visual features are time-sequence adjusted to obtain a visual feature sequence.
3. The Transformer-based CT report generation method according to claim 2, characterized in that: The encoding of the visual feature sequence to obtain a hidden layer feature sequence comprises: Based on the encoder, a fusion encoding module is obtained; The visual feature sequence is input into the fusion coding module to obtain a hidden layer feature sequence.
4. The Transformer-based CT report generation method according to claim 3, characterized in that: The obtaining of the fusion coding module based on the encoder includes: Obtaining model parameters of the encoder; According to the encoder, a multi-head attention is obtained; According to the model parameters and the multi-head attention, an information vector and an attention gate vector are obtained; Constructing a multiple attention mechanism module according to the information vector and the attention gate vector; The multiple attention mechanism module is fused with the encoder to obtain a fused encoding module.
5. The Transformer-based CT report generation method according to claim 1, characterized in that: The step of obtaining a conditional normalization layer based on the relational memory network according to the target scaling parameter, the target mobile learning parameter, and the hidden layer feature sequence includes: According to the hidden layer feature sequence, a hidden layer feature mean value and a hidden layer feature standard error corresponding to the hidden layer feature sequence are obtained; A conditional normalization layer based on the relational memory network is obtained according to the target scaling parameter, the target mobile learning parameter, the hidden layer feature average value and the hidden layer feature standard error.
6. The Transformer-based CT report generation method according to claim 1 or 5, characterized in that: Generating a CT medical report text according to the word probability includes: Generate a model based on the CT report and the word probability to obtain a probability set; Obtaining a target medical report word according to the real sample label and the probability set; According to the target medical report word, a CT medical report text is obtained.
7. A CT report generation device based on Transformer, characterized in that: The device comprises: A visual feature sequence acquisition unit, used to acquire a CT image and extract a visual feature sequence of the CT image based on a preset CT report generation model; A hidden layer feature sequence acquisition unit, used for encoding the visual feature sequence to obtain a hidden layer feature sequence; A word probability acquisition unit, used for decoding the hidden layer feature sequence to obtain word probabilities corresponding to the CT image, wherein the word probabilities are used to represent word recognition probabilities when the CT image is converted into text; A CT medical report text generating unit, used for generating a CT medical report text according to the word probability; Wherein, the CT report generation model includes a visual feature extractor, an encoder and a decoder; The decoding of the hidden layer feature sequence to obtain word probabilities corresponding to the CT image includes: Based on the decoder, a fusion decoder is obtained; Inputting the hidden layer feature sequence into the fusion decoder to obtain word probabilities corresponding to the CT image; The obtaining of a fusion decoder based on the decoder comprises: Building relational memory networks; Constructing a conditional normalization layer based on the relational memory network; fusing the decoder, the relational memory network, and the conditional normalization layer to obtain a fused decoder; The constructing of the relational memory network comprises: Obtain the multi-head attention mechanism output matrix in the encoder; Obtaining a real sample label corresponding to the CT image and an output embedding feature corresponding to the real sample label; Obtaining a relational memory network output matrix according to the output embedding features at the preset interval, the multi-head attention mechanism output matrix and the preset initial relational memory network; Iterating the initial relational memory network according to the relational memory network output matrix to obtain a relational memory network; The output embedding feature at the preset interval, the multi-head attention mechanism output matrix and the preset initial relational memory network are used to obtain the relational memory network output matrix, including: Obtaining a forget gate matrix and an information gate matrix according to the output embedding features at the preset interval and the relational memory network output matrix at the preset interval; Obtaining an intermediate iteration matrix according to the multi-head attention mechanism output matrix, the initial relational memory network, and the relational memory network output matrix at a preset interval; Obtaining a relational memory network output matrix according to the forget gate matrix, the information gate matrix, the intermediate iteration matrix and the relational memory network output matrix at a preset interval; The step of constructing a conditional normalization layer based on the relational memory network includes: Get the scaling parameters and mobile learning parameters in the decoder; According to the relational memory network output matrix, a scaling parameter change and a mobile learning parameter change are obtained; Obtaining a target scaling parameter and a target mobile learning parameter according to the scaling parameter, the mobile learning parameter, the scaling parameter change amount, and the mobile learning parameter change amount; A conditional normalization layer based on the relational memory network is obtained according to the target scaling parameter, the target shift learning parameter, and the hidden layer feature sequence.
8. An intelligent terminal, characterized in that: The device comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, and the one or more programs include being used to execute the method according to any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method as claimed in any one of claims 1 to 6.
Citation Information
Patent Citations
Machine translation method, machine translation model training method, device and equipment
CN112163435A
Brain CT medical report generation method based on hierarchical self-attention sequence coding
CN112614561A
Training method of medical image report generation model and image report generation method
CN112992308A
System and method for generating and editing diagnosis reports based on medical images
US20190139218A1
Method and device for generating medical report
US20210057069A1
