Medical image report generation method based on hidden space image-text matching
By matching the characteristics of medical images and reports in the latent space, the problem of insufficient cross-modal matching relationships between images and reports is solved, high-accuracy medical image report generation is achieved, and misdiagnosis and missed diagnosis are reduced.
Patent Information
- Application Number
- CN202410648294.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2024-09-06
AI Technical Summary
Existing medical imaging report generation methods are difficult to effectively establish cross-modal matching relationships between image features and report features, resulting in insufficient accuracy and interpretability of generated reports.
The image-text matching method based on latent space is used to encode medical images into image sequence features, and the corresponding diagnostic reports are encoded into text sequence features, and mixed sequence features are formed through random mixing, and the model is alternately trained to optimize parameters to achieve image and Semantic associations between reports.
It has successfully realized the semantic association between images and reports in medical imaging report generation, improved the accuracy and interpretability of report generation, reduced misdiagnosis and missed diagnosis, and is suitable for various data sets such as radiological images and pathological images.
Smart Images

Figure CN118609745A
Abstract
Description
Technical Field
[0001] The present invention relates to a medical image report generation method at the intersection of computer vision, natural language processing and medical image analysis fields, and in particular to a medical image report generation method based on latent space image-text matching. Background Art
[0002] Medical imaging report generation is one of the important technologies of artificial intelligence in clinical decision-making assistance. The purpose is to automatically generate diagnostic text to describe the lesions in the image, so as to provide reference information to assist radiologists in writing reports, thereby reducing missed diagnoses or misdiagnoses in clinical practice. In recent years, thanks to the rapid development of multimodal artificial intelligence technology, the use of multimodal deep learning related technologies to achieve medical imaging report generation has become the current mainstream research direction. From the early report generation method based on structured template filling, to the report generation method with variable text length and free structure based on the encoder-decoder network model in recent years, to the report generation method based on large language models such as ChatGPT, the readability, accuracy and applicability of generated diagnostic reports are constantly improving. For a given medical image, the doctor needs to observe the various organs and tissues in the image and write a text report. The report content and the lesions of each organ in the image match each other. Therefore, to improve the accuracy and interpretability of report generation, it is necessary to first learn effective image visual representations and establish a cross-modal matching relationship between image features and report features. Summary of the invention
[0003] The purpose of the present invention is to propose a method for generating medical image reports based on latent space image-text matching in view of the deficiencies of the prior art. Specifically, the present invention binds the image features of the image and the text features of the report in the same latent space and associates them by matching the image-to-text generation and text-to-text generation processes. During the training process, the medical image is encoded as an image sequence feature, the corresponding diagnostic report is encoded as a text sequence feature, and the two sequence features are randomly mixed to form a mixed sequence feature. Then, the image sequence features, text sequence features and mixed sequence features are input as prompt symbols into the text generation decoder to generate the corresponding text, and the model parameters are optimized by an alternating training strategy. The method successfully realizes the semantic association between images and reports, and has achieved good results in three medical image report generation data sets (including radiological images and pathological images).
[0004] A method for generating medical imaging reports based on latent space image-text matching, the specific steps of which are as follows:
[0005] Step (1), select samples {I, R} containing medical images and their diagnostic reports to form a training data set, where I and R represent the medical images in the data set and the diagnostic reports that correspond to each other;
[0006] Step (2): Use convolutional neural network to extract the convolution feature map of medical images and flatten it to obtain image sequence features. Use v i represents the i-th vector in the image sequence feature, N is the length of the image sequence feature, d model Represents the characteristic dimension of the model;
[0007] Step (3): Input the corresponding diagnostic report into the text self-attention encoding layer for self-attention encoding to obtain the self-attention text sequence feature Use s l Represents the lth vector of the self-attention text sequence feature, where L is the length of the text sequence reported in the input;
[0008] Step (4), input the self-attention text sequence features into the text structured encoding layer for encoding to obtain the text sequence features t i represents the i-th vector in the text sequence feature, N is the length of the text sequence feature, and the corresponding structured encoding formula is as follows:
[0009] T=(A×S)W (Formula 1)
[0010] in, Represents a linear mapping matrix, A∈R N×L is the attention weight matrix, and the calculation formula is as follows:
[0011] A = softmax(W2tanh(W1S T )) (Formula 2)
[0012] in, and is the linear mapping matrix, d middle is the intermediate feature dimension of the structured mapping layer. T represents the transposition operation, tanh is the hyperbolic tangent function, and softmax is the normalized exponential function;
[0013] Step (5), the image sequence feature V and the text sequence feature T are randomly cross-mixed to obtain two different mixed sequence features:
[0014] Y t =T⊙M λ +V⊙(1-M λ ) (Formula 3)
[0015] Y v =V⊙Mλ +T⊙(1-M λ ) (Formula 4)
[0016] in, as well as represents the mixed sequence feature, and N is the mixed sequence length. and is the linear mapping matrix, d middle M is the intermediate feature dimension of the structured mapping layer. λ represents a binary random mask, λ is the mask ratio, and ⊙ represents an element-by-element multiplication operation;
[0017] Step (6), the image sequence feature V, the text sequence feature T, the mixed sequence feature Y t and Y v As a prompt symbol for the text generation decoder, the input text generation decoder realizes the generation of report text. Specifically, the loss function of the model optimization is as follows:
[0018]
[0019] in, is the cross entropy loss function, P is the prompt symbol for the decoder generated by the input text, which can be image sequence feature V, text sequence feature T, mixed sequence feature Y t Or a mixed sequence feature Y v p represents the report text R generated at the previous adjacent time t-1 t-1 And the prompt symbol P, the word generated at the current time t is r t The probability of
[0020] Step (7) uses an alternating training strategy to jointly learn the parameters of each module in the model, including the convolutional neural network, the text self-attention encoding layer, the text structured encoding layer, and the text generation decoder. Specifically, a round of training includes multiple epochs, and the last epoch of each round of training adopts Perform model optimization, and finally the second Epoch adopts Perform model optimization, and the remaining Epochs adopt Perform model optimization. As the number of rounds increases, the mask ratio λ will also increase, thereby strengthening the semantic association between images and text.
[0021] Step (8), by using the training method of step (7), matching the image-to-text generation process and the text-to-text generation process, and associating the image features of the image and the text features of the report in the same latent space;
[0022] Step (9), during the test, the image to be tested is input into the image sequence features extracted by the convolutional neural network, and is input into the text generation decoder, and the words at all times are generated by autoregression, and the text before the end character is taken in series to realize the generation of a complete diagnostic report.
[0023] Furthermore, the specific implementation of step (6) is as follows:
[0024] 6-1. The report text R of the previous adjacent time t-1 t-1 ={r1,r2,…,r t-1} Perform word vector mapping to obtain E t-1 ={e1,e2,…,e t-1} and E t-1 Each corresponding element in adds the corresponding position encoding information, which is recorded as the mapping feature E of the report text. 0 , where t≥2.
[0025] 6-2. The prompt symbol P and the mapping feature E of sequence length N i Concatenate the input text to generate the decoder, E i The initial value of is the mapping feature E 0 ; The text generation decoder consists of multiple sub-decoding layers, each of which includes a multi-head attention layer and a linear layer. The specific formula is as follows:
[0026] X i =[P;E i ] Formula (6)
[0027] O i =FFN(MHA(X i ,X i ,X i )) Formula (7)
[0028] E i+1 =O i [N+1:N+t-1] Formula (8)
[0029] Where i represents the i-th sub-decoding layer, [;] represents the feature concatenation operation, MHA represents the multi-head attention layer, and FFN represents the linear layer. i X represents the mapping feature corresponding to the report text in the i-th sub-decoding layer, and the sequence length is t-1. i and O i Represents the input and output of the ith sub-decoding layer, and the sequence length is N+t-1. [start:end] represents the sequence slicing operation, taking the elements from start to end of the input sequence. MHA consists of multiple heads, which can be expressed as the following formula:
[0030] MHA(Q,K,V)=[head1;…;head h ]W O Formula (9)
[0031]
[0032]
[0033] in, Indicates the nth head n The mapping matrix, Represents the mapping matrix of the multi-head attention layer output, d k represents the dimensions of Q and K, d v Represents the dimension of V. The linear layer FFN is expressed as the following formula:
[0034] FFN(x)=max(0,xW f1 +b1)W f2 +b2 Formula (12)
[0035] Among them, W f1 and W f2 represents the linear mapping matrix, b1 and b2 represent the bias.
[0036] 6-3. Take the output of the last sub-decoding layer of the text generation decoder in step 6-2 The text output r at the current time t is obtained through linear mapping and softmax operation t , the specific formula is as follows:
[0037]
[0038] Among them, W p represents the linear mapping matrix, b p represents the bias, U represents the total number of sub-decoding layers, and p t Represents the text word distribution output at the moment;
[0039] 6-4. Use autoregressive method to generate words at all times, and take the text before the end character for concatenation to achieve the generation of a complete diagnostic report.
[0040] The beneficial effects of the present invention are:
[0041] The present invention proposes to match the image-to-report generation process and the report-to-report generation process in a latent space, which provides a new idea for the model to learn the effective semantic association between the image visual representation and the report text representation. After learning the effective visual representation and semantic representation, they are used for the medical image report generation task, which can achieve fast report output and provide diagnostic reports for reference by imaging doctors, thereby assisting doctors in diagnosis and reducing misdiagnosis and missed diagnosis. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a flow chart of the present invention;
[0043] Figure 2 It is a schematic diagram of the overall framework of the present invention;
[0044] Figure 3 The detailed process of encoding the text sequence features of the present invention;
[0045] Figure 4 The effect of the report generation of the present invention on chest X-ray images and pathological images is demonstrated.
[0046] Figure 5 Grad-CAM regions of interest for images when generating reports for the present invention. DETAILED DESCRIPTION
[0047] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0048] like Figure 1As shown, the present invention provides a method for generating a medical image report based on latent space image-text matching, thereby assisting diagnosis and reducing the workload of radiologists. The present invention relates to the fields of medical image analysis, multimodal visual-language learning and cross-modal subtitle generation. The present invention matches the image-to-report generation process (solid line part in the figure) and the report-to-report generation process (dashed line part in the figure) in a latent space. First, a data set containing medical images and diagnostic reports is constructed, and the convolution feature map of the image is extracted by a convolutional neural network, and flattened into image sequence features. Secondly, the corresponding diagnostic report is input into the text self-attention encoding layer and the text structured encoding layer for encoding to obtain the text sequence features of the report. Subsequently, the image sequence features and the text sequence features are randomly mixed to obtain mixed sequence features, and the image sequence features, the text sequence features or the mixed sequence features are alternately used as prompt symbols of the text generation decoder to generate the report text, and the parameters of each module in the learning model are jointly optimized by an alternating training strategy, including a convolutional neural network, a text self-attention encoding layer, a text structured encoding layer and a text generation decoder. Finally, only the solid line convolutional neural network and text generation decoder are used to generate a diagnosis report based on the input image and autoregressive sampling strategy. The present invention can effectively associate the image features of the image and the text features of the report in the same latent space, and is suitable for the field of medical image report generation.
[0049] like Figure 2 As shown, the specific implementation steps are as follows:
[0050] Step (1), inputting the medical image into an image encoder to obtain image sequence features, wherein the image encoder is a convolutional neural network;
[0051] Step (2), input the paired diagnostic reports into a text encoder to obtain text sequence features, where the text encoder includes a text self-attention encoding layer and a text structured encoding layer; specifically, the detailed process of text sequence feature encoding is as follows: Figure 3 As shown;
[0052] Step (3), randomly mixing the image sequence features and the text sequence features through a binary random mask to obtain a mixed sequence feature;
[0053] Step (4), image sequence feature V, text sequence feature T, mixed sequence feature Y t and Y v As a prompt symbol of the text generation decoder, the text generation decoder is input to realize the generation of report text. The parameters of each module in the model are jointly learned through an alternating training strategy, including the convolutional neural network, the text self-attention encoding layer, the text structured encoding layer and the text generation decoder;
[0054] Step (5), by using the training method of step (4), matching the image-to-text generation process and the text-to-text generation process, and associating the image features of the image and the text features of the report in the same latent space;
[0055] Step (6): During the test, the image to be tested is input into the image sequence features extracted by the convolutional neural network and input into the text generation decoder, and an autoregressive sampling strategy is used to generate word combinations at all times to output a diagnostic report.
[0056] To test the performance of the method of the present invention, qualitative and quantitative experiments were conducted on three public datasets: IU X-Ray, MIMIC-CXR, and BladderPathology. Figure 4 As shown, Figure 4 (a), the present invention can generate "Left-sided dual-chamber pacemaker leads terminated in the right atrium and right ventricle. The cardiac outline is enlarged. The aorta is tortuous and diffusely calcified. The mediastinum and hilar contours are normal. The pulmonary vessels are not congested. The lungs are excessively flattened. There is no focal consolidative pleural effusion or emphysema. No acute bone abnormalities are found", which is almost the same as the lesions covered in the reference report written by the doctor "Left-sided dual-chamber pacemaker leads terminated in the right atrium and right ventricle were noted. The cardiac outline is slightly enlarged. The aorta is tortuous and diffusely calcified. The pulmonary vessels are normal. No pleural effusion or emphysema is found. There is mild atelectasis at the lung bases, but no focal areas of consolidation. No acute bone abnormalities are present". In addition, Figure 5 The corresponding Grad-CAM activation area in the image is shown when the present invention generates the corresponding report. It can be seen that the present invention method can accurately focus on the area of lesions in the image. Figure 5 (b), the method of the present invention takes into account diseases such as "low lung capacity".
[0057] In terms of quantitative analysis, the quantitative comparative experimental results of the method of the present invention and the existing report generation method based on the encoding-decoding network structure on three public data sets IU X-Ray, MIMIC-CXR and BladderPathology are shown in Tables 1, 2 and 3.
[0058] Table 1 Performance comparison of IU X-Ray dataset (the best result is marked in bold)
[0059]
[0060]
[0061] Table 2 Performance comparison of MIMIC-CXR dataset (the best results are marked in bold)
[0062]
[0063] Table 3 Performance comparison of Bladder Pathology dataset (the best result is marked in bold)
[0064]
[0065] In summary, it can be seen from Tables 1, 2 and 3 that, whether in chest X-ray images or pathological image datasets, under various evaluation indicators for evaluating image caption generation, the method proposed in the present invention has a significant improvement over the existing methods, indicating that the method of the present invention can effectively improve the generation performance of diagnostic reports. At present, the index results of the method of the present invention are internationally leading in the field of medical image report generation.
Claims
1. A method for generating medical imaging reports based on latent space image-text matching, Features By matching the image-to-text generation and text-to-text generation processes, the image features of medical images and the text features of reports are bound in the same latent space and associated. During the training process, the medical images are encoded as image sequence features, the corresponding diagnostic reports are encoded as text sequence features, and these two sequence features are randomly mixed to form mixed sequence features. Then, the image sequence features, text sequence features and mixed sequence features are input as prompt symbols into the text generation decoder to generate the corresponding text. The model parameters are optimized with an alternating training strategy, thereby achieving semantic association between medical images and reports.
2. According to claim 1, a method for generating a medical imaging report based on latent space image-text matching, Features The specific steps are as follows: Step (1), selecting samples {I, R} containing medical images and their diagnostic reports to form a training data set; wherein I and R represent the medical images in the data set and the diagnostic reports corresponding to each other, respectively; Step (2): Use convolutional neural network to extract the convolution feature map of medical images and flatten it to obtain image sequence features. Use v i represents the i-th vector in the image sequence feature, N is the length of the image sequence feature, d model Represents the characteristic dimension of the model; Step (3): Input the corresponding diagnostic report into the text self-attention encoding layer for self-attention encoding to obtain the self-attention text sequence feature Use s l Represents the lth vector of the self-attention text sequence feature, where L is the length of the text sequence reported in the input; Step (4), input the self-attention text sequence features into the text structured encoding layer for encoding to obtain the text sequence features t i represents the i-th vector in the text sequence feature, and N is the length of the text sequence feature; Step (5), the image sequence feature V and the text sequence feature T are randomly cross-mixed to obtain two different mixed sequence features: Y t =T⊙M λ +V⊙(1-M λ ) Y v =V⊙M λ +T⊙(1-M λ ) in, as well as represents the mixed sequence feature, N is the mixed sequence length; and is the linear mapping matrix, d middle is the intermediate feature dimension of the structured mapping layer; M λ represents a binary random mask, λ is the mask ratio, and ⊙ represents an element-by-element multiplication operation; Step (6), the image sequence feature V, the text sequence feature T, the mixed sequence feature Y t and Y v As a prompt symbol of the text generation decoder, the text generation decoder is input to realize the generation of the report text; Step (7), jointly learning the parameters of each module in the model through an alternating training strategy, including the convolutional neural network, the text self-attention encoding layer, the text structured encoding layer and the text generation decoder; Step (8), by using the training method of step (7), matching the image-to-text generation process and the text-to-text generation process, and associating the image features of the image and the text features of the report in the same latent space; Step (9), during the test, the image to be tested is input into the image sequence features extracted by the convolutional neural network, and is input into the text generation decoder, and the words at all times are generated by autoregression, and the text before the end character is taken in series to realize the generation of a complete diagnostic report.
3. According to claim 2, a method for generating a medical imaging report based on latent space image-text matching, Features The loss function of the model optimization is as follows: in, is the cross entropy loss function, P is the prompt symbol for the decoder generated by the input text, which can be image sequence feature V, text sequence feature T, mixed sequence feature Y t Or a mixed sequence feature Y v ; p represents the report text R generated at the previous adjacent time t-1 t-1 And the prompt symbol P, the word generated at the current time t is r t probability.
4. A method for generating a medical imaging report based on latent space image-text matching according to claim 2 or 3, Features Step (7) is specifically implemented as follows: A round of training includes multiple epochs, and the last epoch of each round of training adopts Perform model optimization, and finally the second Epoch adopts Perform model optimization, and the remaining Epochs adopt Perform model optimization; as the number of rounds increases, the mask ratio λ will also increase, thereby strengthening the semantic association between images and text.
5. According to claim 4, a method for generating a medical imaging report based on latent space image-text matching, Features The specific implementation of step (6) is as follows: 6-1. The report text R of the previous adjacent time t-1 t-1 = {r 1 ,r 2 ,…,r t-1 } Perform word vector mapping to obtain E t-1 ={e 1 ,e 2 ,…,e t-1 } and E t-1 Each corresponding element in adds the corresponding position encoding information, which is recorded as the mapping feature E of the report text. 0 , where t≥2; 6-2. The prompt symbol P and the mapping feature E of sequence length N i Concatenate the input text to generate the decoder, E i The initial value of is the mapping feature E 0 ; The text generation decoder consists of multiple sub-decoding layers, each of which includes a multi-head attention layer and a linear layer; 6-3. Take the output of the last sub-decoding layer of the text generation decoder in step 6-2 The text output r at the current time t is obtained through linear mapping and softmax operation t , 6-4. Use autoregressive method to generate words at all times, and take the text before the end character for concatenation to achieve the generation of a complete diagnostic report.
6. A method for generating a medical imaging report based on latent space image-text matching according to claim 5, Features The specific formula for step 6-2 is as follows: X i =[P;E i ] O i =FFN(MHA(X i ,X i ,X i )) E i+1 =O i [N+1:N+t-1] Where i represents the i-th sub-decoding layer, [;] represents the feature concatenation operation, MHA represents the multi-head attention layer, FFN represents the linear layer; E i X represents the mapping feature corresponding to the report text in the i-th sub-decoding layer, and the sequence length is t-1; i and O i Represents the input and output of the i-th sub-decoding layer, and the sequence length is N+t-1; [start:end] represents the sequence slicing operation, taking the elements from start to end of the input sequence.
7. According to claim 5, a method for generating a medical imaging report based on latent space image-text matching, Features The specific formula for step 6-3 is as follows: Among them, W p represents the linear mapping matrix, b p represents the bias, U represents the total number of sub-decoding layers, and p t Represents the text word distribution output at a certain moment.
Citation Information
Cited By
Method for automatically generating orthodontic diagnosis report based on image text alignment
CN119694477A
Elevator map generation method, system and equipment based on semantic recognition and image segmentation large model and medium
CN120894636A
