Image processing model construction method and device, storage medium and computer product
By using unlabeled medical images and text data to train target pre-training units and generators, the problem of insufficient accuracy of image processing models caused by the high cost of medical image annotation is solved, and more accurate medical image classification is achieved.
Patent Information
- Application Number
- CN202410715435.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-08-30
AI Technical Summary
Since medical images can only be annotated by experienced medical experts, the cost of obtaining high-quality annotated data is high, which limits the amount of training data available for deep learning models, which in turn makes the built image processing models flawed in accuracy.
By using unannotated medical image data and medical text data to train, we obtain a target pre-training unit that can accurately extract image embeddings and text embeddings, and input it into the prompt generator to update the generator and build a model that can accurately identify medical images. Categories of image processing models.
This ensures that the image processing model can more accurately identify the image categories corresponding to the medical image data, and improves the accuracy of the terminal device in building a medical image classification model.
Smart Images

Figure CN118570542A
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method for constructing an image processing model, a terminal device, a storage medium, and a computer program product. Background Art
[0002] With the continuous development of deep learning technology, more and more deep learning models are being developed to support doctors' clinical decision-making and provide doctors with reference for diagnosis.
[0003] In the related art, technicians need to use medical images with precise annotations to train deep learning models in order to obtain image processing models for outputting accurate image categories. However, since medical images can only be annotated by experienced medical experts, and the process of annotating images consumes a lot of time and energy of medical experts, the cost of obtaining high-quality annotated data has increased significantly, which has also led to certain limitations in the amount of training data available for deep learning models, and thus the image processing models constructed by technicians have certain defects in accuracy.
[0004] Therefore, how to better construct an image processing model for classifying medical images has become a technical problem that needs to be urgently solved in the industry. Summary of the invention
[0005] The main purpose of this application is to provide a method for constructing an image processing model, a terminal device, a storage medium and a computer program product, aiming to enable the terminal device to better construct an image processing model for classifying medical images and improve the accuracy of the image processing model in identifying image categories.
[0006] To achieve the above-mentioned purpose, the present application provides a method for constructing an image processing model, which is applied to an initial image processing model including an initial pre-training unit and an initial prompt generator, and the method for constructing the image processing model includes the steps of:
[0007] Acquire a training set, wherein the training set includes training medical image data and training medical text data;
[0008] The initial pre-training unit is updated according to the training medical image data and the training medical text data to obtain a target pre-training unit;
[0009] extracting a target image embedding contained in the training medical image data by the target pre-training unit, and obtaining an automatic text embedding based on the initial prompt generator and the target image embedding;
[0010] Extracting a target text embedding included in the automatic text embedding through the target pre-training unit, and updating the initial prompt generator according to the target text embedding and the target image embedding to obtain a target prompt generator;
[0011] A target image processing model is constructed based on the target prompt generator and the target pre-training unit.
[0012] Further, the initial pre-training unit includes an initial image encoder and an initial text encoder;
[0013] The step of updating the initial pre-training unit according to the training medical image data and the training medical text data to obtain a target pre-training unit comprises:
[0014] extracting initial image embeddings within the training medical image data by the initial image encoder, and extracting initial text embeddings within the training medical text data by the initial text encoder;
[0015] The initial image encoder and the initial text encoder are updated based on the initial image embedding and the initial text embedding to obtain a target pre-trained unit.
[0016] Furthermore, the step of updating the initial image encoder and the initial text encoder based on the initial image embedding and the initial text embedding to obtain a target pre-training unit includes:
[0017] Calculating a first predicted similarity value between the training medical image data and the training medical text data based on the initial image embedding and the initial text embedding;
[0018] Acquire a true similarity value between the training medical image data and the training medical text data, and obtain a first cross entropy loss based on the first predicted similarity value and the true similarity value;
[0019] Updating the initial image encoder based on the first cross entropy loss to obtain a target image encoder;
[0020] Based on the first cross entropy loss, the initial text encoder is updated to obtain a target text encoder;
[0021] The target image encoder and the target text encoder are integrated to obtain a target pre-training unit.
[0022] Furthermore, before the step of updating the initial pre-training unit according to the training medical image data and the training medical text data to obtain a target pre-training unit, the method further includes:
[0023] Extracting standard image labels in the training medical image data, and extracting standard text labels in the training medical text data;
[0024] The true similarity value between the training medical image data and the training medical text data is calculated based on the standard image label and the standard text label.
[0025] Furthermore, the step of extracting the target image embedding contained in the training medical image data by the target pre-training unit comprises:
[0026] The training medical image data is input into the target pre-training unit to extract the target image embedding in the training medical image data through the target image encoder in the target pre-training unit.
[0027] Furthermore, the step of obtaining automatic text embedding based on the initial prompt generator and the target image embedding comprises:
[0028] Obtaining, by means of the initial prompt generator, a plurality of context vectors, category vectors and conditional tags corresponding to the embedding of the target image;
[0029] Automatic text embedding is generated based on the plurality of the context vectors, the category vectors, and the conditional tags.
[0030] Furthermore, the step of updating the initial prompt generator according to the target text embedding and the target image embedding to obtain a target prompt generator comprises:
[0031] Calculate a second predicted similarity value based on the target text embedding and the target image embedding;
[0032] Determining the prediction probabilities of each category corresponding to the training medical image data according to the second prediction similarity value;
[0033] A second cross entropy loss is obtained based on the predicted probabilities of each category, and the initial prompt generator is updated according to the second cross entropy loss to obtain a target prompt generator.
[0034] In addition, to achieve the above-mentioned purpose, the present application also provides a terminal device, which includes: a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the steps of the method for constructing an image processing model as described above are implemented.
[0035] In addition, to achieve the above-mentioned purpose, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for constructing an image processing model as described above are implemented.
[0036] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the method for constructing the image processing model as described above.
[0037] The image processing model construction method, terminal device, storage medium and computer program product provided in the embodiments of the present application are applied to an initial image processing model including an initial pre-training unit and an initial prompt generator, by obtaining a training set, wherein the training set includes training medical image data and training medical text data; updating the initial pre-training unit according to the training medical image data and the training medical text data to obtain a target pre-training unit; extracting the target image embedding contained in the training medical image data through the target pre-training unit, and obtaining an automatic text embedding based on the initial prompt generator and the target image embedding; extracting the target text embedding contained in the automatic text embedding through the target pre-training unit, and updating the initial prompt generator according to the target text embedding and the target image embedding to obtain a target prompt generator; constructing a target image processing model based on the target prompt generator and the target pre-training unit.
[0038] In this embodiment, when the terminal device is running, it first obtains a training set including training medical image data and training medical text data. Then, the terminal device updates the initial pre-training unit in the initial image processing model based on the training medical image data and the training medical text data in the training set to obtain a target pre-training unit. Then, the terminal device inputs the training medical image data into the target pre-training unit, thereby extracting the target image embedding contained in the training medical image data through the target pre-training unit. The terminal device then inputs the target image embedding into the initial prompt generator contained in the initial image processing model, so that the initial prompt generator generates an automatic text embedding based on the target image embedding. Then, the terminal device inputs the automatic text embedding into the trained target pre-training unit, thereby extracting the target text embedding contained in the automatic text embedding through the target pre-training unit. The terminal device updates the initial prompt generator based on the target text embedding and the target image embedding to obtain a target prompt generator. Finally, the terminal device integrates the target prompt generator and the target pre-training unit to construct a target image processing model capable of classifying medical image data.
[0039] In this way, the present application solves the technical problem that the image processing model obtained by training with related technologies has defects in accuracy due to limited medical image resources. That is, the present application obtains a target pre-training unit that can accurately extract image embeddings and text embeddings by training with unannotated medical image data and medical text data, and inputs the image embeddings and text embeddings extracted by the target pre-training unit into the prompt generator, thereby updating the prompt generator with the automatic text embedding and image embedding generated by the prompt generator, and finally obtaining an image processing model composed of a pre-training unit that can extract accurate image embeddings and text embeddings, and a prompt generator that can generate automatic prompt text that is conducive to accurately identifying image types, thereby ensuring that the trained image processing model can more accurately identify information such as image categories corresponding to medical image data, thereby achieving the technical effect of enabling the terminal device to better construct an image processing model for classifying medical images. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a schematic diagram of the structure of a terminal device in the hardware operating environment involved in the embodiment of the present application;
[0041] Figure 2 This is a flow chart of the first embodiment of the method for constructing an image processing model of the present application;
[0042] Figure 3 A schematic diagram of a detailed model construction process involved in an embodiment of a method for constructing an image processing model of the present application;
[0043] Figure 4 A schematic diagram of a training process of a pre-training unit involved in an embodiment of a method for constructing an image processing model of the present application;
[0044] Figure 5 This is a flow chart of the second embodiment of the method for constructing an image processing model of the present application.
[0045] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0046] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0047] Reference Figure 1 , Figure 1 This is a schematic diagram of the terminal device structure of the hardware operating environment involved in the embodiment of the present application.
[0048] It should be noted that the terminal device of the embodiment of the present application can be a device that executes the method for constructing the image processing model of the present application. Specifically, the terminal device can be a mobile terminal, a data storage control terminal, a PC or other terminal that is internally configured with a model training device and can train the initial image processing model including an initial pre-training unit and an initial prompt generator through the model training device.
[0049] like Figure 1 As shown, the terminal device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0050] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the terminal device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0051] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module and a computer program.
[0052] exist Figure 1 In the terminal device shown, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the terminal device of the present application can be set in the terminal device, and the terminal device calls the computer program stored in the memory 1005 through the processor 1001, and executes the following embodiments.
[0053] Based on the above-mentioned terminal device, an overall concept of the method for constructing the image processing model of the present application is provided.
[0054] With the continuous development of deep learning technology, more and more deep learning models have been developed to support doctors' clinical decision-making and provide doctors with reference for diagnosis. In related technologies, technicians need to use medical images with precise annotations to train deep learning models in order to obtain image processing models for outputting accurate image categories. However, since medical images can only be annotated by experienced medical experts, and the process of annotating images will consume a lot of time and energy of medical experts, the cost of obtaining high-quality annotated data has greatly increased, which has also led to certain limitations in the amount of training data available for deep learning models, which in turn has caused certain defects in the accuracy of the image processing models constructed by technicians.
[0055] In view of the above phenomenon, the present application proposes a method for constructing an image processing model, which is applied to an initial image processing model including an initial pre-training unit and an initial prompt generator, and the method for constructing the image processing model includes the steps of: obtaining a training set, wherein the training set includes training medical image data and training medical text data; updating the initial pre-training unit according to the training medical image data and the training medical text data to obtain a target pre-training unit; extracting a target image embedding contained in the training medical image data through the target pre-training unit, and obtaining an automatic text embedding based on the initial prompt generator and the target image embedding; extracting a target text embedding contained in the automatic text embedding through the target pre-training unit, and updating the initial prompt generator according to the target text embedding and the target image embedding to obtain a target prompt generator; and constructing a target image processing model based on the target prompt generator and the target pre-training unit.
[0056] In this way, the present application solves the technical problem that the image processing model obtained by training with related technologies has defects in accuracy due to limited medical image resources. That is, the present application obtains a target pre-training unit that can accurately extract image embeddings and text embeddings by training with unannotated medical image data and medical text data, and inputs the image embeddings and text embeddings extracted by the target pre-training unit into the prompt generator, thereby updating the prompt generator with the automatic text embedding and image embedding generated by the prompt generator, and finally obtaining an image processing model composed of a pre-training unit that can extract accurate image embeddings and text embeddings, and a prompt generator that can generate automatic prompt text that is conducive to accurately identifying image types, thereby ensuring that the trained image processing model can more accurately identify information such as image categories corresponding to medical image data, thereby achieving the technical effect of enabling the terminal device to better construct an image processing model for classifying medical images.
[0057] Based on the above-mentioned server and the overall concept of the method for constructing the image processing model of the present application, various embodiments of the method for constructing the image processing model of the present application are further proposed.
[0058] Please refer to Figure 2 , Figure 2 This is a flow chart of the first embodiment of the method for constructing an image processing model of the present application.
[0059] It should be understood that although a logical order is shown in the flowchart, in some cases, the method for constructing the image processing model of the present application can of course perform the steps shown or described in an order different from that shown here.
[0060] In addition, the construction method of the image processing model of the present application is applied to an initial image processing model including an initial pre-training unit and an initial prompt generator.
[0061] In this embodiment, if Figure 2 As shown, the method for constructing the image processing model of the present application may include the steps of:
[0062] Step S10: obtaining a training set, wherein the training set includes training medical image data and training medical text data;
[0063] Step S20: updating the initial pre-training unit according to the training medical image data and the training medical text data to obtain a target pre-training unit;
[0064] Step S30: extracting the target image embedding contained in the training medical image data through the target pre-training unit, and obtaining the automatic text embedding based on the initial prompt generator and the target image embedding;
[0065] Step S40: extracting the target text embedding included in the automatic text embedding through the target pre-training unit, and updating the initial prompt generator according to the target text embedding and the target image embedding to obtain a target prompt generator;
[0066] Step S50: constructing a target image processing model based on the target prompt generator and the target pre-training unit.
[0067] It should be noted that "embedding" is a technical means to convert discrete data (such as images, text, etc.) into a continuous vector space. It can be understood that image embedding means the feature vector corresponding to the image data in a low dimension. Similarly, text embedding means the feature vector corresponding to the text data in a low dimension. Similarly, automatic text embedding is the feature data containing category information automatically generated based on image data.
[0068] In this embodiment, when the terminal device is running, it first reads the storage device to obtain a training set storing multiple training medical image data and multiple training medical text data, and inputs the training set into the model training device configured by itself. After that, the model training device trains the initial pre-training unit in the initial image processing model based on the multiple training medical image data and multiple training medical text data contained in the training set, thereby obtaining a target pre-training unit that can accurately extract the target image embedding and the target text embedding. After that, the terminal device inputs the multiple training medical image data into the target pre-training unit in sequence, thereby extracting the target image embedding contained in each of the multiple training medical image data through the target pre-training unit, and extracting the target image embedding contained in each of the target image data. The embedding is input to the initial prompt generator contained in the initial image processing model, so that the initial prompt generator generates automatic text embeddings corresponding to multiple training medical images according to each target image embedding. Then, the model training device inputs each automatic text embedding into the target pre-training unit, so as to extract the target text embedding contained in each automatic text embedding through the target pre-training unit, and updates the initial prompt generator based on each target text embedding and each extracted target image embedding, so as to obtain a target prompt generator that can accurately classify the image data. Finally, the model training device connects the trained target pre-training unit and the target prompt generator, so as to obtain a target image processing model that can classify the medical image data.
[0069] For example, see Figure 3 , Figure 3 FIG. 1 is a schematic diagram of a detailed flow chart of a model construction method according to an embodiment of the present application. Figure 3As shown, during operation, the terminal device first reads the storage device configured by itself to obtain a pre-stored training set containing 600,526 X-ray images and 201,063 medical reports obtained from the CheXpert dataset and the MIMIC-CXR dataset, and inputs the training set into the model training device configured by itself. After that, the model training device inputs each X-ray image and each medical report into an initial pre-training unit contained in the initial image processing model to train the initial pre-training unit to obtain a target pre-training unit that can accurately extract the target image embedding corresponding to the X-ray image and the target text embedding corresponding to the medical report. After that, the model training device inputs each X-ray image into the target pre-training unit to extract the target image embedding corresponding to each X-ray image through the target pre-training unit. Image embedding, the model training device then inputs each target image embedding into the initial prompt generator contained in the initial image processing model, and the initial prompt generator processes the target image embedding to generate automatic text embeddings corresponding to each of the multiple X-ray images. Then, the model training device inputs each automatic text embedding into the target pre-training unit to extract the target text embedding corresponding to each automatic text embedding through the target pre-training unit, and updates the initial prompt generator based on each target text embedding and the extracted target image embedding, thereby obtaining a target prompt generator that can generate automatic prompt text that helps to accurately classify X-ray images. Finally, the model training device connects the trained target prompt generator and the target prompt generator to obtain a target image processing model that can classify medical image data.
[0070] In this way, the present application solves the technical problem that the image processing model obtained by training with related technologies has defects in accuracy due to limited medical image resources. That is, the present application obtains a target pre-training unit that can accurately extract image embeddings and text embeddings by training with unannotated medical image data and medical text data, and inputs the image embeddings and text embeddings extracted by the target pre-training unit into the prompt generator, thereby updating the prompt generator with the automatic text embeddings and image embeddings generated by the prompt generator, and finally obtains an image processing model composed of a pre-training unit that can extract accurate image embeddings and text embeddings, and a prompt generator that can generate automatic prompt text that is conducive to accurately identifying image types, thereby ensuring that the trained image processing model can more accurately identify information such as image categories corresponding to medical image data, thereby achieving the technical effect of enabling the terminal device to construct an image processing model for classifying medical images.
[0071] Further, in a feasible embodiment, the initial pre-training unit includes an initial image encoder and an initial text encoder, and the above step S20 may specifically include:
[0072] Step S201: extracting initial image embeddings in the training medical image data by the initial image encoder, and extracting initial text embeddings in the training medical text data by the initial text encoder;
[0073] Step S202: updating the initial image encoder and the initial text encoder based on the initial image embedding and the initial text embedding to obtain a target pre-training unit.
[0074] In this embodiment, after the terminal device inputs the training set into the model training device, the model training device first inputs the multiple training medical image data into the initial image encoder contained in the initial pre-training unit in sequence, thereby extracting the initial image embeddings corresponding to each of the multiple training medical image data through the initial image encoder. At the same time, the model training device inputs the multiple training medical text data into the initial text encoder contained in the initial pre-training unit in sequence, thereby extracting the initial text embeddings corresponding to each of the multiple training medical text data through the initial text encoder. Afterwards, the model training device updates the initial image encoder and the initial text encoder based on each of the initial image embeddings and each of the initial text embeddings to obtain the target pre-training unit.
[0075] For example, for example, Figure 3 As shown, after the terminal device inputs the training set into the model training device, the model training device first inputs a plurality of X-ray images into the initial image encoder E included in the initial pre-training unit. i , the initial image encoder E i Extract the initial image features corresponding to each of the multiple X-ray images, and perform a projection operation on each initial image feature to obtain the initial image embedding I corresponding to the initial image feature in a low dimension e :
[0076] I e =proj(E i (I));
[0077] At the same time, the model training device inputs multiple medical reports into the initial text encoder E included in the initial pre-training unit. t , the initial text encoder E t Extract the initial text features corresponding to each of the multiple medical reports, and perform a projection operation on each initial text feature to obtain the initial image embedding I e The initial text embedding T in the same dimension e :
[0078] T e =proj(E t (T));
[0079] The model training device then embeds I based on each of the initial images e and each of the initial texts is embedded in T e For the initial image encoder E i and the initial text encoder E t Update to get the target pre-trained unit.
[0080] It should be noted that the above initial image is embedded in I e and the initial text is embedded in T e The proj(.) in the figure represents a projection operation. It can be understood that the projection operation is used to align the features in dimension, that is, to ensure that the image features and the text features are in the same dimension, so as to facilitate the image processing model to calculate the similarity values of subsequent image embedding and text embedding. It can be understood that the specific calculation process of the projection operation proj(.) is a prior art, so it will not be repeated here.
[0081] In this way, the terminal device can extract the features of image data and text data, and align the features in dimension, so as to update the pre-training unit based on the aligned image embedding and text embedding to obtain a target pre-training unit that can accurately extract image features and text features.
[0082] For further information, please refer to Figure 4 , Figure 4 This is a schematic diagram of the training process of the pre-training unit involved in an embodiment of the method for constructing an image processing model of the present application, such as Figure 4 As shown, in a feasible embodiment, the above step S202 may specifically include:
[0083] Step S2021: Calculating a first predicted similarity value between the training medical image data and the training medical text data according to the initial image embedding and the initial text embedding;
[0084] Step S2022: obtaining a true similarity value between the training medical image data and the training medical text data, and obtaining a first cross entropy loss based on the first predicted similarity value and the true similarity value;
[0085] Step S2023: updating the initial image encoder based on the first cross entropy loss to obtain a target image encoder;
[0086] Step S2024: updating the initial text encoder based on the first cross entropy loss to obtain a target text encoder;
[0087] Step S2025: Integrate the target image encoder and the target text encoder to obtain a target pre-training unit.
[0088] In this embodiment, after obtaining the initial image embedding and the initial text embedding, the model training device first calculates the cosine similarity values between each initial image embedding and each initial text embedding, and determines the cosine similarity value between each training medical image data and each training medical text data as a first predicted similarity value. Then, the model training device obtains each true similarity value between each training medical image data and multiple training medical text data, and calculates a first cross entropy loss based on each first predicted similarity value and each true similarity value. Then, the model training device updates the initial image encoder based on the first cross entropy loss to obtain a target image encoder. At the same time, the model training device updates the initial text encoder based on the first cross entropy loss to obtain a target text encoder. Finally, the model training device connects the updated target image encoder and the target text encoder to obtain a target pre-training unit that can accurately extract image features and text features.
[0089] For example, for example, Figure 3 As shown, the model training device obtains each initial image embedding I e and each initial text embedding T e After that, first embed I according to the initial image corresponding to the X-ray image i e , and the initial text embedding T corresponding to medical report j e Calculate the cosine similarity between X-ray image i and medical report j
[0090]
[0091] The model training device further uses the cosine similarity Get the first predicted similarity value between X-ray image i and medical report j
[0092]
[0093] Afterwards, the model training device obtains the true similarity value y between the X-ray image i and the medical text j ij , and based on the true similarity value y ij and the first prediction similarity value Calculate the first cross entropy loss L 1 :
[0094]
[0095] The model training device further uses the first cross entropy loss L 1 For the initial image encoder E i Update the parameters to obtain the target image encoder E that can accurately extract the image embedding of the X-ray image I At the same time, the model training device is based on the first cross entropy loss L 1 For the initial text encoder E t Update the parameters to obtain the target text encoder E that can accurately extract the text embedding in the medical report T Finally, the model training device uses the updated target image encoder E I and the target text encoder E T The connection is then used to obtain a target pre-trained unit that can accurately extract image features and text features.
[0096] It should be noted that in the first prediction similarity value In, N text represents the total number of texts, τ represents the learnable temperature parameter, and its initialization value can be 0.07; similarly, the first cross entropy loss L 1 Medium img Indicates the total number of pictures.
[0097] In this way, the terminal device can extract the features of image data and text data, and align the features in dimension, so as to update the pre-training unit based on the aligned image embedding and text embedding to obtain a target pre-training unit that can accurately extract image features and text features.
[0098] Further, in a feasible embodiment, the step of “extracting the target image embedding contained in the training medical image data by the target pre-training unit” in the above step S30 may specifically include:
[0099] Step S301: inputting the training medical image data into the target pre-training unit so as to extract the target image embedding in the training medical image data through the target image encoder in the target pre-training unit.
[0100] In this embodiment, after updating the target pre-training unit, the model training device inputs multiple training medical image data in the training set into the target pre-training unit, and the target pre-training unit inputs the multiple training medical image data into the target image encoder, so that the target image encoder extracts the target image features corresponding to each of the multiple training medical image data, and the target image encoder then performs a projection operation on the target image features to obtain target image embeddings corresponding to each of the multiple target image features.
[0101] For example, for example, Figure 3 As shown, after the model training device updates the target pre-training unit, it sequentially inputs multiple X-ray images in the training set into the target pre-training unit, and the target pre-training unit sequentially inputs multiple X-ray images into the target image encoder E I , so that the target image encoder E I Extract the target image features corresponding to multiple X-ray images, the target image encoder E I Then, projection operations are performed on multiple target image features to obtain target image embeddings I corresponding to each of the multiple X-ray images. E .
[0102] In this way, the terminal device can extract the accurate image embedding corresponding to each X-ray image through the trained image encoder, thereby improving the accuracy of subsequent training of the prompt generator.
[0103] Further, in a feasible embodiment, the step of "obtaining automatic text embedding based on the initial prompt generator and the target image embedding" in the above step S30 may specifically include:
[0104] Step S302: obtaining a plurality of context vectors, category vectors and conditional tags corresponding to the embedding of the target image through the initial prompt generator;
[0105] Step S303: Generate automatic text embedding based on the multiple context vectors, the category vectors and the conditional tags.
[0106] In this embodiment, after extracting the embedding of each target image, the model training device inputs each target image embedding into the initial prompt generator, so that the initial prompt generator learns the context vector, category vector and conditional label corresponding to each training medical image data based on each target image embedding. Thereafter, the initial prompt generator generates the automatic text embedding corresponding to each training medical image data based on each context vector, category vector and conditional label.
[0107] For example, for example, Figure 3 As shown, the model training device extracts each target image embedding I E Afterwards, each target image is embedded into I E Input to the initial prompt generator, the initial prompt generator first embeds each target image into I through its own configured Meta-Net E Processing is performed to extract and embed each target image I E The corresponding conditional label π, at the same time, the initial prompt generator is based on the target image embedding learning I E Get each target image embedding I E The corresponding category vector CK At the same time, the initial prompt generator is based on the target image embedding I E Learn to embed each target image I E Each of the corresponding multiple context vectors V, then the initial prompt generator embeds I based on multiple target images E The corresponding category vector C K , multiple context vectors V and conditional tokens π to generate automatic text embedding
[0108]
[0109]
[0110] It should be noted that automatic text embedding The context vector V in 1 ,v 2 ,...,v m}, where v 1 ,v 2 ,...,v m They represent word embeddings. It can be understood that the dimension of each word embedding is 512, m is the number of context tags in the automatic prompt, and C K is the category embedding;
[0111] In addition, the Meta-Net configured in the initial prompt generator is a neural network composed of a double-layer bottleneck structure based on linear (linear activation function)-ReLU (rectified linear unit)-linear. It can be understood that the specific calculation process of processing image embedding through the Meta-Net to learn image categories and context vectors is a prior art, so it will not be repeated here.
[0112] Further, in a feasible embodiment, the step of "updating the initial prompt generator according to the target text embedding and the target image embedding to obtain a target prompt generator" in the above step S40 may specifically include:
[0113] Step S401: Calculating and obtaining a second predicted similarity value feature based on the target text embedding and the target image embedding;
[0114] Step S402: determining the prediction probability of each category corresponding to the training medical image data according to the second prediction similarity value;
[0115] Step S403: obtaining a second cross entropy loss based on the predicted probability of each category, and updating the initial prompt generator according to the second cross entropy loss to obtain a target prompt generator.
[0116] In this embodiment, after extracting the target text embedding, the model training device calculates a second predicted similarity value between the target text embedding and the target image embedding based on the target text embedding and the above-mentioned target image embedding. Thereafter, the model training device obtains multiple preset image categories, and determines the category prediction probabilities corresponding to the training medical image and the multiple image categories based on the second predicted similarity value. Finally, the model training device obtains a second cross entropy loss based on each of the category prediction probabilities, and updates the initial prompt generator based on the second cross entropy loss to obtain a target prompt generator that can generate text information for accurately identifying image categories.
[0117] For example, for example, Figure 3 As shown, the model training device extracts automatic text embedding Then, embed the auto text into Input to the target pre-training unit, so that the automatic text embedding is extracted by the target text encoder in the target pre-training unit The corresponding target text embedding Afterwards, the model training device embeds and the target image embedding I E =proj(E I (i) Calculate the target text embedding and the target image embedding I E =proj(E I (i)) the second predicted similarity value between
[0118]
[0119] The model training device further based on each of the second prediction similarity values Calculate the category prediction probability when each X-ray image i is predicted to be category k
[0120]
[0121] In this way, the model training device obtains multiple category prediction probabilities generated between X-ray image i and image category k Finally, the model training device predicts the probability of each category The second cross entropy loss L generated between the predicted probability of each category and the true similarity value corresponding to each X-ray image is calculated 2 :
[0122]
[0123] The model training device is based on the second cross entropy loss L2 The initial prompt generator is updated to obtain a target prompt generator that can accurately identify image categories and text information.
[0124] In this way, the terminal device can extract accurate text embedding based on the trained text encoder, and update the prompt generator based on the predicted similarity value between the text embedding and the image embedding, thereby obtaining a target prompt generator that can accurately determine the image category.
[0125] Based on the above-mentioned first embodiment of the method for constructing the image processing model of the present application, a second embodiment of the method for constructing the image processing model of the present application is proposed here.
[0126] For further information, please refer to Figure 5 , Figure 5 This is a flow chart of the second embodiment of the method for constructing an image processing model of the present application. Figure 5 As shown, in a feasible embodiment, before the above step S20, the method for constructing the image processing model of the present application may further include the following steps:
[0127] Step A10: extracting standard image labels in the training medical image data, and extracting standard text labels in the training medical text data;
[0128] Step A20: Calculate the true similarity value between the training medical image data and the training medical text data based on the standard image label and the standard text label.
[0129] In this embodiment, before training the initial pre-training unit based on the training set, the model training device first inputs the training medical image data and training medical text data contained in the training set into the knowledge extractor configured by itself, so that the standard image label corresponding to each training medical image data is extracted by the knowledge extractor. At the same time, the standard text label corresponding to each training medical text data is extracted by the knowledge extractor. After that, the model training device calculates the true similarity value between the training medical image data and the training medical text data based on the features of each training medical image data and each training text feature.
[0130] For example, for example, Figure 3As shown in FIG. 1 , before the model training device trains the initial pre-training unit based on the training set, the model training device first inputs each X-ray image and each medical report contained in the training set into the Negbio tool configured by itself. The Negbio tool first extracts the medical entities defined in the Unified Medical Language System (UMLS) contained in each medical report, and constructs standard text labels T corresponding to 14 standard image categories, namely, no findings, cardiac mediastinal enlargement, cardiac enlargement, lung opacity, lung lesions, edema, consolidation, pneumonia, atelectasis, pneumothorax, pleural effusion, pleural other, fracture and support device, in the form of multi-hot vectors. GT At the same time, the Negbio tool converts each standard text label T GT Determine the standard image label I corresponding to each X-ray image GT After that, the Negbio tool calculates each standard image label I GT Each and multiple standard text labels T GT The cosine similarities generated between them are determined as the ground-truth (GT) similarities between the X-ray image and the medical text.
[0131] In this way, before executing the model training operation, the terminal device can determine the true similarity value between each X-ray image and multiple medical reports based on each image label and the text label corresponding to each of the multiple medical reports, thereby being able to guide the model training device to construct the initial image processing model based on the true similarity value.
[0132] In addition, it should be noted that, in this embodiment and another embodiment, before the terminal device controls the model training device to train the initial image processing model, the terminal device may also first use the pre-trained text transformer in the CLIP (Contrastive Language Image Pre-training) model as the above-mentioned initial text transformer, and at the same time, use the Swin Transformer model as the initial visual encoder. After that, the terminal device splits the initial training medical text data in the training set into sentences, and deletes all sentences with a length of less than 4 to obtain training medical text data.
[0133] In addition, it should be noted that in this embodiment and another embodiment, the terminal device can also set five of the 14 image categories: atelectasis, cardiomegaly, pulmonary lesions, edema, and pleural effusion as unseen categories, and the remaining 9 image categories as basic categories, so as to train the above-mentioned initial prompt generator based on the basic category, and verify the zero-sample and few-sample learning capabilities of the prompt generator based on the unseen category. It can be understood that when the specific basic category and the unseen category are changed, the specific training process of the prompt generator is basically the same as that of the above embodiment, so it will not be repeated here.
[0134] In addition, the present application also provides a terminal device having a computer program that can be run on a processor, and when the terminal device executes the computer program, the steps of the method for constructing an image processing model as described in any of the above embodiments are implemented.
[0135] The specific embodiments of the terminal device of the present application are basically the same as the embodiments of the method for constructing the above-mentioned image processing model, and will not be described in detail here.
[0136] In addition, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for constructing an image processing model as described in any of the above embodiments are implemented.
[0137] The specific embodiments of the computer-readable storage medium of the present application are basically the same as the embodiments of the method for constructing the above-mentioned image processing model, and will not be described in detail here.
[0138] In addition, an embodiment of the present invention further provides a computer program product, including a computer program, which implements the steps of the method for constructing an image processing model as described above when executed by a processor.
[0139] The specific implementation of the computer program product of the present invention is basically the same as the various embodiments of the method for constructing the above-mentioned image processing model, and will not be repeated here.
[0140] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0141] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0142] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application can essentially or in other words, the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM / RAM, disk, CD) as described above, including a number of instructions for enabling a terminal device (which can be a mobile terminal, data storage control terminal, PC, etc. that is internally configured with a model training device and can train the initial image processing model including the initial pre-training unit and the initial prompt generator through the model training device) to execute the methods described in the various embodiments of the present application.
[0143] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for constructing an image processing model, characterized in that: The method for constructing the image processing model is applied to an initial image processing model including an initial pre-training unit and an initial prompt generator, and the method for constructing the image processing model comprises the steps of: Acquire a training set, wherein the training set includes training medical image data and training medical text data; The initial pre-training unit is updated according to the training medical image data and the training medical text data to obtain a target pre-training unit; extracting a target image embedding contained in the training medical image data by the target pre-training unit, and obtaining an automatic text embedding based on the initial prompt generator and the target image embedding; Extracting a target text embedding included in the automatic text embedding through the target pre-training unit, and updating the initial prompt generator according to the target text embedding and the target image embedding to obtain a target prompt generator; A target image processing model is constructed based on the target prompt generator and the target pre-training unit.
2. The method for constructing an image processing model according to claim 1, wherein: The initial pre-training unit includes an initial image encoder and an initial text encoder; The step of updating the initial pre-training unit according to the training medical image data and the training medical text data to obtain a target pre-training unit comprises: extracting initial image embeddings within the training medical image data by the initial image encoder, and extracting initial text embeddings within the training medical text data by the initial text encoder; The initial image encoder and the initial text encoder are updated based on the initial image embedding and the initial text embedding to obtain a target pre-training unit.
3. The method for constructing an image processing model according to claim 2, wherein: The step of updating the initial image encoder and the initial text encoder based on the initial image embedding and the initial text embedding to obtain a target pre-training unit comprises: Calculating a first predicted similarity value between the training medical image data and the training medical text data based on the initial image embedding and the initial text embedding; Acquire a true similarity value between the training medical image data and the training medical text data, and obtain a first cross entropy loss based on the first predicted similarity value and the true similarity value; Updating the initial image encoder based on the first cross entropy loss to obtain a target image encoder; Based on the first cross entropy loss, the initial text encoder is updated to obtain a target text encoder; The target image encoder and the target text encoder are integrated to obtain a target pre-training unit.
4. The method for constructing an image processing model according to claim 3, wherein: Before the step of updating the initial pre-training unit according to the training medical image data and the training medical text data to obtain a target pre-training unit, the method further includes: Extracting standard image labels in the training medical image data, and extracting standard text labels in the training medical text data; The true similarity value between the training medical image data and the training medical text data is calculated based on the standard image label and the standard text label.
5. The method for constructing an image processing model according to claim 3, wherein: The step of extracting the target image embedding contained in the training medical image data by the target pre-training unit comprises: The training medical image data is input into the target pre-training unit to extract the target image embedding in the training medical image data through the target image encoder in the target pre-training unit.
6. The method for constructing an image processing model according to claim 5, characterized in that: The step of obtaining automatic text embedding based on the initial prompt generator and the target image embedding comprises: Obtaining, by means of the initial prompt generator, a plurality of context vectors, category vectors and conditional tags corresponding to the embedding of the target image; Automatic text embedding is generated based on the plurality of the context vectors, the category vectors, and the conditional tags.
7. The method for constructing an image processing model according to claim 6, wherein: The step of updating the initial prompt generator according to the target text embedding and the target image embedding to obtain a target prompt generator comprises: Calculate a second predicted similarity value based on the target text embedding and the target image embedding; Determining the prediction probabilities of each category corresponding to the training medical image data according to the second prediction similarity value; A second cross entropy loss is obtained based on the predicted probabilities of each category, and the initial prompt generator is updated according to the second cross entropy loss to obtain a target prompt generator.
8. A terminal device, characterized in that: The terminal device includes: a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the steps of the method for constructing an image processing model as described in any one of claims 1 to 7 are implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for constructing an image processing model as described in any one of claims 1 to 7 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method for constructing an image processing model as claimed in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Remote sensing image recognition method and device based on retrieval enhancement prompt learning and medium
CN120726498A
