A method for enhancing multimodal feature fusion based on contrastive learning and structured information

Through the method of contrastive learning and structured information enhancement, the structured information of multi-modal data is processed, semantic negative samples and features are generated, and weighted addition is performed based on visual features, which solves the problem that multi-modal data processing methods in the existing technology ignore deep The problem of hierarchical interaction and difference has significantly improved the efficiency and accuracy of multi-modal data processing.

CN118627020BActive Publication Date: 2024-10-29ZHEJIANG LAB

Patent Information

Application Number
CN202411110491.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2024-10-29
Estimated Expiration
2044-08-14

AI Technical Summary

Technical Problem

Existing multimodal data processing methods have limitations in feature extraction and preliminary fusion, and ignore the deep interactions and differences between modalities, especially the structured information of text data, resulting in the failure to fully unleash the potential of multimodal data. .

Method used

Using a method based on contrastive learning, by acquiring and processing structured information in image-text pairs, generating semantic negative samples and structured features, combined with visual features for weighted addition, using the cross-entropy loss function to train the encoder, and in the model Multi-layer fusion is performed in the state information fusion module, and finally an autoregressive decoder is added to improve the depth and accuracy of understanding.

Benefits of technology

Through the enhancement of structured information, the depth of understanding and accuracy of multi-modal feature fusion are significantly improved, the complementary relationship between image and text modalities is fully utilized, and the efficiency and accuracy of data processing are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118627020B_ABST
    Figure CN118627020B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for enhancing multimodal feature fusion based on contrastive learning and structured information. The multimodal network based on contrastive learning fully explores the correspondence between modal features by using positive and negative sample data constructed by structured information, and injects structured information to enhance the fusion of modal features based on the correspondence. The present invention constructs text semantic negative samples and structural knowledge features by structurally processing the text data in paired pictures and text pairs in the original data set, obtaining information such as objects, object relationships, and object attributes in the text data. After the structural knowledge features are injected into the text features, feature alignment is performed together with the text positive samples and picture data in the contrastive learning module, and the alignment features are sent to the feature fusion module for feature fusion. The present invention makes full use of the structural information of the text modality for feature alignment and uses the fusion features for joint optimization, which greatly improves the multimodal understanding ability of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of artificial intelligence application and multimodal information fusion, and in particular to a method for enhancing multimodal feature fusion based on contrastive learning and structured information. Background Art

[0002] In recent years, the rapid development of science and technology has led to the rapid popularization of the Internet and information technology, which has been deeply integrated into people's daily lives. This process has spawned a huge amount of multimodal image and text data, which are like treasures containing endless value and information. However, with the big data wave sweeping in, the explosive growth of such data not only reflects its unprecedented scale, but also poses a severe challenge to machine intelligence - how to quickly and efficiently parse and accurately understand these complex and diverse image data has become a key problem that needs to be solved urgently. Therefore, we urgently call for an innovative multimodal data processing method that has the ability of high-speed processing, efficient analysis and accurate understanding, so as to achieve deep mining, efficient retrieval and comprehensive understanding of these valuable data resources.

[0003] With the advent of the Internet and the information age, the form of data is no longer limited to a single picture or text, but is increasingly tending towards a multimodal fusion state. Taking Weibo as an example, the content on it often integrates text descriptions with corresponding pictures, videos and other media forms, showing the richness and multidimensionality of data expression. Faced with the vast ocean of information on the Internet, how to effectively and accurately parse and understand these image model data that integrate multiple modalities has become an increasingly important research direction in the field of scientific research and application. This not only requires technology to transcend the boundaries of a single media and achieve deep cross-modal fusion and understanding, but also requires continuous improvement in processing speed and accuracy to meet the growing data challenges.

