Visual question and answer method based on image and text discretization representation and dictionary alignment

The discrete representation of images and text is performed through the dual-stream encoder and dictionary bottleneck module, and the dictionary space is aligned by comparing the learning loss value, the problem of low fusion efficiency of multimodal feature in the visual question-and-answer model is solved, and the understanding of complex problems is improved Ability and reasoning ability.

CN118885583APending Publication Date: 2024-11-01NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410885414.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

The existing visual question-and-answer model has too low efficiency in multimodal feature fusion, making it difficult to accurately understand complex problems, and lacks multi-level semantic analysis and accurate matching of images and problems.

Method used

The discrete representation of images and text is performed using dual-stream encoder and dictionary bottleneck module. The importance distribution of features is obtained through maximum pooling and normalization, and the image and text dictionary space are aligned by comparing learning loss values, and the momentum comparison learning is improved. Feature matching efficiency.

Benefits of technology

It realizes high-precision and high-efficiency distribution of graphic and text feature importance distribution, and improves the inference ability of the visual question-and-answer model and the ability to understand complex problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885583A_ABST
    Figure CN118885583A_ABST
Patent Text Reader

Abstract

A visual question and answer method based on image and text discretization representation and dictionary alignment comprises the steps that firstly, in the pre-training stage, a double-flow encoder is used for conducting feature extraction on input images and texts, and then a marker-level language modeling pair is created in a vocabulary space; thirdly, dictionary importance distribution is deduced through maximum pooling operation and normalization operation, then a continuous bag-of-words dense bottleneck is generated, and a mask text is reconstructed from the continuous bag-of-words dense bottleneck by using a weakened mask text encoder; and secondly, aligning the importance scores of the image and the text in a sparse vocabulary space of a large-scale negative sample size, thereby improving the performance of image-text feature matching. According to the method, an image-text alignment task can be efficiently realized, a semantic gap between different modes is reduced, and the precision and efficiency of multi-mode feature fusion are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of artificial intelligence visual question answering models, and in particular to a visual question answering method based on image and text discretization representation and dictionary alignment. Background Art

[0002] In recent years, with the rapid development of artificial intelligence technology, question answering system, as an important branch of artificial intelligence, has received extensive attention and research from many researchers at home and abroad. Visual Question Answering (VQA) task is a learning task that combines computer vision and natural language processing. It was not until 2015 that the concept of visual question answering was formally proposed by Antol et al. A visual question answering system is a system in which a user provides an open, free-style picture to the question answering system and inputs a natural language question related to the picture, and the question answering system generates a corresponding natural language answer. Visual question answering system can be widely used in online customer service, intelligent assistants, online education and other fields. Existing visual question answering models can be summarized as a framework. The framework consists of 4 parts: image characterization module, question characterization module, feature fusion module, and answer generation module. The image characterization module mainly uses VGGNet, ResNet and GoogLeNet. With the continuous development of object detection, the use of FasterR-CNN to extract image features has become the mainstream. The question characterization module mainly uses language encoding models such as LSTM, GRU, Transformer and BERT. The function of the feature fusion module is to map image features and text features to the same feature space for interactive fusion. This module is the core part of the visual question answering model. The answer module can adopt a classification method or a generation method. For multiple-choice tasks, the fused features are sent to the classifier to obtain the probability score of each candidate answer, and the candidate answer with the highest score is selected as the correct answer; for open-ended tasks, the fused features are sent to the RNN or LSTM based on the deep model to generate the answer. The characteristics of existing visual question answering models can be divided into six categories: joint embedding-based methods, attention mechanism-based methods, scene reasoning-based methods, external knowledge-based methods, contrastive learning-based methods, and three-dimensional point cloud-based methods. Joint embedding-based methods usually simply splice image features and text features, fail to achieve the correspondence between image areas and question keywords, and fail to make correct inferences. Although the attention mechanism-based method enhances the model's ability to understand images and semantics, it mainly focuses on image areas and text keywords, fails to perceive the relationship between objects in the image, and has limited help for reasoning problems. It is necessary to further explore how to fuse the reasoning chain and accurately locate the relevant image areas. Scene reasoning-based methods use semantic clues of questions to guide visual content reasoning. Although they perform well in relational reasoning problems, they are not effective in counting, cause, time, etc., and the reasoning process is not transparent enough. External knowledge-based methods use external knowledge bases as supporting evidence to answer complex questions, but they face the challenges of large information interference and difficulty in accurately extracting relevant knowledge.The contrastive learning-based method achieves alignment by maximizing the mutual information between the image and the matching text, but it has limitations in visual question answering. It emphasizes global mutual information while ignoring local and structural information, and may be disturbed by noise, resulting in learning irrelevant features. The 3D point cloud-based method extends visual question answering to the 3D field, requiring language processing and understanding of 3D scenes, but it still has shortcomings in 3D perception and object attribute acquisition. The above are all types of existing visual question answering models, but the reasoning of visual question answering models is still unsatisfactory. Although the attention mechanism has the effect of aligning the key areas of the image and the text keywords, this is only a shallow interaction. The model does not understand the connection between the text semantics and the image content, and lacks interpretability in reasoning. The scene graph-based visual question answering attempts to reason during the question answering process. However, it only relies on the question for chain reasoning, and the reasoning process is relatively simple. It will be helpless when encountering logically complex problems. In summary, in real application scenarios, the visual question answering system often finds it difficult to accurately understand complex problems, lacking multi-level semantic analysis and accurate matching of images and questions. Summary of the invention

