Method and apparatus for training a multimodal representation model and for cross-modal search

The training method for multimodal representation models improves generalizability and robustness by calculating single and cross-modal losses, allowing for accurate cross-modal search and inference across various data types.

JP7552000B2Active Publication Date: 2024-09-18BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2023038523
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2022-04-29
Filing Date
2023-03-13
Publication Date
2024-09-18
Estimated Expiration
2043-03-13

AI Technical Summary

Technical Problem

Existing multimodal representation models lack generalizability and robustness, making it difficult to generate a unified representation of multimodal data, particularly in cross-modal search scenarios.

Method used

A training method for multimodal representation models that calculates single and cross-modal losses based on matched sample tuples, guiding the model to learn intra- and inter-modal semantic associations, using independent or interacting representation modules and pre-trained models for improved efficiency.

Benefits of technology

Enhances the generalizability and robustness of multimodal representation models, enabling accurate cross-modal search and inference tasks by generating unified representations of diverse data modalities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007552000000011
    Figure 0007552000000011
  • Figure 0007552000000007
    Figure 0007552000000007
  • Figure 0007552000000008
    Figure 0007552000000008
Patent Text Reader

Abstract

To provide a training method of a multi-modal representation model.SOLUTION: A method comprises the steps of: obtaining a sample tuple, wherein the sample tuple comprises a first sample and a second sample of a first data mode and a third sample and a fourth sample of a second data mode; respectively inputting the four samples into corresponding representation modules to obtain a first representation, a second representation, a third representation and a fourth representation; determining a first single-modal loss based on the first representation and the second representation; determining a second single-modal loss based on the third representation and the fourth representation; determining a first cross-modal loss and a second cross-modal loss based on the first target representation and the second target representation; based on the first single-modal loss, the second single-modal loss, the first cross-modal loss and the second cross-modal loss, determining the overall loss of the multi-modal representation model; and adjusting parameters of the multi-modal representation model based on the overall loss.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present disclosure relates to the field of artificial intelligence technology, in particular to the field of deep learning and smart search technology, and in particular to a method and apparatus for training a multimodal representation model, a method and apparatus for cross-modal search, an electronic device, a computer-readable storage medium, and a computer program product. [Background technology]

[0002] A data modal is the form in which data exists, e.g., text, image, video, audio, etc. The same object or event can be represented by data of different modalities. In other words, data of different modalities may have the same or similar meaning.

[0003] The approaches described in this section are not necessarily approaches that have been previously contemplated or adopted. Unless otherwise noted, any approach described in this section should not be considered prior art by its inclusion in this section alone. Similarly, unless otherwise noted, any problem addressed in this section should not be considered an admission of prior art. Summary of the Invention

[0004] The present disclosure provides a method and apparatus for training a multimodal representation model, a method and apparatus for cross-modal search, an electronic device, a computer-readable storage medium, and a computer program product.

[0005] According to one aspect of the present disclosure, there is provided a method for training a multimodal representation model, the multimodal representation model including a first representation module corresponding to a first data modality and a second representation module corresponding to a second data modality, the method including: acquiring a sample tuple, the sample tuple including a first sample and a second sample of the first data modality, and a third sample and a fourth sample of the second data modality, the meanings of the samples included in the sample tuple being matched; inputting the first sample and the second sample into the first representation module, respectively, to acquire a first representation of the first sample and a second representation of the second sample; inputting the third sample and the fourth sample into the second representation module, respectively, to acquire a third representation of the third sample and a fourth representation of the fourth sample; and based on the first representation and the second representation, acquiring a fourth representation of the fourth sample. determining a first single-modal loss for one data modal; determining a second single-modal loss for the second data modal based on the third representation and the fourth representation; determining a first cross-modal loss from the first data modal to the second data modal and a second cross-modal loss from the second data modal to the first data modal based on a first target representation and a second target representation, wherein the first target representation is one of the first representation and the second representation and the second target representation is one of the third representation and the fourth representation; determining an overall loss of the multi-modal representation model based on the first single-modal loss, the second single-modal loss, the first cross-modal loss, and the second cross-modal loss; and adjusting parameters of the multi-modal representation model based on the overall loss.

[0006] According to one aspect of the present disclosure, there is provided a cross-modal search method, comprising: obtaining a search target of a first data modality; inputting the search target into a multimodal representation model to obtain a first representation corresponding to the search target; obtaining a second representation of each of a plurality of candidate targets of a second data modality, the second representations being obtained by inputting corresponding candidate targets into the multimodal representation model; and determining a target target matching the search target from the plurality of candidate targets based on a similarity between the first representation and each second representation, the multimodal representation model being obtained by training with a training method based on the multimodal representation model.

[0007] According to an aspect of the present disclosure, there is provided an apparatus for training a multimodal representation model, the multimodal representation model including a first representation unit corresponding to a first data modal and a second representation unit corresponding to a second data modal, the apparatus including: a first acquisition unit configured to acquire a sample tuple, the sample tuple including a first sample and a second sample of the first data modal and a third sample and a fourth sample of the second data modal, the meanings of the samples included in the sample tuple matching; a first input unit configured to input the first sample and the second sample into the first representation unit, respectively, to acquire a first representation of the first sample and a second representation of the second sample; a second input unit configured to input the third sample and the fourth sample into the second representation unit, respectively, to acquire a third representation of the third sample and a fourth representation of the fourth sample; and a first loss unit configured to acquire the first representation and the a second loss unit configured to determine a first single-modal loss for the first data modal based on the second representation; a second loss unit configured to determine a second single-modal loss for the second data modal based on the third representation and the fourth representation; a third loss unit configured to determine a first cross-modal loss from the first data modal to the second data modal and a second cross-modal loss from the second data modal to the first data modal based on a first target representation and a second target representation, wherein the first target representation is one of the first representation and the second representation, and the second target representation is one of the third representation and the fourth representation; a fourth loss unit configured to determine an overall loss of the multi-modal representation model based on the first single-modal loss, the second single-modal loss, the first cross-modal loss, and the second cross-modal loss;configured to adjust parameters of the multimodal representation model.

[0008] According to one aspect of the present disclosure, there is provided a cross-modal search apparatus, the apparatus including: a first acquisition unit configured to acquire a search target of a first data modality; a representation unit configured to acquire a first representation corresponding to the search target by inputting the search target into a multimodal representation model; a second acquisition unit configured to acquire a second representation of each of a plurality of candidate targets of a second data modality, the second representation being obtained by inputting the corresponding candidate target into the multimodal representation model; and a determination unit configured to determine a target target matching the search target from the plurality of candidate targets based on a similarity between the first representation and each second representation, the multimodal representation model being obtained by training with a training apparatus based on the multimodal representation model.

[0009] According to one aspect of the present disclosure, there is provided an electronic device including at least one processor and a memory communicatively coupled to the at least one processor, the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one processor to perform any one of the methods described above.

[0010] According to one aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium having stored thereon computer instructions for causing a computer to perform any one of the methods described above.

[0011] According to one aspect of the present disclosure, there is provided a computer program product including a computer program which, when executed by a processor, implements any one of the above methods.

[0012] According to one or more embodiments of the present disclosure, the multimodal representation model can be guided to simultaneously learn intra-modal and inter-modal semantic associations, improving the generalization and robustness of the multimodal representation model, thereby enabling the multimodal representation model to generate a unified semantic representation of different modal data.

[0013] It should be understood that the contents described in this section are not intended to identify key or important features of the embodiments of the present disclosure, and are not intended to limit the scope of protection of the present disclosure. Other features of the present disclosure will be readily understood from the following description. [Brief description of the drawings]