[0004] At the same time, neural network technology is developing and evolving at an unprecedented speed. The emergence of cutting-edge technologies such as contrastive learning and Transformer architecture has opened up new ways to process multimodal data. Contrastive learning methods, such as Momentum Contrastive Algorithm (MoCo) and SimCLR, combined with the Transformer-based ViT image feature encoder and BERT text encoder, have demonstrated powerful cross-modal data processing capabilities, enabling multimodal data to be more refined and efficiently fused under the framework of contrastive learning. However, the currently popular multimodal visual text feature fusion algorithms, although they have achieved certain results in feature extraction and preliminary fusion, still face significant limitations. These methods often simply add, concatenate or multiply the features of different modalities to form a comprehensive feature, which is then processed in a multi-layer fusion module. This processing method ignores the deep interaction and differences between modalities, especially the structured information of text data, such as object attributes, relationships, etc., which is crucial to improving the understanding depth and accuracy of multimodal feature fusion. Therefore, the existing multimodal fusion algorithms have failed to fully release the potential of multimodal data in terms of final effect, and there is still room for improvement in the fusion effect. Summary of the invention

[0005] In view of the deficiencies of the prior art, the object of the present invention is to provide a method for enhancing multimodal feature fusion based on contrastive learning and structured information.

[0006] To achieve the above object, the present invention adopts the following technical solution: a method for multimodal feature fusion based on contrastive learning and structured information enhancement, comprising the following steps:

[0007] Step 1. Obtain an original image-text pair (composed of an image and a text describing the image), and process the text data in the original image-text pair to obtain text structured information of objects in the text data, relationships between objects, and attributes of the objects themselves; wherein the objects include subjects and objects in the text, and related attributes representing the subjects and objects themselves; the related attributes are text components that modify the subjects and objects;

[0008] Step 2. Swap the text structured information of the objects, the relationships between the objects, and the attributes of the objects themselves obtained in step 1 to generate text semantic negative samples;

[0009] Step 3. Perform word segmentation processing on the subject, object, and related attributes representing the subject and object themselves obtained from the original image-text pair in step 1 to obtain word embedding vectors of the subject, object, and related attributes representing the subject and object themselves; encode the obtained word embedding vectors to obtain structural knowledge features;

[0010] Step 4. Extract the features of the original image-text pair and the text semantic negative sample obtained in step 2 to obtain visual features and text features; perform weighted addition of the text features (including positive and negative sample features) and the structural knowledge features obtained in step 3 to obtain the final text features; perform comparative learning of the visual features and the final text features to obtain the feature matching degree between the paired image-text positive sample pairs and the feature matching degree between the negative sample pairs; horizontally splice the feature matching degree between the positive sample pairs and the feature matching degree between the negative sample pairs and construct a label matrix to constitute the input matrix of the loss function, and then use the cross entropy loss function to train the visual encoder and the text encoder;

[0011] Step 5. horizontally splice the visual features obtained in step 4 and the final text features as the input of the multi-layer modal information fusion module; jointly optimize the modal information fusion module with the visual encoder and text encoder trained in step 4;

[0012] Step 6. Based on the modal information fusion module, visual encoder and text encoder jointly optimized in step 5, add an autoregressive decoder, input corresponding text prompts and answers, and train the autoregressive decoder;

[0013] Step 7. Extract the features of the original image to be retrieved through the trained visual encoder, text encoder, modal information fusion module and autoregressive decoder, input the image and question into the visual encoder and autoregressive decoder respectively, and generate the answer to the final question through the decoder.

[0014] Furthermore, in step 1, the text structured information of the objects of the text data, the relationships between the objects and the properties of the objects themselves is obtained by parsing the text data using a scene graph parser.

[0015] Furthermore, in step 2, the text semantic negative sample is obtained through an attribute exchange function; the specific method is as follows: the subject and object relationship, and the subject attributes and object attributes obtained from the original image-text pair are exchanged using the attribute exchange function to form a text semantic negative sample.