[0003] The purpose of the present invention is to provide a visual question answering method based on discretized representation of images and texts and dictionary alignment, to solve the problem of low efficiency of multimodal feature fusion in the prior art, to design an enhanced feature fusion module, and to narrow the semantic gap between different modalities.

[0004] A visual question answering method based on image and text discretization representation and dictionary alignment includes the following steps:

[0005] Step 1: Use the Transformer form through the dual-stream encoder to discretize the image and text information input into a weighted sparse representation of the image and text dictionary;

[0006] Step 2: Use the content in step 1 to obtain the token of the input question text and the token of the input image through the dictionary bottleneck module;

[0007] Step 3: Use the discretized tokens of the image and text in step 2 to obtain the token distribution of various features in the image and text in the prediction dictionary, and obtain the importance distribution of each feature in the image and text through maximum pooling and normalization;

[0008] Step 4: Align the image and text dictionary space. Use the discretized token representation of the image and text as input, align the image and text dictionary space, and calculate the loss value of contrastive learning.

[0009] The beneficial effects achieved by the present invention are:

[0010] (1) This visual question answering method based on discretized representation of images and texts and dictionary alignment connects a dictionary bottleneck module after the dual-stream encoder, constructs a bag-of-words bottleneck to learn the dictionary importance distribution, discretizes images and texts into tokens and the weight of each token, and can obtain the importance distribution of image and text features with high precision and efficiency.

[0011] (2) This visual question answering method based on the discretized representation of images and texts and the alignment of dictionaries obtains the importance distribution of the discretized tokens of images and texts, uses two queues to cache the discretized samples of images and texts respectively, and uses momentum to slowly update the contents of the two encoders to align the image-text dictionary, thereby improving the matching efficiency of image-text features. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 4 is a flowchart of a visual question answering method based on image and text discretization representation and dictionary alignment in an embodiment of the present invention.

[0013] Figure 2 4 is a flowchart of a dictionary bottleneck module in an embodiment of the present invention.

[0014] Figure 3 It is a schematic diagram of the momentum comparison process of the image-text alignment module in an embodiment of the present invention. DETAILED DESCRIPTION

[0015] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings.

[0016] A visual question answering method based on image and text discretization representation and dictionary alignment, characterized by comprising the following steps:

[0017] In step 1, a dual-stream encoder is used in the form of Transformer to discretize the input image and text information into tokens.

[0018] Step 1.1: Convert the input image into a series of flattened 2D patches, which are then processed by the image encoder in the two-stream encoder to generate the corresponding hidden states. Given an image, all patches are set to x = [x1,…,x m ], the visual encoder converts them into fixed-length vectors:

[0019]

[0020] Trans v is the visual encoder, CLS v represents the global representation of the output vector for the entire input sequence, d is the model size, and H v as a dense representation of an image.

[0021] Step 1.2: Connect a language model head after the visual encoder to project the hidden state into a sparse vocabulary space:

[0022]

[0023] LM-Head v is the language model head of the image, and |V| is the vocabulary size. The logistic regression language model represents the image from the visual encoder. The SPLADE model is then followed to represent the image in a high-dimensional vocabulary space:

[0024]

[0025] where max(·,0) ensures that all values ​​required by sparsity are greater than or equal to 0, MaxPool(·) represents the maximum pooling along the sequence axis, and the saturation function log(1+MaxPool(·)) prevents some items from dominating. v Vocabulary-weighted sparse representation of images.

[0026] Step 1.3: The language encoder generates the input question text y = [y1,…,y n The dictionary weighted sparse representation of ] is:

[0027]

[0028] Among them, H l Represents the dictionary-weighted sparse representation of the generated input text, Trans l is a language encoder, is a textual logistic regression language model from a language encoder, LM-Head l is the language model head of the text, p l is a dictionary-weighted sparse representation of text.