[0014] The drawings illustratively illustrate the examples, constitute a part of the specification, and together with the written description serve to explain exemplary embodiments of the examples. The illustrated examples are for illustrative purposes only and are not intended to limit the scope of the claims. In all the drawings, the same reference numerals refer to similar, but not necessarily identical, elements. [Figure 1] 1 is a flowchart illustrating a method for training a multi-modal representation model according to some embodiments of the present disclosure. [Diagram 2] FIG. 1 is an architectural block diagram illustrating a multimodal expression model according to some embodiments of the present disclosure. [Diagram 3] FIG. 2 is a schematic diagram illustrating a training process of a multi-modal representation model according to some embodiments of the present disclosure. [Figure 4] 1 is a flow chart illustrating a cross-modal search method according to some embodiments of the present disclosure. [Diagram 5] FIG. 1 is a schematic diagram illustrating cross-modal search effects on images and texts of a multi-modal representation model according to an embodiment of the present disclosure. [Figure 6] 1 is a flowchart illustrating a cross-modal reasoning method according to some embodiments of the present disclosure. [Figure 7]FIG. 1 is a block diagram illustrating an apparatus for training a multi-modal expression model according to some embodiments of the present disclosure. [Figure 8] FIG. 1 is a block diagram illustrating a cross-modal search device according to some embodiments of the present disclosure. [Figure 9] FIG. 1 is a block diagram illustrating a cross-modal reasoning device according to some embodiments of the present disclosure. [Figure 10] FIG. 1 is a block diagram illustrating an example electronic device in which some embodiments of the present disclosure can be implemented. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0015] Hereinafter, exemplary embodiments of the present disclosure will be described in conjunction with the drawings, and various details in the embodiments of the present disclosure contained therein will be considered as merely illustrative, in order to facilitate understanding. Therefore, it should be recognized that those skilled in the art can make various changes and modifications to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the following description omits the description of known functions and structures.

[0016] In this disclosure, unless otherwise stated, the use of terms such as "first," "second," and the like to describe various elements is not intended to limit the location, timing, or importance of those elements. Such terms are used only to distinguish one element from another. In some instances, a first element and a second element may refer to the same instance of an element, or in some cases, may refer to different instances based on the contextual description.

[0017] The terms used in the description of various examples of the present disclosure are intended only to describe particular examples and are not intended to be limiting. Unless otherwise clearly indicated by the context, an element may be one or more, unless specifically limited in number. It should be noted that the term "and / or" as used in the present disclosure covers any and all possible combinations of the listed items.

[0018] In some scenarios, a user may have a need for cross-modal data processing. For example, a user may have a need to perform a cross-modal search. A cross-modal search is a search scenario in which the modality of the input data is different from the modality of the retrieved data. For example, in a cross-modal search scenario involving images and text, a user inputs the search text "dog" and wants to retrieve images containing dogs on the screen.

[0019] In related technologies, a multimodal semantic representation model (hereinafter referred to as "multimodal representation model") may be used to convert data of different modalities into semantic representations in the same semantic space (hereinafter referred to as "representations"), and then perform cross-modal data processing tasks such as cross-modal search, cross-modal inference (e.g., visual inference, visual entailment) based on the representations. However, the generalizability and robustness of the multimodal representation model in related technologies is low, making it difficult to generate a unified representation of multimodal data.

[0020] In response to the above problems, an embodiment of the present disclosure provides a method for training a multi-modal representation model, which improves the generalization and robustness of the multi-modal representation model, so that the multi-modal representation model can generate a unified representation of multi-modal data.

[0021] Hereinafter, embodiments of the present disclosure will be described in detail with reference to the drawings.

[0022] 1 is a flowchart illustrating a method 100 for training a multimodal representation model according to an embodiment of the present disclosure. The method 100 may be executed on a server or a client device, i.e., each step of the method 100 may be executed by either the server or the client device.

[0023] In an embodiment of the present disclosure, the multimodal representation model includes a first representation module corresponding to a first data modality and a second representation module corresponding to a second data modality.

[0024] As shown in FIG. 1, the method 100 includes steps S110 to S180.

[0025] In step S110, a sample tuple is obtained, the sample tuple including a first sample and a second sample of a first data modal, and a third sample and a fourth sample of a second data modal, where the meanings of each sample included in the sample tuple match.

[0026] In step S120, the first sample and the second sample are input into a first representation module, respectively, to obtain a first representation of the first sample and a second representation of the second sample.

[0027] In step S130, the third sample and the fourth sample are input into a second representation module, respectively, to obtain a third representation of the third sample and a fourth representation of the fourth sample.

[0028] In step S140, a first unimodal loss for a first data modal is determined based on the first representation and the second representation.

[0029] In step S150, a second unimodal loss for a second data modal is determined based on the third representation and the fourth representation.

[0030] In step S160, a first cross-modal loss from the first data modal to the second data modal and a second cross-modal loss from the second data modal to the first data modal are determined based on the first target representation and the second target representation, where the first target representation is one of the first representation and the second representation, and the second target representation is one of the third representation and the fourth representation.

[0031] In step S170, an overall loss of the multimodal representation model is determined based on the first single-modal loss, the second single-modal loss, the first cross-modal loss, and the second cross-modal loss.

[0032] In step S180, the parameters of the multi-modal representation model are adjusted based on the overall loss.

[0033] According to an embodiment of the present disclosure, a sample tuple is used to train a multi-modal representation model, where the sample tuple includes two samples of different data modalities, and the meanings of each sample in the sample tuple are matched. Based on the sample tuple, in the training process, not only the single-modal loss of each data modal is calculated, but also the cross-modal loss between different modalities is calculated, so that the multi-modal representation model can be guided to simultaneously learn the intra-modal and inter-modal semantic associations, and the generalization and robustness of the model can be improved, so that the model can generate a unified representation of multi-modal data.

[0034] In general, a multimodal representation model can be trained based on a large number of sample tuples in various application scenarios, and thus the trained multimodal representation model is applicable to multiple application scenarios but is a pre-training model that does not correspond to a specific downstream task.

[0035] A data modal is a physical form of data existence, such as text, image, video, audio, etc. The multimodal representation model of the embodiment of the present disclosure relates to multiple (two and more than two) data modalities, and its training samples (i.e., sample tuples) include data of multiple data modalities. In the embodiment of the present disclosure, the semantic associations between multiple data modalities can be learned by processing the sample tuples including multimodal data, and a pre-trained multimodal representation model can be generated. Thus, the training method of the multimodal representation model of the embodiment of the present disclosure is a data processing method used to process multimodal data.

[0036] For example, if the multimodal representation model relates to an image modal and a text modal, the sample tuples include image data and text data, and the training method of the multimodal representation model is not only an image processing method but also a natural language processing method; if the multimodal representation model relates to an image modal and an audio modal, the sample tuples include image data and audio data, and the training method of the multimodal representation model is not only an image processing method but also an audio processing method.

[0037] In an embodiment of the present disclosure, the multimodal representation model includes a first representation module corresponding to a first data modality and a second representation module corresponding to a second data modality.

[0038] It should be noted that in this specification, a multimodal expression model that only includes two data modal expression modules is taken as an example to describe the training method for a multimodal expression model in the embodiment of the present disclosure. Those skilled in the art should understand that the training method for a multimodal expression model in the embodiment of the present disclosure can also be applied to a situation where the multimodal expression model includes three or more data modal expression modules.

[0039] In an embodiment of the present disclosure, the first data modal and the second data modal are any two different data modalities.

[0040] According to some embodiments, the first data modal and the second data modal may be any two of a text modal, an image modal, a video modal, and an audio modal. For example, the first data modal may be a text modal (or an image modal) and the second data modal may be an image modal (or a text modal).

[0041] In another embodiment, the first data modal or the second data modal may be a data modal in an industrial scene, such as an electrical signal, an infrared signal, sensor data, etc.