[0016] Furthermore, the step 3 is specifically as follows: using the word segmentation algorithm of the BERT model to perform word segmentation processing on the subject, object and related attributes representing the subject and object themselves obtained in the step 2 to obtain corresponding word embedding vectors; using a ternary encoder function to perform linear transformation on the word embedding vectors to obtain structured knowledge features; sending the structured knowledge features to a multi-layer Transformer encoder for encoding to obtain the final structured knowledge features.

[0017] Furthermore, the step 4 is specifically as follows: using a visual encoder to extract original image features, a text encoder to extract original text features and correspondingly constructed text negative sample features; performing weighted addition of the text features and text negative sample features with the structural knowledge features obtained in step 3 respectively; applying contrastive learning to the text features and visual features to calculate n image feature matrices (n, c) and corresponding n text positive sample feature matrices (n, c), where n is the number of samples and c is the feature dimension; transposing and multiplying the image feature matrix and the text positive sample feature matrix to obtain a positive feature matching matrix between image and text positive sample pairs; the dimension of the positive feature matching matrix is ​​(n, n), where the diagonal of the positive feature matching matrix is ​​the required image and the corresponding positive text feature matching degree; the feature matching matrix is ​​constructed by taking the data on the diagonal of the feature matching matrix. The positive sample matching matrix required, the output dimension of the positive sample matching matrix is ​​(n, 1); calculate n picture feature matrices (n, c) and corresponding k text negative sample feature matrices (k, c), wherein n and k are the number of samples, and c is the feature dimension; the picture feature matrix and the text negative sample feature matrix are transposed and multiplied to obtain the negative sample matching matrix between the picture text negative sample pairs, the output dimension of the negative sample matching matrix is ​​(n, k); the positive sample matching matrix (n, 1) and the negative sample matching matrix (n, k) are concatenated to form a matching matrix, the output dimension of the matching matrix is ​​(n, k+1); construct a label matrix with a dimension of (n, k+1) in which the first column is all 1 and the following k columns are all 0; use the matching matrix and the label matrix as input matrices, and use the cross entropy loss function to train the visual encoder and the text encoder.

[0018] Furthermore, the step 5 is specifically as follows: concatenating the visual features and the text features; inputting the concatenated features into the Transformer-based modal information fusion module for modal information fusion; when encoding the concatenated features, randomly masking 15% of the data in the text features by masking; or replacing the text or image features in the matching picture-text pair with other text or image features with a probability of 50%; using the text / attribute features and all visual features around the masked features as input, and using a text mask model to predict the masked text features; extracting the output text features of the last layer of the modal information fusion module and the corresponding output visual features of the visual encoder, applying comparative learning information and classifying, using the corresponding matching features classified as 1 and the unmatched features classified as 0 to calculate the loss of the modal information fusion module; training the visual encoder, the text encoder and the modal information fusion module.

[0019] Furthermore, the step 6 is specifically as follows: based on the trained visual encoder, text encoder and modal information fusion module, an autoregressive encoder is added after the modal information fusion module, pictures, text questions and corresponding answer data are input, and the autoregressive loss function is used to train the autoregressive encoder to fit the answer.

[0020] The present invention also provides a device for enhancing multimodal feature fusion based on contrastive learning and structured information, comprising one or more processors and a GPU processor, for implementing the method for enhancing multimodal feature fusion based on contrastive learning and structured information.

[0021] The present invention also provides an electronic device, including a memory and a processor, including a memory, a central processing unit and a GPU processor, wherein the memory is coupled to the central processing unit and the GPU processor; wherein the memory is used to store program data, and the central processing unit and the GPU processor are used to execute the program data to implement the method of enhancing multimodal feature fusion based on contrastive learning and structured information.

[0022] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the method for enhancing multimodal feature fusion based on contrastive learning and structured information is implemented.

[0023] Compared with the prior art, the present invention has the following beneficial effects:

[0024] 1. The present invention utilizes the structured information in the text data, constructs structured semantic negative samples and structured features, and utilizes the contrastive learning method to enable the text encoder and the visual encoder to better perform feature encoding and extraction;