[0029] In step 2, the dictionary bottleneck module is used to obtain the token of the input question text and the token of the input image using the content in step 1.

[0030] Step 2.1: Pre-train the language encoder Trans using masked language modeling l , the input text y is marked to obtain α% of the symbols are replaced by special tokens or random symbols from the input text vocabulary, and the rest remain unchanged.

[0031] Step 2.2: Mask Symbols is processed by the language encoder to generate a logistic regression language model of the language model, And reconstruct the mask token through the following objective function:

[0032]

[0033] Where P(w j )for Calculate, D is the set of all samples, M (enc) for The set of mask indices in , w j is the discrete variable on V at the jth position in y, y j The original token.

[0034] In step 3, the discretized tokens of the image and text in step 2 are used to obtain the token distribution of each feature in the image text in the prediction dictionary, and the importance distribution of each feature in the image and text is obtained through maximum pooling and normalization.

[0035] Step 3.1: In dictionary bottleneck masked language modeling, the graph-text dictionary importance distribution is obtained by normalization to indicate the relative importance of different dictionaries in the vocabulary.

[0036]

[0037] Normalize(·)=softmax(·) represents the normalization function, let ∑a i =1. (·) Represents the dictionary importance distribution on image v or text l, that is, the normalized result of the image and text.

[0038] In step 3.1, the important distribution of the image-text dictionary is used as a bridge to guide the reconstruction of the mask dictionary, guiding the image and text encoder to focus on the key tags or words in the dictionary space. However, directly using the high-dimensional distribution vector a (·) ∈[0,1] as a bottleneck is a more difficult task, which reduces the effectiveness of bottleneck processing. Secondly, high-dimensional vectors are difficult to input into the decoder for representation learning and text reconstruction tasks. Therefore, by obtaining the importance distribution of the dictionary space, a continuous bag of words representation is generated as a bottleneck.

[0039]

[0040] Where W (te) ∈R V×d is the token embedding matrix of the text encoder, sg(·) refers to the stop gradient, b (·) represents a continuous bag-of-words bottleneck representation.

[0041] In order to know the bottleneck feature b (·) The learning of dictionary space importance distribution a (·)learning, using a visual encoder and a text encoder, from b (·) Reconstruct Mask Text These two decoders are called weak masked decoders and are designed to rely heavily on the bottleneck representation by adopting two strategies. Adopt an aggressive masking strategy to produce masked text with a larger masking rate Encourage the encoder to compress the information in the question text into the bottleneck representation b (·) .

[0042] In step 4, the image and text dictionary spaces are aligned, the discretized token representation of the image and text is used as input, and the loss value of contrastive learning is calculated.

[0043] Step 4.1: Use the momentum contrastive learning method in MoCo to cache images and texts separately with two different queues Q v and Q l Negative samples.

[0044] Step 4.2: Using Two Momentum Encoders and To update the samples in the queue, it shares the same structure and initial parameters as the original encoder, using truncated gradients and applying an exponential moving average mechanism for update:

[0045]

[0046] where θ o is the parameter of the original encoder, and m is the EMA decay weight. The momentum dictionary sparse representation of images and text is and

[0047] Step 4.3: Calculate the momentum contrast loss function as:

[0048]

[0049] Where T represents vector transposition, i2t represents image-to-text generation, and t2i represents text-to-image generation. Negative samples representing text or images represent queues, τ is a temperature hyperparameter, λ is a regularization hyperparameter, and F(·) represents the FLOPS function introduced by sparsity. The overall momentum contrast loss is:

[0050]

[0051] This visual question answering method based on the discretized representation of images and texts and dictionary alignment connects the dictionary bottleneck module after the dual-stream encoder, builds a bag-of-words bottleneck to learn the dictionary importance distribution, discretizes images and texts into tokens and the weight of each token, and can obtain the importance distribution of image and text features with high precision and efficiency.

[0052] This visual question answering method based on discretized representation of images and texts and dictionary alignment obtains the importance distribution of discretized tokens of images and texts, uses two queues to cache discretized samples of images and texts respectively, and uses momentum to slowly update the contents of the two encoders to align the image-text dictionary and improve the matching efficiency of image-text features.

[0053] The above description is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiment. Any equivalent modifications or changes made by ordinary technicians in this field based on the contents disclosed by the present invention should be included in the protection scope recorded in the claims.

Claims