[0042] The first representation module is used to generate a representation of the data by encoding (or encoding and decoding) the data of a first data modality. The second representation module is used to generate a representation of the data by encoding (or encoding and decoding) the data of a second data modality. In embodiments of the present disclosure, the representation of the data may be in any form, such as a vector, a matrix, a binary code, etc.

[0043] According to some embodiments, the first representation module and the second representation module may be two modules independent of each other and do not influence each other when generating the representation of the data of the corresponding data modality. For example, in an embodiment as shown in FIG. 2, the multimodal representation model 200 includes a first representation module 210 and a second representation module 220, and the first representation module 210 and the second representation module 220 are independent of each other.

[0044] According to another embodiment, the first representation module and the second representation module may be two modules having an interaction relationship, and are influenced by each other when generating a representation of data of a corresponding data modal. For example, the first representation module and the second representation module may realize the interaction through a cross-attention mechanism.

[0045] The first and second representation modules may be implemented in any structure, and the structures of the first and second representation modules may be different. For example, the first and second representation modules may be implemented as neural networks with different structures, such as Convolutional Neural Networks (CNN), a transformer, an encoder, an encoder-decoder, etc.

[0046] According to some embodiments, in order to improve the training efficiency of the multimodal representation model, the first representation module and the second representation module may use pre-trained models of the corresponding data modalities. For example, the first data modal may be text, and thus the first representation module may use a pre-trained text representation model, such as ERNIE (Textual Mind Model), BERT (Bidirectional Encoder Representations from Transformers), etc. The second data modal may be image, and thus the second representation module may use a pre-trained visual representation model, such as ViT (Vision Transformer), DeiT (Data-efficient image Transformers), etc.

[0047] In an embodiment of the present disclosure, a multi-modal representation model is trained using sample tuples, where each sample tuple includes a first sample and a second sample of a first data modal and a third sample and a fourth sample of a second data modal, and the first sample, the second sample, the third sample, and the fourth sample have matching semantics.

[0048] According to some embodiments, the sample tuples may be generated based on semantically matching raw data pairs. That is, the training method 100 of the embodiments of the present disclosure may further include the steps of generating the sample tuples by obtaining raw data pairs, the raw data pairs including first raw data of a first data modal and second raw data of a second data modal, the first raw data and the second raw data having matching semantics. For example, the first raw data may be an image, and the second raw data may be text describing the image. Then, a first sample and a second sample may be generated based on the first raw data. A third sample and a fourth sample may be generated based on the second raw data.

[0049] According to the above embodiment, sample tuples can be automatically generated based on raw data pairs with cross-modal semantic matching, without the need for additional data annotation processing, thereby improving the efficiency of obtaining training samples (i.e., sample tuples).

[0050] It should be understood that in the process of generating sample tuples according to the above embodiment, the processing on the raw data does not change (or only slightly changes) the meaning of the raw data, i.e., the meaning of the generated first sample and second sample is approximately the same as the first raw data, and the meaning of the generated third sample and fourth sample is approximately the same as the second raw data. Since the meanings of the first raw data and the second raw data match, the meanings of the generated first sample, second sample, third sample and fourth sample also match each other.

[0051] According to some embodiments, the step of "generating a first sample and a second sample based on the first raw data" includes performing a first data extension process on the first raw data to generate a first sample, and performing a second data extension process on the first raw data to generate a second sample different from the first sample.

[0052] Data Augmentation refers to processing raw data (e.g., the first raw data) to generate new data (e.g., the first sample and the second sample) that have a similar meaning to the raw data, under the premise that the meaning of the raw data (e.g., the first raw data) is guaranteed not to change.

[0053] The specific processing manner of the first data augmentation process and the second data augmentation process is determined based on the modality of the first raw data, i.e., the first data modality. For example, when the first data modality is an image, the first data augmentation process and the second data augmentation process may be processes such as adding random noise, rotating, cropping, masking, and discoloring. When the first data modality is text, the first data augmentation process and the second data augmentation process may be processes such as replacing synonyms, random inserting, random replacing, random deleting, and back-translation (translating an original text into a text in another language using a machine translation model, and then back-translating it into the original language using a machine translation model). When the first data modality is audio, the first data augmentation process and the second data augmentation process may be processes such as adding random noise, changing the speed of sound, and changing the volume.

[0054] The first data augmentation process may be a similar data augmentation method to the second data augmentation process or a different data augmentation method, but the first data augmentation process and the second data augmentation process should make the generated first sample different from the second sample, so that the subsequently generated first representation is different from the second representation, thereby improving the learning effect of the multimodal representation model.

[0055] According to another embodiment, both the first sample and the second sample are the same as the first raw data, and the first representation module is configured to make the generated first representation different from the second representation by adding random noise, which can be realized for example as a neural network model adding random noise.

[0056] For example, the first data modal may be a text modal and the first representation module may be a text encoder including a dropout processing layer with a drop probability below a pre-defined threshold (e.g., 20%), thereby ensuring that the first representation module does not change the meaning of its input data.

[0057] The execution step of "generating a third sample and a fourth sample based on the second raw data" is similar to the execution step of "generating a first sample and a second sample based on the first raw data" above.

[0058] Specifically, according to some embodiments, "generating a third sample and a fourth sample based on the second raw data" may include performing a third data augmentation process on the second raw data to generate the third sample, and performing a fourth data augmentation process on the second raw data to generate the fourth sample. The third sample is different from the fourth sample, such that the subsequently generated third representation and the fourth representation are different, thereby improving the learning effect of the multimodal representation model.

[0059] According to another embodiment, the third and fourth samples are the same as the second raw data and the second representation module is configured to make the third representation different from the fourth representation by adding random noise. The second data modal may for example be a text modal and the second representation module may be a text encoder including a dropout processing layer having a drop probability below a pre-defined threshold (for example 20%), thereby ensuring that the first representation module does not change the meaning of its input data.

[0060] For other details of “generating a third sample and a fourth sample based on the second raw data”, you may refer to the explanation of “generating a first sample and a second sample based on the first raw data” above, and detailed explanation will be omitted here.

[0061] A first sample and a second sample can be input into a first representation module, and a third sample and a fourth sample can be input into a second representation module, to obtain four corresponding representations, i.e., a first representation, a second representation, a third representation and a fourth representation.

[0062] A first unimodal loss for the first data modal may be calculated based on the first representation and the second representation. A second unimodal loss for the second data modal may be calculated based on the third representation and the fourth representation. A first cross-modal loss from the first data modal to the second data modal and a second cross-modal loss from the second data modal to the first data modal may be calculated based on the first target representation and the second target representation, where the first target representation is one of the first representation and the second representation, and the second target representation is one of the third representation and the fourth representation.

[0063] According to some embodiments, the first unimodal loss can be determined by the following steps: determine a first unimodal loss based on a first similarity between the first representation and the second representation and a second similarity between the first representation and the second representation of another sample tuple, where the first unimodal loss is negatively correlated with the first similarity and positively correlated with the second similarity. The first similarity and the second similarity may be, for example, a dot product of the two representations.

[0064] According to the above embodiment, the first single-modal loss can make representations (i.e., the first representation and the second representation) of two data (i.e., the first sample and the second sample) that match in meaning similar, and guide the multimodal representation model to learn semantic associations in the first data modal by making representations (i.e., the first representation and the second representation) of two data (i.e., the first sample and the second sample of another sample tuple) that do not match in meaning similar (i.e., the first representation and the second representation of another sample tuple).

[0065] Specifically, the first single-modal loss can be calculated by the following formula (1).

number

[0066] In equation (1), L1 denotes the first single-modal loss, N denotes the number of sample tuples participating in training per batch (i.e., batchsize), and h1 i , h2 i denote the first and second representations of the i-th sample tuple, respectively, and h2 j Let denote the second representation of the jth sample tuple, and τ is a trainable parameter.

