Image-text pre-training model training, image-text prediction model training method and device
By performing feature masking and cross-modal information interaction in the training of the graphic and text pre-training model, the problem of insufficient cross-modal information learning in the existing technology is solved, and the accuracy and cross-modal prediction ability of the graphic and text prediction model are improved.
Patent Information
- Application Number
- CN202210108283.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-28
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-01-28
AI Technical Summary
The existing technology cannot effectively learn cross-modal information during the pre-training model training process, resulting in reduced accuracy of the image and text prediction model.
By obtaining the original features of training images and texts, masking the features and inputting them into the initial image-text pre-training model, the image-text matching degree is evaluated and cross-modal information interaction is performed, the model loss information is calculated, and the model is trained based on this information until Meet the training completion conditions.
The accuracy of the pre-trained model is improved, thereby improving the accuracy of the image and text prediction model, and enhancing the ability to make cross-modal predictions based on images and text.
Smart Images

Figure CN114419351B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer equipment, storage medium and computer program product for training a graph-text pre-training model and a graph-text prediction model. Background Art
[0002] With the development of artificial intelligence technology, there have emerged technologies for task prediction using images and texts, such as visual question answering, image and text detection, and visual common sense reasoning. At present, further training is usually performed on the basis of a pre-trained model to obtain an image and text prediction model, thereby improving the training effect of the image and text prediction model. When training a pre-trained model, an image encoder and a language encoder are usually used for pre-training respectively to obtain a pre-trained model. However, the independent training method cannot learn cross-modal information during pre-training, resulting in a decrease in the accuracy of the obtained pre-trained model, which in turn leads to a decrease in the accuracy of the trained image and text prediction model. Summary of the invention
[0003] Based on this, it is necessary to provide a graphic-text pre-training model training, graphic-text prediction model training method, device, computer equipment, computer-readable storage medium and computer program product that can improve the accuracy of the pre-training model and thereby improve the accuracy of the graphic-text prediction model in response to the above-mentioned technical problems.
[0004] In one aspect, the present application provides a method for training a pre-trained image and text model. The method comprises:
[0005] Obtaining original features of the training image corresponding to the training image and original features of the training text corresponding to the training text;
[0006] Perform feature masking based on the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, and input the target features of the training image and the target features of the training text into the initial image-text pre-training model;
[0007] The initial image-text pre-training model uses the training target image features and the training target text features to evaluate the image-text matching degree, and obtains the initial image-text matching degree;
[0008] The initial image-text pre-training model uses the initial image-text matching degree, the training target image features, and the training target text features to perform cross-modal information interaction to obtain the initial image interaction features and the initial text interaction features;
[0009] The model loss is calculated based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree to obtain the training model loss information;
[0010] The initial image-text pre-training model is trained based on the training model loss information until the training completion condition is met, and the target image-text pre-training model is obtained. The target image-text pre-training model is used to train a model for cross-modal prediction based on images and texts.
[0011] In one embodiment, the calculating the similarity between the training image and the training text, performing loss calculation based on the similarity and the image-text matching degree, and obtaining matching loss information includes:
[0012] Obtaining training object category information corresponding to the training image, and calculating a category weight vector corresponding to the training object category information;
[0013] Calculating a word weight vector based on the training text to obtain a word weight vector, and calculating a weight vector similarity between the category weight vector and the word weight vector;
[0014] The minimum square error between the weight vector similarity and the image-text matching degree is calculated to obtain the matching loss information.
[0015] On the other hand, the present application also provides a device for training a graphic and text pre-training model. The device comprises:
[0016] A feature acquisition module, used to acquire original features of training images corresponding to training images and original features of training texts corresponding to training texts;
[0017] A feature masking module is used to perform feature masking based on the original features of the training image and the original features of the training text, obtain the target features of the training image and the target features of the training text, and input the target features of the training image and the target features of the training text into the initial image-text pre-training model;
[0018] A matching module is used to evaluate the image-text matching degree using the training target image features and the training target text features through the initial image-text pre-training model to obtain the initial image-text matching degree;
[0019] An interaction module is used to perform cross-modal information interaction using an initial image-text matching degree, training target image features, and training target text features through an initial image-text pre-training model to obtain initial image interaction features and initial text interaction features;
[0020] A loss calculation module is used to calculate the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree to obtain the training model loss information;
[0021] The training module is used to train the initial image-text pre-training model based on the training model loss information until the training completion condition is met, and then obtain the target image-text pre-training model, which is used to train a model for cross-modal prediction based on images and texts.
[0022] On the other hand, the present application also provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0023] Obtaining original features of the training image corresponding to the training image and original features of the training text corresponding to the training text;
[0024] Perform feature masking based on the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, and input the target features of the training image and the target features of the training text into the initial image-text pre-training model;
[0025] The initial image-text pre-training model uses the training target image features and the training target text features to evaluate the image-text matching degree, and obtains the initial image-text matching degree;
[0026] The initial image-text pre-training model uses the initial image-text matching degree, the training target image features, and the training target text features to perform cross-modal information interaction to obtain the initial image interaction features and the initial text interaction features;
[0027] The model loss is calculated based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree to obtain the training model loss information;
[0028] The initial image-text pre-training model is trained based on the training model loss information until the training completion condition is met, and the target image-text pre-training model is obtained. The target image-text pre-training model is used to train a model for cross-modal prediction based on images and texts.
[0029] On the other hand, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0030] Obtaining original features of the training image corresponding to the training image and original features of the training text corresponding to the training text;
[0031] Perform feature masking based on the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, and input the target features of the training image and the target features of the training text into the initial image-text pre-training model;
[0032] The initial image-text pre-training model uses the training target image features and the training target text features to evaluate the image-text matching degree, and obtains the initial image-text matching degree;
[0033] The initial image-text pre-training model uses the initial image-text matching degree, the training target image features, and the training target text features to perform cross-modal information interaction to obtain the initial image interaction features and the initial text interaction features;
[0034] The model loss is calculated based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree to obtain the training model loss information;
[0035] The initial image-text pre-training model is trained based on the training model loss information until the training completion condition is met, and the target image-text pre-training model is obtained. The target image-text pre-training model is used to train a model for cross-modal prediction based on images and texts.
[0036] On the other hand, the present application also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0037] Obtaining original features of the training image corresponding to the training image and original features of the training text corresponding to the training text;
[0038] Perform feature masking based on the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, and input the target features of the training image and the target features of the training text into the initial image-text pre-training model;
[0039] The initial image-text pre-training model uses the training target image features and the training target text features to evaluate the image-text matching degree, and obtains the initial image-text matching degree;
[0040] The initial image-text pre-training model uses the initial image-text matching degree, the training target image features, and the training target text features to perform cross-modal information interaction to obtain the initial image interaction features and the initial text interaction features;
[0041] The model loss is calculated based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree to obtain the training model loss information;
[0042] The initial image-text pre-training model is trained based on the training model loss information until the training completion condition is met, and the target image-text pre-training model is obtained. The target image-text pre-training model is used to train a model for cross-modal prediction based on images and texts.
[0043] The above-mentioned image-text pre-training model training method, device, computer equipment, storage medium and computer program product, by inputting the training image target features and the training text target features into the initial image-text pre-training model, using the training target image features and the training target text features to evaluate the image-text matching degree through the initial image-text pre-training model to obtain the initial image-text matching degree, and using the initial image-text matching degree, the training target image features and the training target text features to perform cross-modal information interaction through the initial image-text pre-training model to obtain initial image interaction features and initial text interaction features, and then calculating the training model loss information, using the training model loss information to train the initial image-text pre-training model until the training completion condition is met, to obtain the target image-text pre-training model, wherein the image-text matching degree is evaluated and then the image-text matching degree is used to perform cross-modal information interaction to train the image pre-training model, so that the accuracy of the trained image-text pre-training model can be improved, and then the accuracy of the model trained for cross-modal prediction based on images and texts can be improved.
[0044] In one aspect, the present application provides a method for training a graph-text prediction model. The method comprises:
[0045] Obtain image-text prediction training samples and corresponding image-text prediction labels;
[0046] Obtain a pre-trained image-text model, and use the pre-trained image-text model as an initial image-text prediction model;
[0047] The image-text pre-training model is obtained by masking the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, inputting the target features of the training image and the target features of the training text into the initial image-text pre-training model, evaluating the image-text matching degree using the training target image features and the training target text features through the initial image-text pre-training model to obtain the initial image-text matching degree, performing cross-modal information interaction through the initial image-text pre-training model using the initial image-text matching degree, the training target image features and the training target text features to obtain the initial image interaction features and the initial text interaction features, calculating the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree to obtain the training model loss information, and training is performed based on the training model loss information;
[0048] Inputting the image-text prediction training sample into the initial image-text prediction model to obtain the image-text prediction result corresponding to the image-text prediction training sample;
[0049] The prediction loss information between the image-text prediction result and the image-text prediction label is calculated, and the initial image-text prediction model is trained based on the prediction loss information. When the prediction training completion condition is met, the target image-text prediction model is obtained. The target image-text prediction model is used for cross-modal prediction using images and texts.
[0050] On the other hand, the present application also provides a device for training a graph-text prediction model. The device comprises:
[0051] A sample acquisition module is used to obtain image-text prediction training samples and corresponding image-text prediction labels;
[0052] A model acquisition module is used to acquire a pre-trained image-text model and use the pre-trained image-text model as an initial image-text prediction model; the pre-trained image-text model is obtained by masking the original features of the training image and the original features of the training text to obtain target features of the training image and the target features of the training text, inputting the target features of the training image and the target features of the training text into the initial pre-trained image-text model, evaluating the image-text matching degree using the features of the training target image and the features of the training target text through the initial pre-trained image-text model to obtain the initial image-text matching degree, performing cross-modal information interaction through the initial pre-trained image-text model using the initial image-text matching degree, the features of the training target image and the features of the training target text to obtain the initial image interaction features and the initial text interaction features, calculating the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree to obtain the training model loss information, and training is performed based on the training model loss information;
[0053] The training prediction module is used to input the image-text prediction training samples into the initial image-text prediction model to obtain the image-text prediction results corresponding to the image-text prediction training samples;
[0054] The model acquisition module is used to calculate the prediction loss information between the image-text prediction results and the image-text prediction labels, and train the initial image-text prediction model based on the prediction loss information. When the prediction training completion conditions are met, the target image-text prediction model is obtained. The target image-text prediction model is used for cross-modal prediction using images and texts.
[0055] On the other hand, the present application also provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0056] Obtain image-text prediction training samples and corresponding image-text prediction labels;
[0057] Obtain a pre-trained image-text model, and use the pre-trained image-text model as an initial image-text prediction model;
[0058] The image-text pre-training model is obtained by masking the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, inputting the target features of the training image and the target features of the training text into the initial image-text pre-training model, evaluating the image-text matching degree using the training target image features and the training target text features through the initial image-text pre-training model to obtain the initial image-text matching degree, performing cross-modal information interaction through the initial image-text pre-training model using the initial image-text matching degree, the training target image features and the training target text features to obtain the initial image interaction features and the initial text interaction features, calculating the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree to obtain the training model loss information, and training is performed based on the training model loss information;
[0059] Inputting the image-text prediction training sample into the initial image-text prediction model to obtain the image-text prediction result corresponding to the image-text prediction training sample;
[0060] The prediction loss information between the image-text prediction result and the image-text prediction label is calculated, and the initial image-text prediction model is trained based on the prediction loss information. When the prediction training completion condition is met, the target image-text prediction model is obtained. The target image-text prediction model is used for cross-modal prediction using images and texts.
[0061] On the other hand, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0062] Obtain image-text prediction training samples and corresponding image-text prediction labels;
[0063] Obtain a pre-trained image-text model, and use the pre-trained image-text model as an initial image-text prediction model;
[0064] The image-text pre-training model is obtained by masking the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, inputting the target features of the training image and the target features of the training text into the initial image-text pre-training model, evaluating the image-text matching degree using the training target image features and the training target text features through the initial image-text pre-training model to obtain the initial image-text matching degree, performing cross-modal information interaction through the initial image-text pre-training model using the initial image-text matching degree, the training target image features and the training target text features to obtain the initial image interaction features and the initial text interaction features, calculating the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree to obtain the training model loss information, and training is performed based on the training model loss information;
[0065] Inputting the image-text prediction training sample into the initial image-text prediction model to obtain the image-text prediction result corresponding to the image-text prediction training sample;
[0066] The prediction loss information between the image-text prediction result and the image-text prediction label is calculated, and the initial image-text prediction model is trained based on the prediction loss information. When the prediction training completion condition is met, the target image-text prediction model is obtained. The target image-text prediction model is used for cross-modal prediction using images and texts.
[0067] On the other hand, the present application also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0068] Obtain image-text prediction training samples and corresponding image-text prediction labels;
[0069] Obtain a pre-trained image-text model, and use the pre-trained image-text model as an initial image-text prediction model;
[0070] The image-text pre-training model is obtained by masking the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, inputting the target features of the training image and the target features of the training text into the initial image-text pre-training model, evaluating the image-text matching degree using the training target image features and the training target text features through the initial image-text pre-training model to obtain the initial image-text matching degree, performing cross-modal information interaction through the initial image-text pre-training model using the initial image-text matching degree, the training target image features and the training target text features to obtain the initial image interaction features and the initial text interaction features, calculating the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree to obtain the training model loss information, and training is performed based on the training model loss information;
[0071] Inputting the image-text prediction training sample into the initial image-text prediction model to obtain the image-text prediction result corresponding to the image-text prediction training sample;
[0072] The prediction loss information between the image-text prediction result and the image-text prediction label is calculated, and the initial image-text prediction model is trained based on the prediction loss information. When the prediction training completion condition is met, the target image-text prediction model is obtained. The target image-text prediction model is used for cross-modal prediction using images and texts.
[0073] The above-mentioned image-text prediction model training method, device, computer equipment, storage medium and computer program product obtain image-text prediction training samples and corresponding image-text prediction labels, and obtain image-text pre-training models, use the image-text pre-training model as the initial image-text prediction model, input the image-text prediction training samples into the initial image-text prediction model, and obtain the image-text prediction results corresponding to the image-text prediction training samples; calculate the prediction loss information between the image-text prediction results and the image-text prediction labels, train the initial image-text prediction model based on the prediction loss information, and obtain the target image-text prediction model when the prediction training completion conditions are met. Among them, since the image-text pre-training model is obtained by evaluating the image-text matching degree, and then training through cross-modal information interaction through the image-text matching degree, the accuracy of the trained image-text pre-training model can be improved, and then the image-text pre-training model is used to further train the target image-text prediction model, thereby improving the accuracy of the target image-text prediction model, and then improving the accuracy of cross-modal prediction using images and texts. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 A diagram showing an application environment of a method for training a graphic and text pre-training model in an embodiment;
[0075] Figure 2 A schematic diagram of a flow chart of a method for training a graphic and text pre-training model in an embodiment;
[0076] Figure 3 A schematic diagram of a process for obtaining original features for training in one embodiment;
[0077] Figure 4 A schematic diagram of a process for obtaining training target features in one embodiment;
[0078] Figure 5 A schematic diagram of a process for obtaining training interaction features in one embodiment;
[0079] Figure 6 A schematic diagram of a process for obtaining a degree of image-text matching in one embodiment;
[0080] Figure 7 A schematic diagram of a flow chart for obtaining training interaction features in another embodiment;
[0081] Figure 8 A schematic diagram of a process of obtaining an initial character interaction vector in one embodiment;
[0082] Fig. 9 A schematic diagram of a process of obtaining an initial area interaction vector in one embodiment;
[0083] Fig.10 A schematic diagram of a process for obtaining a final target image-text pre-training model in one embodiment;
[0084] Fig.11 A schematic diagram of a process for obtaining loss information of a training model in one embodiment;
[0085] Fig.12 A schematic diagram of a process for obtaining image feature loss information in one embodiment;
[0086] Fig.13 A schematic diagram of a flow chart of a method for training a picture-text prediction model in an embodiment;
[0087] Fig.14 A schematic diagram of a flow chart of a method for training a graphic and text pre-training model in a specific embodiment;
[0088] Fig.15 A schematic diagram of a framework of a picture-text pre-training model in a specific embodiment;
[0089] Fig.16 It is a structural block diagram of a training device for a picture-text pre-training model in an embodiment;
[0090] Fig.17 It is a structural block diagram of a device for training a picture-text prediction model in one embodiment;
[0091] Fig.18 is an internal structure diagram of a computer device in one embodiment;
[0092] Fig.19 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION
[0093] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. 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.
[0094] Computer Vision (CV) is a science that studies how to make machines "see". To put it more specifically, it refers to machine vision such as using cameras and computers to replace human eyes to identify and measure targets, and further perform graphic processing so that computer processing becomes an image that is more suitable for human eye observation or transmission to instrument detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multi-dimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and map construction, and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition.
[0095] Natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.
[0096] The solution provided in the embodiments of the present application involves technologies such as image processing and text processing by artificial intelligence, which are specifically described by the following embodiments:
[0097] The image-text pre-training model training method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown, the terminal 102 communicates with the server 104 through a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other servers. The server 104 can obtain the original features of the training image corresponding to the training image and the original features of the training text corresponding to the training text from the data storage system according to the model training instruction sent by the terminal 102; then the server 104 performs feature masking based on the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, and inputs the target features of the training image and the target features of the training text into the initial image-text pre-training model; the server 104 uses the training target image features and the training target text features through the initial image-text pre-training model to evaluate the image-text matching degree and obtain the initial image-text matching degree; the server 104 uses the initial image-text matching degree, the training target image features and the training target text features through the initial image-text pre-training model to perform cross-modal information interaction and obtain the initial image interaction features and the initial text interaction features; the server 104 calculates the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree to obtain the training model loss information; the server 104 trains the initial image-text pre-training model based on the training model loss information until the training completion condition is met, and the target image-text pre-training model is obtained. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, aircraft, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented as an independent server or a server cluster composed of multiple servers. The embodiments of the present invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc.
[0098] In one embodiment, Figure 2 As shown, a method for training a graph-text pre-training model is provided, and the method is applied to Figure 1 The server in the example is used for explanation. It can be understood that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0099] Step 202: Obtain original features of the training image corresponding to the training image and original features of the training text corresponding to the training text.
[0100] The original features of the training images refer to the features corresponding to the objects in the training images, and the original features of the training texts refer to the features obtained after the training texts are normalized, which can be the sequences corresponding to the words in the texts.
[0101] Specifically, the server can directly obtain the original features of the training image corresponding to the training image and the original features of the training text corresponding to the training text from the database. The server can also obtain the original features of the training image and the original features of the training text uploaded by the terminal. The server can also obtain the original features of the training image and the original features of the training text from the service provider who provides the data.
[0102] In one embodiment, the server may obtain the training image and the training text from the database, and then extract the original features of the training image and the original features of the training text. The training image and the training text may be obtained by random sampling from the training text set and the training image set in the database, that is, the training image and the training text may be associated or not.
[0103] Step 204 , performing feature masking based on the original features of the training image and the original features of the training text to obtain target features of the training image and the target features of the training text, and inputting the target features of the training image and the target features of the training text into the initial image-text pre-training model.
[0104] Among them, feature masking refers to transforming the feature value in the original feature into an artificially set value. The training image target feature refers to the training image feature with masked features. The training text target feature refers to the training text feature with masked features. The initial image-text pre-training model is an image-text pre-training model with model parameters initialized, and this model needs to be pre-trained.
[0105] Specifically, the server can randomly mask the features in the original features of the training image and the original features of the training text, or mask the features at the positions in the original features of the training image and the original features of the training text according to the pre-set positions, to obtain the target features of the training image and the target features of the training text. Then, the server establishes an initial image-text pre-training model, that is, initializes the model parameters of the image-text pre-training model, which can be random initialization, zero initialization, Gaussian distribution initialization, etc. Then, the obtained target features of the training image and the target features of the training text are input into the initial image-text pre-training model for training.
[0106] In one embodiment, the server randomly selects object features from the original features of the training image, masks the randomly selected object features, and obtains the target features of the training image, and records the position of the selected object features in the original features of the training image. Then, text word features can be randomly selected from the original features of the training text, and the text word features can be masked to obtain the target features of the training text. The target features of the training image and the target features of the training text are then input into the initial image-text pre-training model for training.
[0107] Step 206 , using the initial image-text pre-training model to evaluate the image-text matching degree using the training target image features and the training target text features, to obtain an initial image-text matching degree.
[0108] The initial image-text matching degree refers to the matching degree between the training image and the training text obtained during training.
[0109] Specifically, the initial image-text pre-training model in the server uses the initial image-text matching degree evaluation parameters to evaluate the image-text matching degree of the training target image features and the training target text features to obtain the initial image-text matching degree. The initial image-text matching degree evaluation parameters are the model parameters used during training.
[0110] Step 208 , using the initial image-text pre-training model to perform cross-modal information interaction using the initial image-text matching degree, the training target image features, and the training target text features, to obtain initial image interaction features and initial text interaction features.
[0111] Among them, cross-modal information interaction refers to making the information of the training image interact with the information of the training text. The initial image interaction feature refers to the training image feature with text information obtained during training. The initial text interaction feature refers to the training text feature with image information obtained during training. The initial image interaction feature and the initial text interaction feature are complete features corresponding to the predicted training image and training text.
[0112] Specifically, the server uses the training target image features and the training target text features through the initial image-text pre-training model to extract cross-attention features, and then uses the initial image-text matching degree to perform weighted calculation on the extracted cross-attention features to obtain initial image interaction features and initial text interaction features. When the matching degree between the training image and the training text is high, the interaction between the image modality and the text modality is strengthened, and when the matching degree between the training image and the training text is weak, the interaction between the image modality and the text modality is reduced.
[0113] Step 210 , calculate the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial picture matching degree to obtain the training model loss information.
[0114] Specifically, the server calculates the error between the original features of the training image and the interactive features of the initial image, calculates the error between the original features of the training text and the interactive features of the initial image, then calculates the error of the matching degree of the initial image, and finally calculates the sum of all errors to obtain the training model loss information.
[0115] Step 212, train the initial image-text pre-training model based on the training model loss information until the training completion condition is met, and obtain the target image-text pre-training model, which is used to train a model for cross-modal prediction based on images and texts.
[0116] The target image and text pre-training model refers to the model obtained when the training is completed. The training completion condition refers to the condition for obtaining the target image and text pre-training model through training, including but not limited to the number of training iterations reaching the maximum number of iterations, the model loss information reaching the preset threshold, and the model parameters no longer changing.
[0117] Specifically, the server uses the training model loss information to update the model parameters in the initial image-text pre-training model to obtain the updated image-text pre-training model, and then uses the updated image-text pre-training model as the initial image-text pre-training model and performs the next iteration, that is, the server returns the step of iteratively executing the steps of obtaining the original features of the training image corresponding to the training image and the original features of the training text corresponding to the training text, and can also return the step of performing feature masking based on the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, and iteratively executing the step of inputting the target features of the training image and the target features of the training text into the initial image-text pre-training model until the training completion condition is met, and the initial image-text pre-training model when the training completion condition is met is used as the target image-text pre-training model, and the target image-text pre-training model is used to train a model for cross-modal prediction based on images and texts.
[0118] The above-mentioned image-text pre-training model training method inputs the training image target features and the training text target features into the initial image-text pre-training model, uses the training target image features and the training target text features to evaluate the image-text matching degree through the initial image-text pre-training model to obtain the initial image-text matching degree, and uses the initial image-text matching degree, the training target image features and the training target text features through the initial image-text pre-training model to perform cross-modal information interaction to obtain initial image interaction features and initial text interaction features, and then calculates the training model loss information, and uses the training model loss information to train the initial image-text pre-training model until the training completion condition is met to obtain the target image-text pre-training model, wherein the image-text matching degree is evaluated and then the image-text matching degree is used to perform cross-modal information interaction to train the image pre-training model, so that the accuracy of the trained image-text pre-training model can be improved, and then the accuracy of the model trained for cross-modal prediction based on images and texts can be improved.
[0119] In one embodiment, Figure 3 As shown, step 202, obtaining the original features of the training image corresponding to the training image and the original features of the training text corresponding to the training text, includes:
[0120] Step 302, obtaining training samples, where the training samples include training images and training texts;
[0121] Step 304 , performing character-level text translation on the training text to obtain a full representation vector of the training text and a character representation vector of the training text, and obtaining original features of the training text based on the full representation vector of the training text and the character representation vector of the training text.
[0122] The training sample refers to the sample used in training, which can be randomly selected from the training image set and the training text set. The training text full representation vector is used to represent the global information of the training text. The training text character representation vector refers to the representation vector corresponding to the word in the training text. Each word in the training text can have a corresponding training text character representation vector.
[0123] Specifically, the server can randomly select training samples from a training sample set from a database, and the training sample set can be obtained by randomly selecting training images and training texts from a training image set and a training text set. The server then performs character-level text translation on the training text to obtain a full representation vector of the training text and a character representation vector of the training text, wherein the server can use a text translation model to perform character-level text translation, and the text translation model can be a vectorization model, such as a BERT (Bidirectional Encoder Representation from Transformers) text vectorization model. The full representation vector of the training text and the character representation vector of the training text are then concatenated in sequence according to the order of the words in the text to obtain the original features of the training text.
[0124] In a specific embodiment, the server may use a standard model token to tokenize a text sentence into a sequence of subword tokens to obtain the original features of the training text.
[0125] Step 306, classify and identify the target object based on the training image, obtain the full representation vector of the training image, the training object category representation vector and the training object region representation vector, and obtain the original features of the training image based on the training object category representation vector and the training object region representation vector.
[0126] The training image full representation vector is used to represent the global information corresponding to the training image. The training object category representation vector refers to the representation vector corresponding to the category of the object in the training image. The training object region representation vector refers to the representation vector corresponding to the image region where the object is located in the training image.
[0127] Specifically, the server uses the image target object detection model to detect the target object of the training image, that is, to classify and identify the target object, obtain the training object category representation vector and the training object region representation vector, and determine the full representation vector of the training image. If there are multiple target objects in the training image, multiple training object category representation vectors and the training object region representation vector corresponding to each training object category representation vector are obtained. Then the training object category representation vector and the training object region representation vector are spliced to obtain the original features of the training image.
[0128] In a specific embodiment, the server may use a target detector, such as Faster RCNN (image target detection model), to extract multiple target object frames, and extract category information of the target objects as image object labels, obtain a training object category representation vector based on the image object labels, and determine a training object region representation vector based on the target object frames.
[0129] In the above embodiment, the original features of the training text and the original features of the training image are obtained by performing text translation and image recognition, thereby improving the accuracy of the obtained original features of the training text and the original features of the training image.
[0130] In one embodiment, Figure 4 As shown, step 204, performing feature masking based on the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, includes:
[0131] Step 402, randomly determining a current character representation vector from the training text character representation vectors contained in the original features of the training text;
[0132] Step 404: replace the current character representation vector in the original feature of the training text with a preset text mask vector to obtain the target feature of the training text.
[0133] The current character representation vector refers to the character representation vector corresponding to the word to be masked. The preset text masking vector is a pre-set vector used to mask the words in the training text, and the vector may be an all-zero vector.
[0134] Specifically, the server randomly selects a training text character representation vector from the training text character representation vectors contained in the original features of the training text as the vector to be masked, that is, obtains the current character representation vector, and then replaces the current character representation vector in the original features of the training text with a preset text masking vector, while other vectors in the original features of the training text remain unchanged, thereby obtaining the target features of the training text.
[0135] Step 406 : randomly determine a current object category representation vector and a current object region representation vector from the training object category representation vector and the training object region representation vector included in the target features of the training image.
[0136] Step 408: Replace the current object category representation vector in the training image target feature with a preset image object mask vector, and replace the current object region representation vector in the training image target feature with a preset image region mask vector to obtain the training image target feature.
[0137] Among them, the current object category representation vector refers to the category representation vector of the object that needs to be masked in the training image. The current object region representation vector refers to the region representation vector of the object that needs to be masked in the training image. The current object region representation vector corresponds to the current object category representation vector, and is the category representation vector and region representation vector of the same object in the training image. The preset image object masking vector refers to a pre-set vector for masking the object category representation vector in the training image, which can be an all-zero vector. The preset image region masking vector refers to a pre-set vector for masking the object region representation vector in the training image, which can be an all-zero vector.
[0138] Specifically, the server randomly selects the current object category representation vector from the training object category representation vector contained in the training image target feature, and selects the training object region representation vector corresponding to the current object category representation vector from the training object region representation vector contained in the training image target feature as the current object region representation vector. The server then replaces the current object category representation vector in the training image target feature with a preset image object masking vector, and other object category representation vectors in the training image target feature remain unchanged. Then the current object region representation vector in the training image target feature is replaced with a preset image region masking vector, and other object region representation vectors in the training image target feature remain unchanged, thereby obtaining the training image target feature.
[0139] In the above embodiment, the original features of the training text and the original features of the training image are randomly masked by using a preset masking vector, thereby improving the efficiency of obtaining the target features of the training text and the target features of the training image.
[0140] In one embodiment, Figure 5 As shown, step 206, using the initial image-text pre-training model to evaluate the image-text matching degree using the training target image features and the training target text features, to obtain the initial image-text matching degree, includes:
[0141] Step 502, extracting self-attention features from the training target image features through the initial image-text pre-training model to obtain initial image self-attention features;
[0142] Step 504: extract self-attention features from the training target text features through the initial image-text pre-training model to obtain initial text self-attention features.
[0143] The initial image self-attention feature refers to the image feature extracted by self-attention during training. The initial text self-attention feature refers to the text feature extracted by self-attention during training.
[0144] Specifically, the initial image-text pre-training model in the server performs self-attention feature extraction on the training target image features through the image self-attention layer to obtain the initial image self-attention features, and performs self-attention feature extraction on the training target text features through the text self-attention layer to obtain the initial text self-attention features, wherein the image self-attention layer and the text self-attention layer have the same layer structure and the same initialization parameters. In one embodiment, the initialization parameters of the image self-attention layer and the text self-attention layer may also be different.
[0145] Step 506, using the initial image-text pre-training model to evaluate the matching degree of the initial image self-attention feature and the initial text self-attention feature, to obtain the training image-text matching degree.
[0146] Specifically, the server evaluates the matching degree of the initial image self-attention features and the initial text self-attention features through the matching degree evaluation layer in the initial image-text pre-training model to obtain the matching degree of the training image and text.
[0147] Step 208, i.e., performing cross-modal information interaction using the initial image-text matching degree, the training target image features, and the training target text features through the initial image-text pre-training model, to obtain initial image interaction features and initial text interaction features, includes:
[0148] Step 508, using the initial image-text pre-training model to perform cross-modal information interaction using the training image-text matching degree, the initial image self-attention feature and the initial text self-attention feature, to obtain the training image interaction feature and the training text interaction feature.
[0149] Specifically, the server can use the training image-text matching degree, initial image self-attention features and initial text self-attention features to perform cross-modal information interaction through the cross-modal information interaction layer to obtain the output of the cross-modal information interaction layer, namely, the training image interaction features and the training text interaction features.
[0150] In the above embodiment, the initial image and text pre-training model in the server first extracts self-attention features, and then uses the self-attention features to perform matching degree evaluation and cross-modal information interaction, thereby improving the accuracy of matching degree evaluation and cross-modal information interaction.
[0151] In one embodiment, the initial image-text pre-training model includes an initial image-text prediction network, and the initial image-text prediction network includes an initial image self-attention network, an initial text self-attention network, and an initial matching network;
[0152] Step 206, i.e., evaluating the image-text matching degree using the training target image features and the training target text features through the initial image-text pre-training model to obtain the initial image-text matching degree, includes:
[0153] Input the target image features into the initial image self-attention network in the initial image-text pre-training model to extract self-attention features, and obtain the initial image self-attention features;
[0154] Input the target text features into the initial text self-attention network in the initial image-text pre-training model to extract self-attention features, and obtain the initial text self-attention features;
[0155] The initial image full-quantity representation vector in the initial image self-attention feature and the initial text full-quantity representation vector in the initial text self-attention feature are input into the initial matching network in the initial image-text pre-training model to evaluate the matching degree and obtain the image-text matching degree.
[0156] Among them, the initial image-text prediction network refers to the image-text prediction network with initialized network parameters, which is used to predict the masked content in the input data. The initial image self-attention network is the image self-attention network during training, which is used to extract self-attention features from images. The initial text self-attention network is the text self-attention network during training, which is used to extract self-attention features from text. The initial matching network refers to the matching network during training, which is used to evaluate the matching degree.
[0157] Specifically, the server extracts self-attention features in parallel through the initial image self-attention network and the initial image self-attention network in the initial image-text pre-training model to obtain the initial image self-attention features and the initial text self-attention features, that is, the initial image self-attention network and the initial image self-attention network are two branch networks in the initial image-text pre-training model. Then, the initial image full-quantity representation vector in the initial image self-attention feature and the initial text full-quantity representation vector in the initial text self-attention feature are input into the initial matching network in the initial image-text pre-training model to evaluate the matching degree and obtain the image-text matching degree. By using the initial image full-quantity representation vector and the initial text full-quantity representation vector to evaluate the matching degree, the accuracy of the image-text matching degree is improved.
[0158] In one embodiment, the initial image self-attention features and the initial text self-attention features can also be directly input into the initial matching network to evaluate the matching degree, thereby obtaining the image-text matching degree, thereby further improving the accuracy of the obtained image-text matching degree.
[0159] In one embodiment, Figure 6As shown, step 508 is to input the initial image full-quantity representation vector in the initial image self-attention feature and the initial text full-quantity representation vector in the initial text self-attention feature into the initial matching network in the initial image-text pre-training model to evaluate the matching degree, and obtain the image-text matching degree, including:
[0160] Step 602, inputting the initial image full quantity representation vector in the initial image self-attention feature and the initial text full quantity representation vector in the initial text self-attention feature into the initial matching network in the initial image-text pre-training model;
[0161] Step 604: weight the initial image full-quantity representation vector and the initial text full-quantity representation vector respectively through the initial matching network to obtain a weighted image representation vector and a weighted text representation vector.
[0162] Specifically, the server uses the weight parameters that need to be trained in the initial matching network to weight the initial image full representation vector and the initial text full representation vector, wherein the initial image full representation vector is weighted using the image weight parameters in the initial matching network, and the initial text full representation vector is weighted using the text weight parameters summarized by the initial matching network, thereby obtaining a weighted image representation vector and a weighted text representation vector.
[0163] Step 606: Calculate the vector sum of the weighted image representation vector and the weighted text representation vector through the initial matching network to obtain a matching degree vector.
[0164] Specifically, the matching degree vector is a vector used to characterize the matching degree between the training image and the training text. The server obtains the matching degree vector by calculating the vector sum of the weighted image representation vector and the weighted text representation vector. In one embodiment, after obtaining the vector sum, the server adds the vector sum to the bias parameter in the initial matching network to obtain the matching degree vector.
[0165] Step 608: Activate the matching degree vector through the initial matching network to obtain the image-text matching degree.
[0166] Specifically, the server can use an activation function to activate the matching degree vector, that is, to limit the weight of the matching degree vector to [0, 1]. The closer to 0, the weaker the matching degree between the training image and the training text, and the closer to 1, the stronger the matching degree between the training image and the training text. The activation function can use an S-type function, such as a Sigmoid function.
[0167] In a specific embodiment, the degree of image-text matching is calculated using the formula (1) shown below.
[0168] α=σ(W αw qw +W αr q r +b) Formula (1)
[0169] Among them, α refers to the degree of image-text matching. w and b are learnable parameters in the initial matching network. αw Refers to the text weight parameter. q w Refers to the initial image full quantity representation vector. Refers to W αr Refers to the image weight parameter. q r refers to the full representation vector of the initial image, and σ(·) refers to the Sigmoid function.
[0170] In the above embodiment, the matching degree between the training image and the training text is evaluated by using the initial matching network, so that the obtained image-text matching degree can be made more accurate.
[0171] In one embodiment, the initial image-text pre-training model includes an initial image-text prediction network, and the initial image-text prediction network includes an initial image spanning attention network and an initial text spanning attention network;
[0172] like Figure 7 As shown, step 508, i.e., performing cross-modal information interaction using the training image-text matching degree, the initial image self-attention feature and the initial text self-attention feature through the initial image-text pre-training model to obtain the training image interaction feature and the training text interaction feature, includes:
[0173] Step 702: Input the initial text full-quantity representation vector in the initial text self-attention feature and the initial category self-attention vector and the initial region self-attention vector in the initial image self-attention feature into the initial text cross-attention network for cross-modal information interaction to obtain the initial text full-quantity interaction vector.
[0174] Among them, the initial text spanning attention network refers to the text spanning attention network that needs to be trained, and the text spanning attention network is used to extract the full text representation vector with image information.
[0175] Specifically, the server inputs the initial text full representation vector, the initial category self-attention vector, and the initial region self-attention vector into the initial text cross-attention network for cross-modal information interaction, that is, the scaled dot-product attention operation is performed on the initial text full representation vector, the initial category self-attention vector, and the initial region self-attention vector through the scaled dot-product attention mechanism of the cross-attention network, and the initial text full interaction vector is output.
[0176] In a specific embodiment, the server may use formula (2) shown below to calculate the initial text full interaction vector.
[0177]
[0178] in, refers to the initial text full-volume interaction vector, Att(·) refers to the scaled point multiplication attention mechanism, q w It refers to the initial text full quantity representation vector, {r1,r2,...,r N} refers to the N (positive integer) vectors in the initial image self-attention features except the initial image full-quantity representation vector, including each initial category self-attention vector and the corresponding initial region self-attention vector.
[0179] Step 704, based on the degree of matching between the training image and text and the full interaction feature of the initial text, the initial character self-attention vector in the initial text self-attention feature is updated to obtain the initial character interaction vector, and the training text interaction feature is obtained based on the full interaction vector of the initial text and the initial character interaction vector.
[0180] Specifically, the server uses the degree of training image-text matching to gate the initial character self-attention vector, that is, the initial character self-attention vector in the initial text self-attention feature is weighted updated using the training image-text matching degree and the initial text full interaction feature to obtain an updated initial character interaction vector, and finally the training text interaction feature is obtained based on the updated initial character interaction vector and the initial text full interaction vector.
[0181] Step 706: Input the initial image full-quantity representation vector and the initial character self-attention vector into the initial image cross-attention network for cross-modal information interaction to obtain the initial image full-quantity interaction vector.
[0182] The initial image spanning attention network refers to an image spanning attention network that needs to be trained, and the image spanning attention network is used to extract a full representation vector of an image with text information.
[0183] Specifically, the server inputs the initial image full representation vector and the initial character self-attention vector into the initial image cross-attention network for cross-modal information interaction, that is, the scaled dot product attention operation is performed on the initial image full representation vector and the initial character self-attention vector through the scaled dot product attention mechanism (scaled dot-product attention) of the cross-attention network to output the initial image full interaction vector.
[0184] In a specific embodiment, the server may use the formula (3) shown below to calculate the initial image full-quantity interaction vector.
[0185]
[0186] in, refers to the initial image full-scale interaction vector, Att(·) refers to the scaled point multiplication attention mechanism, q r It refers to the initial image full quantity representation vector, {w1,w2,...,w T} refers to the vector in the initial text self-attention feature except the initial text full-quantity representation vector, including T (positive integer) initial character self-attention vectors.
[0187] Step 708, based on the degree of matching between the training image and text and the full interaction vector of the initial image, the initial category self-attention vector and the initial region self-attention vector are updated respectively to obtain the initial category interaction vector and the initial region interaction vector, and the training image interaction features are obtained based on the full interaction vector of the initial image, the initial category interaction vector and the initial region interaction vector.
[0188] Specifically, the server uses the degree of training image-text matching to gate the initial category self-attention vector and the initial region self-attention vector, that is, the initial category self-attention vector and the initial region self-attention vector are weighted updated using the training image-text matching degree and the full interaction features of the initial image to obtain updated initial category interaction vectors and initial region interaction vectors, and finally the training image interaction features are obtained based on the updated initial category interaction vectors, initial region interaction vectors and the full interaction vector of the initial image.
[0189] In one embodiment, the initial image-text prediction network includes an initial image self-attention network, an initial text self-attention network, an initial matching network, an initial image spanning attention network, and an initial text spanning attention network. The training target image features and the training target text features are input into the initial image-text prediction network, and the masked content is predicted by the initial image self-attention network, the initial text self-attention network, the initial matching network, the initial image spanning attention network, and the initial text spanning attention network, and the predicted results, namely the training image interaction features and the training text interaction features, are output.
[0190] In the above embodiment, the accuracy of cross-modal information interaction is improved by using an image cross-attention network and a text cross-attention network to interact with cross-modal information.
[0191] In one embodiment, Figure 8As shown, step 704 updates the initial character self-attention vector in the initial text self-attention feature based on the training image-text matching degree and the initial text full-quantity interaction feature to obtain the initial character interaction vector, including:
[0192] Step 802: weight the initial character self-attention vector using the training image-text matching degree to obtain a weighted character self-attention feature.
[0193] Specifically, the server calculates the product of the training image-text matching degree and the initial character self-attention vector to obtain a weighted character self-attention vector, that is, a weighted character self-attention feature.
[0194] Step 804, calculate the weight of the full interactive feature based on the matching degree of the training image and text to obtain the weight of the full interactive feature, and use the weight of the full interactive feature to weight the full interactive feature of the initial text to obtain the weighted full interactive feature of the text.
[0195] Among them, the full interaction feature weight is the weight used to weight the full interaction features. It can be used to weight the full interaction features of texts or the full interaction features of images.
[0196] Specifically, the sum of the training image-text matching degree and the weight of the full interactive feature is the target value, which can be preset, for example, 1. At this time, the difference between the target value and the training image-text matching degree is calculated to obtain the full interactive feature weight, and then the product of the full interactive feature weight and the initial text full interactive feature is calculated to obtain the weighted text full interactive feature, that is, the weighted text full interactive feature.
[0197] Step 806, calculate the feature sum of the weighted character self-attention feature and the weighted text full-quantity interaction feature to obtain an initial character interaction vector.
[0198] Specifically, the server adds the weighted character self-attention feature to the weighted text full interaction feature to obtain an initial character interaction vector.
[0199] In a specific embodiment, the server calculates the initial character interaction vector using formula (4) shown below.
[0200]
[0201] in, refers to the tth initial character interaction vector, a refers to the degree of matching between training images and texts, Refers to the initial text full-volume interaction vector. t refers to the t-th initial character self-attention vector.
[0202] In the above embodiment, the initial character self-attention vector is weighted by using the degree of training image-text matching, and the full interaction feature weight is used to weight the full interaction feature of the initial text, so as to obtain the final initial character interaction vector, which can improve the accuracy of the obtained initial character interaction vector.
[0203] In one embodiment, Fig. 9 As shown, step 708, based on the training image-text matching degree and the initial image full amount interaction vector, the initial category self-attention vector and the initial region self-attention vector are updated respectively to obtain the initial category interaction vector and the initial region interaction vector, including:
[0204] Step 902, weighting the initial category self-attention vector using the degree of training image-text matching to obtain a weighted category self-attention feature, and weighting the initial region self-attention vector using the degree of training image-text matching to obtain a weighted region self-attention feature.
[0205] Specifically, the server directly calculates the product of the degree of matching between the training image and text and the initial category self-attention vector and the initial region self-attention vector to obtain the weighted category self-attention feature and the weighted region self-attention feature.
[0206] Step 904, calculate the weight of the full interaction feature based on the matching degree of the training image and text to obtain the full interaction feature weight, and use the full interaction feature weight to weight the full interaction vector of the initial image to obtain the weighted image full interaction feature.
[0207] Specifically, the server obtains the set target value, calculates the difference between the target value and the degree of matching between the training image and text, obtains the right interaction feature weight, and then calculates the product of the full interaction feature weight and the full interaction vector of the initial image to obtain the weighted image full interaction feature.
[0208] Step 906, calculate the feature sum of the weighted category self-attention feature and the weighted image full interaction feature to obtain an initial category interaction vector, calculate the feature sum of the weighted region self-attention feature and the weighted image full interaction feature to obtain an initial region interaction vector.
[0209] Specifically, the server adds the weighted category self-attention feature and the weighted image full interaction feature, and then weights the weighted region self-attention feature and the weighted image full interaction feature to obtain an initial category interaction vector and an initial region interaction vector corresponding to the initial category interaction vector.
[0210] In a specific embodiment, the server calculates the initial category interaction vector or the initial region interaction vector using formula (5) shown below.
[0211]
[0212] in, It refers to the nth vector in the training image interaction feature except the initial image full interaction vector. It can be the initial category interaction vector or the initial region interaction vector. a refers to the matching degree of the training image and text. Refers to the initial image full amount interaction vector. n It refers to the nth vector in the initial text self-attention feature except the initial image full-quantity representation vector, which can be the initial category self-attention vector or the initial region self-attention vector.
[0213] In the above embodiment, the initial category self-attention vector and the initial region self-attention vector are weighted respectively according to the degree of training image-text matching, and the initial image full interaction vector is weighted by using the full interaction feature weight to obtain the weighted image full interaction feature, thereby obtaining the initial category interaction vector and the initial distinction interaction vector, thereby improving the accuracy of the obtained interaction vector.
[0214] In one embodiment, the initial image-text pre-training model includes at least two initial image-text prediction networks, and the at least two initial image-text prediction networks are connected end to end;
[0215] like Fig.10 As shown, the image pre-training model training method also includes:
[0216] Step 1002, obtaining the forward training image interaction features and the forward training text interaction features output by the forward initial image-text prediction network,
[0217] Step 1004, input the forward training image interaction features and the forward training text interaction features into the backward initial image-text prediction network to obtain output backward training image interaction features and backward training text interaction features.
[0218] Among them, the network structures of the forward initial image-text prediction network and the backward initial image-text prediction network are exactly the same, but the network parameters are different. The network order is the forward initial image-text prediction network first, and the backward initial image-text prediction network later, that is, the data input to the model first passes through the forward initial image-text prediction network for network calculation, and after obtaining the output result of the forward initial image-text prediction network, the output result of the forward initial image-text prediction network passes through the backward initial image-text prediction network for network calculation.
[0219] Specifically, the server establishes an initial image-text pre-training model including at least two initial image-text prediction networks, that is, each initial image-text prediction network is connected end to end in turn to obtain an initial image-text pre-training model, wherein each initial image-text prediction network can include an initial image self-attention network, an initial text self-attention network, an initial matching network, an initial image spanning attention network and an initial text spanning attention network.
[0220] During training, the server inputs the training image target features and the training text target features into the initial image-text pre-training model. The initial image-text pre-training model performs image-text prediction through the first initial image-text prediction network, outputs the training image interaction features and the training text interaction features, and then uses the first initial image-text prediction network as the forward initial image-text prediction network to obtain the output training image interaction features and as the forward training image interaction features, and obtain the output training text interaction features as the forward training text interaction features. The forward training image interaction features and the forward training text interaction features are then input into the next initial image-text prediction network, i.e., the backward initial image-text prediction network, to obtain the output backward training image interaction features and backward training text interaction features.
[0221] Step 1006, using the backward initial image-text prediction network as the forward initial image-text prediction network, and returning to the step of obtaining the forward training image interaction features and the forward training text interaction features output by the forward initial image-text prediction network, until there is no backward image-text prediction network, the forward training image interaction features when there is no backward image-text prediction network are used as the final training image interaction features, and the forward training text interaction features when there is no backward image-text prediction network are used as the final training text interaction features.
[0222] The absence of a backward image-text prediction network means that there is no next initial image-text prediction network in the initial image-text pre-training model, that is, the input data has been predicted by the last initial image-text prediction network.
[0223] Specifically, the server then inputs the output result into the next initial image-text prediction network, that is, the backward initial image-text prediction network is used as the forward initial image-text prediction network, and the output backward training image interaction features and backward training text interaction features are used as the forward training image interaction features and forward training text interaction features, and returns to the step of obtaining the forward training image interaction features and forward training text interaction features output by the forward initial image-text prediction network for iterative execution until all the initial image-text prediction networks are passed, and the training image interaction features output by the last initial image-text prediction network are used as the final training image interaction features, and the training text interaction features are used as the final training text interaction features.
[0224] Step 1008, based on the original features of the training image, the original features of the training text, the final training image interaction features, and the final training text interaction features, feature loss is calculated to obtain final training feature loss information, and the similarity between the training image and the training text is calculated, and matching loss is calculated based on the similarity and the final image-text matching degree without the backward image-text prediction network to obtain final training matching loss information.
[0225] The final image-text matching degree without the backward image-text prediction network refers to the image-text matching degree calculated by the last image-text prediction network.
[0226] Specifically, the server uses the final output of the final training image interaction features and the final training text interaction features to calculate the loss with the original features of the training image and the original features of the training text, respectively, to obtain the final training feature loss information, and then calculates the similarity between the training image and the training text, and calculates the matching loss based on the similarity and the final image-text matching degree without the backward image-text prediction network, to obtain the final training matching loss information.
[0227] Step 1010, training the initial image-text pre-training model based on the final training feature loss information and the final training matching loss information until the final training completion condition is met, thereby obtaining the final target image-text pre-training model.
[0228] Specifically, the server uses the final training feature loss information and the final training matching loss information to reversely update each initial image-text prediction network in the initial image-text pre-training model through the gradient descent algorithm to obtain an updated image-text pre-training model. The updated image-text pre-training model is used as the initial image-text pre-training model, and the next iteration is performed, that is, the server returns the steps of obtaining the original features of the training image corresponding to the training image and the original features of the training text corresponding to the training text, and iteratively executes it. It can also return to perform feature masking based on the original features of the training image and the original features of the training text, obtain the target features of the training image and the target features of the training text, and iteratively execute the steps of inputting the target features of the training image and the target features of the training text into the initial image-text pre-training model until the final training completion condition is reached, and the initial image-text pre-training model when the final training completion condition is reached is used as the final target image-text pre-training model. The final training completion condition refers to the training completion condition of the final target image-text pre-training model, including but not limited to the number of training iterations reaching the maximum number of iterations, the model loss information reaching the preset final threshold, and the model parameters no longer changing.
[0229] In the above embodiment, an initial image-text pre-training model is established by using at least two initial image-text prediction networks, and then the established initial image-text pre-training model is trained to obtain a final target image-text pre-training model, which can further improve the accuracy of the final target image-text pre-training model.
[0230] In one embodiment, Fig.11 As shown, step 210, based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial picture matching degree, the model loss calculation is performed to obtain the training model loss information, including the steps of:
[0231] Step 1102, performing feature loss calculation based on the original features of the image, the original features of the text, the image interaction features, and the text interaction features to obtain feature loss information;
[0232] Step 1104, calculating the similarity between the training image and the training text, performing loss calculation based on the similarity and the image-text matching degree, and obtaining matching loss information;
[0233] Step 1106, calculate the sum of feature loss information and matching loss information to obtain training model loss information.
[0234] The feature loss information is used to characterize the error between the original feature and the interactive feature, and the matching loss information is used to characterize the error between the similarity between the training image and the training text and the image-text matching degree.
[0235] Specifically, the server can use a preset image loss function to calculate the error between the original features of the image and the interactive features of the image to obtain image feature loss information, and then use a preset text loss function to calculate the error between the original features of the text and the interactive features of the text to obtain text feature loss information, and then calculate the sum of the image feature loss and the text feature loss to obtain feature loss information. The server then calculates the similarity between the training image and the training text, and uses a preset matching loss function to calculate the error between the similarity and the image-text matching degree to obtain matching loss information.
[0236] In one embodiment, step 1102, performing feature loss calculation based on original image features, original text features, image interaction features, and text interaction features to obtain feature loss information includes the following steps:
[0237] Calculate the cross entropy error between the original features of the image and the image interaction features to obtain the image feature loss information; calculate the cross entropy error between the original features of the text and the text interaction features to obtain the text feature loss information; calculate the sum of the image feature loss information and the text feature loss information to obtain the feature loss information.
[0238] Specifically, the server uses the cross-entropy loss function to calculate the error between the original feature and the interaction feature, and then calculates the sum of all errors to obtain the feature loss information. For example, the cross-entropy loss can be used as the cross-entropy loss function to calculate the cross-entropy error.
[0239] In one embodiment, Fig.12 As shown, the cross entropy error between the original features of the image and the image interaction features is calculated to obtain the image feature loss information, including:
[0240] Step 1202 , obtaining a target object category representation vector from the original features of the image according to a preset category replacement position, and obtaining a target object region representation vector from the original features of the image according to a preset region replacement position.
[0241] The preset category replacement position refers to the preset vector position corresponding to the image category to be masked. The preset area replacement position refers to the preset vector position of the image area corresponding to the image category to be masked. The target object category representation vector refers to the original representation vector of the image category to be masked before masking. The target object area representation vector refers to the original representation vector of the image area to be masked before masking.
[0242] Specifically, the server determines the target object category representation vector before masking from the original features of the image according to the preset category replacement position, and at the same time, determines the target object region representation vector before masking from the original features of the image according to the preset region replacement position.
[0243] Step 1204 , obtaining a target object category interaction vector from the image interaction feature according to the preset category replacement position, and obtaining a target object region interaction vector from the image interaction feature according to the preset category replacement position.
[0244] The target object category interaction vector refers to the representation vector of the image category to be masked after masking, and the target object region interaction vector refers to the representation vector of the image region to be masked after masking.
[0245] Specifically, the server determines the vector corresponding to the preset category replacement position from the image interaction feature to obtain the target object category interaction vector. At the same time, the server determines the vector corresponding to the preset category replacement position from the image interaction feature to obtain the target object region interaction vector.
[0246] Step 1206, calculate the cross entropy error between the target object category representation vector and the target object category interaction vector to obtain category vector loss information, and calculate the cross entropy error between the target object region representation vector and the target object region interaction vector to obtain region vector loss information.
[0247] Specifically, the server uses the cross entropy loss function to calculate the error between the target object category representation vector and the target object category interaction vector, that is, to obtain category vector loss information, which is used to characterize the error between the category representation vector before masking and the category representation vector predicted after masking. At the same time, the cross entropy loss function is used to calculate the error between the target object region representation vector and the target object region interaction vector, to obtain region vector loss information, which is used to characterize the error between the object region representation vector before masking and the object region representation vector predicted after masking.
[0248] Step 1208, calculate the sum of the category vector loss information and the region vector loss information to obtain the image vector loss information, and use the image vector loss information as the image feature loss information.
[0249] Specifically, the server adds the class vector loss information and the region vector loss information to obtain the image vector loss information, which is used to characterize the error between the original vector and the predicted vector at the masked position. The server uses the image vector loss information as the image feature loss information, thereby improving the accuracy of the obtained image feature loss information.
[0250] In one embodiment, the cross entropy error between the original features of the text and the interactive features of the text is calculated to obtain text feature loss information, including:
[0251] Based on the preset text replacement position, a target character representation vector replaced by a preset text masking vector is obtained from the original text features; and based on the preset text replacement position, a target character interaction vector is obtained from the text interaction features; the cross entropy error between the target character representation vector and the target character interaction vector is calculated to obtain text vector loss information, and the replacement vector loss information is used as text feature loss information.
[0252] The preset text replacement position refers to the position of the word to be masked in the pre-set text. The target character representation vector refers to the original vector before the target character is masked. The target character interaction vector refers to the vector predicted after the target character is masked.
[0253] Specifically, the server determines the vector corresponding to the preset text replacement position from the original text features to obtain the target character representation vector, and determines the vector corresponding to the preset text replacement position from the text interaction features to obtain the target character interaction vector.
[0254] In one embodiment, step 1104, i.e., calculating the similarity between the training image and the training text, performing loss calculation based on the similarity and the image-text matching degree, and obtaining matching loss information, includes the following steps:
[0255] The training image and the training text are respectively input into the trained semantic feature extraction model to obtain the semantic features of the training image and the semantic features of the training text; the model similarity between the semantic features of the training image and the semantic features of the training text is calculated; the minimum square error between the model similarity and the image-text matching degree is calculated to obtain the matching loss information.
[0256] The semantic feature extraction model refers to a model used to extract semantic features and is pre-trained.
[0257] Specifically, the server inputs the training image and the training text into the trained semantic feature extraction model respectively. For example, the semantic feature extraction model can be a neural network model trained using the BERT algorithm. The semantic feature extraction model extracts the semantic features corresponding to the training image to obtain the semantic features of the training image. The semantic feature extraction model extracts the semantic features corresponding to the training text to obtain the semantic features of the training text. Then, a similarity algorithm is used to calculate the similarity between the semantic features of the training image and the semantic features of the training text to obtain the model similarity. The similarity algorithm can be a Euclidean distance similarity algorithm, a cosine similarity algorithm, etc. Then, the minimum square error is used to calculate the error between the model similarity and the image-text matching degree to obtain the matching loss information.
[0258] In the above embodiment, semantic features are extracted by using a trained semantic feature extraction model, and then the model similarity between the semantic features is calculated. The matching loss information is obtained by calculating the minimum square error between the model similarity and the image-text matching degree, thereby improving the accuracy of the obtained matching loss information.
[0259] In one embodiment, step 1104, i.e., calculating the similarity between the training image and the training text, performing loss calculation based on the similarity and the image-text matching degree, and obtaining matching loss information, includes the following steps:
[0260] Obtaining training object category information corresponding to the training image, and calculating a category weight vector corresponding to the training object category information;
[0261] Calculate the word weight vector based on the training text to obtain the word weight vector, and calculate the weight vector similarity between the category weight vector and the word weight vector;
[0262] Calculate the minimum square error between the similarity of the weight vector and the image-text matching degree to obtain the matching loss information.
[0263] Specifically, the server can also use the TD-IDF (term frequency-inverse document frequency) algorithm to calculate the similarity between the training image and the training text. That is, by calculating the category weight vector corresponding to the training object category information, then calculating the weight vectors of each word in the training text, and then calculating the weight vector similarity between the category weight vector and the word weight vector, and calculating the minimum square error between the weight vector similarity and the image-text matching degree to obtain the matching loss information.
[0264] In a specific embodiment, the server may use formula (6) shown below to calculate the matching loss information.
[0265]
[0266] Among them, L match refers to the matching loss information, a refers to the degree of image-text matching, and s refers to the similarity between the training text and the training image.
[0267] In a specific embodiment, the server may use formula (7) shown below to calculate the training model loss information.
[0268] L total =L MLM +λ1(L MTM +L MRM )+λ2L match Formula (7)
[0269] Among them, L total Refers to the training model loss information, L MLM refers to the text feature loss information, L MTM refers to the category vector loss information, L MRM Region vector loss information, L match Refers to the matching loss information. λ1 refers to the coefficient that weighs the visual information and text information, and λ2 refers to the coefficient that controls the matching degree loss.
[0270] In the above embodiment, the loss information corresponding to the training image and the loss information corresponding to the training text are calculated to obtain the loss information of the training model, thereby improving the accuracy of the obtained loss information of the training model.
[0271] In one embodiment, Fig.13 As shown, a method for training a graph-text prediction model is provided, and the method is applied to Figure 1 The server in the example is used for explanation. It can be understood that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0272] Step 1302: Obtain image-text prediction training samples and corresponding image-text prediction labels.
[0273] The image-text prediction training samples refer to samples used in image-text prediction training, including images and texts. The image-text prediction labels refer to labels used in image prediction training, which are the real results corresponding to the image prediction results.
[0274] Specifically, the server obtains the image-text prediction training samples and the corresponding image-text prediction labels from the database, and can also obtain the image-text prediction training samples and the corresponding image-text prediction labels from the service provider providing data services. The server can also obtain the image-text prediction training samples and the corresponding image-text prediction labels from the business party. The server can also obtain the image-text prediction training samples and the corresponding image-text prediction labels uploaded by the terminal.
[0275] Step 1302, obtaining a picture-text pre-training model, and using the picture-text pre-training model as an initial picture-text prediction model; the picture-text pre-training model is obtained by masking the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, inputting the target features of the training image and the target features of the training text into the initial picture-text pre-training model, evaluating the picture-text matching degree using the training target image features and the training target text features through the initial picture-text pre-training model to obtain the initial picture-text matching degree, performing cross-modal information interaction through the initial picture-text pre-training model using the initial picture-text matching degree, the training target image features and the training target text features to obtain the initial image interaction features and the initial text interaction features, calculating the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial picture matching degree to obtain the training model loss information, and training is performed based on the training model loss information.
[0276] The image-text pre-training model may be a model trained by any embodiment of the image-text pre-training model training method. The image-text pre-training model and the initial image-text prediction model have the same model structure.
[0277] Specifically, the server obtains the pre-training parameters in the image-text pre-training model, and uses the pre-training parameters in the image-text pre-training model as the initialization parameters of the initial image-text prediction model. The server can obtain the target features of the training image and the target features of the training text by masking the original features of the training image and the original features of the training text in advance, input the target features of the training image and the target features of the training text into the initial image-text pre-training model, evaluate the image-text matching degree by using the training target image features and the training target text features through the initial image-text pre-training model, obtain the initial image-text matching degree, perform cross-modal information interaction by using the initial image-text matching degree, the training target image features and the training target text features through the initial image-text pre-training model, obtain the initial image interaction features and the initial text interaction features, calculate the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree, obtain the training model loss information, and train based on the training model loss information to obtain the image-text pre-training model.
[0278] Step 1306 inputs the image-text prediction training sample into the initial image-text prediction model to obtain the image-text prediction result corresponding to the image-text prediction training sample.
[0279] Specifically, the server inputs the image-text prediction training samples into the initial image-text prediction model, and the server extracts self-attention features on the training samples to obtain image self-attention features and text self-attention features, and then evaluates the degree of matching between the image self-attention features and the text self-attention features to obtain the degree of image-text matching, and then uses the image-text matching degree, image self-attention features, and text self-attention features to perform cross-modal information interaction to obtain output image interaction features and text interaction features, and determines the corresponding image-text prediction results based on the image interaction features and text interaction features.
[0280] Step 1308 calculates the prediction loss information between the image-text prediction result and the image-text prediction label, trains the initial image-text prediction model based on the prediction loss information, and obtains the target image-text prediction model when the prediction training completion condition is met. The target image-text prediction model is used for cross-modal prediction using images and texts.
[0281] Specifically, the server uses a pre-set loss function to calculate the error between the image-text prediction result and the image-text prediction label to obtain the prediction loss information, and then uses the prediction loss information to reversely update the initial image-text prediction model to obtain the updated image-text prediction model. At this time, a loop iteration is performed, that is, the updated image-text prediction model is used as the initial image-text prediction model, and the image-text prediction training sample is returned to obtain the image-text prediction training sample, and the image-text prediction training sample is input into the initial image-text prediction model. The steps of obtaining the image-text prediction result corresponding to the image-text prediction training sample are iteratively executed until the prediction training completion condition is met, and the target image-text prediction model is obtained. The target image-text prediction model is used for cross-modal prediction using images and texts.
[0282] In one embodiment, the target image-text prediction model obtained through training is a target image-text question-answering model. For example, the server obtains a tiger image and a question sentence "What is the object in the image?", inputs the image and the question sentence into the target image-text question-answering model to predict the reply sentence, obtains output image interaction features and text interaction features, and then determines the reply sentence "The object in the image is the animal tiger" based on the image interaction features and the text interaction features.
[0283] The above-mentioned image-text prediction model training method obtains image-text prediction training samples and corresponding image-text prediction labels, obtains an image-text pre-training model, uses the image-text pre-training model as the initial image-text prediction model, inputs the image-text prediction training samples into the initial image-text prediction model, obtains the image-text prediction results corresponding to the image-text prediction training samples; calculates the prediction loss information between the image-text prediction results and the image-text prediction labels, trains the initial image-text prediction model based on the prediction loss information, and obtains the target image-text prediction model when the prediction training completion conditions are met. Among them, since the image-text pre-training model is obtained by evaluating the image-text matching degree, and then training through cross-modal information interaction through the image-text matching degree, the trained image-text pre-training model can improve the accuracy, and then the image-text pre-training model is further trained to obtain the target image-text prediction model, thereby improving the accuracy of the target image-text prediction model, and then improving the accuracy of cross-modal prediction using images and texts.
[0284] In a specific embodiment, Fig.14 As shown, a schematic diagram of an image pre-training model training method is provided, comprising the following steps:
[0285] Step 1402, obtain training samples, the training samples include training images and training texts, perform character-level text translation on the training texts, obtain a full representation vector of the training texts and a character representation vector of the training texts, and obtain original features of the training texts based on the full representation vector of the training texts and the character representation vector of the training texts.
[0286] Step 1404, classify and identify the target object based on the training image, obtain the full representation vector of the training image, the training object category representation vector and the training object region representation vector, and obtain the original features of the training image based on the training object category representation vector and the training object region representation vector.
[0287] Step 1406, perform feature masking based on the original features of the training image and the original features of the training text to obtain target features of the training image and the target features of the training text, and input the target features of the training image and the target features of the training text into the initial image-text pre-training model.
[0288] Step 1408, performing self-attention feature extraction on the training target image features through the initial image-text pre-training model to obtain the initial image self-attention features, and performing self-attention feature extraction on the training target text features to obtain the initial text self-attention features.
[0289] Step 1410, weight the initial image full-quantity representation vector in the initial image self-attention feature and the initial text full-quantity representation vector in the initial text self-attention feature respectively through the initial image-text pre-training model to obtain a weighted image representation vector and a weighted text representation vector, calculate the vector sum of the weighted image representation vector and the weighted text representation vector to obtain a matching degree vector, activate the matching degree vector, and obtain the image-text matching degree.
[0290] Step 1412, through the initial image-text pre-training model, cross-attention feature extraction is performed on the initial text full-quantity representation vector in the initial text self-attention feature and the initial category self-attention vector and the initial region self-attention vector in the initial image self-attention feature to obtain the initial text full-quantity interaction vector.
[0291] Step 1414, based on the degree of matching between the training image and text and the full interaction features of the initial text, the initial character self-attention vector in the initial text self-attention features is updated through the initial image-text pre-training model to obtain the initial character interaction vector, and the training text interaction features are obtained based on the full interaction vector of the initial text and the initial character interaction vector.
[0292] Step 1416, perform cross-attention feature extraction on the initial image full representation vector and the initial character self-attention vector through the initial image-text pre-training model to obtain the initial image full interaction vector, and update the initial category self-attention vector and the initial region self-attention vector based on the training image-text matching degree and the initial image full interaction vector to obtain the initial category interaction vector and the initial region interaction vector, and obtain the training image interaction feature based on the initial image full interaction vector, the initial category interaction vector and the initial region interaction vector.
[0293] Step 1418, calculate the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial picture matching degree to obtain the training model loss information; train the initial image-text pre-training model based on the training model loss information until the training completion conditions are met, and obtain the target image-text pre-training model.
[0294] In a specific embodiment, Fig.15 As shown, a schematic diagram of a training framework of an image pre-training model is provided, specifically:
[0295] The server randomly selects the training sentence "I just caught the fish from the water" and the training image from the text set and the image set, symbolizes the training sentence into a sequence of subword tokens, and uses the target detector (FasterRCNN) to first extract multiple target boxes and the target category information, and uses the target category information as the image label. The visual modality token sequence is formed according to the image label and the posts of the target area. Then randomly select the tokens in the sequence for masking. For example, replace the vector corresponding to "in the water" in the training sentence sequence with a full zero vector, and replace the vector corresponding to the area where "people" are located and the label of people in the training image sequence with a full zero vector to obtain the text target features and image target features. Then the text target features and image target features are input into the initial image-text pre-training model, which includes N image-text prediction networks.
[0296] Taking a picture-text prediction network as an example, the text target features and image target features are respectively input into the self-attention layer for self-attention feature extraction, and the image self-attention features are represented as {q^w, w_1, w_2, …, w_T} and the text self-attention features are represented as {q^r, r_1, r_2, …, r_N}, where q^w and q^r represent two special tokens to capture the global information of text and image. Then, the image self-attention features and text self-attention features are used to evaluate the degree of picture-text matching to obtain the picture-text matching degree. Then, the picture-text matching degree, q^w and {r_1, r_2, …, r_N} are input into the text cross-attention layer for cross-modal information interaction to obtain the output text full interaction features, and then the text full interaction features and the picture-text matching degree are used to update {w, w_2, …, w_T}, and finally the training text interaction features are obtained.
[0297] At the same time, the image-text matching degree, q^r and {w,w_2,…,w_T} are input into the image cross-domain attention layer for cross-modal information interaction, and the full image interaction features are output. Then, the full image interaction features and the image-text matching degree are used to update {r_1,r_2,…,r_N}, and finally the training image interaction features are obtained. After multiple layers of self-attention and cross-attention processing, the final training text interaction features and the final training image interaction features are finally output, and the final training text interaction features and the final training image interaction features predict the masked token vector.
[0298] The server then uses the final training text interaction features and the final training image interaction features to calculate the loss information to obtain the training model loss information. Based on the training model loss information, the server uses the gradient descent algorithm to reversely update the initial image-text pre-training model until the pre-training completion conditions are met, thereby obtaining the target image-text pre-training model.
[0299] In a specific embodiment, the image-text pre-training model is applied in an image-text question-answering scenario, specifically:
[0300] The server obtains a picture-text question and answer training sample and a corresponding picture-text question and answer reply label; obtains a picture-text pre-training model, and uses the picture-text pre-training model as an initial picture-text question and answer model; inputs the picture-text question and answer training sample into the initial picture-text question and answer model, and obtains a picture-text question and answer result corresponding to the picture-text question and answer training sample; calculates the prediction loss information between the picture-text question and answer result and the picture-text question and answer reply label, trains the initial picture-text question and answer model based on the prediction loss information, and obtains the target picture-text question and answer model when the prediction training completion condition is met.
[0301] The server deploys and uses the target image-text question-answering model. When in use, the server obtains the image and query sentence sent by the terminal, inputs the image and query sentence into the target image-text question-answering model, obtains the output image interaction features and text interaction features, determines the reply sentence based on the output image interaction features and text interaction features, and then returns the reply sentence to the terminal. The terminal displays the reply sentence.
[0302] In a specific embodiment, the image pre-training model training method is applied in a picture and text retrieval scenario, specifically:
[0303] The server obtains the image-text retrieval training samples and the corresponding image-text retrieval result labels; obtains the image-text pre-training model, and uses the image-text pre-training model as the initial image-text retrieval model; inputs the image-text question-answering training samples into the initial image-text question-answering model to obtain the image-text prediction retrieval results corresponding to the image-text retrieval training samples; calculates the prediction loss information between the image-text prediction retrieval results and the image-text retrieval result labels, trains the initial image-text retrieval model based on the prediction loss information, and obtains the target image-text retrieval model when the prediction training completion conditions are met.
[0304] The server deploys and uses the target image-text retrieval model. When in use, the server obtains the image and search sentence sent by the terminal, inputs the image and search sentence into the target image-text retrieval model, obtains the output image interaction features and text interaction features, determines the image-text object to be retrieved based on the output image interaction features and text interaction features, then detects the corresponding image and text in the image-text database for the image-text object to be retrieved, and then returns the retrieved image and text to the terminal. The terminal displays the reply sentence. For example, it can be a search for news.
[0305] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0306] Based on the same inventive concept, the embodiment of the present application also provides a graphic-text pre-training model training device and a graphic-text prediction model training method for implementing the graphic-text pre-training model training method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more graphic-text pre-training model training devices or graphic-text prediction model training device embodiments provided below can refer to the limitations of the graphic-text pre-training model training method or the graphic-text prediction model training method above, and will not be repeated here.
[0307] In one embodiment, Fig.16As shown, a training device 1600 for a pre-trained image and text model is provided, comprising: a feature acquisition module 1602, a feature masking module 1604, a matching module 1606, an interaction module 1608, a loss calculation module 1610 and a training module 1612, wherein:
[0308] A feature acquisition module 1602 is used to acquire original features of training images corresponding to the training images and original features of training texts corresponding to the training texts;
[0309] A feature masking module 1604 is used to perform feature masking based on the original features of the training image and the original features of the training text, obtain the target features of the training image and the target features of the training text, and input the target features of the training image and the target features of the training text into the initial image-text pre-training model;
[0310] Matching module 1606, used to evaluate the image-text matching degree using the training target image features and the training target text features through the initial image-text pre-training model to obtain an initial image-text matching degree;
[0311] An interaction module 1608 is used to perform cross-modal information interaction using an initial image-text matching degree, a training target image feature, and a training target text feature through an initial image-text pre-training model to obtain an initial image interaction feature and an initial text interaction feature;
[0312] A loss calculation module 1610 is used to calculate the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial picture matching degree to obtain the training model loss information;
[0313] The training module 1612 is used to train the initial image-text pre-training model based on the training model loss information until the training completion condition is met, and then obtain the target image-text pre-training model, which is used to train a model for cross-modal prediction based on images and texts.
[0314] In one embodiment, the feature acquisition module 1602 is also used to acquire training samples, which include training images and training texts; perform character-level text translation on the training text to obtain a full representation vector of the training text and a character representation vector of the training text, and obtain the original features of the training text based on the full representation vector of the training text and the character representation vector of the training text; perform target object classification and recognition based on the training image to obtain a full representation vector of the training image, a category representation vector of the training object, and a region representation vector of the training object, and obtain the original features of the training image based on the category representation vector of the training object and the region representation vector of the training object.
[0315] In one embodiment, the feature masking module 1604 is also used to randomly determine a current character representation vector from the training text character representation vector contained in the original feature of the training text; replace the current character representation vector in the original feature of the training text with a preset text masking vector to obtain a training text target feature; randomly determine a current object category representation vector and a current object area representation vector from the training object category representation vector and the training object area representation vector contained in the training image target feature; replace the current object category representation vector in the training image target feature with a preset image object masking vector, and replace the current object area representation vector in the training image target feature with a preset image area masking vector to obtain a training image target feature.
[0316] In one embodiment, the matching module 1606 is further used to extract self-attention features from the training target image features through the initial image-text pre-training model to obtain the initial image self-attention features; extract self-attention features from the training target text features through the initial image-text pre-training model to obtain the initial text self-attention features; evaluate the matching degree of the initial image self-attention features and the initial text self-attention features through the initial image-text pre-training model to obtain the training image-text matching degree;
[0317] The interaction module 1608 is also used to perform cross-modal information interaction using the training image-text matching degree, initial image self-attention features and initial text self-attention features through the initial image-text pre-training model to obtain training image interaction features and training text interaction features.
[0318] In one embodiment, the initial image-text pre-training model includes an initial image-text prediction network, which includes an initial image self-attention network, an initial text self-attention network, and an initial matching network; the matching module 1606 includes:
[0319] A self-attention extraction unit is used to input the target image feature into the initial image self-attention network in the initial image-text pre-training model to extract the self-attention feature, so as to obtain the initial image self-attention feature; and input the target text feature into the initial text self-attention network in the initial image-text pre-training model to extract the self-attention feature, so as to obtain the initial text self-attention feature;
[0320] The matching evaluation unit is used to input the initial image full-quantity representation vector in the initial image self-attention feature and the initial text full-quantity representation vector in the initial text self-attention feature into the initial matching network in the initial image-text pre-training model to evaluate the matching degree and obtain the image-text matching degree.
[0321] In one embodiment, the matching evaluation unit is also used to input the initial image full-quantity representation vector in the initial image self-attention feature and the initial text full-quantity representation vector in the initial text self-attention feature into the initial matching network in the initial image-text pre-training model; weight the initial image full-quantity representation vector and the initial text full-quantity representation vector respectively through the initial matching network to obtain a weighted image representation vector and a weighted text representation vector; calculate the vector sum of the weighted image representation vector and the weighted text representation vector through the initial matching network to obtain a matching degree vector; activate the matching degree vector through the initial matching network to obtain the image-text matching degree.
[0322] In one embodiment, the initial image-text pre-training model includes an initial image-text prediction network, and the initial image-text prediction network includes an initial image spanning attention network and an initial text spanning attention network;
[0323] The interaction module 1608 includes:
[0324] A text interaction unit is used to input the initial text full-quantity representation vector in the initial text self-attention feature and the initial category self-attention vector and the initial region self-attention vector in the initial image self-attention feature into the initial text cross-attention network for cross-modal information interaction to obtain the initial text full-quantity interaction vector; based on the degree of training image-text matching and the initial text full-quantity interaction feature, the initial character self-attention vector in the initial text self-attention feature is updated to obtain the initial character interaction vector, and the training text interaction feature is obtained based on the initial text full-quantity interaction vector and the initial character interaction vector;
[0325] The image interaction unit is used to input the initial image full representation vector and the initial character self-attention vector into the initial image cross-attention network for cross-modal information interaction to obtain the initial image full interaction vector; based on the training image-text matching degree and the initial image full interaction vector, the initial category self-attention vector and the initial region self-attention vector are updated respectively to obtain the initial category interaction vector and the initial region interaction vector; based on the initial image full interaction vector, the initial category interaction vector and the initial region interaction vector, the training image interaction feature is obtained.
[0326] In one embodiment, the text interaction unit is also used to weight the initial character self-attention vector using the degree of matching of the training image and text to obtain a weighted character self-attention feature; calculate the weight of the full interaction feature based on the degree of matching of the training image and text to obtain the weight of the full interaction feature, and use the full interaction feature weight to weight the initial text full interaction feature to obtain a weighted text full interaction feature; calculate the feature sum of the weighted character self-attention feature and the weighted text full interaction feature to obtain the initial character interaction vector.
[0327] In one embodiment, the image interaction unit is further used to weight the initial category self-attention vector using the training image-text matching degree to obtain a weighted category self-attention feature; weight the initial region self-attention vector using the training image-text matching degree to obtain a weighted region self-attention feature; calculate the weight of the full interaction feature based on the training image-text matching degree to obtain the full interaction feature weight, and use the full interaction feature weight to weight the initial image full interaction vector to obtain a weighted image full interaction feature; calculate the feature sum of the weighted category self-attention feature and the weighted image full interaction feature to obtain the initial category interaction vector; calculate the feature sum of the weighted region self-attention feature and the weighted image full interaction feature to obtain the initial region interaction vector;
[0328] In one embodiment, the initial image-text pre-training model includes at least two initial image-text prediction networks, and the at least two initial image-text prediction networks are connected end to end;
[0329] The image-text pre-training model training device 1600 further includes:
[0330] The final training module is used to obtain the forward training image interaction features and the forward training text interaction features output by the forward initial image-text prediction network, input the forward training image interaction features and the forward training text interaction features into the backward initial image-text prediction network, and obtain the output backward training image interaction features and the backward training text interaction features; use the backward initial image-text prediction network as the forward initial image-text prediction network, and return to the step of obtaining the forward training image interaction features and the forward training text interaction features output by the forward initial image-text prediction network, until there is no backward image-text prediction network, and use the forward training image interaction features when there is no backward image-text prediction network as the final training image interaction features , taking the forward training text interaction features when there is no backward image-text prediction network as the final training text interaction features; performing feature loss calculation based on the original features of the training image, the original features of the training text, the final training image interaction features, and the final training text interaction features to obtain the final training feature loss information, and calculating the similarity between the training image and the training text, performing matching loss calculation based on the similarity and the final image-text matching degree when there is no backward image-text prediction network to obtain the final training matching loss information; training the initial image-text pre-training model based on the final training feature loss information and the final training matching loss information until the final training completion condition is met, and obtaining the final target image-text pre-training model.
[0331] In one embodiment, the loss calculation module 1610 includes:
[0332] A feature loss calculation unit, used to calculate feature loss based on original image features, original text features, image interaction features, and text interaction features to obtain feature loss information;
[0333] A matching loss calculation unit is used to calculate the similarity between the training image and the training text, and to calculate the loss based on the similarity and the image-text matching degree to obtain matching loss information;
[0334] The calculation unit is used to calculate the sum of feature loss information and matching loss information to obtain training model loss information.
[0335] In one embodiment, the feature loss calculation unit is also used to calculate the cross entropy error between the original features of the image and the image interaction features to obtain image feature loss information; calculate the cross entropy error between the original features of the text and the text interaction features to obtain text feature loss information; calculate the sum of the image feature loss information and the text feature loss information to obtain feature loss information.
[0336] In one embodiment, the feature loss calculation unit is also used to obtain the target object category representation vector from the original features of the image according to a preset category replacement position, and obtain the target object region representation vector from the original features of the image according to a preset region replacement position; obtain the target object category interaction vector from the image interaction features according to the preset category replacement position, and obtain the target object region interaction vector from the image interaction features according to the preset category replacement position; calculate the cross entropy error between the target object category representation vector and the target object category interaction vector to obtain category vector loss information, and calculate the cross entropy error between the target object region representation vector and the target object region interaction vector to obtain region vector loss information; calculate the sum of the category vector loss information and the region vector loss information to obtain image vector loss information, and use the image vector loss information as image feature loss information.
[0337] In one embodiment, the feature loss calculation unit is also used to obtain a target character representation vector replaced by a preset text masking vector from the original feature of the text based on a preset text replacement position; and to obtain a target character interaction vector from the text interaction feature based on the preset text replacement position; calculate the cross entropy error between the target character representation vector and the target character interaction vector to obtain text vector loss information, and use the replacement vector loss information as text feature loss information.
[0338] In one embodiment, the matching loss calculation unit is also used to input the training image and the training text into the trained semantic feature extraction model respectively to obtain the semantic features of the training image and the semantic features of the training text; calculate the model similarity between the semantic features of the training image and the semantic features of the training text; calculate the minimum square error between the model similarity and the image-text matching degree to obtain matching loss information.
[0339] In one embodiment, the matching loss calculation unit is also used to obtain the training object category information corresponding to the training image, and calculate the category weight vector corresponding to the training object category information; perform word weight vector calculation based on the training text to obtain the word weight vector, and calculate the weight vector similarity between the category weight vector and the word weight vector; calculate the minimum square error between the weight vector similarity and the image-text matching degree to obtain matching loss information.
[0340] In one embodiment, Fig.17 As shown, a graphic prediction model training device 1700 is provided, including: a sample acquisition module 1702, a model acquisition module 1704, a training prediction module 1706 and a model acquisition module 1708, wherein:
[0341] The sample acquisition module 1702 is used to acquire image-text prediction training samples and corresponding image-text prediction labels;
[0342] Model acquisition module 1704 is used to acquire a pre-trained image-text model, and use the pre-trained image-text model as an initial image-text prediction model; the pre-trained image-text model is obtained by masking the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, inputting the target features of the training image and the target features of the training text into the initial pre-trained image-text model, using the initial pre-trained image-text model to evaluate the image-text matching degree using the features of the training target image and the features of the training target text to obtain the initial image-text matching degree, using the initial image-text matching degree, the features of the training target image and the features of the training target text to perform cross-modal information interaction through the initial pre-trained image-text model to obtain the initial image interaction features and the initial text interaction features, calculating the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image matching degree to obtain the training model loss information, and training is performed based on the training model loss information;
[0343] The training prediction module 1706 is used to input the image-text prediction training sample into the initial image-text prediction model to obtain the image-text prediction result corresponding to the image-text prediction training sample;
[0344] The model acquisition module 1708 is used to calculate the prediction loss information between the image-text prediction result and the image-text prediction label, train the initial image-text prediction model based on the prediction loss information, and obtain the target image-text prediction model when the prediction training completion condition is met. The target image-text prediction model is used for cross-modal prediction using images and texts.
[0345] Each module in the above-mentioned image-text pre-training model training device or image-text prediction model training device can be implemented in whole or in part by software, hardware, and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0346] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.18 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store training text sets and training image sets. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for training a graphic pre-training model or a method for training a graphic prediction model is implemented.
[0347] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.19As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device 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 input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for training a graphic pre-training model or a method for training a graphic prediction model is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0348] Those skilled in the art will understand that Fig.18 The structure shown in or 19 is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0349] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0350] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0351] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0352] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0353] 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 the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0354] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0355] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for training a picture-text pre-training model, characterized in that: The method comprises: Obtaining original features of the training image corresponding to the training image and original features of the training text corresponding to the training text; Perform feature masking based on the original features of the training image and the original features of the training text to obtain target features of the training image and the target features of the training text, and input the target features of the training image and the target features of the training text into an initial image-text pre-training model; The initial image-text pre-training model uses the training image target features and the training text target features to evaluate the image-text matching degree, thereby obtaining an initial image-text matching degree, wherein the initial image-text matching degree is obtained by the initial image-text pre-training model using initial image-text matching degree evaluation parameters to evaluate the image-text matching degree of the training image target features and the training text target features; The initial image-text pre-training model uses the initial image-text matching degree, the training image target feature and the training text target feature to perform cross-modal information interaction to obtain initial image interaction features and initial text interaction features, including: using the training image target feature and the training text target feature to extract cross-attention features, using the initial image-text matching degree to perform weighted calculation on the extracted cross-attention features to obtain the initial image interaction features and the initial text interaction features, the initial image interaction features refer to the training image features with text information obtained during training, and the initial text interaction features refer to the training text features with image information obtained during training; Based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image-text matching degree, a model loss calculation is performed to obtain training model loss information, wherein the training model loss information is obtained by calculating the information sum of feature loss information and matching loss information, wherein the feature loss information is the information sum of image feature loss information and text feature loss information, and is used to characterize the error between the original features and the interaction features, and the matching loss information is used to characterize the error between the similarity between the training image and the training text and the initial image-text matching degree; The initial image-text pre-training model is trained based on the training model loss information until a training completion condition is met, thereby obtaining a target image-text pre-training model, wherein the target image-text pre-training model is used to train a model for cross-modal prediction based on images and texts.
2. The method according to claim 1, characterized in that: The obtaining of original features of the training image corresponding to the training image and original features of the training text corresponding to the training text includes: Acquire training samples, where the training samples include training images and training texts; Performing character-level text translation on the training text to obtain a full-text representation vector of the training text and a character-representation vector of the training text, and obtaining original features of the training text based on the full-text representation vector of the training text and the character-representation vector of the training text; Based on the training image, target object classification and recognition are performed to obtain a full representation vector of the training image, a training object category representation vector and a training object region representation vector, and based on the training object category representation vector and the training object region representation vector, the original features of the training image are obtained.
3. The method according to claim 1, characterized in that The step of performing feature masking based on the original features of the training image and the original features of the training text to obtain target features of the training image and target features of the training text includes: Randomly determine a current character representation vector from the training text character representation vectors contained in the original features of the training text; Replacing the current character representation vector in the original feature of the training text with a preset text masking vector to obtain the target feature of the training text; Randomly determine a current object category representation vector and a current object region representation vector from the training object category representation vector and the training object region representation vector included in the training image target feature; The current object category representation vector in the training image target feature is replaced with a preset image object masking vector, and the current object region representation vector in the training image target feature is replaced with a preset image region masking vector to obtain the training image target feature.
4. The method according to claim 1, characterized in that: The initial image-text pre-training model uses the training image target features and the training text target features to evaluate the image-text matching degree to obtain the initial image-text matching degree, including: Performing self-attention feature extraction on the target features of the training image through the initial image-text pre-training model to obtain the initial image self-attention feature; Performing self-attention feature extraction on the training text target features through the initial image-text pre-training model to obtain initial text self-attention features; Evaluate the matching degree of the initial image self-attention feature and the initial text self-attention feature through the initial image-text pre-training model to obtain the initial image-text matching degree; The method of performing cross-modal information interaction using the initial image-text matching degree, the training image target feature, and the training text target feature through the initial image-text pre-training model to obtain initial image interaction features and initial text interaction features includes: The initial image-text pre-training model uses the initial image-text matching degree, the initial image self-attention feature and the initial text self-attention feature to perform cross-modal information interaction to obtain initial image interaction features and initial text interaction features.
5. The method according to any one of claims 1 to 4, characterized in that: The initial image-text pre-training model includes an initial image-text prediction network, and the initial image-text prediction network includes an initial image self-attention network, an initial text self-attention network and an initial matching network; The step of evaluating the image-text matching degree by using the training image target features and the training text target features through the initial image-text pre-training model to obtain the initial image-text matching degree includes: Inputting the training image target features into the initial image self-attention network in the initial image-text pre-training model to extract self-attention features, thereby obtaining the initial image self-attention features; Inputting the training text target features into the initial text self-attention network in the initial image-text pre-training model to extract self-attention features, thereby obtaining the initial text self-attention features; The initial image full-quantity representation vector in the initial image self-attention feature and the initial text full-quantity representation vector in the initial text self-attention feature are input into the initial matching network in the initial image-text pre-training model to evaluate the matching degree, so as to obtain the initial image-text matching degree.
6. The method according to claim 5, characterized in that Inputting the initial image full-quantity representation vector in the initial image self-attention feature and the initial text full-quantity representation vector in the initial text self-attention feature into the initial matching network in the initial image-text pre-training model to evaluate the matching degree, and obtaining the initial image-text matching degree, including: Inputting the initial image full-quantity representation vector in the initial image self-attention feature and the initial text full-quantity representation vector in the initial text self-attention feature into the initial matching network in the initial image-text pre-training model; The initial image full-quantity representation vector and the initial text full-quantity representation vector are weighted respectively by the initial matching network to obtain a weighted image representation vector and a weighted text representation vector; Calculating the vector sum of the weighted image representation vector and the weighted text representation vector through the initial matching network to obtain a matching degree vector; The matching degree vector is activated through the initial matching network to obtain the initial image-text matching degree.
7. The method according to claim 4, characterized in that The initial image-text pre-training model includes an initial image-text prediction network, and the initial image-text prediction network includes an initial image spanning attention network and an initial text spanning attention network; The method of performing cross-modal information interaction using the initial image-text matching degree, the initial image self-attention feature, and the initial text self-attention feature through the initial image-text pre-training model to obtain initial image interaction features and initial text interaction features includes: Inputting the initial text full-quantity representation vector in the initial text self-attention feature and the initial category self-attention vector and the initial region self-attention vector in the initial image self-attention feature into the initial text cross-attention network for cross-modal information interaction to obtain an initial text full-quantity interaction vector; Based on the initial image-text matching degree and the initial text full interaction vector, the initial character self-attention vector in the initial text self-attention feature is updated to obtain an initial character interaction vector, and based on the initial text full interaction vector and the initial character interaction vector, the initial text interaction feature is obtained; Inputting the initial image full quantity representation vector in the initial image self-attention feature and the initial character self-attention vector into the initial image cross-attention network for cross-modal information interaction to obtain the initial image full quantity interaction vector; The initial category self-attention vector and the initial region self-attention vector are updated respectively based on the initial image-text matching degree and the initial image full interaction vector to obtain an initial category interaction vector and an initial region interaction vector, and the initial image interaction feature is obtained based on the initial image full interaction vector, the initial category interaction vector and the initial region interaction vector.
8. The method according to claim 7, characterized in that The updating of the initial character self-attention vector in the initial text self-attention feature based on the initial image-text matching degree and the initial text full-quantity interaction vector to obtain the initial character interaction vector includes: Using the initial image-text matching degree to weight the initial character self-attention vector, to obtain a weighted character self-attention feature; Calculating the weight of the full interactive feature based on the initial image-text matching degree to obtain the full interactive feature weight, and using the full interactive feature weight to weight the full interactive vector of the initial text to obtain the weighted text full interactive feature; The feature sum of the weighted character self-attention feature and the weighted text full-quantity interaction feature is calculated to obtain the initial character interaction vector.
9. The method according to claim 7, characterized in that: The updating of the initial category self-attention vector and the initial region self-attention vector based on the initial image-text matching degree and the initial image full-quantity interaction vector to obtain an initial category interaction vector and an initial region interaction vector includes: Using the initial image-text matching degree to weight the initial category self-attention vector, to obtain a weighted category self-attention feature; Using the initial image-text matching degree to weight the initial regional self-attention vector, to obtain a weighted regional self-attention feature; Calculating the weight of the full interactive feature based on the initial image-text matching degree to obtain the full interactive feature weight, and using the full interactive feature weight to weight the full interactive vector of the initial image to obtain the weighted image full interactive feature; Calculating the feature sum of the weighted category self-attention feature and the weighted image full-quantity interaction feature to obtain the initial category interaction vector; The feature sum of the weighted regional self-attention feature and the weighted image full-quantity interaction feature is calculated to obtain the initial regional interaction vector.
10. The method according to claim 1, characterized in that The initial image-text pre-training model includes at least two initial image-text prediction networks, and the at least two initial image-text prediction networks are connected end to end; The method further comprises: Obtain the forward training image interaction features and forward training text interaction features output by the forward initial image-text prediction network. Inputting the forward training image interaction features and the forward training text interaction features into a backward initial image-text prediction network to obtain output backward training image interaction features and backward training text interaction features; The backward initial image-text prediction network is used as the forward initial image-text prediction network, and the step of returning to obtain the forward training image interaction features and the forward training text interaction features output by the forward initial image-text prediction network is executed until there is no backward image-text prediction network, and the forward training image interaction features when there is no backward image-text prediction network are used as the final training image interaction features, and the forward training text interaction features when there is no backward image-text prediction network are used as the final training text interaction features; Based on the original features of the training image, the original features of the training text, the final training image interaction features, and the final training text interaction features, feature loss calculation is performed to obtain final training feature loss information, and the similarity between the training image and the training text is calculated, and matching loss calculation is performed based on the similarity and the final image-text matching degree without the backward image-text prediction network to obtain final training matching loss information; The initial image-text pre-training model is trained based on the final training feature loss information and the final training matching loss information until the final training completion condition is met, thereby obtaining a final target image-text pre-training model.
11. The method according to claim 1, characterized in that: The model loss is calculated based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image-text matching degree to obtain the training model loss information, including: Perform feature loss calculation based on the original features of the training image, the original features of the training text, the initial image interaction features, and the initial text interaction features to obtain feature loss information; Calculating the similarity between the training image and the training text, performing loss calculation based on the similarity and the initial image-text matching degree, and obtaining matching loss information; The sum of the feature loss information and the matching loss information is calculated to obtain the training model loss information.
12. The method according to claim 11, characterized in that The feature loss calculation is performed based on the original features of the training image, the original features of the training text, the initial image interaction features, and the initial text interaction features to obtain feature loss information, including: Calculating the cross entropy error between the original features of the training image and the interactive features of the initial image to obtain image feature loss information; Calculating the cross entropy error between the original features of the training text and the initial text interaction features to obtain text feature loss information; The sum of the image feature loss information and the text feature loss information is calculated to obtain the feature loss information.
13. The method according to claim 12, characterized in that The calculating the cross entropy error between the original features of the training image and the interactive features of the initial image to obtain image feature loss information includes: Obtaining a target object category representation vector from the original features of the training image according to a preset category replacement position, and obtaining a target object region representation vector from the original features of the training image according to a preset region replacement position; Obtaining a target object category interaction vector from the initial image interaction feature according to the preset category replacement position, and obtaining a target object region interaction vector from the initial image interaction feature according to the preset category replacement position; Calculating the cross entropy error between the target object category representation vector and the target object category interaction vector to obtain category vector loss information, and calculating the cross entropy error between the target object region representation vector and the target object region interaction vector to obtain region vector loss information; The sum of the category vector loss information and the region vector loss information is calculated to obtain image vector loss information, and the image vector loss information is used as the image feature loss information.
14. The method according to claim 12, characterized in that The calculating the cross entropy error between the original features of the training text and the initial text interaction features to obtain text feature loss information includes: Obtaining a target character representation vector replaced by a preset text masking vector from the original features of the training text based on a preset text replacement position; and acquiring a target character interaction vector from the initial text interaction feature based on the preset text replacement position; The cross entropy error between the target character representation vector and the target character interaction vector is calculated to obtain text vector loss information, and the text vector loss information is used as the text feature loss information.
15. The method according to claim 11, characterized in that The calculating the similarity between the training image and the training text, performing loss calculation based on the similarity and the initial image-text matching degree, and obtaining matching loss information includes: Inputting the training image and the training text into a trained semantic feature extraction model respectively to obtain a training image semantic feature and a training text semantic feature; Calculating the model similarity between the semantic features of the training image and the semantic features of the training text; The minimum square error between the model similarity degree and the initial image-text matching degree is calculated to obtain the matching loss information.
16. The method according to claim 11, characterized in that The calculating the similarity between the training image and the training text, performing loss calculation based on the similarity and the initial image-text matching degree, and obtaining matching loss information includes: Obtaining training object category information corresponding to the training image, and calculating a category weight vector corresponding to the training object category information; Calculating a word weight vector based on the training text to obtain a word weight vector, and calculating a weight vector similarity between the category weight vector and the word weight vector; The minimum square error between the weight vector similarity and the initial image-text matching degree is calculated to obtain the matching loss information.
17. A method for training a graph-text prediction model, characterized in that: The method comprises: Obtain image-text prediction training samples and corresponding image-text prediction labels; Obtaining a pre-trained image-text model, and using the pre-trained image-text model as an initial image-text prediction model; The image-text pre-training model is obtained by masking the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, inputting the target features of the training image and the target features of the training text into the initial image-text pre-training model, evaluating the image-text matching degree by using the target features of the training image and the target features of the training text through the initial image-text pre-training model to obtain the initial image-text matching degree, performing cross-modal information interaction by using the initial image-text matching degree, the target features of the training image and the target features of the training text through the initial image-text pre-training model to obtain the initial image interaction features and the initial text interaction features, performing model loss calculation based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image-text matching degree to obtain the training model loss information, and performing training based on the training model loss information, wherein the initial image-text matching degree is obtained by using the initial image-text pre-training model to evaluate the target features of the training image and the target features of the training text using the initial image-text matching degree evaluation parameters. The training model loss information is obtained by evaluating the degree of image-text matching, the training model loss information is obtained by calculating the sum of feature loss information and matching loss information, the feature loss information is the sum of image feature loss information and text feature loss information, and is used to characterize the error between the original feature and the interactive feature, the matching loss information is used to characterize the error between the degree of similarity between the training image and the training text and the initial image-text matching degree, the initial image-text pre-training model uses the initial image-text matching degree, the training image target feature and the training text target feature to perform cross-modal information interaction to obtain initial image interaction features and initial text interaction features, including: using the training image target feature and the training text target feature to extract cross-attention features, using the initial image-text matching degree to perform weighted calculation on the extracted cross-attention features to obtain the initial image interaction features and the initial text interaction features, the initial image interaction features refer to the training image features with text information obtained during training, and the initial text interaction features refer to the training text features with image information obtained during training; Inputting the image-text prediction training sample into the initial image-text prediction model to obtain the image-text prediction result corresponding to the image-text prediction training sample; The prediction loss information between the image-text prediction result and the image-text prediction label is calculated, and the initial image-text prediction model is trained based on the prediction loss information. When the prediction training completion condition is met, a target image-text prediction model is obtained, and the target image-text prediction model is used for cross-modal prediction using images and texts.
18. A device for training a picture and text pre-training model, characterized in that: The device comprises: A feature acquisition module, used to acquire original features of training images corresponding to training images and original features of training texts corresponding to training texts; A feature masking module, used for performing feature masking based on the original features of the training image and the original features of the training text, obtaining target features of the training image and the target features of the training text, and inputting the target features of the training image and the target features of the training text into an initial image-text pre-training model; A matching module, used to evaluate the image-text matching degree using the training image target features and the training text target features through the initial image-text pre-training model to obtain an initial image-text matching degree, wherein the initial image-text matching degree is obtained by evaluating the image-text matching degree of the training image target features and the training text target features through the initial image-text pre-training model using initial image-text matching degree evaluation parameters; An interaction module, used to perform cross-modal information interaction using the initial image-text matching degree, the training image target features and the training text target features through the initial image-text pre-training model to obtain initial image interaction features and initial text interaction features, including: using the training image target features and the training text target features to extract cross-attention features, using the initial image-text matching degree to perform weighted calculation on the extracted cross-attention features to obtain the initial image interaction features and the initial text interaction features, the initial image interaction features refer to the training image features with text information obtained during training, and the initial text interaction features refer to the training text features with image information obtained during training; A loss calculation module, used to calculate the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image-text matching degree, to obtain training model loss information, wherein the training model loss information is obtained by calculating the information sum of feature loss information and matching loss information, wherein the feature loss information is the information sum of image feature loss information and text feature loss information, and is used to characterize the error between the original features and the interaction features, and the matching loss information is used to characterize the error between the similarity between the training image and the training text and the initial image-text matching degree; A training module is used to train the initial image-text pre-training model based on the training model loss information until the training completion condition is met, thereby obtaining a target image-text pre-training model, wherein the target image-text pre-training model is used to train a model for cross-modal prediction based on images and texts.
19. The device according to claim 18, characterized in that The feature acquisition module is also used to acquire training samples, which include training images and training texts; perform character-level text translation on the training text to obtain a full-volume representation vector of the training text and a character representation vector of the training text, and obtain the original features of the training text based on the full-volume representation vector of the training text and the character representation vector of the training text; Based on the training image, target object classification and recognition are performed to obtain a full representation vector of the training image, a training object category representation vector and a training object region representation vector, and based on the training object category representation vector and the training object region representation vector, the original features of the training image are obtained.
20. The device according to claim 18, characterized in that The feature masking module is also used to randomly determine a current character representation vector from the training text character representation vectors contained in the original features of the training text; replace the current character representation vector in the original features of the training text with a preset text masking vector to obtain the target features of the training text; A current object category representation vector and a current object region representation vector are randomly determined from the training object category representation vector and the training object region representation vector contained in the training image target feature; the current object category representation vector in the training image target feature is replaced with a preset image object masking vector, and the current object region representation vector in the training image target feature is replaced with a preset image region masking vector to obtain the training image target feature.
21. The device according to claim 18, characterized in that The matching module also extracts self-attention features from the target features of the training image through the initial image-text pre-training model to obtain initial image self-attention features; extracts self-attention features from the target features of the training text through the initial image-text pre-training model to obtain initial text self-attention features; and evaluates the matching degree between the initial image self-attention features and the initial text self-attention features through the initial image-text pre-training model to obtain the initial image-text matching degree; The interaction module is also used to perform cross-modal information interaction using the initial image-text matching degree, the initial image self-attention feature and the initial text self-attention feature through the initial image-text pre-training model to obtain initial image interaction features and initial text interaction features.
22. The device according to any one of claims 18 to 21, characterized in that The initial image-text pre-training model includes an initial image-text prediction network, and the initial image-text prediction network includes an initial image self-attention network, an initial text self-attention network and an initial matching network; The matching module comprises: A self-attention extraction unit is used to input the training image target feature into the initial image self-attention network in the initial image-text pre-training model to extract the self-attention feature, so as to obtain the initial image self-attention feature; input the training text target feature into the initial text self-attention network in the initial image-text pre-training model to extract the self-attention feature, so as to obtain the initial text self-attention feature; A matching evaluation unit is used to input the initial image full-quantity representation vector in the initial image self-attention feature and the initial text full-quantity representation vector in the initial text self-attention feature into the initial matching network in the initial image-text pre-training model to evaluate the matching degree and obtain the initial image-text matching degree.
23. The device according to claim 22, characterized in that The matching evaluation unit is also used to input the initial image full-quantity representation vector in the initial image self-attention feature and the initial text full-quantity representation vector in the initial text self-attention feature into the initial matching network in the initial image-text pre-training model; weight the initial image full-quantity representation vector and the initial text full-quantity representation vector respectively through the initial matching network to obtain a weighted image representation vector and a weighted text representation vector; calculate the vector sum of the weighted image representation vector and the weighted text representation vector through the initial matching network to obtain a matching degree vector; activate the matching degree vector through the initial matching network to obtain the initial image-text matching degree.
24. The device according to claim 21, characterized in that The initial image-text pre-training model includes an initial image-text prediction network, and the initial image-text prediction network includes an initial image spanning attention network and an initial text spanning attention network; The interaction module comprises: A text interaction unit, used for inputting the initial text full-quantity representation vector in the initial text self-attention feature and the initial category self-attention vector and the initial region self-attention vector in the initial image self-attention feature into the initial text cross-attention network for cross-modal information interaction to obtain an initial text full-quantity interaction vector; updating the initial character self-attention vector in the initial text self-attention feature based on the initial image-text matching degree and the initial text full-quantity interaction vector to obtain an initial character interaction vector, and obtaining the initial text interaction feature based on the initial text full-quantity interaction vector and the initial character interaction vector; An image interaction unit is used to input the initial image full-quantity representation vector and the initial character self-attention vector in the initial image self-attention feature into the initial image cross-attention network for cross-modal information interaction to obtain the initial image full-quantity interaction vector; based on the initial image-text matching degree and the initial image full-quantity interaction vector, the initial category self-attention vector and the initial region self-attention vector are respectively updated to obtain an initial category interaction vector and an initial region interaction vector; and the initial image interaction feature is obtained based on the initial image full-quantity interaction vector, the initial category interaction vector and the initial region interaction vector.
25. The device according to claim 24, characterized in that The text interaction unit is further used to weight the initial character self-attention vector using the initial image-text matching degree to obtain a weighted character self-attention feature; Calculating the weight of the full interactive feature based on the initial image-text matching degree to obtain the full interactive feature weight, and using the full interactive feature weight to weight the full interactive vector of the initial text to obtain the weighted text full interactive feature; The feature sum of the weighted character self-attention feature and the weighted text full-quantity interaction feature is calculated to obtain the initial character interaction vector.
26. The device according to claim 24, characterized in that The image interaction unit is further used to weight the initial category self-attention vector using the initial image-text matching degree to obtain a weighted category self-attention feature; Using the initial image-text matching degree to weight the initial regional self-attention vector, to obtain a weighted regional self-attention feature; Calculating the weight of the full interactive feature based on the initial image-text matching degree to obtain the full interactive feature weight, and using the full interactive feature weight to weight the full interactive vector of the initial image to obtain the weighted image full interactive feature; The feature sum of the weighted category self-attention feature and the weighted image full interaction feature is calculated to obtain the initial category interaction vector; the feature sum of the weighted region self-attention feature and the weighted image full interaction feature is calculated to obtain the initial region interaction vector.
27. The device according to claim 18, characterized in that The initial image-text pre-training model includes at least two initial image-text prediction networks, and the at least two initial image-text prediction networks are connected end to end; The device further comprises: The final training module is used to obtain the forward training image interaction features and the forward training text interaction features output by the forward initial image-text prediction network, input the forward training image interaction features and the forward training text interaction features into the backward initial image-text prediction network, and obtain the output backward training image interaction features and the backward training text interaction features; use the backward initial image-text prediction network as the forward initial image-text prediction network, and return to the step of obtaining the forward training image interaction features and the forward training text interaction features output by the forward initial image-text prediction network, until there is no backward image-text prediction network, use the forward training image interaction features when there is no backward image-text prediction network as the final training image interaction features, and use the backward initial image-text prediction network when there is no backward image-text prediction network The forward training text interaction features in the backward image-text prediction network are used as the final training text interaction features; feature loss calculation is performed based on the original features of the training image, the original features of the training text, the final training image interaction features, and the final training text interaction features to obtain final training feature loss information, and the similarity between the training image and the training text is calculated, and the matching loss calculation is performed based on the similarity and the final image-text matching degree without the backward image-text prediction network to obtain final training matching loss information; the initial image-text pre-training model is trained based on the final training feature loss information and the final training matching loss information until the final training completion condition is met, thereby obtaining the final target image-text pre-training model.
28. The device according to claim 18, characterized in that The loss calculation module comprises: A feature loss calculation unit performs feature loss calculation based on the original features of the training image, the original features of the training text, the initial image interaction features, and the initial text interaction features to obtain feature loss information; A matching loss calculation unit, used to calculate the similarity between the training image and the training text, and perform loss calculation based on the similarity and the initial image-text matching degree to obtain matching loss information; and a calculation unit, used to calculate the sum of the feature loss information and the matching loss information to obtain the training model loss information.
29. The device according to claim 28, characterized in that The feature loss calculation unit is also used to calculate the cross entropy error between the original features of the training image and the interactive features of the initial image to obtain image feature loss information; Calculating the cross entropy error between the original features of the training text and the initial text interaction features to obtain text feature loss information; The sum of the image feature loss information and the text feature loss information is calculated to obtain the feature loss information.
30. The device according to claim 29, characterized in that The feature loss calculation unit is also used to obtain a target object category representation vector from the original features of the training image according to a preset category replacement position, and obtain a target object region representation vector from the original features of the training image according to a preset region replacement position; obtain a target object category interaction vector from the initial image interaction feature according to the preset category replacement position, and obtain a target object region interaction vector from the initial image interaction feature according to the preset category replacement position; calculate the cross entropy error between the target object category representation vector and the target object category interaction vector to obtain category vector loss information, and calculate the cross entropy error between the target object region representation vector and the target object region interaction vector to obtain region vector loss information; The sum of the category vector loss information and the region vector loss information is calculated to obtain image vector loss information, and the image vector loss information is used as the image feature loss information.
31. The device according to claim 29, characterized in that The feature loss calculation unit is also used to obtain a target character representation vector replaced by a preset text masking vector from the original feature of the training text based on a preset text replacement position; and to obtain a target character interaction vector from the initial text interaction feature based on the preset text replacement position; calculate the cross entropy error between the target character representation vector and the target character interaction vector to obtain text vector loss information, and use the text vector loss information as the text feature loss information.
32. The device according to claim 29, characterized in that The matching loss calculation unit is further used to input the training image and the training text into the trained semantic feature extraction model respectively to obtain the training image semantic feature and the training text semantic feature; Calculating the model similarity between the semantic features of the training image and the semantic features of the training text; The minimum square error between the model similarity degree and the initial image-text matching degree is calculated to obtain the matching loss information.
33. The device according to claim 29, characterized in that The matching loss calculation unit is also used to obtain the training object category information corresponding to the training image, and calculate the category weight vector corresponding to the training object category information; perform word weight vector calculation based on the training text to obtain the word weight vector, and calculate the weight vector similarity between the category weight vector and the word weight vector; The minimum square error between the weight vector similarity and the initial image-text matching degree is calculated to obtain the matching loss information.
34. A graphic and text prediction model training device, characterized in that: The device comprises: A sample acquisition module is used to obtain image-text prediction training samples and corresponding image-text prediction labels; A model acquisition module is used to acquire a pre-trained image-text model and use the pre-trained image-text model as an initial image-text prediction model; the pre-trained image-text model is obtained by masking the original features of the training image and the original features of the training text to obtain the target features of the training image and the target features of the training text, inputting the target features of the training image and the target features of the training text into the initial pre-trained image-text model, evaluating the image-text matching degree by using the target features of the training image and the target features of the training text to obtain the initial image-text matching degree, performing cross-modal information interaction by using the initial image-text matching degree, the target features of the training image and the target features of the training text to obtain the initial image interaction features and the initial text interaction features, calculating the model loss based on the original features of the training image, the original features of the training text, the initial image interaction features, the initial text interaction features and the initial image-text matching degree to obtain the training model loss information, and training is performed based on the training model loss information, and the initial image-text matching degree is obtained by using the initial image-text pre-trained model to use the initial image-text matching degree evaluation parameters The training image target feature and the training text target feature are evaluated for their image-text matching degree, the training model loss information is obtained by calculating the sum of feature loss information and matching loss information, the feature loss information is the sum of image feature loss information and text feature loss information, and is used to characterize the error between the original feature and the interactive feature, and the matching loss information is used to characterize the error between the similarity between the training image and the training text and the initial image-text matching degree, and the initial image-text pre-training model is used to perform cross-modal information interaction to obtain initial image interaction features and initial text interaction features, including: using the training image target feature and the training text target feature to extract cross-attention features, and using the initial image-text matching degree to perform weighted calculation on the extracted cross-attention features to obtain the initial image interaction features and the initial text interaction features, the initial image interaction features refer to the training image features with text information obtained during training, and the initial text interaction features refer to the training text features with image information obtained during training; A training prediction module, used for inputting the image-text prediction training sample into the initial image-text prediction model to obtain the image-text prediction result corresponding to the image-text prediction training sample; The model acquisition module is used to calculate the prediction loss information between the image-text prediction result and the image-text prediction label, train the initial image-text prediction model based on the prediction loss information, and obtain the target image-text prediction model when the prediction training completion condition is met. The target image-text prediction model is used for cross-modal prediction using images and texts.
35. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 17 are implemented.
36. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 17 are implemented.
Citation Information
Patent Citations
Cross-modal information retrieval method and device and storage medium
CN109816039A
Image-text matching method and system based on frequency self-adaption
CN112861882A
Multi-modal pre-training model training method, application method and device thereof
CN112990297A
Depth cross-modal hash image retrieval method based on joint semantic matrix
CN113177132A
Visual language model obtaining method and device, visual language task processing method and device, equipment and storage medium
CN113792113A