1. A visual question answering method based on image and text discretization representation and dictionary alignment, characterized by: The following steps are involved: Step 1: Use the Transformer form through the dual-stream encoder to discretize the image and text information input into a weighted sparse representation of the image and text dictionary; Step 2: Use the content in step 1 to obtain the token of the input question text and the token of the input image through the dictionary bottleneck module; Step 3: Use the discretized tokens of the image and text in step 2 to obtain the token distribution of each feature in the image and text in the prediction dictionary, and obtain the importance distribution of each feature in the image and text through maximum pooling and normalization; Step 4: Align the image and text dictionary space. Use the discretized token representation of the image and text as input, align the image and text dictionary space, and calculate the loss value of contrastive learning.

2. The visual question answering method based on image and text discretization representation and dictionary alignment according to claim 1, characterized in that: In step 1, the dual-stream encoder uses the Transformer form to discretize the image and text information input into tokens, specifically: Step 1.1: Convert the input image into a series of flattened 2D patches, which are then processed by the image encoder in the two-stream encoder to generate the corresponding hidden states. Given an image, all patches are set to x = [x1, ..., x m ], the visual encoder converts them into fixed-length vectors: Trans v is the visual encoder, CLS v represents the global representation of the output vector for the entire input sequence, d is the model size, and H v as a dense representation of an image; Step 1.2: Connect a language model head LM-Head after the visual encoder to project the hidden state into the sparse vocabulary space: LM-Head v is the language model head of the image, V| is the vocabulary; Represent the logistic regression language model of the image from the visual encoder; then follow the SPLADE model to represent the image in a high-dimensional vocabulary space: where max(·,0) ensures that all values ​​of the sparsity requirement are greater than or equal to 0, MaxPool(·) represents the maximum pooling along the sequence axis, and the saturation function log(1+MaxPool(·)) prevents some items from dominating. v Representing vocabulary-weighted sparse representations of images; Step 1.3: The language encoder generates the input question text y = [y1,…,y n The dictionary weighted sparse representation of ] is: Among them, H l Represents the dictionary-weighted sparse representation of the generated input text, Trans l is a language encoder, is a textual logistic regression language model from a language encoder, LM-Head l is the language model head of the text, p l is a dictionary-weighted sparse representation of text.

3. The visual question answering method based on image and text discretization representation and dictionary alignment according to claim 1, characterized in that: In step 2, the dictionary bottleneck module is used to obtain the token of the input question text and the token of the input image using the content in step 1, specifically: Step 2.1: Pre-train the language encoder Trans using masked language modeling l , the input text y is marked to obtain Among them, tokens with a random probability of α% are replaced by special tokens or random tokens in the input text vocabulary, and the rest remain unchanged; Step 2.2: Mask Symbols is processed by the language encoder to generate a logistic regression language model of the language model, And reconstruct the mask token through the following objective function: Where P(w j )for Calculate, D is the set of all samples, M (enc) for The set of mask indices in , w j is the discrete variable on V at the jth position in y, y j The original token.

4. The visual question answering method based on image and text discretization representation and dictionary alignment according to claim 1, characterized in that: In step 3, the discretized tokens of the image and text in step 2 are used to obtain the token distribution of each feature in the image and text in the prediction dictionary, and the importance distribution of each feature in the image and text is obtained through maximum pooling and normalization, specifically: Step 3.1: In dictionary bottleneck masked language modeling, obtain the image-text dictionary importance distribution by normalization to indicate the relative importance of different dictionaries in the vocabulary; Normalize(·)=softmax(·) represents the normalization function, let Σa i =1; a (·) Represents the dictionary importance distribution on image v or text l, that is, the normalized result of the image and text.

5. The visual question answering method based on image and text discretization representation and dictionary alignment according to claim 1, characterized in that: In step 4, the image and text dictionary spaces are aligned, and the discretized token representation of the image and text is used as input to calculate the loss value of contrastive learning, specifically: Step 4.1: Use the momentum contrastive learning method in MoCo to cache images and texts separately with two different queues Q v and Q l Negative samples; Step 4.2: Using Two Momentum Encoders and To update the samples in the queue, we share the same structure and initial parameters as the original encoder, using truncated gradients and applying an exponential moving average mechanism (EMA) for update: where θ o is the parameter of the original encoder, m is the EMA attenuation weight; the momentum dictionary sparse representation of image and text is and Step 4.3: Calculate the momentum contrast loss function as: Where T represents vector transposition, i2t represents image-to-text generation, and t2i represents text-to-image generation. Negative samples representing text or images represent queues, τ is a temperature hyperparameter, λ is a regularization hyperparameter, and F(·) represents the FLOPS function introduced by sparsity; the overall momentum contrast loss is:

Citation Information

Cited By

  • Image-text data multi-modal training method based on image-text semantic relation alignment

    CN119416064A

  • Few-sample fine tuning method and device for pre-trained visual language model and readable medium

    CN119445288A

  • Control method and system of intelligent electric lifting device

    CN120560126A