[0067] According to some embodiments, the second unimodal loss can be determined by the following steps: Determine a second unimodal loss based on a sixth similarity between the third representation and the fourth representation and a seventh similarity between the third representation and the fourth representation of another sample tuple, where the second unimodal loss is negatively correlated with the sixth similarity and positively correlated with the seventh similarity. The sixth similarity and the seventh similarity may be, for example, a dot product of the two representations.

[0068] According to the above embodiment, the second single-modal loss can make representations (i.e., the third representation and the fourth representation) of two data whose meanings match (i.e., the third sample and the fourth sample) similar, and guide the multimodal representation model to learn semantic associations in the second data modal by making representations (i.e., the third representation and the fourth representation) of two data whose meanings do not match (i.e., the third sample and the fourth sample of another sample tuple) dissimilar (i.e., the third representation and the fourth representation of another sample tuple).

[0069] Specifically, the second single-modal loss can be calculated by the following formula (2).

number

[0070] In equation (2), L2 denotes the second single-modal loss, N denotes the number of sample tuples participating in training per batch (i.e., batchsize), and h3 i , h4 i denote the third and fourth representations of the i-th sample tuple, respectively, and h4 j Let us denote the fourth representation of the jth sample tuple, and τ is a trainable parameter.

[0071] According to some embodiments, the first cross-modal loss can be determined by the following steps: Determine a first cross-modal loss based on a third similarity between the first target representation and the second target representation and a fourth similarity between the first target representation and the second target representation of another sample tuple, where the first cross-modal loss is negatively correlated with the third similarity and positively correlated with the fourth similarity. The third similarity and the fourth similarity may be, for example, a dot product of the two representations.

[0072] According to the above embodiment, the first cross-modal loss can make two semantically matching data representations (i.e., the first target representation and the second target representation) similar, and guide the multi-modal representation model to learn cross-modal semantic associations from the first data modal to the second data modal by making two semantically inconsistent data representations (i.e., the first target representation and the second target representation of another sample tuple) dissimilar.

[0073] Specifically, taking the first target representation as an example, the second representation and the second target representation as a third representation, the first cross-modal loss can be calculated by the following formula (3):

number

[0074] In equation (3), L3 denotes the first cross-modal loss, N denotes the number of sample tuples participating in training per batch (i.e., batchsize), and h2 i , h3 i denote the second representation (i.e., the first target representation) and the third representation (i.e., the second target representation) of the i-th sample tuple, respectively, and h3 j denote the third representation of the jth sample tuple (i.e., the second target representation), and τ is a trainable parameter.

[0075] According to some embodiments, the second cross-modal loss can be determined by the following steps: determining a second cross-modal loss based on a third similarity between the first target representation and the second target representation and a fifth similarity between the second target representation and the first target representation of another sample tuple, where the second cross-modal loss is negatively correlated with the third similarity and positively correlated with the fifth similarity. The third similarity and the fifth similarity may be, for example, a dot product of the two representations.

[0076] According to the above embodiment, the second cross-modal loss can make two semantically matching data representations (i.e., the first target representation and the second target representation) similar, and guide the multi-modal representation model to learn cross-modal semantic associations from the second data modal to the first data modal by making two semantically mismatching data representations (i.e., the second target representation and the first target representation of another sample tuple) dissimilar.

[0077] Specifically, for example, the first target representation is the second representation, and the second target representation is the third representation. The second cross-modal loss can be calculated by the following equation (4):

number

[0078] In equation (4), L4 denotes the second cross-modal loss, N denotes the number of sample tuples participating in training per batch (i.e., batchsize), and h2 i , h3 i denote the second representation (i.e., the first target representation) and the third representation (i.e., the second target representation) of the i-th sample tuple, respectively, and h2 j Let τ denote the second representation of the jth sample tuple (i.e., the first target representation), and τ is a trainable parameter.

[0079] Based on the first single-modal loss L1, the second single-modal loss L2, the first cross-modal loss L3, and the second cross-modal loss L4, an overall loss L of the multi-modal representation model can be determined.

[0080] According to some embodiments, the overall loss L of the multimodal representation model is a weighted sum of the first single-modal loss L1, the second single-modal loss L2, the first cross-modal loss L3, and the second cross-modal loss L4, i.e.,

number

[0081] In equation (5), w i is the i-th loss L i is the specific gravity of w i By flexibly setting the value of , the learning direction of the multimodal representation model can be flexibly adjusted, and the compatibility of the multimodal representation model with practical application scenarios can be improved.

[0082] After determining the overall loss of the multimodal representation model, parameters of the multimodal representation model can be adjusted based on the overall loss.

[0083] It should be understood that the above steps S110 to S180 may be repeatedly performed multiple times until a predetermined termination condition (e.g., the total loss is smaller than a predetermined value, the number of iterations reaches a predetermined maximum number of iterations, etc.) is met, thereby terminating the model training process and obtaining a pre-trained multimodal representation model.

[0084] As mentioned above, the first data modal and the second data modal may be any two of a text modal, an image modal, a video modal, and an audio modal.

[0085] For example, the first data modal may be an image modal, and the second data modal may be a text modal. Thus, the multimodal representation model is an image or text multimodal representation model, which includes an image representation module (i.e., a first representation module) corresponding to the image modal and a text representation module (i.e., a second representation module) corresponding to the text modal, and the training method for the image or text multimodal representation model includes the following steps S110' to S180'.

[0086] In step S110', an image or text sample tuple is obtained, where the image or text sample tuple includes a first image sample (i.e., the first sample) and a second image sample (i.e., the second sample) in an image modal, and a first text sample (i.e., the third sample) and a second text sample (i.e., the fourth sample) in a text modal, and the meanings of the samples included in the image or text sample tuple are matched.

[0087] In step S120′, the first image sample and the second image sample are input into an image representation module, respectively, to obtain a first image representation (i.e., a first representation) of the first image sample and a second image representation (i.e., a second representation) of the second image sample.

[0088] In step S130′, the first text sample and the second text sample are input into a text representation module respectively to obtain a first text representation (i.e., a third representation) of the first text sample and a second text representation (i.e., a fourth representation) of the second text sample.

[0089] In step S140', a first single-modal loss of an image modal is determined based on the first image representation and the second image representation.

[0090] In step S150', a second unimodal loss for the text modal is determined based on the first text representation and the second text representation.

[0091] In step S160′, a first cross-modal loss from image modal to text modal and a second cross-modal loss from text modal to image modal are determined based on a target image representation (i.e., a first target representation) and a target text representation (i.e., a second target representation), where the target image representation is any one of the first image representation and the second image representation, and the target text representation is any one of the first text representation and the second text representation.

[0092] In step S170', an overall loss of the multi-modal representation model is determined based on the first single-modal loss, the second single-modal loss, the first cross-modal loss, and the second cross-modal loss.

[0093] In step S180', the parameters of the multi-modal representation model are adjusted based on the overall loss.

[0094] According to the above embodiment, an image and text sample tuple is used to train an image and text multimodal representation model, the image and text sample tuple includes two image samples in an image modal and two text samples in a text modal, and the meanings of the samples in the image and text sample tuple are matched. In the model training process, not only the single-modal loss of the image modal and the text modal are calculated, but also the cross-modal loss between the image and text modal is calculated, so that the image and text multimodal representation model can be guided to simultaneously learn the intra-modal and inter-modal semantic associations, and the generalization and robustness of the model can be improved, so that the model can generate a unified representation of the image and text multimodal data. Based on the unified representation, the accuracy of downstream image and text cross-modal tasks (such as image and text cross-modal search, image and text semantic matching, etc.) can be improved.

[0095] It should be understood that steps S110' to S180' correspond to steps S110 to S180 described above. The embodiment of steps S110' to S180' may refer to the description of steps S110 to S180 described above, and detailed description will be omitted here.