[0025] 2. In order to improve the fusion performance between text and pictures, the present invention uses text features that integrate structured information, and performs supervised optimization again by contrastive learning in the output stage after fusion, thereby achieving the purpose of enhancing modal fusion;

[0026] 3. The present invention is based on the strategy of contrastive learning and structured enhancement, which can make full use of the correspondence between text structure and time pictures, thereby greatly improving the ability of modal fusion. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0028] Figure 1 It is the overall structure calculation flow chart of the method of the present invention;

[0029] Figure 2 Schematic diagram of the feature matching comparison calculation of positive and negative samples of the present invention;

[0030] Figure 3 is a schematic diagram of the Transformer layer in the present invention;

[0031] Figure 4 is a schematic diagram of the device of the present invention;

[0032] Figure 5 The figure is a schematic diagram of an electronic device according to the present invention. DETAILED DESCRIPTION

[0033] Here, exemplary embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application.

[0034] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0035] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0036] The present invention is described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the features of the following embodiments and implementations can be combined with each other.

[0037] The present invention is based on a Transformer multimodal network, utilizes the structured information of text data to construct semantic negative samples and structured features, utilizes contrastive learning to mine the correspondence between modalities, and simultaneously mines the fusion between modal features through these structured attribute information, thereby being able to utilize the complementary and aligned modal information between modalities; in the method of the present invention, by structurally processing the text data in the original data set, constructing semantic negative samples and structured features, then extracting features from paired images, text pairs and corresponding negative sample information to obtain corresponding features, then using contrastive learning methods to calculate the matching degree to calculate the potential correspondence; subsequently, feature fusion is performed using the data injected with structured features; by using contrastive learning and structured information to enhance the multimodal feature fusion method, the visual modal information of the image, the text modal structured information and their attribute information can be fully utilized for joint optimization, thereby greatly improving the image-text fusion performance.

[0038] like Figure 1 As shown, an embodiment of the present invention provides a method for enhancing multimodal feature fusion based on contrastive learning and structured information. Based on contrastive learning strategy and structured information, structured processing is performed on pre-collected text, and then a visual encoder, a text encoder and a modal information fusion module are used to extract features and fuse images and texts for subsequent multimodal image understanding or question answering. The method includes the following steps:

[0039] 1. Use the scene graph parsing algorithm tool to process the text in the original image-text pair to obtain the subject object, object object, relational attributes representing the relationship between objects, and attribute text structured information of the object itself.

[0040] Specifically, Figure 1 As shown, first, the original text data is input into the scene graph algorithm parsing tool; the scene graph algorithm parsing tool is used to parse the text and separate the subject object in the text. Object Subject-object relation modifier R 1~n And the attribute text of the object itself. Among them, "1~n" represents the separated objects 1 to n.

[0041] 2. For the structured information such as objects, attributes and relationship data obtained through the scene graph parsing tool, use the attribute exchange function to swap the subject and object relationship and the subject attributes and object attributes to generate negative samples in text semantics.

[0042] The formula of the attribute exchange function is in, is the parsed subject, is the object, and R is the relationship between the subject and the object. For these subjects and objects, their relative positions are exchanged while keeping the relationship unchanged. The object becomes the subject, and the subject becomes the object. The semantic negative sample W is constructed by the attribute exchange function. - For example, if there is a text corresponding to a picture: "A cute puppy is lying on a big bed", after the above exchange function, the following semantic negative sample can be generated: "The big bed is lying on a cute puppy". This method of constructing structured text semantic negative samples by exchanging attribute data can better reflect the structured semantic information contained in the picture, compared with directly using text from other unrelated pictures as semantic negative samples in the subsequent training process. Therefore, it is more valuable in contrastive learning.

[0043] 3. Use BERT's word segmenter to obtain the word embedding vectors of the subject, object, and their corresponding attributes; use the ternary encoder function to encode the obtained word embeddings to construct the data structured knowledge features of the subject, object, and their corresponding attributes; then send the structured knowledge features to the multi-layer Transformer encoder to obtain the final structural knowledge features. Figure 3 Schematic diagram of the Transformer layer.

