Model training method and apparatus, and device, storage medium and product
By using masking processing and optimization technology in the feature extraction model, the problem of low prediction accuracy of semantic association between multi-modal data is solved, and the prediction accuracy of the feature extraction model is significantly improved.
Patent Information
- Application Number
- PCT/CN2023/130147
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-22
- Filing Date
- 2023-11-07
- Publication Date
- 2024-08-29
AI Technical Summary
It is difficult to effectively improve the accuracy of feature extraction models in predicting semantic associations between multi-modal data with existing technologies, especially in the associations between different types of data such as text and images.
By obtaining a multi-modal data set, masking processing is performed to form a masked data set, and feature extraction models are used for feature prediction processing to obtain global restoration features and global features, and the model is optimized to enhance cross-modal representation and improve prediction accuracy.
By capturing the semantic information of unmasked data, restoring the lost information of masked data, and enhancing the global representation of multi-modal data, the prediction accuracy of the feature extraction model is significantly improved.
Smart Images

Figure CN2023130147_29082024_PF_FP_ABST
Abstract
Description
A model training method, device, equipment, storage medium and product
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on February 22, 2023, with application number 202310181561.5 and application name “A model training method, device, equipment, storage medium and product”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer technology, and in particular to a model training method, a model training device, a computer device, a computer-readable storage medium, and a computer program product. Background Art
[0003] With the advancement of scientific and technological research, a huge amount of data has emerged on the Internet. The types of this data may include but are not limited to text, images, videos, etc. Data containing multiple (at least two) different types can be called multimodal data. In many fields, semantic associations between multimodal data are involved; such as the field of text with pictures, the field of picture writing, the field of advertising push, etc. Research has found that the mainstream way to determine the semantic associations between multimodal data is to extract the features of multimodal data through a feature extraction model, and predict the semantic associations between multimodal data based on the features of multimodal data. How to improve the accuracy of the prediction results of the feature extraction model has become a hot issue in current research.
[0004] Summary of the Invention
[0005] The embodiments of the present application provide a model training method, apparatus, device, readable storage medium and product, which can improve the accuracy of the prediction results of the feature extraction model.
[0006] On the one hand, an embodiment of the present application provides a model training method, comprising:
[0007] Obtaining a first modal data set and a second modal data set, wherein the first modal data set includes M first modal data, each first modal data includes at least two first sub-modal data, and the second modal data set includes M second modal data, each second modal data includes at least two second sub-modal data; the M first modal data correspond one-to-one to the M second modal data; and M is an integer greater than 1;
[0008] Obtaining a first masked data set and a second masked data set, wherein the first masked data set is obtained by masking at least one first submodal data included in each first modal data in the first modal data set; and the second masked data set is obtained by masking at least one second submodal data included in each second modal data in the second modal data set;
[0009] Using a feature extraction model to perform feature prediction processing on the first masked data set and the second modal data set to obtain a global restoration feature of each first modal data and a global feature of each second modal data;
[0010] Using a feature extraction model to perform feature prediction processing on the second masked data set and the first modal data set to obtain a global feature of each first modal data set and a global restored feature of each second modal data set;
[0011] The feature extraction model is optimized based on the global restoration features of each first modal data, the global features of each first modal data, the global restoration features of each second modal data, and the global restoration features of each second modal data; the optimized feature extraction model is used to retrieve the first modal data and the second modal data that correspond to each other.
[0012] In one aspect, an embodiment of the present application provides a model training device, comprising:
[0013] an acquisition unit, configured to acquire a first modal data set and a second modal data set, wherein the first modal data set includes M first modal data, each first modal data including at least two first sub-modal data, and the second modal data set includes M second modal data, each second modal data including at least two second sub-modal data; the M first modal data correspond one-to-one to the M second modal data; and M is an integer greater than 1;
[0014] and obtaining a first masked data set and a second masked data set, wherein the first masked data set is obtained by masking at least one first submodal data contained in each first modal data in the first modal data set; and the second masked data set is obtained by masking at least one second submodal data contained in each second modal data in the second modal data set;
[0015] a processing unit, configured to perform feature prediction processing on the first masked data set and the second modal data set using a feature extraction model to obtain global restoration features corresponding to M pieces of first modal data and global features corresponding to M pieces of second modal data;
[0016] and performing feature prediction processing on the second masked data set and the first modal data set using a feature extraction model to obtain a global feature of each first modal data set and a global restored feature of each second modal data set;
[0017] And it is used to optimize the feature extraction model according to the global restoration features of each first modal data, the global features of each first modal data, the global restoration features of each second modal data and the global restoration features of each second modal data; the optimized feature extraction model is used to retrieve the first modal data and the second modal data that correspond to each other.
[0018] Accordingly, the present application provides a computer device, comprising:
[0019] a memory, wherein a computer program is stored in the memory;
[0020] A processor is used to load a computer program to implement the above-mentioned model training method.
[0021] Accordingly, the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is suitable for being loaded by a processor and executing the above-mentioned model training method.
[0022] Accordingly, the present application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the above-mentioned model training method.
[0023] In an embodiment of the present application, a first modal data set and a second modal data set are obtained, wherein the first modal data set includes M first modal data, each first modal data includes at least two first sub-modal data; the second modal data set contains M second modal data, each second modal data includes at least two second sub-modal data, and the M first modal data correspond one-to-one to the M second modal data; by selecting mutually corresponding and different types of modal data for model training, the feature extraction model can capture the semantic association between multimodal data, and can narrow the heterogeneous gap between different modal data through training and learning, thereby achieving the purpose of improving the accuracy of the model prediction results. A first masked data set and a second masked data set are obtained, wherein the first masked data set is obtained by masking at least one first sub-modal data contained in each first modal data in the first modal data set, and the second masked data set is obtained by masking at least one second sub-modal data contained in each second modal data in the second modal data set. In this way, the mutual correspondence between the first modal data and the second modal data can be expanded into two sets of corresponding data: one set is the mutual correspondence between the first masked data and the second modal data, and the other set is the mutual correspondence between the second masked data and the first modal data. In this way, the masked modal data can learn the lost semantic information from the other unmasked modal data, that is, the first masked data can learn the semantic information lost due to masking from the second modal data, and the second masked data can learn the semantic information lost due to masking from the first modal data. A feature extraction model is used to perform feature prediction processing on a first masked data set and a second modal data set, obtaining global restored features for each first modal data set and global features for each second modal data set. Feature extraction models are also used to perform feature prediction processing on the second masked data set and the first modal data set, obtaining global features for each first modal data set and global restored features for each second modal data set. The feature prediction processing of the feature extraction model can explore the semantic association between the two sets of corresponding data in terms of global representation, and restore the lost semantic information of the masked modal data by capturing the unmasked modal data, thereby enhancing the global representation of each modal data set. The feature extraction model is optimized based on the global restored features of each first modal data set, the global restored features of each first modal data set, the global restored features of each second modal data set, and the global restored features of each second modal data set. This optimization process can facilitate the feature extraction model to extract richer cross-modal global representations, thereby improving the accuracy of the feature extraction model's prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] FIG1 is a diagram of a model training framework provided in an embodiment of the present application;
[0025] FIG2 is a flow chart of a model training method provided in an embodiment of the present application;
[0026] FIG3 is a schematic diagram of modal data processing provided by an embodiment of the present application;
[0027] FIG4 is a flow chart of another model training method provided in an embodiment of the present application;
[0028] FIG5 is a diagram showing a model effect provided by an embodiment of the present application;
[0029] FIG6 is a schematic structural diagram of a model training device provided in an embodiment of the present application;
[0030] FIG7 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] This application involves artificial intelligence, computer vision technology, natural language processing technology, and deep learning. The following is a brief introduction to the relevant technologies:
[0032] Artificial Intelligence (AI): It is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that the machines have the functions of perception, reasoning and decision-making. The application of AI technology in the embodiments of the present application mainly involves extracting features of multimodal data through a feature extraction model, and analyzing the semantic associations between different modal data through the extracted features.
[0033] AI technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, large-scale application processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0034] Computer Vision Technology (CV): Computer vision is a science that studies how to make machines "see". To put it more specifically, it refers to machine vision that uses cameras and computers to replace human eyes to identify, track and measure targets, and further performs graphic processing so that computer processing becomes an image that is more suitable for human eye observation or transmission to instruments for 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 multidimensional data. Computer vision technology generally 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. The application of CV technology in the embodiments of the present application mainly involves extracting features from image (video) modal data through feature extraction modality.
[0035] 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 enable effective communication between humans 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 generally includes text processing, semantic understanding, machine translation, robot question answering, knowledge graphs and other technologies. The application of NLP technology in the embodiments of the present application mainly involves extracting features from text modal data through feature extraction modality.
[0036] Machine Learning (ML) is a multi-disciplinary interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithmic complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their own performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning generally include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning by formulas. The application of ML technology in the embodiment of the present application is mainly to optimize the feature extraction model through the global restoration features and global features corresponding to the first modal data set and the second modal data set, so as to promote the alignment of global features and local features learned by the feature extraction model, thereby improving the accuracy of the prediction results of the feature extraction model.
[0037] The embodiment of the present application provides a model training scheme to improve the accuracy of the prediction results of the feature extraction model. Figure 1 is a diagram of a model training framework provided by the embodiment of the present application. As shown in Figure 1, the model training framework can be carried by a computer device 101, and the computer device 101 here can be a terminal device or a server. Among them, the terminal device can include but is not limited to: smart phones (such as Android phones, IOS phones, etc.), tablet computers, portable personal computers, mobile Internet devices (Mobile Internet Devices, referred to as MID), vehicle-mounted terminals, smart home appliances, unmanned aerial vehicles, wearable devices, etc., and the embodiment of the present application does not limit this. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network, content distribution network), and basic cloud computing services such as big data and artificial intelligence platforms, and the embodiment of the present application does not limit this.
[0038] It should be noted that the number of computer devices in Figure 1 is for example only and does not constitute an actual limitation of this application; for example, the model training framework in Figure 1 can also be installed in multiple computer devices respectively, and each computer device can be connected via wired or wireless means, and this application does not impose any restrictions on this.
[0039] In specific implementation, the general principle of the model training scheme is as follows:
[0040] (1) The computer device 101 obtains a first modal data set and a second modal data set. The first modal data set includes M first modal data, each first modal data contains at least two first sub-modal data, and each first sub-modal data can be called a token; for example, assuming that the first modal data is text, the first sub-modal data can refer to the characters (or words) obtained after word segmentation processing of the text, and each character (or word) obtained by word segmentation processing can be called a token. Similarly, the second modal data set includes M second modal data, each second modal data contains at least two second sub-modal data, and each second sub-modal data can be called a token; for example, assuming that the second modal data is an image, the second sub-modal data can refer to the mesh obtained after mesh segmentation of the image, and each second mesh can be called a token. Wherein, M is an integer greater than 1.
[0041] The type of the first modal data is different from the type of the second modal data. For example, the first modal data is text and the second modal data is an image; for another example, the first modal data is a video and the second modal data is a text. M first modal data correspond one-to-one with M second modal data; the so-called one-to-one correspondence means that one first modal data corresponds to one second modal data, one second modal data corresponds to one first modal data, and different first modal data correspond to different second modal data. The so-called correspondence can be understood in the semantic space as: the features of the first modal data and the features of the second modal data match each other in the semantic space (that is, the matching degree is greater than a preset threshold). The so-called semantic space refers to a mathematical space that describes semantic relationships. In the field of natural language processing, the semantic space can be used to represent the semantic relationship between words, phrases or sentences; in the field of computer vision, the semantic space can be used to represent the semantic relationship between images; in the embodiment of the present application, the semantic space can be used to represent the semantic relationship between the first modal data and the second modal data. The features of the first modal data and the features of the second modal data are mapped to the semantic space, and the matching degree (similarity) between them can be calculated. The so-called correspondence in the real world (i.e., the real world that can be experienced and perceived) can be understood as: the first modal data and the second modal data can describe each other; for example, the first modal data is image 1, and the second modal data is text A. The content in image 1 can summarize text A, and the content in image 1 can also be described by text A.
[0042] (2) The computer device 101 obtains a first masked data set and a second masked data set. The first masked data set is obtained by masking at least one first submodal data contained in each first modal data in the first modal data set; the second masked data set is obtained by masking at least one second submodal data contained in each second modal data in the second modal data set. Masking is a method of masking or covering data, which prevents the data from being obtained or recognized by modifying, hiding or blurring the data. For different types of modal data, the masking method may be different. For example, for text, masking can specifically refer to replacing at least one token (i.e., a character or a word) in the text with a preset identifier, or replacing it with other characters (or words). The other characters (or words) mentioned here refer to characters (or words) different from the masked characters (or words); for images, masking can specifically refer to replacing at least one token (i.e., a mesh block) in the image with a preset identifier, or replacing it with other arbitrary images. The other arbitrary images mentioned here refer to images different from the masked mesh block.
[0043] (3) The computer device 101 uses a feature extraction model to perform feature prediction processing on the first mask data set and the second modal data set to obtain a global restoration feature of each first modal data and a global feature of each second modal data.
[0044] In one embodiment, the feature extraction model includes a first encoder, a second encoder, and a third encoder; wherein the first encoder and the second encoder are unimodal encoders, and the third encoder is a cross-modal encoder. The unimodal encoder is used to extract features of single-modal data, and the cross-modal encoder is used to enhance the interaction between features of multimodal data. The computer device 101 uses the first encoder to encode each first masked data in the first masked data set to obtain first feature information of each first masked data. Similarly, the computer device 101 uses the second encoder to encode each second modal data in the second modal data set to obtain second feature information of each second modal data. After obtaining the first feature information of each first masked data and the second feature information of each second modal data, the computer device 101 uses the third encoder to perform feature interaction processing on the M first feature information and the M second feature information to obtain global restoration features of each first modal data and global features of each second modal data.
[0045] (4) The computer device 101 uses a feature extraction model to perform feature prediction processing on the second masked data set and the first modal data set to obtain a global feature of each first modal data and a global restoration feature of each second modal data.
[0046] Similar to step (3), the feature extraction model includes a first encoder, a second encoder, and a third encoder. The computer device 101 uses the first encoder to encode each first modal data in the first modal data set to obtain the third feature information of each first modal data. Similarly, the computer device 101 uses the second encoder to encode each second masked data in the second masked data set to obtain the fourth feature information of each second masked data. After obtaining the third feature information of each first modal data and the fourth feature information of each second masked data, the computer device 101 uses the third encoder to perform feature interaction processing on the M third feature information and the M fourth feature information to obtain the global feature of each first modal data and the global restoration feature of each second masked data.
[0047] (5) The computer device 101 optimizes the feature extraction model based on the global restoration features of each first modal data, the global features of each first modal data, the global restoration features of each second modal data, and the global restoration features of each second modal data, to obtain an optimized feature extraction model. The optimized feature extraction model can be used to retrieve multimodal data with corresponding relationships; for example, to retrieve second modal data corresponding to target first modal data in a second modal data set, where the target first modal data can be any first modal data; for another example, to retrieve first modal data corresponding to target second modal data in a first modal data set, where the target second modal data can be any second modal data.
[0048] In one embodiment, on the one hand, the computer device 101 calculates a first semantic loss value based on the similarity between the global restoration features of each first modal data and the global features of the M first modal data. On the other hand, the computer device 101 calculates a second semantic loss value based on the similarity between the global restoration features of each second modal data and the global features of the M second modal data. After obtaining the first semantic loss value and the second semantic loss value, the computer device 101 sums the first semantic loss value and the second semantic loss value to obtain a first loss value, and optimizes the feature extraction model through the first loss value (such as adjusting the number of network layers in the feature extraction model, the number of convolution kernels in the network layer, the scale of the convolution kernel in the network layer, etc.) to obtain an optimized feature extraction model.
[0049] In an embodiment of the present application, a first modal data set and a second modal data set are obtained, wherein the first modal data set includes M first modal data, each first modal data includes at least two first sub-modal data; the second modal data set contains M second modal data, each second modal data includes at least two second sub-modal data, and the M first modal data correspond one-to-one to the M second modal data; by selecting mutually corresponding and different types of modal data for model training, the feature extraction model can capture the semantic association between multimodal data, and can narrow the heterogeneous gap between different modal data through training and learning, thereby achieving the purpose of improving the accuracy of the model prediction results. A first masked data set and a second masked data set are obtained, wherein the first masked data set is obtained by masking at least one first sub-modal data contained in each first modal data in the first modal data set, and the second masked data set is obtained by masking at least one second sub-modal data contained in each second modal data in the second modal data set. In this way, the mutual correspondence between the first modal data and the second modal data can be expanded into two sets of corresponding data: one set is the mutual correspondence between the first masked data and the second modal data, and the other set is the mutual correspondence between the second masked data and the first modal data. In this way, the masked modal data can learn the lost semantic information from the other unmasked modal data, that is, the first masked data can learn the semantic information lost due to masking from the second modal data, and the second masked data can learn the semantic information lost due to masking from the first modal data. A feature extraction model is used to perform feature prediction processing on a first masked data set and a second modal data set, obtaining global restored features for each first modal data set and global features for each second modal data set. Feature extraction models are also used to perform feature prediction processing on the second masked data set and the first modal data set, obtaining global features for each first modal data set and global restored features for each second modal data set. The feature prediction processing of the feature extraction model can explore the semantic association between the two sets of corresponding data in terms of global representation, and restore the lost semantic information of the masked modal data by capturing the unmasked modal data, thereby enhancing the global representation of each modal data set. The feature extraction model is optimized based on the global restored features of each first modal data set, the global restored features of each first modal data set, the global restored features of each second modal data set, and the global restored features of each second modal data set. This optimization process can facilitate the feature extraction model to extract richer cross-modal global representations, thereby improving the accuracy of the feature extraction model's prediction results.
[0050] Based on the above-mentioned model training scheme, the embodiment of the present application proposes a more detailed model training method. The model training method proposed in the embodiment of the present application will be introduced in detail below with reference to the accompanying drawings.
[0051] Please refer to Figure 2, which is a flowchart of a model training method provided in an embodiment of the present application. The model training method can be executed by a computer device, which can be a terminal device or a server. As shown in Figure 2, the model training method may include the following steps S201-S205:
[0052] S201. Acquire a first modal data set and a second modal data set.
[0053] S202: Acquire a first masked data set and a second masked data set.
[0054] In one embodiment, the computer device divides each first modal data in the first modal data set, and each first modal data is divided into a first data sequence, and each first data sequence includes at least two first sub-modal data. Similarly, the computer device divides each second modal data in the second modal data set, and each second modal data is divided into a second data sequence, and each second data sequence includes at least two second sub-modal data. The so-called division refers to the process of dividing a whole into several parts; for different types of modal data, division can have different meanings, for example: the first modal data is text, and dividing the first modal data can refer to word segmentation processing of the text; for example: the second modal data is an image, and dividing the second modal data can refer to block segmentation processing of the image. The first data sequence refers to the sequence formed by the sequential arrangement of the first sub-modal data obtained by dividing the first modal data. For example: the first modal data is text, and the first data sequence is the sequence formed by the sequential arrangement of the tokens (i.e., characters or words) formed after the word segmentation processing of the text. The second data sequence refers to a sequence formed by arranging in order the second sub-modal data obtained by dividing the second modal data. For example, if the second modal data is an image, the second data sequence is a sequence formed by arranging in order the tokens (i.e., blocks) obtained by dividing the image into blocks.
[0055] Then the computer device performs masking processing on at least one first submodal data in each first data sequence to obtain a first masked data set. The number of masked first submodal data in different first modal data can be the same or different, and the number of masked first submodal data in each first modal data can be adjusted according to actual conditions (such as adjusting the masking ratio of each first modal data), and this application does not impose any restrictions on this. The so-called masking ratio refers to the percentage between the number of submodal data that needs to be masked in a modal data and the total amount of all submodal data contained in the modal data; for example: a certain first modal data contains a total of 10 first submodal data, and the number of first submodal data that needs to be masked is 5, then the masking ratio of the first modal data is 5 / 10*100%=50%. In the embodiment of the present application, masking processing refers to replacing at least one submodal data contained in the modal data with a preset identifier, or replacing it with other interference data; for example, if the type of the modal data is text, a submodal data can be called a token, and a token refers to a character or a word obtained after word segmentation processing of the text; masking processing can be understood as replacing at least one token in the text (modal data) with a preset identifier, or replacing it with other characters or words. For another example: if the type of the modal data is an image, a submodal data can be called a token, and a token refers to a block obtained after block segmentation of the image; masking processing can be understood as replacing at least one token in the image (modal data) with a preset identifier, or replacing it with any other image.
[0056] Similarly, the computer device performs masking processing on at least one second submodal data item contained in each second data sequence to obtain a second masked data set. In a specific implementation, the computer device may obtain a masking ratio for each second modal data item and, based on the masking ratio for each second modal data item, perform masking processing on at least one second submodal data item in the second modal data to obtain the second masked data set. For example, if the masking ratio for a particular second modal data item is 40%, and the second modal data item contains a total of 10 second submodal data items, the computer may determine, based on the masking ratio for the second modal data item, that the number of second submodal data items that need to be masked in the second modal data item is 4. In this case, the computer may randomly select 4 second submodal data items for masking processing (e.g., replacing the selected 4 second submodal data items with preset identifiers).
[0057] S203: Perform feature prediction processing on the first masked data set and the second modal data set using a feature extraction model to obtain a global restoration feature of each first modal data set and a global feature of each second modal data set.
[0058] The feature extraction model includes a first encoder, a second encoder and a third encoder; wherein the first encoder and the second encoder are unimodal encoders, and the third encoder is a cross-modal encoder. The unimodal encoder is used to extract features of single-modal data, and the cross-modal encoder is used to enhance the interaction between features of multimodal data.
[0059] In one embodiment, the computer device uses a first encoder to encode each piece of first masked data in the first masked data set to obtain first feature information for each piece of first masked data. Similarly, the computer device uses a second encoder to encode each piece of second modal data in the second modal data set to obtain second feature information for each piece of second modal data.
[0060] Assume that any first masked data in the first masked data set is denoted as the i-th first masked data, the i-th first masked data is obtained after masking the i-th first modal data in the first modal data set, and the first feature information of the i-th first masked data is denoted as the i-th first feature information, where i is a positive integer less than or equal to M. It can be understood that since the i-th first masked data is obtained after masking the i-th first modal data, the i-th first feature information may include the following ①-③: ① local features of the i-th first modal data. The so-called local features of the i-th first modal data refer to: the features of each unmasked first sub-modal data in the i-th first modal data; ② local restored features of the i-th first modal data. The so-called local restored features of the i-th first modal data refer to: the features of each masked first sub-modal data in the i-th first modal data after restoration. Schematically, the local restoration features of the i-th first modal data can be restored based on the local features of the i-th first modal data, where i is a positive integer less than or equal to M; ③ the global restoration features of the i-th first modal data. The so-called global restoration features of the i-th first modal data refer to the overall features after the i-th first masked data is restored. Schematically, the global restoration features of the i-th first modal data can be obtained by directly combining the local features of the i-th first modal data and the local restoration features, or can be obtained by further processing (such as noise reduction processing, feature extraction processing, etc.) the combination of the local features of the i-th first modal data and the local restoration features.
[0061] Suppose any second modal data in the second modal data set is represented as the i-th second modal data, and the second feature information of the i-th second modal data is represented as the i-th second feature information. The i-th second feature information includes the following ④-⑤: ④ local features of the i-th second modal data. The so-called local features of the i-th second modal data refer to: the features of each second sub-modal data in the i-th second modal data; ⑤ global features of the i-th second modal data. The so-called global features of the i-th second modal data refer to: the overall features of the i-th second modal data. Schematically, the global features of the i-th second modal data can be obtained by directly combining the local features of the i-th second modal data, or can be obtained by further processing the combination of the local features of the i-th second modal data (such as noise reduction processing, feature extraction processing, etc.).
[0062] After obtaining the first feature information of each first masked data and the second feature information of each second modal data, the computer device uses a third encoder to perform feature interaction processing on the M first feature information and the M second feature information to obtain the global restoration feature of each first modal data and the global feature of each second modal data.
[0063] The third encoder includes a self-attention mechanism module and a cross-attention mechanism module. The process of the computer device using the third encoder to perform feature interaction processing on M first feature information and M second feature information includes: (1) using the self-attention mechanism module to mine the correlation relationship between each feature in each first feature information. Specifically, the i-th first feature information includes the local features of the i-th first modal data and the local restoration features of the i-th first modal data; here, the correlation relationship between each feature in the i-th first feature information includes: the correlation relationship between the local features of the i-th first modal data, the correlation relationship between the local restoration features of the i-th first modal data, and the correlation relationship between the local features and the local restoration features of the i-th first modal data; (2) using the self-attention mechanism module to mine the correlation relationship between each feature in each second feature information. Specifically, the i-th second feature information includes the local features of the i-th second modal data; here, the correlation relationship between each feature in the i-th second feature information includes: the correlation relationship between the local features of the i-th second modal data. (3) A cross-attention mechanism module is used to perform feature interaction processing on the M first feature information after mining and the M second feature information after mining. For example, assuming that the type of the first modal data is an image, the type of the first masked data is also an image; the second modal data is text, and the computer device can use the first feature information after mining of the first masked data as a question (query) and the second feature information after mining of the second modal data as an answer (key and value) to perform feature interaction. Optionally, since the first feature information can also include the global restoration feature of the first modal data, the computer device can also use the global restoration feature of the first modal data as a question (query) and the second feature information after mining of the second modal data as an answer (key and value) to perform feature interaction.
[0064] S204 , performing feature prediction processing on the second masked data set and the first modal data set using a feature extraction model to obtain a global feature of each first modal data set and a global restoration feature of each second modal data set.
[0065] In one embodiment, the computer device uses a first encoder to encode each first modal data in the first modal data set to obtain third feature information of each first modal data. Similarly, the computer device uses a second encoder to encode each second masked data in the second masked data set to obtain fourth feature information of each second masked data.
[0066] Suppose any first modal data in the first modal data set is represented as the i-th first modal data, and the third feature information of the i-th first modal data is represented as the i-th third feature information. The i-th third feature information includes the following ①-②: ① local features of the i-th first modal data. The so-called local features of the i-th first modal data refer to: the features of each first sub-modal data in the i-th first modal data; ② global features of the i-th first modal data. The so-called global features of the i-th first modal data refer to: the overall features of the i-th first modal data. Schematically, the global features of the i-th first modal data can be obtained by directly combining the local features of the i-th first modal data, or can be obtained after further processing (such as noise reduction processing, feature extraction processing, etc.) of the combination of local features of the i-th first modal data.
[0067] Assume that any second masked data in the second masked data set is represented as the i-th second masked data, the i-th second masked data is obtained by masking the i-th second modal data in the second modal data set, and the fourth feature information of the i-th second masked data is represented as the i-th fourth feature information, where i is a positive integer less than or equal to M. It can be understood that since the i-th second masked data is obtained by masking the i-th second modal data, the i-th fourth feature information may include the following ④-⑥: ④ local features of the i-th second modal data. The so-called local features of the i-th second modal data refer to: the features of each unmasked second sub-modal data in the i-th second modal data; ⑤ local restoration features of the i-th second modal data. The so-called local restoration features of the i-th second modal data refer to: the features after the masked second sub-modal data in the i-th second modal data are restored; schematically, the local restoration features of the i-th second modal data can be restored based on the local features of the i-th second modal data, and i is a positive integer less than or equal to M. ⑥ Global restoration features of the i-th second modal data. The so-called global restoration features of the i-th second modal data refer to: the overall features after the i-th second masked data is restored. Schematically, the global restoration features of the i-th second modal data can be obtained by directly combining the local features and local restoration features of the i-th second modal data, or can be obtained by further processing (such as noise reduction processing, feature extraction processing, etc.) the combination of the local features and local restoration features of the i-th second modal data.
[0068] After obtaining the third feature information of each first modal data and the fourth feature information of each second masked data, the computer device uses a third encoder to perform feature interaction processing on the M third feature information and the M fourth feature information to obtain the global feature of each first modal data and the global restoration feature of each second modal data.
[0069] The process of a computer device using a third encoder to perform feature interaction processing on M third feature information and M fourth feature information includes: (1) using a self-attention mechanism module to mine the correlation between each feature in each third feature information. Specifically, the i-th third feature information includes the local features of the i-th first modal data; here, the correlation between each feature in the i-th third feature information includes: the correlation between the local features of the i-th first modal data. (2) using a self-attention mechanism module to mine the correlation between each feature in each fourth feature information. Specifically, the i-th fourth feature information includes the local features of the i-th second modal data and the local restored features of the i-th second modal data; here, the correlation between each feature in the i-th fourth feature information includes: the correlation between the local features of the i-th second modal data, the correlation between the local restored features of the i-th second modal data, and the correlation between the local features and the local restored features of the i-th second modal data; (3) using a cross-attention mechanism module to perform feature interaction processing on the mined M third feature information and the mined M fourth feature information.
[0070] S205: Optimize the feature extraction model based on the global restoration features of each first modal data item, the global features of each first modal data item, the global restoration features of each second modal data item, and the global restoration features of each second modal data item. The optimized feature extraction model can be used to retrieve multimodal data items having corresponding relationships; for example, to retrieve second modal data items in a set of second modal data items that correspond to target first modal data items; where the target first modal data item can refer to any first modal data item.
[0071] FIG3 is a schematic diagram of a modal data processing method provided by an embodiment of the present application. As shown in FIG3, during the feature extraction model optimization process, the feature extraction model can be allowed to restore the overall features of the masked data (i.e., the global restoration features of the modal data to which the masked data belongs) through cross-modal interaction; specifically: assuming that the first modal data and the second modal data correspond to each other, the first modal data is an image I and the second modal data is a text T; the tokens in the first modal data can be randomly masked according to the masking ratio of the first modal data to obtain the first masked data I mask , randomly mask the tokens in the second modal data according to the masking ratio of the second modal data to obtain the second masked data T mask, so that the masked modal data can learn the lost semantic information from the other unmasked modal data, that is, the first masked data can learn the semantic information lost due to masking from the second modal data, and the second masked data can learn the semantic information lost due to masking from the first modal data. Schematically, the masking ratio of the first modal data (type is image) can be 80%, that is, 80% of the patches in the image are masked; the masking ratio of the second modal data (type is text) can be 40%, that is, 40% of the tokens (words or words) in the text are masked. Then the two sets of corresponding data (one set consists of the first masked data and the second modal data, represented as {I mask ,T}, the other group consists of the first modality data and the second masked data, denoted as {I,T mask The global restoration features of the modal data are obtained by using the cross-modal information in each group, and the global restoration features are made close to the global features through contrastive learning.
[0072] In one embodiment, the computer device calculates a first semantic loss value based on the similarity between the global restoration feature of each first modality data and the global features of the M first modality data. Specifically, it can be expressed as:
[0073] Among them, NCE V is the first semantic loss value, represents the global restoration feature of the i-th first modal data, represents the global feature of the i-th first modal data, s(x, y) represents the calculation of the cosine similarity of x and y, exp() is the exponential function, τ is the temperature coefficient, and M is the number of first modal data in the first modal data set.
[0074] On the other hand, the computer device calculates the second semantic loss value based on the similarity between the global restoration feature of each second modal data and the global features of the M second modal data. Specifically, it can be expressed as:
[0075] Among them, NCE L is the second semantic loss value, represents the global restoration feature of the i-th second modal data, represents the global feature of the i-th second modal data, s(x, y) represents the calculation of the cosine similarity of x and y, exp() is the exponential function, τ is the temperature coefficient, and M is the number of second modal data in the second modal data set.
[0076] After obtaining the first semantic loss value and the second semantic loss value, the computer device sums the first semantic loss value and the second semantic loss value to obtain the first loss value. Specifically, it can be expressed as: L SCL =NCE V +NCE L
[0077] Among them, L SCL is the first loss value, NCE V is the first semantic loss value, NCE L is the second semantic loss value.
[0078] After obtaining the first loss value, the computer device can optimize the feature extraction model based on the first loss value (such as adjusting the number of network layers in the feature extraction model, the number of convolution kernels in the network layer, the scale of the convolution kernels in the network layer, etc.) to obtain an optimized feature extraction model.
[0079] In an embodiment of the present application, a first modal data set and a second modal data set are obtained, wherein the first modal data set includes M first modal data, each first modal data includes at least two first sub-modal data; the second modal data set contains M second modal data, each second modal data includes at least two second sub-modal data, and the M first modal data correspond one-to-one to the M second modal data; by selecting mutually corresponding and different types of modal data for model training, the feature extraction model can capture the semantic association between multimodal data, and can narrow the heterogeneous gap between different modal data through training and learning, thereby achieving the purpose of improving the accuracy of the model prediction results. A first masked data set and a second masked data set are obtained, wherein the first masked data set is obtained by masking at least one first sub-modal data contained in each first modal data in the first modal data set, and the second masked data set is obtained by masking at least one second sub-modal data contained in each second modal data in the second modal data set. In this way, the mutual correspondence between the first modal data and the second modal data can be expanded into two sets of corresponding data: one set is the mutual correspondence between the first masked data and the second modal data, and the other set is the mutual correspondence between the second masked data and the first modal data. In this way, the masked modal data can learn the lost semantic information from the other unmasked modal data, that is, the first masked data can learn the semantic information lost due to masking from the second modal data, and the second masked data can learn the semantic information lost due to masking from the first modal data. A feature extraction model is used to perform feature prediction processing on a first masked data set and a second modal data set, obtaining global restored features for each first modal data set and global features for each second modal data set. Feature extraction models are also used to perform feature prediction processing on the second masked data set and the first modal data set, obtaining global features for each first modal data set and global restored features for each second modal data set. The feature prediction processing of the feature extraction model can explore the semantic association between the two sets of corresponding data in terms of global representation, and restore the lost semantic information of the masked modal data by capturing the unmasked modal data, thereby enhancing the global representation of each modal data set. The feature extraction model is optimized based on the global restored features of each first modal data set, the global restored features of each first modal data set, the global restored features of each second modal data set, and the global restored features of each second modal data set. This optimization process can facilitate the feature extraction model to extract richer cross-modal global representations, thereby improving the accuracy of the feature extraction model's prediction results.
[0080] Please refer to Figure 4, which is a flowchart of another model training method provided in an embodiment of the present application. The model training method can be executed by a computer device, which can be a terminal device or a server. As shown in Figure 4, the model training method may include the following steps S401-S409:
[0081] S401: Acquire a first modal data set and a second modal data set.
[0082] S402: Acquire a first masked data set and a second masked data set.
[0083] The specific implementation of step S401 and step S402 can refer to the implementation of step S201 and step S202 in Figure 2, and will not be repeated here.
[0084] S403: Perform feature prediction processing on the first masked data set and the second modal data set using a feature extraction model to obtain a global restoration feature of each first modal data set and a global feature of each second modal data set.
[0085] Assume that in the corresponding first modal data and second modal data, the first modal data is an image I and the second modal data is a text T; the token in the first modal data can be randomly masked according to the masking ratio of the first modal data to obtain the first masked data I mask ; Randomly mask the tokens in the second modal data according to the masking ratio of the second modal data to obtain the second masked data T mask ; In this way, the masked modal data can learn the lost semantic information from the other unmasked modal data, that is, the first masked data can learn the semantic information lost due to masking from the second modal data, and the second masked data can learn the semantic information lost due to masking from the first modal data. Then the two sets of corresponding data (one set consists of the first masked data and the second modal data, denoted as {I mask ,T}; the other group consists of the first modal data and the second masked data, denoted as {I,T mask}) are input into the feature extraction model for processing.
[0086] In one embodiment, the computer device may use a feature extraction model to perform feature prediction processing on the first masked data set and the second modal data set corresponding to each other, thereby obtaining the global restoration features (and local features and local restoration features) of the first modal data to which the first masked data belongs; and the global features (and local features) of the second modal data. Specifically, this can be expressed as: Re ,T Co =Model(I mask ,T)
[0087] Among them, I Re is the global restoration feature of the first modal data, T Co is the global feature of the second modality data, I mask is the first mask data, T is the second modal data, and Model(a,b) indicates that the feature extraction model is used to perform feature prediction processing on a and b in a set of corresponding input data {a,b}.
[0088] According to the above embodiment, the computer device repeatedly calls the feature extraction model to perform feature prediction processing on the corresponding data in the first mask data set and the second modal data set, thereby obtaining the global restoration features of each first modal data and the global features of each second modal data.
[0089] S404: Using a feature extraction model to perform feature prediction processing on the second masked data set and the first modal data set to obtain a global feature of each first modal data set and a global restoration feature of each second modal data set.
[0090] In one embodiment, the computer device may use a feature extraction model to perform feature prediction processing on the second masked data set and the first modal data set that correspond to each other, thereby obtaining the global restoration features (and local features and local restoration features) of the second modal data to which the second masked data belongs; and the global features (and local features) of the first modal data. Specifically, this can be expressed as: Co ,T Re =Model(I,T mask )
[0091] Among them, I Co is the global feature of the first modal data, T Re is the global restoration feature of the second modal data, I is the first modal data, T mask is the second mask data, Model(a,b) indicates that the feature extraction model is used to perform feature prediction processing on a and b in a set of corresponding input data {a,b}.
[0092] According to the above embodiment, the computer device repeatedly calls the feature extraction model to perform feature prediction processing on the corresponding data in the second masked data set and the first modal data set, thereby obtaining the global features of each first modal data and the global restoration features of each second modal data.
[0093] S405 , calculating a first loss value according to the global restoration feature of each first modal data, the global feature of each first modal data, the global restoration feature of each second modal data, and the global restoration feature of each second modal data.
[0094] The specific implementation of step S405 can refer to the calculation method of the first loss value in step S205 in Figure 2, which will not be repeated here.
[0095] S406. Calculate a second loss value based on the global features of each first modality data and the global features of each second modality data.
[0096] During the optimization process of the feature extraction model, the global features of each first modal data in the first modal data set and the global features of each second modal data in the second modal data set can be mapped to their respective types of encoding spaces. For example, if the first modal data is an image, the global features of each first modal data in the first modal data set can be mapped to the visual encoding space. If the second modal data is text, the global features of each second modal data in the second modal data set can be mapped to the language encoding space. Then, through comparative learning, the positions of the global features of each first modal data and the global features of each second modal data in the semantic space are adjusted so that the positive sample features are close and the negative sample features are far apart. Specifically, in the first modal data set and the second modal data set, the corresponding first modal data and the second modal data are used as positive samples, and the second modal data in the second modal data set other than the current second modal data are negative samples for the current first modal data; wherein the current first modal data refers to the first modal data being processed, and the current second modal data refers to the second modal data corresponding to the current first modal data. After mapping the global features of M first modal data and the global features of M second modal data to a unified semantic space, the third encoder (fusion encoder) performs (token level) interaction on the first sub-modal data (such as mesh blocks in an image) contained in each first modal data and the second sub-modal data (such as characters or words in a text) contained in each second modal data.
[0097] In one embodiment, the computer device may obtain the global features of each first modal data by executing step S404, and obtain the global features of each second modal data by executing step S403. In another embodiment, the computer device may use a feature extraction model to perform feature extraction processing on the first modal data set and the second modal data set to obtain the global features of each first modal data and the global features of each second modal data. Specifically, the computer device uses a first encoder to encode each first modal data in the first modal data set respectively to obtain the third feature information of each first modal data. Similarly, the computer device uses a second encoder to encode each second modal data in the second modal data set respectively to obtain the second feature information of each second modal data. After obtaining the third feature information of each first modal data and the second feature information of each second modal data, the computer device uses a third encoder to perform feature interaction processing on M third feature information and M second feature information to obtain the global features of each first modal data and the global features of each second modal data.
[0098] Furthermore, the computer device calculates the second loss value according to the global features of each first modality data and the global features of each second modality data in a specific implementation as follows:
[0099] On the one hand, the computer device calculates a third semantic loss value based on the similarity between each global feature of the first modal data and the global features of the M second modal data. Specifically, it can be expressed as:
[0100] Among them, NCE V2T is the third semantic loss value, V i represents the global features of the i-th first modal data, T i represents the global feature of the i-th second modal data, s(x,y) represents the calculation of the cosine similarity of x and y, exp() is the exponential function, τ is the temperature coefficient, and M is the number of first modal data in the first modal data set.
[0101] On the other hand, the computer device calculates a fourth semantic loss value based on the similarity between each global feature of the second modal data and the global features of the M first modal data. Specifically, it can be expressed as:
[0102] Among them, NCE T2V is the fourth semantic loss value, T i represents the global features of the i-th second modal data, V irepresents the global feature of the i-th first modal data, s(x,y) represents the calculation of the cosine similarity of x and y, exp() is the exponential function, τ is the temperature coefficient, and M is the number of second modal data in the second modal data set.
[0103] After obtaining the third semantic loss value and the fourth semantic loss value, the computer device sums the third semantic loss value and the fourth semantic loss value to obtain the second loss value. Specifically, it can be expressed as: L CL =NCE V2T +NCE T2V
[0104] Among them, L CL is the second loss value, NCE V2T is the third semantic loss value, NCE T2V is the fourth semantic loss value.
[0105] S407. Calculate a third loss value using the global features of the target first modality data and the global features of the target second modality data.
[0106] During the optimization process of the feature extraction model, the global features of the labeled (e.g., labeled by [CLS]) first modality data and the global features of the labeled second modality data output by the third encoder (fusion encoder) can be spliced, and then the spliced results can be binary classified to help the feature extraction model learn the correspondence between the overall information of the first modality data and the overall information of the second modality data. In the first modality data set and the second modality data set, the corresponding target first modality data and target second modality data are used as positive samples, and the target first modality data are randomly replaced with other first modality data in the first modality data set to construct negative samples.
[0107] In one embodiment, the global features of the target first modal data and the global features of the target second modal data are obtained by performing feature extraction processing on the labeled first modal data in the first modal data set and the labeled second modal data in the second modal data set by the feature extraction model. The number of labeled first modal data in the first modal data set can be [1, M], and the number of labeled second modal data in the second modal data set can be [1, M]. The computer device performs splicing processing on the global features of the target first modal data and the global features of the target second modal data to obtain splicing features. After obtaining the splicing features, the matching relationship between the global features of the target first modal data and the global features of the target second modal data is predicted by the splicing features, and based on the predicted matching relationship and the corresponding relationship between the global features of the target first modal data and the global features of the target second modal data, the third loss value is calculated. It can be specifically expressed as: L VTM=CE(φ(concat[V,T]),y)
[0108] Among them, L VTM is the third loss value, V is the global feature of the target first modality data, T is the global feature of the target second modality data, concat(a,b) represents the concatenation of feature a and feature b, φ is a binary classifier, y is the actual correspondence between V and T (0 means no correspondence, 1 means correspondence), and CE(c,d) represents the calculation of the cross entropy loss of c and d.
[0109] S408 : Obtain local restoration features of the target first modal data, and calculate a fourth loss value based on the local restoration features of the target first modal data.
[0110] Assuming the first modality data is text and the second modality data is visual (image / video), during the feature extraction model optimization process, a portion (at least one) of the characters or words in each text (i.e., the first sub-modality data) can be masked, allowing the feature extraction model to predict the masked characters or words (i.e., the masked first sub-modality data in the first modality data) based on the visual information (i.e., the second modality data) and the textual context (i.e., the unmasked first sub-modality data in the first modality data). This character / token-level reconstruction can help the model learn the connection between linguistic words and visual entities, achieving accurate part-to-part alignment.
[0111] The local restoration features of the target first modal data are obtained after the feature extraction model performs feature extraction processing on the masked target first modal data and the second modal data corresponding to the target first modal data.
[0112] In one embodiment, the computer device can obtain the local restoration features of the target first modal data through step S403, and predict the masked first submodal data in the target first modal data through the local restoration features of the target first modal data; for example, predict the identifier (ID) of the masked first submodal data in the vocabulary of the target first modal data. After predicting the masked first submodal data in the target first modal data, the fourth loss value is calculated based on the predicted first submodal data and the masked first submodal data in the target first modal data. Specifically, it can be expressed as: L MLM =CE(φ(Tmask),y)
[0113] Among them, L MLM is the fourth loss value, T mask is the local restoration feature of the masked first submodal data in the target first modal data, φ() is the vocabulary classifier, y is the identifier (ID) of the masked first submodal data in the target first modal data in the vocabulary, and CE(a,b) represents the calculation of the cross entropy loss of a and b.
[0114] S409: summing the first loss value, the second loss value, the third loss value, and the fourth loss value, and optimizing the feature extraction model according to the summation result.
[0115] The sum of the first loss value, the second loss value, the third loss value and the fourth loss value can be expressed as: L = L CL +L VTM +L MLM +L SCL
[0116] Among them, L is the total loss, L SCL is the first loss value, L CL is the second loss value, L VTM is the third loss value, L MLM is the fourth loss value.
[0117] Optionally, the computer device can also calculate the overall loss based on at least one of the second loss value-fourth loss value and the first loss value; for example, calculate the overall loss based on the first loss value and the second loss value; for another example, calculate the overall loss based on the first loss value, the third loss value, and the fourth loss value.
[0118] After obtaining the overall loss, the computer device can optimize the feature extraction model (such as adjusting the number of network layers in the feature extraction model, the number of convolution kernels in the network layer, the scale of the convolution kernels in the network layer, etc.) to obtain an optimized feature extraction model.
[0119] In one embodiment, the first modality data is an image or video, and the first encoder is a visual encoder. The first modality data set (the input image set or video) is first processed through convolution into patch features of size Q×3×N×P×P, where P is the patch size, N is the number of patches per image, and Q is the number of frames. For image modality data, Q is 1. Learnable positional and temporal encodings can also be added as input to the feature extraction model. The patch features are then passed through a stacked visual attention module in the first encoder for feature extraction. For the visual encoder (the first encoder), parameters from an existing image encoder (such as CLIP-ViT) can be used to initialize the first encoder's parameters. The second modality data is text, and the second encoder is a text encoder. For the second modality data set, a tokenizer is first used to segment the data to obtain a character / word (token) sequence, which is then mapped to the latent state space dimension. The mapping results are then passed through a stacked self-attention module in the second encoder to learn the text context. The parameters of the second encoder can be initialized using parameters from an existing text encoder (such as RoBERTa). The fusion encoder (the third encoder) is a two-stream fusion structure with a total of k layers (k is a positive integer, such as k = 6). Each layer consists of a module composed of intra-modality self-attention and inter-modality cross-attention. Taking image features as an example, each layer first uses visual self-attention to mine intra-modality information. Then, cross-attention is performed on the image features as the query and the text features as the key and value. The hidden state space dimension of all encoders can be 768, the image size can be 288×288 during pre-training, and the text length can be 50.
[0120] Figure 5 is a model effect display diagram provided by an embodiment of the present application. As shown in Figure 5, after the feature extraction model is trained by the model training method provided by the present application, the overall representation of the text (local features and global features) can more accurately focus on the corresponding target in the image. By using the local features of the visible data (unmasked data) to restore the features of the masked data, the global restoration features of the modal data are obtained, so that the feature extraction model learns global features with strong representation capabilities. Under the same amount of pre-training data, the prediction results of the optimized feature extraction model obtained by the model training method proposed in this application are more accurate, and better results have been achieved in many downstream tasks.
[0121] Furthermore, the optimized feature extraction model can be applied to multiple scenarios such as video intelligent creation, ad fingerprint generation, and ad recommendation, improving the overall advertising delivery effect and content consumer experience. Specific scenarios are as follows:
[0122] (1) Application to intelligent video creation: Through cross-modal retrieval + splicing, video creatives can be automatically generated in batches based on text, which can greatly improve the efficiency of video creation. Specifically, given the text modal data of the video to be created, the optimized feature extraction model retrieves semantically related video clips from the massive video library based on the text modal data. The retrieved video clips are then roughly sorted and finely sorted based on dimensions such as similarity and click-through rate, and finally combined and rendered into a video. It can be understood that due to the automation of this process, the efficiency of video creation is greatly improved.
[0123] (2) Advertising fingerprint generation: Through the optimized feature extraction model, similar advertisements can be better recalled through the multimodal (text mode, image mode, etc.) features of the creative, generating advertising fingerprints; thereby improving the consistency of advertising estimates and the freshness of content consumers.
[0124] (3) Advertisement recommendation: For an ad video creative, it usually contains text and video materials. The optimized feature extraction model can generate semantically related text features and video features for a creative. This multimodal feature (text modality, image modality, etc.) can better represent the content of an ad creative. In addition, the text features and video features extracted by the optimized feature extraction model can also be applied to the ad recommendation model to help the ad recommendation model better understand the ad content and improve the recommendation effect (for example, making the ad recommendation more targeted).
[0125] (4) Image-Text Question Answering: The computer device can obtain the target image and the question text corresponding to the target image. The optimized feature extraction model is used to extract the features of the target image and the question text, and the feature information of the target image and the question text is obtained. The feature information of the target image and the question text is then classified by a multilayer perceptron (MLP) to obtain the answer text corresponding to the question text.
[0126] In an embodiment of the present application, a first modal data set and a second modal data set are obtained, wherein the first modal data set includes M first modal data, each first modal data includes at least two first sub-modal data; the second modal data set contains M second modal data, each second modal data includes at least two second sub-modal data, and the M first modal data correspond one-to-one to the M second modal data; by selecting mutually corresponding and different types of modal data for model training, the feature extraction model can capture the semantic association between multimodal data, and can narrow the heterogeneous gap between different modal data through training and learning, thereby achieving the purpose of improving the accuracy of the model prediction results. A first masked data set and a second masked data set are obtained, wherein the first masked data set is obtained by masking at least one first sub-modal data contained in each first modal data in the first modal data set, and the second masked data set is obtained by masking at least one second sub-modal data contained in each second modal data in the second modal data set. In this way, the mutual correspondence between the first modal data and the second modal data can be expanded into two sets of corresponding data: one set is the mutual correspondence between the first masked data and the second modal data, and the other set is the mutual correspondence between the second masked data and the first modal data. In this way, the masked modal data can learn the lost semantic information from the other unmasked modal data, that is, the first masked data can learn the semantic information lost due to masking from the second modal data, and the second masked data can learn the semantic information lost due to masking from the first modal data. A feature extraction model is used to perform feature prediction processing on a first masked data set and a second modal data set, obtaining global restored features for each first modal data set and global features for each second modal data set. Feature extraction models are also used to perform feature prediction processing on the second masked data set and the first modal data set, obtaining global features for each first modal data set and global restored features for each second modal data set. The feature prediction processing of the feature extraction model can explore the semantic association between the two sets of corresponding data in terms of global representation, and restore the lost semantic information of the masked modal data by capturing the unmasked modal data, thereby enhancing the global representation of each modal data set. The feature extraction model is optimized based on the global restored features of each first modal data set, the global restored features of each first modal data set, the global restored features of each second modal data set, and the global restored features of each second modal data set. This optimization process can facilitate the feature extraction model to extract richer cross-modal global representations, thereby improving the accuracy of the feature extraction model's prediction results.
[0127] The above describes in detail the method of the embodiment of the present application. In order to facilitate better implementation of the above scheme of the embodiment of the present application, the device of the embodiment of the present application is provided below accordingly.
[0128] Please refer to Figure 6, which is a schematic diagram of the structure of a model training device provided in an embodiment of the present application. The model training device shown in Figure 6 can be installed in a computer device, which can specifically be a terminal device or a server. The model training device shown in Figure 6 can be used to perform some or all of the functions of the method embodiments described in Figures 2 and 4 above. Please refer to Figure 6, the model training device includes:
[0129] An acquisition unit 601 is configured to acquire a first modal data set and a second modal data set, wherein the first modal data set includes M first modal data, each first modal data including at least two first sub-modal data, and the second modal data set includes M second modal data, each second modal data including at least two second sub-modal data; the M first modal data correspond one-to-one to the M second modal data; and M is an integer greater than 1.
[0130] and obtaining a first masked data set and a second masked data set, wherein the first masked data set is obtained by masking at least one first submodal data contained in each first modal data in the first modal data set; and the second masked data set is obtained by masking at least one second submodal data contained in each second modal data in the second modal data set;
[0131] A processing unit 602 is configured to perform feature prediction processing on the first masked data set and the second modal data set using a feature extraction model to obtain a global restored feature of each first modal data set and a global feature of each second modal data set;
[0132] and performing feature prediction processing on the second masked data set and the first modal data set using a feature extraction model to obtain a global feature of each first modal data set and a global restored feature of each second modal data set;
[0133] And it is used to optimize the feature extraction model according to the global restoration features of each first modal data, the global features of each first modal data, the global restoration features of each second modal data and the global restoration features of each second modal data; the optimized feature extraction model is used to retrieve the first modal data and the second modal data that correspond to each other.
[0134] In one embodiment, the processing unit 602 is specifically configured to:
[0135] Calculating a first semantic loss value based on the similarity between the global restoration feature of each first modal data and the global features of the M first modal data;
[0136] Calculating a second semantic loss value based on the similarity between the global restoration feature of each second modal data and the global features of the M second modal data;
[0137] Summing the first semantic loss value and the second semantic loss value to obtain a first loss value;
[0138] The feature extraction model is optimized using the first loss value.
[0139] In one embodiment, the processing unit 602 is specifically configured to:
[0140] Calculating a second loss value according to the global feature of each first modality data and the global feature of each second modality data;
[0141] Calculating a third loss value using global features of the target first modal data and global features of the target second modal data; the global features of the target first modal data and the global features of the target second modal data are obtained by performing feature extraction processing on the labeled first modal data in the first modal data set and the labeled second modal data in the second modal data set by the feature extraction model;
[0142] Obtaining a local restoration feature of the target first modal data, and calculating a fourth loss value based on the local restoration feature of the target first modal data;
[0143] The first loss value, the second loss value, the third loss value, and the fourth loss value are summed, and the feature extraction model is optimized according to the summation result.
[0144] In one embodiment, the processing unit 602 is specifically configured to:
[0145] Calculating a third semantic loss value based on the similarity between each global feature of the first modal data and the global features of the M second modal data;
[0146] Calculating a fourth semantic loss value based on the similarity between each global feature of the second modal data and the global features of the M first modal data;
[0147] The third semantic loss value and the fourth semantic loss value are summed to obtain the second loss value.
[0148] In one embodiment, the processing unit 602 is specifically configured to:
[0149] Performing splicing processing on the global features of the target first modal data and the global features of the target second modal data to obtain spliced features;
[0150] Predicting a matching relationship between a global feature of the target first modality data and a global feature of the target second modality data by concatenating features;
[0151] A third loss value is calculated based on the predicted matching relationship and the correspondence between the global features of the target first modality data and the global features of the target second modality data.
[0152] In one embodiment, the local restored features of the target first modal data are obtained after the feature extraction model performs feature extraction processing on the masked target first modal data and the second modal data corresponding to the target first modal data; the processing unit 602 is specifically configured to:
[0153] Predicting masked first submodal data in the target first modal data by using local restoration features of the target first modal data;
[0154] A fourth loss value is calculated based on the predicted first submodality data and the masked first submodality data in the target first modality data.
[0155] In one embodiment, the feature extraction model includes a first encoder, a second encoder, and a third encoder; the processing unit 602 is specifically configured to:
[0156] Using a first encoder to encode each first masked data in the first masked data set to obtain first feature information of each first masked data;
[0157] Using a second encoder to encode each second modal data in the second modal data set, to obtain second feature information of each second modal data;
[0158] A third encoder is used to perform feature interaction processing on the M first feature information and the M second feature information to obtain a global restoration feature of each first modal data and a global feature of each second modal data.
[0159] In one embodiment, any first masked data in the first masked data set is represented as the i-th first masked data, and the i-th first masked data is obtained by masking the i-th first modal data in the first modal data set; the first feature information of the i-th first masked data is represented as the i-th first feature information, and the i-th first feature information includes the local features and local restoration features of the i-th first modal data, where i is a positive integer less than or equal to M; any second modal data in the second modal data set is represented as the i-th second modal data, and the second feature information of the i-th second modal data is represented as the i-th second feature information, and the i-th second feature information includes the local features of the i-th second modal data; the third encoder includes a self-attention mechanism module and a cross-attention mechanism module; the processing unit 602 is specifically used to:
[0160] A self-attention mechanism module is used to mine the correlation between each feature in each first feature information; the correlation between each feature in the i-th first feature information includes: the correlation between the local features of the i-th first modal data, the correlation between the local restored features of the i-th first modal data, and the correlation between the local features and the local restored features of the i-th first modal data;
[0161] A self-attention mechanism module is used to mine the correlation between each feature in each second feature information; the correlation between each feature in the i-th second feature information includes: the correlation between the local features of the i-th second modal data;
[0162] A cross-attention mechanism module is used to perform feature interaction processing on the mined M first feature information and the mined M second feature information.
[0163] In one embodiment, the feature extraction model includes a first encoder, a second encoder, and a third encoder; the processing unit 602 is specifically configured to:
[0164] Using a first encoder to encode each first modal data in the first modal data set, to obtain third feature information of each first modal data;
[0165] using a second encoder to encode each second masked data in the second masked data set to obtain fourth feature information of each second masked data;
[0166] A third encoder is used to perform feature interaction processing on the M third feature information and the M fourth feature information to obtain a global feature of each first modal data and a global restoration feature of each second modal data.
[0167] In one embodiment, the processing unit 602 is specifically configured to:
[0168] Dividing the first modal data in the first modal data set respectively, each first modal data is formed into a first data sequence after the division, and each first data sequence includes at least two first sub-modal data;
[0169] Dividing the second modal data in the second modal data set respectively, each second modal data is divided into a second data sequence, each second data sequence includes at least two second sub-modal data;
[0170] performing masking processing on at least one first submodal data in each first data sequence to obtain a first masked data set;
[0171] Masking is performed on at least one second submodal data in each second data sequence to obtain a second masked data set.
[0172] In one embodiment, the processing unit 602 is further configured to:
[0173] Get the target image and the question text corresponding to the target image;
[0174] The optimized feature extraction model is used to extract features from the target image and question text to obtain feature information of the target image and feature information of the question text;
[0175] The feature information of the target image and the feature information of the question text are classified by a multi-layer perceptron to obtain the answer text corresponding to the question text.
[0176] According to one embodiment of the present application, some of the steps involved in the model training method shown in Figures 2 and 4 can be performed by the various units in the model training device shown in Figure 6. For example, step S201 and step S202 shown in Figure 2 can be performed by the acquisition unit 601 shown in Figure 6, and steps S203-step S205 can be performed by the processing unit 602 shown in Figure 6; step S401 and step S402 shown in Figure 4 can be performed by the acquisition unit 601 shown in Figure 6, steps S403-step S407 and step S409 can be performed by the processing unit 602 shown in Figure 6, and step S408 can be jointly performed by the acquisition unit 601 and the processing unit 602 shown in Figure 6. The various units in the model training device shown in Figure 6 can be individually or completely merged into one or several other units to form a composition, or one (or some) of the units can be further split into multiple functionally smaller units to form a composition, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above units are divided based on logical functions. In actual applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the model training device can also include other units. In actual applications, these functions can also be assisted by other units and can be implemented by multiple units in collaboration.
[0177] According to another embodiment of the present application, a model training device as shown in Figure 6 can be constructed, and the model training method of the embodiment of the present application can be implemented by running a computer program (including program code) capable of executing the steps involved in the corresponding method as shown in Figures 2 and 4 on a general computing device such as a computer device including processing elements and storage elements such as a central processing unit (CPU), a random access storage medium (RAM), and a read-only storage medium (ROM). The computer program can be recorded on, for example, a computer-readable recording medium, and loaded into the above-mentioned computing device through the computer-readable recording medium and run therein.
[0178] In an embodiment of the present application, a first modal data set and a second modal data set are obtained, wherein the first modal data set includes M first modal data, each first modal data includes at least two first sub-modal data; the second modal data set contains M second modal data, each second modal data includes at least two second sub-modal data, and the M first modal data correspond one-to-one to the M second modal data; by selecting mutually corresponding and different types of modal data for model training, the feature extraction model can capture the semantic association between multimodal data, and can narrow the heterogeneous gap between different modal data through training and learning, thereby achieving the purpose of improving the accuracy of the model prediction results. A first masked data set and a second masked data set are obtained, wherein the first masked data set is obtained by masking at least one first sub-modal data contained in each first modal data in the first modal data set, and the second masked data set is obtained by masking at least one second sub-modal data contained in each second modal data in the second modal data set. In this way, the mutual correspondence between the first modal data and the second modal data can be expanded into two sets of corresponding data: one set is the mutual correspondence between the first masked data and the second modal data, and the other set is the mutual correspondence between the second masked data and the first modal data. In this way, the masked modal data can learn the lost semantic information from the other unmasked modal data, that is, the first masked data can learn the semantic information lost due to masking from the second modal data, and the second masked data can learn the semantic information lost due to masking from the first modal data. A feature extraction model is used to perform feature prediction processing on a first masked data set and a second modal data set, obtaining global restored features for each first modal data set and global features for each second modal data set. Feature extraction models are also used to perform feature prediction processing on the second masked data set and the first modal data set, obtaining global features for each first modal data set and global restored features for each second modal data set. The feature prediction processing of the feature extraction model can explore the semantic association between the two sets of corresponding data in terms of global representation, and restore the lost semantic information of the masked modal data by capturing the unmasked modal data, thereby enhancing the global representation of each modal data set. The feature extraction model is optimized based on the global restored features of each first modal data set, the global restored features of each first modal data set, the global restored features of each second modal data set, and the global restored features of each second modal data set. This optimization process can facilitate the feature extraction model to extract richer cross-modal global representations, thereby improving the accuracy of the feature extraction model's prediction results.
[0179] Please refer to Figure 7, which is a structural diagram of a computer device provided in an embodiment of the present application. The computer device can be a terminal device or a server. As shown in Figure 7, the computer device includes at least a processor 701, a communication interface 702 and a memory 703. Among them, the processor 701, the communication interface 702 and the memory 703 can be connected via a bus or other means. Among them, the processor 701 (or central processing unit (CPU)) is the computing core and control core of the computer device. It can parse various instructions within the computer device and process various data of the computer device. For example, the CPU can be used to parse the power on and off instructions issued by the object to the computer device and control the computer device to perform power on and off operations; for example, the CPU can transmit various interactive data between the internal structures of the computer device, etc. The communication interface 702 can optionally include a standard wired interface, a wireless interface (such as WI-FI, a mobile communication interface, etc.), which can be used to send and receive data under the control of the processor 701; the communication interface 702 can also be used for the transmission and interaction of data within the computer device. The memory 703 (Memory) is a memory device in the computer device for storing programs and data. It is understood that the memory 703 herein may include both the built-in memory of the computer device and, of course, the extended memory supported by the computer device. The memory 703 provides storage space for storing the operating system of the computer device, which may include, but is not limited to, Android, iOS, Windows Phone, etc., and this application does not limit this.
[0180] The embodiment of the present application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space that stores the processing system of the computer device. In addition, a computer program suitable for being loaded and executed by the processor 701 is also stored in the storage space. It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk storage; optionally, it can also be at least one computer-readable storage medium located away from the aforementioned processor.
[0181] In one embodiment, the processor 701 loads and runs the computer program in the memory 703 to execute the implementation methods provided by the steps shown in Figures 2 and 4 above. For details, please refer to the implementation methods provided by the above steps, which will not be repeated here.
[0182] In an embodiment of the present application, a first modal data set and a second modal data set are obtained, wherein the first modal data set includes M first modal data, each first modal data includes at least two first sub-modal data; the second modal data set contains M second modal data, each second modal data includes at least two second sub-modal data, and the M first modal data correspond one-to-one to the M second modal data; by selecting mutually corresponding and different types of modal data for model training, the feature extraction model can capture the semantic association between multimodal data, and can narrow the heterogeneous gap between different modal data through training and learning, thereby achieving the purpose of improving the accuracy of the model prediction results. A first masked data set and a second masked data set are obtained, wherein the first masked data set is obtained by masking at least one first sub-modal data contained in each first modal data in the first modal data set, and the second masked data set is obtained by masking at least one second sub-modal data contained in each second modal data in the second modal data set. In this way, the mutual correspondence between the first modal data and the second modal data can be expanded into two sets of corresponding data: one set is the mutual correspondence between the first masked data and the second modal data, and the other set is the mutual correspondence between the second masked data and the first modal data. In this way, the masked modal data can learn the lost semantic information from the other unmasked modal data, that is, the first masked data can learn the semantic information lost due to masking from the second modal data, and the second masked data can learn the semantic information lost due to masking from the first modal data. A feature extraction model is used to perform feature prediction processing on a first masked data set and a second modal data set, obtaining global restored features for each first modal data set and global features for each second modal data set. Feature extraction models are also used to perform feature prediction processing on the second masked data set and the first modal data set, obtaining global features for each first modal data set and global restored features for each second modal data set. The feature prediction processing of the feature extraction model can explore the semantic association between the two sets of corresponding data in terms of global representation, and restore the lost semantic information of the masked modal data by capturing the unmasked modal data, thereby enhancing the global representation of each modal data set. The feature extraction model is optimized based on the global restored features of each first modal data set, the global restored features of each first modal data set, the global restored features of each second modal data set, and the global restored features of each second modal data set. This optimization process can facilitate the feature extraction model to extract richer cross-modal global representations, thereby improving the accuracy of the feature extraction model's prediction results.
[0183] An embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored. The computer program is suitable for being loaded by a processor and executing the model training method of the above-mentioned method embodiment.
[0184] An embodiment of the present application also provides a computer program product, which includes a computer program, and the computer program is suitable for being loaded by a processor and executing the model training method of the above method embodiment.
[0185] The present application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the above-described model training method.
[0186] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0187] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0188] A person skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, which can include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0189] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of the above embodiment and equivalent changes made in accordance with the claims of this application are still within the scope covered by the application.
Claims
1. A model training method, characterized in that: The method comprises: Acquire a first modal data set and a second modal data set, wherein the first modal data set includes M first modal data, each of which includes at least two first sub-modal data, and the second modal data set includes M second modal data, each of which includes at least two second sub-modal data; the M first modal data correspond one to one with the M second modal data; and M is an integer greater than 1; Acquire a first masked data set and a second masked data set, wherein the first masked data set is obtained by masking at least one first submodal data contained in each first modal data in the first modal data set; and the second masked data set is obtained by masking at least one second submodal data contained in each second modal data in the second modal data set; Using a feature extraction model to perform feature prediction processing on the first masked data set and the second modal data set to obtain a global restoration feature of each first modal data and a global feature of each second modal data; Using a feature extraction model to perform feature prediction processing on the second masked data set and the first modal data set to obtain a global feature of each first modal data and a global restoration feature of each second modal data; The feature extraction model is optimized according to the global restoration features of each of the first modal data, the global features of each of the first modal data, the global restoration features of each of the second modal data, and the global restoration features of each of the second modal data; the optimized feature extraction model is used to retrieve the first modal data and the second modal data that correspond to each other.
2. The method according to claim 1, characterized in that The optimizing process of the feature extraction model according to the global restoration feature of each of the first modal data, the global feature of each of the first modal data, the global restoration feature of each of the second modal data, and the global restoration feature of each of the second modal data includes: Calculating a first semantic loss value according to the similarity between each global restoration feature of the first modal data and the global features of the M first modal data; Calculating a second semantic loss value according to the similarity between each global restoration feature of the second modal data and the global features of the M second modal data; Summing the first semantic loss value and the second semantic loss value to obtain a first loss value; The feature extraction model is optimized using the first loss value.
3. The method according to claim 2, characterized in that The optimizing process of the feature extraction model by using the first loss value includes: Calculating a second loss value according to the global feature of each of the first modal data and the global feature of each of the second modal data; Calculating a third loss value by using global features of the target first modality data and global features of the target second modality data; the global features of the target first modality data and the global features of the target second modality data are obtained by the feature extraction model performing feature extraction processing on the labeled first modality data in the first modality data set and the labeled second modality data in the second modality data set; Acquire a local restoration feature of the target first modal data, and calculate a fourth loss value according to the local restoration feature of the target first modal data; The first loss value, the second loss value, the third loss value and the fourth loss value are summed, and the feature extraction model is optimized according to the summation result.
4. The method according to claim 3, characterized in that The calculating a second loss value according to the global feature of each of the first modal data and the global feature of each of the second modal data comprises: According to the similarity between each global feature of the first modal data and the global features of the M second modal data, calculate The third semantic loss value; Calculating a fourth semantic loss value according to the similarity between each global feature of the second modal data and the global features of the M first modal data; The third semantic loss value and the fourth semantic loss value are summed to obtain a second loss value.
5. The method according to claim 3 or 4, characterized in that The calculating the third loss value by using the global features of the target first modality data and the global features of the target second modality data includes: Performing splicing processing on the global features of the target first modal data and the global features of the target second modal data to obtain splicing features; Predicting a matching relationship between a global feature of the target first modality data and a global feature of the target second modality data through the splicing feature; Based on the predicted matching relationship and the corresponding relationship between the global features of the target first modality data and the global features of the target second modality data, a third loss value is calculated.
6. The method according to any one of claims 3 to 5, characterized in that The local restoration features of the target first modal data are obtained after the feature extraction model performs feature extraction processing on the masked target first modal data and the second modal data corresponding to the target first modal data; the fourth loss value is calculated according to the local restoration features of the target first modal data, including: Predicting masked first submodal data in the target first modal data by using local restoration features of the target first modal data; A fourth loss value is calculated based on the predicted first submodality data and the masked first submodality data in the target first modality data.
7. The method according to any one of claims 1 to 6, characterized in that The feature extraction model includes a first encoder, a second encoder and a third encoder; the feature extraction model is used to perform feature prediction processing on the first masked data set and the second modal data set to obtain a global restoration feature of each first modal data and a global feature of each second modal data, including: Using the first encoder to encode each first masked data in the first masked data set, to obtain first feature information of each first masked data; Using the second encoder to encode each second modal data in the second modal data set, to obtain second feature information of each second modal data; The third encoder is used to perform feature interaction processing on the M first feature information and the M second feature information to obtain a global restoration feature of each of the first modal data and a global feature of each of the second modal data.
8. The method according to claim 7, characterized in that Any first masked data in the first masked data set is represented as the i-th first masked data, and the i-th first masked data is obtained by performing masking processing on the i-th first modal data in the first modal data set; The first feature information of the i-th first masked data is represented as the i-th first feature information, the i-th first feature information includes the local features and the local restoration features of the i-th first modality data, and i is a positive integer less than or equal to M; any second modality data in the second modality data set is represented as the i-th second modality data, the second feature information of the i-th second modality data is represented as the i-th second feature information, and the i-th second feature information includes the local features of the i-th second modality data; the third encoder includes a self-attention mechanism module and a cross-attention mechanism module; The process of using the third encoder to perform feature interaction processing on the M first feature information and the M second feature information includes: The self-attention mechanism module is used to mine the correlation relationship between each feature in each of the first feature information; the correlation relationship between each feature in the i-th first feature information includes: the correlation relationship between the local features of the i-th first modal data, the correlation relationship between the local restoration features of the i-th first modal data, and the correlation relationship between the local features of the i-th first modal data and the local restoration features. The relationship between the signs; The self-attention mechanism module is used to mine the correlation relationship between the features in each of the second feature information; the correlation relationship between the features in the i-th second feature information includes: the correlation relationship between the local features of the i-th second modal data; The cross-attention mechanism module is used to perform feature interaction processing on the mined M first feature information and the mined M second feature information.
9. The method according to any one of claims 1 to 8, characterized in that The feature extraction model includes a first encoder, a second encoder and a third encoder; the feature extraction model is used to perform feature prediction processing on the second masked data set and the first modal data set to obtain a global feature of each first modal data and a global restoration feature of each second modal data, including: Using the first encoder to encode each first modal data in the first modal data set, to obtain third feature information of each first modal data; using the second encoder to respectively encode each second masked data in the second masked data set to obtain fourth feature information of each second masked data; The third encoder is used to perform feature interaction processing on the M third feature information and the M fourth feature information to obtain a global feature of each of the first modal data and a global restoration feature of each of the second modal data.
10. The method according to any one of claims 1 to 9, characterized in that The obtaining of the first masked data set and the second masked data set comprises: Dividing each first modality data in the first modality data set respectively, each first modality data is divided into a first data sequence respectively, and each first data sequence includes at least two first sub-modality data; Respectively dividing the second modal data in the second modal data set, each second modal data is divided into a second data sequence, and each second data sequence includes at least two second sub-modal data; Performing masking processing on at least one first submodal data in each of the first data sequences to obtain a first masked data set; A masking process is performed on at least one second submodal data in each of the second data sequences to obtain a second masked data set.
11. The method according to any one of claims 1 to 10, characterized in that The method further comprises: Obtaining a target image and a question text corresponding to the target image; Using the optimized feature extraction model to perform feature extraction on the target image and the question text to obtain feature information of the target image and feature information of the question text; The feature information of the target image and the feature information of the question text are classified by a multi-layer perceptron to obtain a reply text corresponding to the question text.
12. A model training device, characterized in that: The model training device comprises: an acquisition unit, configured to acquire a first modal data set and a second modal data set, wherein the first modal data set includes M first modal data, each of which includes at least two first sub-modal data, and the second modal data set includes M second modal data, each of which includes at least two second sub-modal data; the M first modal data correspond one to one with the M second modal data; and M is an integer greater than 1; and for obtaining a first masked data set and a second masked data set, wherein the first masked data set is obtained by masking at least one first sub-modal data contained in each first modal data in the first modal data set; and the second masked data set is obtained by masking at least one second sub-modal data contained in each second modal data in the second modal data set; A processing unit, configured to perform feature prediction processing on the first masked data set and the second modal data set using a feature extraction model; Processing to obtain a global restoration feature of each of the first modal data and a global feature of each of the second modal data; and for performing feature prediction processing on the second masked data set and the first modal data set using a feature extraction model to obtain a global feature of each first modal data and a global restored feature of each second modal data; And used to optimize the feature extraction model according to the global restoration features of each of the first modal data, the global features of each of the first modal data, the global restoration features of each of the second modal data and the global restoration features of each of the second modal data; the optimized feature extraction model is used to retrieve the first modal data and the second modal data that correspond to each other.
13. A computer device, characterized in that: include: Memory and processor; a memory, wherein a computer program is stored in the memory; A processor, used to load the computer program to implement the model training method as described in any one of claims 1-11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which is suitable for being loaded by a processor and executing the model training method as described in any one of claims 1-11.
15. A computer program product, characterized in that The computer program product comprises a computer program, which is suitable for being loaded by a processor and executing the model training method as described in any one of claims 1-11.
Citation Information
Patent Citations
Image-text pre-training model training method and device and image-text prediction model training method and device
CN114419351A
Neural network model training method and device, equipment, medium and program product
CN115115049A
Model optimization method and device, equipment, storage medium and program product
CN115129908A
Pre-training method and device for multi-modal feature extraction network
CN115293348A
Domain specific pre-training of cross modality transformer model
US20220277218A1
Cited By
Video description generation method and device, electronic equipment and storage medium
CN119562141A
Cross-modal retrieval model training method and remote sensing image text retrieval method
CN119646255A
Training Method of Cross-Modal Retrieval Model and Remote Sensing Image Text Retrieval Method
CN119646255B