[0096] 3 is a schematic diagram illustrating a training process of a multi-modal representation model of images and text according to some embodiments of the present disclosure. As shown in FIG. 3, firstly, an image 331 and a text 332 are obtained, and the meanings of the image 331 and the text 332 are matched.

[0097] Data augmentation processing is performed twice on image 331 without changing its meaning, to obtain images 341 and 342. Data augmentation processing is performed twice on text 332 without changing its meaning, to obtain text 343 and text 344.

[0098] Images 341 and 342 are input to an image representation module 310, which obtains image representations 351 and 352. Text 343 and 344 are input to a text representation module 320, which obtains text representations 353 and 354.

[0099] Based on the image representation 351 and the image representation 352, an image modal single-modal loss 361 can be calculated. Based on the text representation 353 and the text representation 354, a text modal single-modal loss 362 can be calculated. Based on the image representation 352 and the text representation 353, an image modal to text modal cross-modal loss 363 and a text modal to image modal cross-modal loss 364 can be calculated.

[0100] An overall loss 370 is obtained by performing a weighted sum over the single-modal loss 361, the single-modal loss 362, the cross-modal loss 363, and the cross-modal loss 364. Based on the overall loss 370, the parameters of the image representation module 310 and the text representation module 320 are adjusted using an algorithm such as backpropagation.

[0101] According to some embodiments, a pre-trained multimodal expression model is obtained based on steps S110 to S180, and the multimodal expression model is fine-tuned based on matching data pairs in a pre-set application scenario (e.g., image and text matching pairs in an image and text search scenario), thereby improving the expression effect of the multimodal expression model in a specific application scenario.

[0102] Specifically, according to some embodiments, the matching data pair includes first data and second data of a target data modal, and the meanings of the first data and the second data match, and "fine-tuning the multimodal expression model based on the matching data pair in a pre-defined application scenario" includes fine-tuning the expression module corresponding to the target data modal based on the matching data pair.

[0103] According to another embodiment, the matching data pair includes first data of a first data modal and second data of a second data modal, and the meanings of the first data and the second data match, and "performing fine-tuning on the multimodal representation model based on the matching data pair in the preset application scenario" includes generating a first data sample and a second data sample of the first data modal based on the first data, generating a third data sample and a fourth data sample of the second data modal based on the second data, constructing a data sample tuple based on the first data sample, the second data sample, the third data sample and the fourth data sample, and performing fine-tuning on the multimodal representation model based on the data sample tuple.

[0104] The embodiment of fine-tuning the multimodal representation model based on data sample tuples is similar to the embodiment of training the multimodal representation model based on sample tuples in steps S110 to S180, and a detailed description is omitted here.

[0105] The multimodal representation model training method 100 according to an embodiment of the present disclosure can obtain a pre-trained (or pre-trained and fine-tuned) multimodal representation model. The pre-trained (or pre-trained and fine-tuned) multimodal representation model may be applied to multiple cross-modal data processing tasks, such as cross-modal search tasks, cross-modal inference tasks, etc. It should be understood that the pre-trained (or pre-trained and fine-tuned) multimodal representation model may also be applied to single-modal data processing tasks.

[0106] According to an embodiment of the present disclosure, a cross-modal search method is further provided. Figure 4 is a flow chart illustrating a cross-modal search method 400 according to an embodiment of the present disclosure. The method 400 may be performed on a server or a client device. That is, each step of the method 400 may be performed by a server or a client device.

[0107] As shown in FIG. 4, the method 400 includes steps S410 to S440.

[0108] In step S410, a search target of the first data modal is obtained.

[0109] In step S420, a first representation corresponding to the search target is obtained by inputting the search target into a multimodal representation model, which is obtained by training using the training method for a multimodal representation model according to the above embodiment.

[0110] In step S430, a second representation of each of the multiple candidate objects of a second data modality is obtained, where the second representation is obtained by inputting the corresponding candidate object into a multi-modal representation model.

[0111] In step 440, a target object that matches the search object is determined from the plurality of candidate objects based on the similarity between the first expression and each of the second expressions.

[0112] According to the embodiments of the present disclosure, accurate cross-modal search can be achieved.

[0113] According to some embodiments, the first data modal and the second data modal may be an image modal and a text modal, and thus the method 400 can achieve cross-modal search for accurate images and texts.

[0114] The similarity between the first and second representations may be, for example, a cosine similarity.

[0115] According to some embodiments, the target object may be, for example, one or more candidate objects with the greatest similarity, while according to other embodiments, the target object may be one or more candidate objects with a similarity greater than a threshold.

[0116] 5 is a comparison diagram of the cross-modal search effectiveness of the multimodal representation model of the embodiment of the present disclosure (i.e., the present model) and the multimodal representation model of the prior art for images and texts in the public datasets Flickr30K and MSCOCO. Here, R@K indicates the proportion of all sample instances in which the correct answer appears in the previous K return results, * indicates that the model is fine-tuned on the MSCOCO dataset.

[0117] According to an embodiment of the present disclosure, there is further provided a cross-modal reasoning method. Fig. 6 is a flowchart illustrating a cross-modal reasoning method 600 according to an embodiment of the present disclosure. The method 600 may be executed, for example, on a server or on a client device. That is, each step of the method 600 may be executed by a server or a client device.

[0118] As shown in FIG. 6, the method 600 includes steps S610 to S630.

[0119] In step S610, a first object of a first data modal and a second object of a second data modal are obtained.

[0120] In step S620, a first representation corresponding to the first object and a second representation corresponding to the second object are obtained by inputting the first object and the second object into a multimodal representation model, respectively, which is obtained by training using the training method for a multimodal representation model according to the above embodiment.

[0121] In step S630, inferred tags for the first object and the second object are determined based on the similarity between the first expression and the second expression.

[0122] According to the embodiments of the present disclosure, accurate cross-modal inference can be achieved.

[0123] According to some embodiments, inference tags include, for example, Entailment, Neutral, and Contradiction.

[0124] According to an embodiment of the present disclosure, there is further provided an apparatus for training a multi-modal expression model. Figure 7 is a block diagram of an apparatus 700 for training a multi-modal expression model according to an embodiment of the present disclosure. As shown in Figure 7, the apparatus 700 includes: a first acquiring unit 710 configured to acquire a sample tuple, the sample tuple including a first sample and a second sample of the first data modal, and a third sample and a fourth sample of the second data modal, where the meanings of the samples included in the sample tuple match; a first input unit 720 configured to input the first sample and the second sample to the first representation unit, respectively, to obtain a first representation of the first sample and a second representation of the second sample; a second input unit 730 configured to input the third sample and the fourth sample to the second representation unit, respectively, to obtain a third representation of the third sample and a fourth representation of the fourth sample; a first loss unit 740 configured to determine a first unimodal loss for the first data modal based on the first representation and the second representation; a second loss unit 750 configured to determine a second unimodal loss for the second data modal based on the third representation and the fourth representation; a third loss unit 760 configured to determine a first cross-modal loss from the first data modal to the second data modal and a second cross-modal loss from the second data modal to the first data modal based on a first target representation and a second target representation, where the first target representation is one of the first representation and the second representation, and the second target representation is one of the third representation and the fourth representation; a fourth loss unit 770 configured to determine an overall loss of the multimodal representation model based on the first single-modal loss, the second single-modal loss, the first cross-modal loss, and the second cross-modal loss; an adjustment unit 780 configured to adjust parameters of the multi-modal representation model based on the overall loss.

[0125] According to an embodiment of the present disclosure, a sample tuple is used to train a multi-modal representation model, where the sample tuple includes two samples of different data modalities, and the meanings of each sample in the sample tuple are matched. Based on the sample tuple, during the training process, not only single-modal losses for each data modality are calculated, but also cross-modal losses between different modalities are calculated, which can guide the multi-modal representation model to simultaneously learn intra-modal and inter-modal semantic associations, thereby improving the generalization and robustness of the model, and thus enabling the model to generate a unified representation of multi-modal data.