[0044] Specifically, for the above and R 1~n , respectively using W x =WordEmb(x) function extracts the corresponding word vector, where x represents and R 1~n . Among them, the ternary encoder is e tri =ENCODE tri (O 1 , R 1 , O 2 )=W o1 +W o2 -W R The input is the subject, object and the corresponding relationship, W 01 , W 02 and W R The corresponding word vectors extracted by the word segmenter are used to construct the structured knowledge features. The structured knowledge features are then sent to the multi-layer Transformer encoder for encoding, and the final structured knowledge features e are obtained. ke In the ternary encoder, the subject, object, and corresponding relationship features are input, and the fused structural features are constructed in the feature space through addition and subtraction calculations. Since the structural features contain the relative relationship between them, they are endowed with structural knowledge, which will play a supervisory role in the subsequent fusion.

[0045] 4. For the text semantic negative samples obtained in step 2 and the original text data and image data, use the text encoder and the visual encoder to extract features respectively; perform weighted addition of the text features (including positive and negative sample features) and the corresponding structural knowledge features obtained in step 3 to obtain the final text features; perform comparative learning on the visual features and text features; obtain the feature matching degree between the paired image-text positive sample pairs and the feature matching degree between the negative sample pairs, and then horizontally splice the feature matching degrees as the input matrix of the loss function, and use the cross entropy loss function to train the visual encoder and the text encoder.

[0046] Specifically, the text positive and negative samples obtained by the scene graph parsing tool and the structural knowledge features obtained by the ternary encoder are used to extract the features T′ of the text positive and negative samples. text , after the extracted features and structural knowledge features are weighted and added T text =T′ text +λe ke , and obtain the final text features, where λ is the weighted coefficient. The image data of the element is passed through the visual encoder to extract the corresponding visual features I. The dimensions of the text features and visual features are c. In a batch, there are n sample pairs, and the corresponding visual feature matrix dimension is (n, c), and the feature dimension of the text positive sample is (n, c). There are k negative text samples, so the text negative sample feature matrix is ​​(k, c). If Figure 2 As shown, matrix multiplication is then used to calculate the similarity matching between the visual features and the text positive samples and the similarity matching between the visual features and the text negative samples. The output matrix dimensions are (n, n) and (n, k) respectively. Since the visual features are matched with the text positive samples and not matched with the negative samples, the diagonal of the output matrix (n, n) of the positive feature matching matrix are all positive samples, and the values ​​on the diagonal are taken to form the positive sample matching matrix (n, 1). The negative sample matching matrix (n, k) is all negative samples. The positive and negative sample matching matrices are concatenated to construct the matching matrix (n, k+1). At the same time, a label matrix (n, k+1) is constructed, in which the first column is all 1 for the code positive sample, and the values ​​of the other columns are all 0 representing the negative sample. The label matrix and the matching matrix are then input into the cross entropy loss function CrossEntropyLoss=-(ylogy - +(1-y)log(1-y - )), where y represents the positive sample label in the label matrix, y - Represents the values ​​in the feature matrix. Computes the loss and optimizes the feature encoder.

[0047] 5. Horizontally splice the visual features and text features obtained in step 4 and send them to a multi-layer modal information fusion module; take the output text features of the last layer of the modal information fusion module and the visual features of the visual encoder and apply comparative learning information for classification, and use a binary classification text image matching model to predict whether the image and the corresponding text are replaced; at the same time, use a text mask model to predict the masked text data based on the surrounding unmasked features using an autoregressive probability function; and jointly optimize the visual encoder, text encoder and modal information fusion module together with the above step 4.