[0126] According to some embodiments, the apparatus 700 further comprises a second acquisition unit configured to acquire a raw data pair, the raw data pair including first raw data of the first data modal and second raw data of the second data modal, the first raw data and the second raw data having matching meanings; a first generation unit configured to generate the first sample and the second sample based on the first raw data; and a second generation unit configured to generate the third sample and the fourth sample based on the second raw data.

[0127] According to some embodiments, the first generation unit includes a first extension subunit configured to generate the first sample by performing a first data extension process on the first raw data, and a second extension subunit configured to generate the second sample different from the first sample by performing a second data extension process on the first raw data.

[0128] According to some embodiments, the first samples and the second samples are the same as the first raw data, and the first representation unit is configured to make the first representation different from the second representation by adding random noise.

[0129] According to some embodiments, the first data modal is a text modal and the first representation unit is a text encoder including a dropout processing layer, the drop probability of the dropout processing layer being smaller than a pre-set threshold.

[0130] According to some embodiments, the first loss unit 740 is further configured to determine the first unimodal loss based on a first similarity between the first representation and the second representation and a second similarity between the first representation and a second representation of another sample tuple, where the first unimodal loss is negatively correlated with the first similarity and positively correlated with the second similarity.

[0131] According to some embodiments, the third loss unit 760 is further configured to determine the first cross-modal loss based on a third similarity between the first target representation and the second target representation and a fourth similarity between the first target representation and a second target representation of another sample tuple, where the first cross-modal loss is negatively correlated with the third similarity and positively correlated with the fourth similarity.

[0132] According to some embodiments, the third loss unit 760 is further configured to determine the second cross-modal loss based on a third similarity between the first target representation and the second target representation and a fifth similarity between the second target representation and the first target representation of another sample tuple, where the second cross-modal loss is negatively correlated with the third similarity and positively correlated with the fifth similarity.

[0133] According to some embodiments, the overall loss is a weighted sum of the first single-modal loss, the second single-modal loss, the first cross-modal loss, and the second cross-modal loss.

[0134] According to some embodiments, the apparatus 700 further comprises a fine-tuning unit configured to perform fine-tuning on the multimodal representation model based on matching data pairs in a pre-defined application scenario.

[0135] According to some embodiments, the matching data pair includes first data and second data of a target data modal, and the meanings of the first data and the second data match, and wherein the fine-tuning unit is further configured to perform fine-tuning on a representation unit corresponding to the target data modal based on the matching data pair.

[0136] According to some embodiments, the matching data pair comprises first data of a first data modal and second data of a second data modal, the meanings of the first data and the second data matching, wherein the fine-tuning unit comprises a first generation subunit configured to generate a first data sample and a second data sample of the first data modal based on the first data, a second generation subunit configured to generate a third data sample and a fourth data sample of the second data modal based on the second data, a third generation subunit configured to construct a data sample tuple based on the first data sample, the second data sample, the third data sample and the fourth data sample, and a fine-tuning subunit configured to perform fine-tuning on the multimodal representation model based on the data sample tuple.

[0137] According to some embodiments, the first data modal and the second data modal are any two of the following: a text modal, an image modal, a video modal, an audio modal.

[0138] According to an embodiment of the present disclosure, there is further provided a cross-modal search device. FIG. 8 is a block diagram showing a cross-modal search device 800 according to an embodiment of the present disclosure. As shown in FIG. 8, the device 800 includes: A first acquiring unit 810 configured to acquire a search object of a first data modality; a representation unit 820 configured to input the search subject into a multimodal representation model to obtain a first representation corresponding to the search subject; a second acquisition unit 830 configured to acquire a second representation of each of a plurality of candidate objects in a second data modality, where the second representation is obtained by inputting the corresponding candidate object into the multimodal representation model; a determination unit 840 configured to determine a target object matching the search object from the plurality of candidate objects based on a similarity between the first representation and each second representation, where the multimodal representation model is obtained by training with a training device based on the multimodal representation model.

[0139] According to the embodiments of the present disclosure, accurate cross-modal search can be achieved.

[0140] According to an embodiment of the present disclosure, there is further provided a cross-modal reasoning apparatus. FIG. 9 is a block diagram showing a cross-modal reasoning apparatus 900 according to an embodiment of the present disclosure. As shown in FIG. 9, the apparatus 900 includes: an acquisition unit 910 configured to acquire a first object of a first data modality and a second object of a second data modality; a representation unit 920 configured to input the first object and the second object into a multimodal representation model, respectively, to obtain a first representation corresponding to the first object and a second representation corresponding to the second object; a determining unit 930 configured to determine inferred tags of the first object and the second object based on a similarity between the first representation and the second representation, where the multimodal representation model includes a multimodal representation model obtained by training with a training device based on the multimodal representation model.

[0141] According to the embodiments of the present disclosure, accurate cross-modal inference can be achieved.

[0142] It should be understood that each unit of the apparatus 700 as shown in Fig. 7 may correspond to each step in the method 100 as shown in Fig. 1, each unit of the apparatus 800 as shown in Fig. 8 may correspond to each step in the method 400 as shown in Fig. 4, and each unit of the apparatus 900 as shown in Fig. 9 may correspond to each step in the method 600 as shown in Fig. 6. Thus, the operations, features and advantages described for the method 100 above also apply to the apparatus 700 and the units included therein, the operations, features and advantages described for the method 400 above also apply to the apparatus 800 and the units included therein, and the operations, features and advantages described for the method 600 above also apply to the apparatus 900 and the units included therein. For the sake of brevity, some operations, features and advantages are not described herein.

[0143] It should be noted that although particular functionality is discussed above with reference to particular units, the functionality of each unit discussed herein may be split into multiple units and / or at least some functionality of multiple units may be combined into a single unit. For example, the first input unit 720 and the second input unit 730 described above may in some embodiments be combined into a single unit.

[0144] It should also be understood that various techniques may be described herein in the general context of software hardware elements or program units. With respect to each unit described in FIG. 7-FIG. 9 above, it may be implemented in hardware or in hardware in combination with software and / or firmware. For example, these units may be implemented as computer program code / instructions configured to be executed in one or more processors and stored in a computer-readable storage medium. Alternatively, these units may be implemented as hardware logic / circuitry. For example, in some embodiments, one or more of the units 710-930 may be implemented together in a System on Chip (SoC). The SoC may include an integrated circuit chip (e.g., a processor (e.g., including a Central Processing Unit (CPU), microcontroller, microprocessor, Digital Signal Processor (DSP), etc.), memory, one or more communication interfaces, and / or one or more components in other circuits) that may optionally execute received program code and / or include embedded firmware to perform functions.

[0145] According to an embodiment of the present disclosure, there is provided an electronic device including at least one processor and a memory communicatively connected to the at least one processor, the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one processor to perform at least one of a multimodal representation model training method, a cross-modal search method, and a cross-modal inference method according to an embodiment of the present disclosure.

[0146] According to one aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium having stored thereon computer instructions for causing a computer to perform at least one of a method for training a multimodal representation model, a method for cross-modal search, and a method for cross-modal inference according to embodiments of the present disclosure.

[0147] According to one aspect of the present disclosure, there is provided a computer program product including a computer program that, when executed by a processor, implements at least one of a method for training a multimodal representation model, a method for cross-modal search, and a method for cross-modal inference according to an embodiment of the present disclosure.

[0148] As shown in FIG. 10, a block diagram of an electronic device 1000 that can be used as a server or client of the present disclosure, which is an example of a hardware device applicable to various aspects of the present disclosure, will be described. The electronic device may represent various forms of digital electronic computers, such as laptop computers, desktop computers, stages, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components, their connections, and their functions shown herein are merely exemplary and do not limit the implementation of the present disclosure as described and / or claimed herein.

[0149] As shown in Fig. 10, the electronic device 1000 includes a computing unit 1001, which can perform various suitable operations and processes by means of a computer program stored in a read-only memory (ROM) 1002 or loaded from a storage unit 1008 into a random access memory (RAM) 1003. The RAM 1003 may further store various programs and data required for operating the device 1000. The computing unit 1001, the ROM 1002 and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0150] The components of the electronic device 1000 are connected to an I / O interface 1005, and include an input unit 1006, an output unit 1007, a storage unit 1008, and a communication unit 1009. The input unit 1006 may be any type of device capable of inputting information to the device 1000, and the input unit 1006 may receive input numeric or character information and generate key signal inputs for user settings and / or function control of the electronic device, and may include, but is not limited to, a mouse, a keyboard, a touch screen, a trackboard, a trackball, a control lever, a microphone, and / or a remote control. The output unit 1007 may be any type of device capable of presenting information, and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 1008 may include, but is not limited to, a magnetic disk, an optical disk. The communication unit 1009 enables the device 1000 to exchange information / data with other devices via a computer network, e.g., the Internet, and / or various telecommunication networks, and may include a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, e.g., Bluetooth. TM These may include, but are not limited to, devices, 802.11 devices, Wi-Fi devices, WiMAX devices, cellular communication devices and / or the like.

[0151] The computing unit 1001 may be any of a variety of general-purpose and / or special-purpose processing components having processing and computing capabilities. Some examples of the computing unit 1001 may include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units for executing machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1001 performs each of the methods and processes described above, such as methods 100, 400, and 600. For example, in some embodiments, the methods 100, 400, and 600 may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 1008. In some embodiments, some or all of the computer programs may be loaded and / or installed into the device 1000 via the ROM 1002 and / or the communication unit 1009. The computer program, when loaded into RAM 1003 and executed by the computing unit 1001, may perform one or more steps of the above-described methods 100, 400 or 600. Alternatively, in other embodiments, the computing unit 1001 is configured to perform at least one of the methods 100, 400, 600 in any other suitable manner (e.g., using firmware).

[0152] Various embodiments of the systems and techniques described herein may be implemented in digital electronic circuitry systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), software hardware, firmware, software, and / or combinations thereof. These various embodiments may be embodied in one or more computer programs that may be executed and / or interpreted by a programmable system that includes at least one programmable processor, which may be a special purpose or general purpose programmable processor, and may include receiving data and instructions from a storage system, at least one input device, at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0153] The program code implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer or other programmable data processing apparatus, so that when executed by the processor or controller, the program code performs the functions / operations specified in the flowcharts and / or block diagrams. The program code may be entirely executed on a machine, partly executed on a machine, partly executed on a machine and partly executed on a remote machine as a separate software package, or entirely executed on a remote machine or server.

[0154] In the context of this disclosure, a machine-readable medium may be a tangible medium, which may include or store a program for use in or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the above. More specific examples of machine-readable storage media include: Portable Computer Disk , hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), Portable Compact Disk Read-Only Memory (CD-ROM) , optical storage, magnetic storage, or any suitable combination of the above.

[0155] To provide for interaction with a user, a computer may implement the systems and techniques described herein and include a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user, and a keyboard and pointing device (e.g., a mouse or trackball) through which the user may provide input to the computer. Other types of devices may also be provided for providing interaction with a user. For example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or haptic feedback), and may receive input from the user in any form (including audio input, speech input, or tactile input).

[0156] The systems and techniques described herein may be implemented in a computing system including a backstage component (e.g., as a data server), a middleware component (e.g., an application server), a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with the system or technique embodiment), or any combination of backstage, middleware, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communications network). Examples of communications networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0157] The computer system may include a client side and a server. The client side and the server are generally remote from each other and usually interact with each other via a communication network. The relationship between the client side and the server is generated by running computer programs having a client side-server relationship with each other on corresponding computers. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0158] It should be understood that the steps may be reordered, added, or removed using the various forms of flow described above, for example, the steps described in this disclosure may be performed in parallel, sequentially, or in a different order, and the present disclosure is not limited thereto as long as the technical solutions disclosed in this disclosure can achieve the desired results.

[0159] Although the embodiments or examples of the present disclosure have been described with reference to the drawings, it should be understood that the above methods, systems, and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the scope of the claims and their equivalents after grant. Various elements of the embodiments or examples may be omitted or replaced by their equivalent elements. In addition, each step may be performed in a different order from the order described in this disclosure. Furthermore, various elements of the embodiments or examples may be combined in various ways. It is important to note that with the evolution of technology, many elements described herein may be replaced by equivalent elements that appear later in this disclosure.

Claims

1. 1. A computer-implemented training method for a multi-modal representation model, the multi-modal representation model including a first representation module corresponding to a first data modality and a second representation module corresponding to a second data modality, the training method comprising: obtaining a sample tuple, the sample tuple including a first sample and a second sample of the first data modal, and a third sample and a fourth sample of the second data modal, the meanings of the samples included in the sample tuple being consistent; inputting the first sample and the second sample into the first representation module, respectively, to obtain a first representation of the first sample and a second representation of the second sample; inputting the third sample and the fourth sample into the second representation module, respectively, to obtain a third representation of the third sample and a fourth representation of the fourth sample; determining a first unimodal loss for the first data modal based on a first similarity between the first representation and the second representation and a second similarity between the first representation and a second representation of another sample tuple, the first unimodal loss being negatively correlated with the first similarity and positively correlated with the second similarity; determining a second single-modal loss for the second data modal based on a sixth similarity between the third representation and the fourth representation and a seventh similarity between the third representation and a fourth representation of another sample tuple, the second single-modal loss being negatively correlated with the sixth similarity and positively correlated with the seventh similarity; Based on a first target representation and a second target representation, a first cross-modal loss from the first data modal to the second data modal and a second cross-modal loss from the second data modal to the first data modal are determined, the first target representation being one of the first representation and the second representation, the second target representation being one of the third representation and the fourth representation, a third similarity between the first target representation and the second target representation, and a third similarity between the first target representation and the other sample data. determining the first cross-modal loss based on a fourth similarity between the first target representation and the second target representation of another sample tuple, the first cross-modal loss being negatively correlated with the third similarity and positively correlated with the fourth similarity; determining the second cross-modal loss based on a third similarity between the first target representation and the second target representation and a fifth similarity between the second target representation and a first target representation of another sample tuple, the second cross-modal loss being negatively correlated with the third similarity and positively correlated with the fifth similarity; determining an overall loss of the multimodal representation model based on the first single-modal loss, the second single-modal loss, the first cross-modal loss, and the second cross-modal loss; and adjusting parameters of the multi-modal representation model to reduce the overall loss. method.

2. obtaining a raw data pair, the raw data pair including first raw data of the first data modal and second raw data of the second data modal, the first raw data and the second raw data being semantically consistent; generating the first sample and the second sample based on the first raw data; The method of claim 1 , further comprising generating the third sample and the fourth sample based on the second raw data.

3. generating the first sample and the second sample based on the first raw data, performing a first data augmentation process on the first raw data to generate the first samples; 3. The method of claim 2, further comprising: performing a second data augmentation operation on the first raw data to generate the second samples, the second samples being different from the first samples.

4. 3. The method of claim 2, wherein the first sample and the second sample are the same as the first raw data, and the first representation module is configured to make the first representation different from the second representation by adding random noise.

5. 5. The method of claim 4, wherein the first data modal is a text modal and the first representation module is a text encoder including a dropout processing layer, the drop probability of the dropout processing layer being less than a preset threshold.