[0048] Specifically, the visual features I and text positive and negative sample features T obtained in step 4 are text The concatenation is performed to form a feature matrix with a dimension of (n+n+k,c), which is then input into the modal information fusion module. In the concatenated feature matrix, since negative samples are features containing structured knowledge, they can mine the structured information in the image and text when performing the following binary classification feature classification. The modal information fusion module is a multi-layer encoder based on Transformer. When encoding the concatenated features, the text mask model uses a mask to randomly mask 15% of the data in the text features; or replaces the text or image features in the matching image-text pair with other text or image features with a probability of 50%. Then, a binary-based text-image matching model is used to predict whether the image-text pair is matched, thereby calculating the loss of the modal information fusion module, taking the text / attribute features around the masked features and all visual features as input, and using the text mask model to predict the masked text features based on the autoregressive probability function. The visual encoder, text encoder, and modal information fusion module are trained together with the cross entropy in step 4.

[0049] 6. After training the visual encoder, text encoder and modal information fusion module, add an autoregressive decoder head on this basis, input the corresponding text prompts and answers, and train the autoregressive decoder to answer questions.

[0050] Specifically, for the trained visual encoder, text encoder and modal information fusion module, the corresponding image is input to obtain the output of the model information fusion module, and then the output is sent to the autoregressive encoder. The autoregressive encoder receives the text data of the question corresponding to the image, and then the autoregressive encoder uses the output of the modal information fusion module to optimize the maximum likelihood estimate of the autoregressive decoder, and trains the autoregressive decoder parameters to calculate the corresponding answer to the question text.

[0051] 7. Through the trained visual encoder, text encoder, modal information fusion module and autoregressive decoder, use the visual encoder to extract the features of the original image to be retrieved, and input the corresponding text prompts to extract the text features, and input the original image features and text features into the autoregressive decoder together, and finally use the autoregressive decoder to answer questions about the content of the image.

[0052] For example, for a question or an image to be understood, the image is input into a visual encoder to extract features and finally obtain the output of the modal information fusion module. Correspondingly, the text data of the question and the output of the modal information fusion module are sent to the autoregressive decoder together, and the answer to the question is calculated based on the text feature data of the question using the output of the modal information fusion.

[0053] Corresponding to the aforementioned method embodiment of enhancing multimodal feature fusion based on contrastive learning and structured information, the present invention also provides an embodiment of a device for enhancing multimodal feature fusion based on contrastive learning and structured information.

[0054] See also Figure 4 The device for enhancing multimodal feature fusion based on contrastive learning and structured information provided in an embodiment of the present invention includes one or more processors and a GPU processor, which are used to implement the method for enhancing multimodal feature fusion based on contrastive learning and structured information in the above embodiment.

[0055] The embodiments of the device for enhancing multimodal feature fusion based on contrastive learning and structured information of the present invention can be applied to any device with data processing capability, which can be a device or apparatus such as a computer. The device embodiment can be implemented through software, or through hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of any device with data processing capability in which it is located reading the corresponding computer program instructions in the non-volatile memory into the internal memory for execution. From the hardware level, if Figure 5 As shown in FIG. 1 , a hardware structure diagram of any device with data processing capability is provided for the device for enhancing multimodal feature fusion based on contrastive learning and structured information of the present invention, except Figure 4 In addition to the central processing unit, memory, network interface, non-volatile memory, GPU processor, and I / O device shown, any device with data processing capabilities in which the apparatus in the embodiment is located may also include other hardware, which will not be described in detail.

[0056] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0057] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.

[0058] Corresponding to the aforementioned method embodiment of enhancing multimodal feature fusion based on contrastive learning and structured information, the embodiment of the present application further provides an electronic device, including: one or more processors; a memory for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the aforementioned method of enhancing multimodal feature fusion based on contrastive learning and structured information. Figure 5 As shown, it is a hardware structure diagram of any device with data processing capability in which the method for multimodal feature fusion based on contrastive learning and structured information enhancement provided in the embodiment of the present application is located, except Figure 5 In addition to the central processing unit, memory, GPU processor, storage, I / O device, DMA controller, disk, and non-volatile memory shown, any device with data processing capability in which the apparatus in the embodiment is located may also include other hardware, which will not be described in detail.