6. The method of claim 1 , wherein the overall loss is a weighted sum of the first single-modal loss, the second single-modal loss, the first cross-modal loss, and the second cross-modal loss.

7. The method of claim 1 , further comprising: fine-tuning the multimodal representation model based on matching data pairs in a preset application scenario.

8. The matching data pair includes a first data and a second data of a target data modality, and the meaning of the first data and the second data are consistent. According to the matching data pair in a preset application scenario, fine-tuning the multi-modal expression model is performed. The method of claim 7, further comprising: making refinements to a representation module corresponding to the target data modal based on the matching data pairs.

9. The matching data pair includes first data of a first data modality and second data of a second data modality, and the first data and the second data have the same meaning. The matching data pair in a preset application scenario is used to fine-tune the multimodal expression model. generating a first data sample and a second data sample of the first data modal based on the first data; generating a third data sample and a fourth data sample of the second data modality based on the second data; constructing a data sample tuple based on the first data sample, the second data sample, the third data sample, and the fourth data sample; and performing fine-tuning on the multi-modal representation model based on the data sample tuples.

10. The method of claim 1 , wherein the first data modal and the second data modal are any two of a text modal, an image modal, a video modal, and an audio modal.

11. A computer-implemented cross-modal search method, comprising: Obtaining a search target of a first data modal; inputting the search subject into a multimodal representation model to obtain a first representation corresponding to the search subject; obtaining a second representation of each of a plurality of candidate objects of a second data modality, the second representation being obtained by inputting the corresponding candidate object into the multimodal representation model; determining a target object that matches the search object from the plurality of candidate objects based on a similarity between the first representation and each of the second representations; 2. A method for cross-modal search, wherein the multi-modal representation model is obtained by training using the method of claim 1.

12. 1. An apparatus for training a multimodal representation model, the multimodal representation model comprising a first representation unit corresponding to a first data modality and a second representation unit corresponding to a second data modality, the training apparatus comprising: a first acquiring unit configured to acquire a sample tuple, the sample tuple including a first sample and a second sample of the first data modal, and a third sample and a fourth sample of the second data modal, the meanings of the samples included in the sample tuple being consistent; a first input unit configured to input the first sample and the second sample to the first representation unit, respectively, to obtain a first representation of the first sample and a second representation of the second sample; a second input unit configured to input the third sample and the fourth sample to the second representation unit, respectively, to obtain a third representation of the third sample and a fourth representation of the fourth sample; a first loss unit configured to determine a first unimodal loss of the first data modal based on a first similarity between the first representation and the second representation and a second similarity between the first representation and a second representation of another sample tuple, the first unimodal loss being negatively correlated with the first similarity and positively correlated with the second similarity; a second loss unit configured to determine a second single-modal loss of the second data modal based on a sixth similarity between the third representation and the fourth representation and a seventh similarity between the third representation and a fourth representation of another sample tuple, the second single-modal loss being negatively correlated with the sixth similarity and positively correlated with the seventh similarity; a third loss unit configured to determine a first cross-modal loss from the first data modal to the second data modal and a second cross-modal loss from the second data modal to the first data modal based on a first target representation and a second target representation, the first target representation being any one of the first representation and the second representation, the second target representation being any one of the third representation and the fourth representation, a third similarity between the first target representation and the second target representation, and a fourth similarity between the first target representation and the second target representation. determining the first cross-modal loss based on a fourth similarity between the first target representation and the second target representation of another sample tuple, the first cross-modal loss being negatively correlated with the third similarity and positively correlated with the fourth similarity; determining the second cross-modal loss based on a third similarity between the first target representation and the second target representation and a fifth similarity between the second target representation and the first target representation of another sample tuple, the second cross-modal loss being negatively correlated with the third similarity and positively correlated with the fifth similarity; a fourth loss unit configured to determine an overall loss of the multimodal representation model based on the first single-modal loss, the second single-modal loss, the first cross-modal loss, and the second cross-modal loss; and an adjustment unit configured to adjust parameters of the multimodal representation model to reduce the overall loss; Device.

13. a second acquiring unit configured to acquire a raw data pair, the raw data pair including first raw data of the first data modal and second raw data of the second data modal, the first raw data and the second raw data being semantically consistent; a first generating unit configured to generate the first sample and the second sample based on the first raw data; The apparatus of claim 12 , further comprising: a second generating unit configured to generate the third sample and the fourth sample based on the second raw data.

14. The first generating unit is a first enhancement subunit configured to perform a first data enhancement process on the first raw data to generate the first samples; and a second enhancement subunit configured to perform a second data enhancement process on the first raw data to generate the second samples that differ from the first samples.

15. 14. The apparatus of claim 13, wherein the first samples and the second samples are the same as the first raw data, and the first representation unit is configured to make the first representation different from the second representation by adding random noise.

16. 16. The apparatus of claim 15, wherein the first data modal is a text modal and the first representation unit is a text encoder including a dropout processing layer, the drop probability of the dropout processing layer being less than a pre-set threshold.

17. 13. The apparatus of claim 12, wherein the overall loss is a weighted sum of the first single-modal loss, the second single-modal loss, the first cross-modal loss, and the second cross-modal loss.

18. The apparatus of claim 12 , further comprising a fine-tuning unit configured to perform fine-tuning on the multimodal representation model based on matching data pairs in a preset application scenario.

19. The matching data pair includes first data and second data of a target data modal, and the first data and the second data have a matching meaning, and the fine-tuning unit further comprises: The apparatus of claim 18 , configured to perform fine-tuning on a representation unit corresponding to the target data modal based on the matching data pairs.

20. The matching data pair includes first data of a first data modal and second data of a second data modal, and the first data and the second data have a matching meaning, and the fine-tuning unit: a first generating subunit configured to generate a first data sample and a second data sample of the first data modal based on the first data; a second generating subunit configured to generate a third data sample and a fourth data sample of the second data modality based on the second data; a third generating subunit configured to construct a data sample tuple based on the first data sample, the second data sample, the third data sample, and the fourth data sample; and a fine-tuning subunit configured to perform fine-tuning on the multi-modal representation model based on data sample tuples.

21. The apparatus of claim 12 , wherein the first data modal and the second data modal are any two of a text modal, an image modal, a video modal, and an audio modal.

22. A cross-modal search device, comprising: a first acquiring unit configured to acquire a search subject of a first data modality; a representation unit configured to input the search subject into a multimodal representation model to obtain a first representation corresponding to the search subject; a second acquisition unit configured to acquire a second representation of each of a plurality of candidate objects in a second data modality, the second representation being obtained by inputting the corresponding candidate object into the multimodal representation model; a determining unit configured to determine a target object matching the search object from the plurality of candidate objects based on a similarity between the first representation and each second representation; The multimodal representation model is obtained by training with the device according to claim 12.

23. An electronic device, At least one processor; a memory communicatively coupled to the at least one processor; 11. An electronic device comprising: an electronic device having stored therein instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one processor to perform a method according to any one of claims 1 to 10.

24. An electronic device comprising: At least one processor; a memory communicatively coupled to the at least one processor; 12. An electronic device comprising: an electronic device having a memory storing therein instructions executable by the at least one processor, the instructions, when executed by the at least one processor, causing the at least one processor to perform the method of claim 11.

25. A non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to carry out the method of any one of claims 1 to 10.

26. A non-transitory computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the method of claim 11.

27. A computer program which, when executed by a processor, causes the processor to carry out a method according to any one of claims 1 to 10.

28. A computer program product which, when executed by a processor, causes the processor to perform the method of claim 11.

Citation Information

Patent Citations

  • Cross-modal retrieval method, system and equipment based on supervised comparison

    CN113239214A

  • Construction method and application of cross-modal retrieval model based on multilayer attention mechanism

    CN113779361A