[0059] Corresponding to the aforementioned embodiment of the method for enhancing multimodal feature fusion based on contrastive learning and structured information, an embodiment of the present invention also provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the method for enhancing multimodal feature fusion based on contrastive learning and structured information in the above embodiment is implemented.

[0060] The computer-readable storage medium may be an internal storage unit of any device with data processing capability described in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium may also be any device with data processing capability, such as a plug-in hard disk, a smart media card (SMC), an SD card, a flash card, etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of any device with data processing capability and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capability, and may also be used to temporarily store data that has been output or is to be output.

[0061] The above contents are only preferred embodiments of the present invention and should not be construed as limiting the scope of the present invention. For those skilled in the art, various changes, combinations, simplifications, modifications, substitutions and readjustments should all be equivalent replacement methods and will not depart from the protection scope of the present invention. Therefore, although the present invention has been described in more detail through the above implementation examples, the present invention is not limited to the above implementation examples, but also includes more other equivalent implementation examples within the protection scope of the present invention.

Claims

1. A method for enhancing multimodal feature fusion based on contrastive learning and structured information, characterized in that: The following steps are involved: (1) obtaining an original image-text pair, and processing text data in the original image-text pair to obtain text structured information of objects of the text data, relationships between objects, and attributes of the objects themselves; wherein the objects include subjects and objects in the text, and related attributes representing the subjects and objects themselves; and the related attributes are text components that modify the subjects and objects; (2) exchanging the text structured information of the objects, the relationships between the objects, and the attributes of the objects themselves obtained in step (1) to generate text semantic negative samples; (3) performing word segmentation processing on the subject, object, and related attributes representing the subject and object themselves obtained from the original image-text pair in step (1) to obtain word embedding vectors of the subject, object, and related attributes representing the subject and object themselves; encoding the obtained word embedding vectors to obtain structural knowledge features; (4) extracting features of the original image-text pair and the text semantic negative sample obtained in step (2) to obtain visual features and text features; wherein the text features and the structural knowledge features obtained in step (3) are weightedly added, and compared with the visual features to obtain the positive and negative sample feature matching degree; constructing labels and taking the positive and negative sample feature matching degrees as input, and using the cross entropy loss function to train the visual encoder and the text encoder; (5) horizontally splicing the visual features and text features obtained in step (4) as input of a multi-layer modal information fusion module; jointly optimizing the modal information fusion module with the visual encoder and text encoder trained in step (4); (6) adding an autoregressive decoder based on the modal information fusion module, visual encoder and text encoder jointly optimized in step (5), and inputting corresponding text prompts and answers to train the autoregressive decoder; (7) Through the trained visual encoder, text encoder, modal information fusion module and autoregressive decoder, the features of the original image to be retrieved are extracted, and the image and question are input into the visual encoder and autoregressive decoder respectively, and the answer to the final question is generated through the decoder.

2. The method for enhancing multimodal feature fusion based on contrastive learning and structured information according to claim 1, characterized in that: In the step (1), the text structured information of the objects of the text data, the relationships between the objects and the properties of the objects themselves is obtained by parsing the text data with a scene graph parser.

3. The method for enhancing multimodal feature fusion based on contrastive learning and structured information according to claim 1, characterized in that: In the step (2), the text semantic negative sample is obtained by an attribute exchange function; the specific method is as follows: the subject and object relationship, and the subject attribute and the object attribute obtained by the original image-text pair are exchanged using the attribute exchange function to form a text semantic negative sample.

4. The method for enhancing multimodal feature fusion based on contrastive learning and structured information according to claim 1, characterized in that: The step (3) specifically comprises: using the word segmentation algorithm of the BERT model to perform word segmentation processing on the subject, object and related attributes representing the subject and object obtained in the step (2) to obtain corresponding word embedding vectors; using the ternary encoder function to perform linear transformation on the word embedding vectors to obtain structured knowledge features; The structured knowledge features are sent to the multi-layer Transformer encoder for encoding to obtain the final structured knowledge features.

5. The method for enhancing multimodal feature fusion based on contrastive learning and structured information according to claim 1, characterized in that: The step (4) is specifically as follows: using a visual encoder to extract original image features, a text encoder to extract original text features and correspondingly constructed text negative sample features; performing weighted addition of the text features and text negative sample features with the structural knowledge features obtained in the step (3); applying contrastive learning to the text features and visual features to calculate n image feature matrices (n, c) and corresponding n text positive sample feature matrices (n, c), where n is the number of samples and c is the feature dimension; transposing and multiplying the image feature matrix and the text positive sample feature matrix to obtain a positive feature matching matrix between image and text positive sample pairs; the dimension of the positive feature matching matrix is ​​(n, n), where the diagonal of the positive feature matching matrix is ​​the required image and corresponding positive text feature matching; the required A positive sample matching matrix, the output dimension of which is (n, 1); calculating n picture feature matrices (n, c) and corresponding k text negative sample feature matrices (k, c), wherein n and k are the number of samples and c is the feature dimension; transposing and multiplying the picture feature matrix and the text negative sample feature matrix to obtain a negative sample matching matrix between picture and text negative sample pairs, the output dimension of which is (n, k); concatenating the positive sample matching matrix (n, 1) and the negative sample matching matrix (n, k) to form a matching matrix, the output dimension of which is (n, k+1); constructing a label matrix with a dimension of (n, k+1) in which the first column is all 1 and the following k columns are all 0; using the matching matrix and the label matrix as input matrices, and using the cross entropy loss function to train the visual encoder and the text encoder.

6. The method for enhancing multimodal feature fusion based on contrastive learning and structured information according to claim 1, characterized in that: The step (5) is specifically as follows: concatenating the visual features and the text features; inputting the concatenated features into a Transformer-based modal information fusion module for modal information fusion; when encoding the concatenated features, randomly masking 15% of the data in the text features by means of a mask; or replacing the text or image features in the matching image-text pair with other text or image features with a probability of 50%; using the text features around the masked features and all the visual features as input, and using a text mask model to predict the masked text features; extracting the output text features of the last layer of the modal information fusion module and the corresponding output visual features of the visual encoder, applying comparative learning information and classifying, using the corresponding matching features classified as 1 and the unmatched features classified as 0 to calculate the loss of the modal information fusion module; and training the visual encoder, the text encoder and the modal information fusion module.

7. The method for enhancing multimodal feature fusion based on contrastive learning and structured information according to claim 1, characterized in that: The step (6) is specifically as follows: based on the trained visual encoder, text encoder and modal information fusion module, an autoregressive encoder is added after the modal information fusion module, pictures, text questions and corresponding answer data are input, and the autoregressive loss function is used to train the autoregressive encoder to fit the answer.

8. A device for enhancing multimodal feature fusion based on contrastive learning and structured information, characterized in that: The method comprises one or more processors and a GPU processor, and is used to implement the method for enhancing multimodal feature fusion based on contrastive learning and structured information as described in any one of claims 1 to 7.

9. An electronic device comprising a memory and a processor, characterized in that: It includes a memory, a central processing unit and a GPU processor, wherein the memory is coupled to the central processing unit and the GPU processor; wherein the memory is used to store program data, and the central processing unit and the GPU processor are used to execute the program data to implement the method for enhancing multimodal feature fusion based on contrastive learning and structured information as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for enhancing multimodal feature fusion based on contrastive learning and structured information as described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Task prediction method and device based on video multi-modal information

    CN116975615A

  • Visual language cross-modal learning method for structural health diagnosis large model

    CN117253112A

Cited By

  • Multi-modal sample sharing processing method and system

    CN120012020A