Visual question and answer method based on multi-modal large model and related device
Through the visual question and answer method of multi-modal large models, through visual feature encoding, image feature extraction and residual vector quantization, image semantic information is extracted and combined with multi-modal knowledge base for question and answer prediction, which solves the problem that existing visual question and answer models ignore semantic information. questions, improving the accuracy of question answering and knowledge reasoning.
Patent Information
- Application Number
- CN202411077121.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-08-07
AI Technical Summary
Existing visual question and answer models based on scene interaction tasks tend to ignore the semantic information in images, resulting in low question and answer accuracy and knowledge reasoning accuracy, and cannot meet users' high-precision question and answer needs and answer interpretability needs.
Using a visual question and answer method based on a multi-modal large model, through visual feature encoding processing, image feature extraction and compression processing, combined with the residual vector quantization method, the semantic information in the image is extracted, and the multi-modal knowledge base is used for question and answer prediction. Improve question answering accuracy and knowledge reasoning accuracy.
By extracting rich semantic information and performing feature replacement processing, the question answering accuracy and knowledge reasoning accuracy of visual question and answer are improved, making the semantic information of the reconstructed image the same as the semantic features in the multi-modal knowledge base, satisfying the user's high accuracy Q&A requirements.
Smart Images

Figure CN118607644A
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a visual question answering method and related devices based on a multimodal large model. Background Art
[0002] Visual question answering is a learning task involving computer vision and natural language processing. It refers to giving corresponding answers after deep understanding and reasoning of the content of videos and images and questions raised by users. Among them, visual question answering based on scene interaction tasks can understand the behavior of humans interacting with scenes and is widely used.
[0003] Visual question answering in scene-based interaction tasks requires that the visual question model that performs the corresponding visual question answering task has strong combinatorial understanding capabilities and can reason between knowledge graphs, questions, and images. However, the visual question answering models in related technologies tend to ignore the semantic information in the image, resulting in relatively low question answering accuracy and knowledge reasoning accuracy, which cannot meet users' needs for high-precision question answering and explainable answers. Summary of the invention
[0004] The purpose of this application is to provide a visual question answering method and related devices based on a multimodal large model, which can extract semantic information in images and improve the question answering accuracy and knowledge reasoning accuracy of visual question answering.
[0005] The present application embodiment provides a visual question answering method based on a multimodal large model, including: Acquire an original image and question information for the original image; Performing visual feature encoding processing on the original image to obtain a first feature vector sequence; Performing image feature extraction processing on the first feature vector sequence and image feature compression processing based on the image feature extraction result to obtain a second feature vector sequence; Using a residual vector quantization method, using a semantic feature vector set to perform feature replacement processing on the second feature vector sequence to obtain a third feature vector sequence; Performing feature decoding processing on the third feature vector sequence to obtain a reconstructed image; In combination with the knowledge content information in the multimodal knowledge base, question-answer prediction processing is performed on the reconstructed image and the question information to obtain an answer result corresponding to the question information.
[0006] In some embodiments, performing visual feature encoding processing on the original image to obtain a first feature vector sequence includes: Performing image block processing on the original image to obtain multiple image blocks; Performing linear embedding processing and position embedding processing on each of the image blocks to obtain an image block feature vector sequence; the image block feature vector sequence includes a plurality of image block feature vectors, and the image block feature vectors are respectively embedded with relative position information between the image blocks; Based on the self-attention mechanism, feature information of the plurality of image block feature vectors in the image block feature vector sequence is propagated to obtain the first feature vector sequence.
[0007] In some embodiments, performing image feature extraction processing on the first feature vector sequence and image feature compression processing based on the image feature extraction result to obtain the second feature vector sequence includes: According to the feature information amount contained in the image block feature vector in the first feature vector sequence, the image block feature vector is subjected to binary classification processing to obtain a binary distribution of the image block feature vector; Reparameterizing the binary distribution to obtain a binary decision mask; performing feature vector selection on the first feature vector sequence according to the binary decision mask to determine a selected image block feature vector and an unselected image block feature vector; According to the semantic similarity between the selected image block feature vector and the unselected image block feature vector, the unselected image block feature vector is compressed and fused into the selected image block feature vector to obtain the second feature vector sequence.
[0008] In some embodiments, the step of compressing and fusing the unselected image block feature vector into the selected image block feature vector according to the semantic similarity between the selected image block feature vector and the unselected image block feature vector to obtain the second feature vector sequence includes: Performing self-attention calculation on the selected image block feature vectors so that a subsequent selected image block feature vector can only observe a previous selected image block feature vector; Taking the selected image block feature vector as a query and the unselected image block feature vector as a key and a value, the unselected image block feature vector is compressed and fused into the selected image block feature vector through an attention mechanism to obtain the second feature vector sequence.
[0009] In some embodiments, the method of using a residual vector quantization method to perform feature replacement processing on the second feature vector sequence using a semantic feature vector set to obtain a third feature vector sequence includes: An iterative residual vector quantization operation is performed on the second feature vector sequence to obtain a residual vector quantization result and a feature vector search result corresponding to each residual vector quantization operation; the residual vector quantization operation is an operation of searching for a feature vector with the highest similarity to the latest vector to be quantized in the semantic feature vector set corresponding to the iteration; the residual vector quantization result is a deviation between the latest vector to be quantized and the feature vector with the highest similarity to the latest vector to be quantized; the latest vector to be quantized is the residual vector quantization result corresponding to the second feature vector sequence or the last residual vector quantization operation; the feature vector search result is a feature vector searched by the residual vector quantization operation; The third feature vector sequence is constructed using the feature vector search results.
[0010] In some embodiments, the combining of the knowledge content information in the multimodal knowledge base to perform question-answer prediction processing on the reconstructed image and the question information to obtain an answer result corresponding to the question information includes: The reconstructed image, the question information and the knowledge content information in the multimodal knowledge base are input into a multimodal large model to perform question and answer prediction processing to obtain an answer result corresponding to the question information; the multimodal large model is obtained by training a preset model based on a sample reconstructed image, sample question information and sample knowledge content information of the sample reconstructed image.
[0011] In some embodiments, the step of inputting the reconstructed image, the question information, and the knowledge content information in the multimodal knowledge base into a multimodal macro model, performing question-answer prediction processing, and obtaining an answer result corresponding to the question information includes: combining the reconstructed image and the question information to obtain an input combination result; Inputting the input combination result into the multimodal large model, performing correlation calculation on the input combination result and the knowledge content information in the multimodal knowledge base, and obtaining a correlation calculation result; According to the correlation calculation result, the answer result corresponding to the question information is output.
[0012] The present application also provides a visual question-answering device based on a multimodal large model, including: The first module is used to obtain an original image and question information for the original image; The second module is used to perform visual feature encoding processing on the original image to obtain a first feature vector sequence; A third module is used to perform image feature extraction processing on the first feature vector sequence and image feature compression processing based on the image feature extraction result to obtain a second feature vector sequence; A fourth module is used to adopt a residual vector quantization method and use a semantic feature vector set to perform feature replacement processing on the second feature vector sequence to obtain a third feature vector sequence; A fifth module is used to perform feature decoding processing on the third feature vector sequence to obtain a reconstructed image; The sixth module is used to combine the knowledge content information in the multimodal knowledge base, perform question-answer prediction processing on the reconstructed image and the question information, and obtain the answer result corresponding to the question information.
[0013] An embodiment of the present application also provides an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the above-mentioned visual question answering method based on the multimodal large model is implemented.
[0014] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned visual question answering method based on a multimodal large model.
[0015] The beneficial effects of the present application are as follows: by performing visual feature encoding processing on the original image, a first feature vector sequence containing the semantic information of the original image is obtained, and then the first feature vector sequence is subjected to image feature extraction processing and image feature compression processing based on the image feature extraction result to evaluate the importance of each image block, and a second feature vector sequence rich in feature information is obtained, and then a residual vector quantization method is adopted to perform feature replacement processing on the second feature vector sequence using a semantic feature vector set to obtain a third feature vector sequence that is similar to the semantic information contained in the corresponding semantic feature vector in the multimodal knowledge base, and in combination with the knowledge content information in the multimodal knowledge base, a question and answer prediction processing is performed on the reconstructed image and question information reconstructed using the third feature vector sequence to obtain an answer result corresponding to the question information. Since the original image is first subjected to visual feature encoding processing, image feature extraction processing, and feature replacement processing using a semantic feature vector set before question and answer prediction processing, rich semantic information can be extracted from the original image. After evaluating the importance of each image block, image blocks with rich feature information are selected, and feature replacement processing is performed using a preset semantic feature vector set. This makes the semantic information contained in the reconstructed image tend to be the same as the semantic information contained in the corresponding semantic feature vector in the multimodal knowledge base, thereby improving the question answering accuracy and knowledge reasoning accuracy of visual question answering. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a flowchart of the visual question answering method based on a multimodal large model provided in an embodiment of the present application.
[0017] Figure 2It is a flowchart of the specific method of step S102 provided in an embodiment of the present application.
[0018] Figure 3 It is a flowchart of the specific method of step S103 provided in an embodiment of the present application.
[0019] Figure 4 It is a flowchart of the specific method of step S104 provided in an embodiment of the present application.
[0020] Figure 5 It is a flowchart of the specific method of step S106 provided in an embodiment of the present application.
[0021] Figure 6 It is a structural diagram of a visual question-answering device based on a multimodal large model provided in an embodiment of the present application.
[0022] Figure 7 It is a hardware structure diagram of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0024] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown can be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second" and the like in the specification, claims and drawings are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0025] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0026] See also Figure 1 , Figure 1 is a flowchart of a visual question answering method based on a multimodal large model provided in an embodiment of the present application. In some embodiments of the present application, Figure 1 The method may specifically include but is not limited to steps S101 to S106. Figure 1 These six steps are introduced in detail.
[0027] Step S101, obtaining an original image and question information for the original image.
[0028] It can be understood that the question information for the original image refers to the text content that asks questions about the relevant features of the original image or the text content converted from other types of information. For example, the question information can be "What color is the flower in the original image?" or "What is the name of the animal in the original image?"
[0029] In step S101, obtaining question information for the original image may be a text content containing question information typed by a user account, obtaining the original image may be an original image uploaded by the user account, or randomly selecting an original image from a preset image library, or receiving an image selection instruction from the user account, and selecting an original image associated with the image information carried in the image selection instruction from the preset image library. The embodiments of the present application do not specifically limit the method for obtaining the original image and question information, and the types of the original image and question information.
[0030] Step S102: Perform visual feature encoding processing on the original image to obtain a first feature vector sequence.
[0031] In step S102, the original image may be divided into blocks, and a plurality of image blocks obtained by the image division are input into a pre-trained visual encoder, and the visual encoder outputs a first feature vector sequence.
[0032] Among them, as a kind of feature encoder, the visual encoder is mainly used to extract features from the data of the video frame to obtain visual features. The visual encoder can be obtained by pre-training. The visual encoder performs visual feature encoding processing on each image block respectively, obtains multiple image block feature vectors containing semantic information of the corresponding image blocks, and thus obtains a first feature vector sequence.
[0033] Step S103: performing image feature extraction processing on the first feature vector sequence and image feature compression processing based on the image feature extraction result to obtain a second feature vector sequence.
[0034] In step S103, the first feature vector sequence may be input into a pre-trained image feature selector, and the image feature selector outputs a second feature vector sequence.
[0035] The image feature selector is used to evaluate the importance of each image block. The image feature selector screens the image block feature vectors in the first feature vector sequence according to the amount of feature information contained in each image block feature vector in the first feature vector sequence, selects several image block feature vectors with the largest amount of feature information, and then performs feature compression processing on the unselected image block feature vectors and merges them into the selected image block feature vectors, thereby obtaining a second feature vector sequence.
[0036] Step S104: adopting a residual vector quantization method and using a semantic feature vector set to perform feature replacement processing on the second feature vector sequence to obtain a third feature vector sequence.
[0037] It can be understood that the semantic feature vector set is a set consisting of multiple semantic feature vectors containing corresponding semantic information, and the semantic information contained in the semantic feature vectors in the semantic feature vector set is the same as the semantic information contained in the corresponding semantic feature vectors in the multimodal knowledge base.
[0038] In step S104, the residual similarity between the semantic feature vectors in the semantic feature vector set and the image block feature vectors in the second feature vector sequence is determined by adopting a residual vector quantization method, and the corresponding semantic feature vectors are selected from the semantic feature vector set to replace the corresponding image block feature vectors in the second feature vector sequence, thereby obtaining a third feature vector sequence.
[0039] Step S105: performing feature decoding processing on the third feature vector sequence to obtain a reconstructed image.
[0040] In step S105, the replaced semantic feature vector in the third feature vector sequence is quantized to obtain a quantized embedding vector, and the quantized embedding vector is input into a pre-trained decoder to reconstruct the visual semantic features of the original image, thereby obtaining a reconstructed image. The model loss information of the decoder is determined by the cosine similarity between the quantized embedding vector and the true visual embedding vector.
[0041] Step S106, combining the knowledge content information in the multimodal knowledge base, performing question-answer prediction processing on the reconstructed image and the question information, and obtaining an answer result corresponding to the question information.
[0042] In step S106, the features corresponding to the reconstructed image, question information and knowledge content information in the multimodal knowledge base are extracted by using a search engine, and mapped to a unified multimodal semantic space, and the similarity between each knowledge content information in the multimodal knowledge base and the reconstructed image and question information is calculated, and the top K knowledge content information with the similarity ranking is selected as candidate knowledge content information (K is a positive integer greater than or equal to 2), and question-answer prediction processing is performed based on the candidate knowledge content information, thereby generating an answer result corresponding to the question information. Among them, the similarity can be represented by the maximum inner product similarity, and the knowledge content information in the multimodal knowledge base can include text information, image information and graphic information.
[0043] The visual question answering method based on a multimodal large model provided in steps S101 to S106 of the embodiment of the present application obtains a first feature vector sequence containing semantic information of the original image by performing visual feature encoding processing on the original image, and then performs image feature extraction processing and image feature compression processing based on the image feature extraction result on the first feature vector sequence to evaluate the importance of each image block to obtain a second feature vector sequence rich in feature information, and then adopts a residual vector quantization method to perform feature replacement processing on the second feature vector sequence using a semantic feature vector set to obtain a third feature vector sequence that is similar to the semantic information contained in the corresponding semantic feature vector in the multimodal knowledge base, and combines the knowledge content information in the multimodal knowledge base to perform question and answer prediction processing on the reconstructed image reconstructed using the third feature vector sequence and the question information to obtain an answer result corresponding to the question information. Since the original image is first subjected to visual feature encoding processing, image feature extraction processing, and feature replacement processing using a semantic feature vector set before question and answer prediction processing, rich semantic information can be extracted from the original image. After evaluating the importance of each image block, image blocks with rich feature information are selected, and feature replacement processing is performed using a preset semantic feature vector set. This makes the semantic information contained in the reconstructed image tend to be the same as the semantic information contained in the corresponding semantic feature vector in the multimodal knowledge base, thereby improving the question answering accuracy and knowledge reasoning accuracy of visual question answering.
[0044] In a specific embodiment, see Figure 2 Step S102 may specifically include but is not limited to steps S201 to S203. Figure 2 These three steps are introduced in detail.
[0045] Step S201, performing image block processing on the original image to obtain multiple image blocks.
[0046] In step S201, the input original image may be divided into a plurality of image blocks of a fixed size according to a given size, and each image block contains local information in the image.
[0047] Specifically, for the original image x∈R H×W×C , split the original image x into HW / P 2 non-overlapping image blocks, where H and W are the height and width respectively, C is the number of channels, and P is the height and width of the image block. For example, the size of the original image is 60×100 pixels, and the original image is divided into multiple 20×20 pixel image blocks. The height of the original image is divided into 3 rows, and the width of the original image is divided into 5 columns, so 15 image blocks can be obtained.
[0048] Step S202: perform linear embedding and position embedding processing on each image block to obtain an image block feature vector sequence, wherein the image block feature vector sequence includes multiple image block feature vectors, and the image block feature vectors are respectively embedded with relative position information between image blocks.
[0049] In step S202, each image block is first flattened into a vector of a preset length value to obtain a plurality of initial feature vectors, and then a linear embedding process is performed to map each initial feature vector to an embedding space through a linear transformation to obtain a linear embedding vector of a corresponding dimension, and then a position embedding process is performed to add a position embedding to each linear embedding vector to obtain an image block feature vector. The position embedding is a vector having the same length as the linear embedding vector and is used to represent the relative position of each linear embedding vector in the sequence. The image block feature vector sequence is constructed using the image block feature vectors obtained by the linear embedding process and the position embedding process.
[0050] For example, after the original image is divided into 15 image blocks, the image blocks are flattened into initial feature vectors with a length of 20×20=400, and the initial feature vectors are input into the embedding space to generate linear embedding vectors with a length of 768, where 768 is the dimension or length of each linear embedding vector after linear embedding. The linear embedding vectors are then positionally embedded using position embedding with a length of 768 to obtain image block feature vectors with a length of 768. Then, based on the relative position information between the image blocks indicated by the position embedding, the 15 image block feature vectors are used to construct an image block feature vector sequence.
[0051] Step S203: Based on the self-attention mechanism, multiple image block feature vectors in the image block feature vector sequence are propagated with feature information to obtain a first feature vector sequence.
[0052] In step S203, a self-attention mechanism is applied to capture the relationship between image block feature vectors in the image block feature vector sequence, allowing the image block feature vectors to exchange information so that the image block feature vectors after the information exchange contain semantic information sufficient to describe the entire original image, and these image block feature vectors are used to construct a first feature vector sequence.
[0053] Specifically, for the image block feature vector sequence, the similarity or correlation scores between the image block feature vectors are calculated. These scores are usually represented by calculating the vector dot product of the elements. Based on the calculated attention scores, the scores are converted into weights through a classification function to ensure that the sum of all weights is 1, thereby forming a weight distribution. The weights are applied to each image block feature vector of the image block feature vector sequence, and the weighted image block feature vectors are summed to obtain the first feature vector sequence.
[0054] In a specific embodiment, see Figure 3 Step S103 may specifically include but is not limited to steps S301 to S304. Figure 3 These four steps are introduced in detail.
[0055] Step S301 : performing binary classification processing on the image block feature vectors according to the feature information amount contained in the image block feature vectors in the first feature vector sequence to obtain the binary distribution of the image block feature vectors.
[0056] In step S301, the first feature vector sequence may be input into a lightweight multi-layer perceptron, and the multi-layer perceptron is used to evaluate the importance of each image block feature vector in the first feature vector sequence to obtain a binary distribution of the image block feature vector.
[0057] Step S302, reparameterizing the binary distribution to obtain a binary decision mask.
[0058] In step S302, sampling is performed in the binary distribution of the image block feature vector. In order to make the sampling process differentiable and thus enable end-to-end optimization, the binary distribution is reparameterized using the Gumbel Softmax technique to obtain a reparameterized distribution. Sampling is performed on the reparameterized distribution to obtain a binary decision mask M∈{0,1} N , indicating whether the feature vector of each image block is selected, and N is the number of image blocks.
[0059] In this embodiment, the expression for reparameterizing the binary distribution is: , in, To sample the noise of the i-th image patch in the j-th feature dimension from the Gumbel distribution, is the temperature coefficient, is the image block feature vector of the i-th image block in the j-th feature dimension in the binary distribution, is the image block feature vector of the i-th image block in the j-th feature dimension in the reparameterized distribution.
[0060] Step S303: performing feature vector selection on the first feature vector sequence according to the binary decision mask to determine the selected image block feature vectors and the unselected image block feature vectors.
[0061] In step S303, the binary decision mask M∈{0,1} obtained by sampling is N, the image block feature vectors in the first feature vector sequence are divided into two groups of vector sequences, one group is composed of selected image block feature vectors, and the other group is composed of unselected image block feature vectors.
[0062] Step S304: according to the semantic similarity between the selected image block feature vector and the unselected image block feature vector, the unselected image block feature vector is compressed and merged into the selected image block feature vector to obtain a second feature vector sequence.
[0063] In a specific embodiment, step S304 specifically includes: Perform self-attention calculation on the selected image block feature vectors, so that the feature vector of the next selected image block can only observe the feature vector of the previous selected image block; The feature vector of the selected image block is used as the query, and the feature vector of the unselected image block is used as the key and value. Through the attention mechanism, the feature vector of the unselected image block is compressed and fused into the feature vector of the selected image block to obtain a second feature vector sequence.
[0064] More specifically, self-attention calculation is performed on the selected image block feature vector, and a causal mask is introduced to ensure that each selected image block feature vector can only see the previous selected image block feature vector, so as to convert the two-dimensional unordered feature vector sequence into a one-bit ordered feature vector sequence, and then the selected image block feature vector is used as a query, and the unselected image block feature vector is used as a key and value, and the unselected image block feature vector is compressed and fused to the selected image block feature vector through the attention mechanism to obtain the fused image block feature vector, and then each fused image block feature vector is subjected to a nonlinear transformation to finally obtain a second feature vector sequence.
[0065] It can be understood that the output second feature vector sequence absorbs the visual semantic information of most unselected image block feature vectors while maintaining the same length as the first feature vector sequence, and can dynamically adjust the encoding length according to the complexity of the image, thereby minimizing information loss while improving reasoning efficiency.
[0066] In a specific embodiment, see Figure 4 Step S104 may specifically include but is not limited to steps S401 to S402. Figure 4 These two steps are introduced in detail.
[0067] Step S401 , performing an iterative residual vector quantization operation on the second feature vector sequence to obtain a residual vector quantization result and a feature vector search result corresponding to each residual vector quantization operation.
[0068] Step S402: construct a third feature vector sequence using the feature vector search results.
[0069] Among them, the residual vector quantization operation is an operation of searching for the feature vector with the highest similarity to the latest vector to be quantized in the semantic feature vector set corresponding to this iteration, the residual vector quantization result is the deviation between the latest vector to be quantized and the feature vector with the highest similarity to the latest vector to be quantized, the latest vector to be quantized is the second feature vector sequence or the residual vector quantization result corresponding to the previous residual vector quantization operation, and the feature vector search result is the feature vector obtained by the residual vector quantization operation search.
[0070] In step S401, a plurality of vector quantization variational autoencoders are used to iteratively perform residual vector quantization operations on the second feature vector sequence, and each residual vector quantization operation obtains a corresponding residual vector quantization result and a feature vector search result.
[0071] Specifically, the second feature vector sequence is input into the first vector quantization variational autoencoder, and the feature vector with the highest similarity is searched in the corresponding semantic feature vector set according to the image block feature vector in the second feature vector sequence, and the feature vector with the highest similarity is used as the feature vector search result of the first vector quantization variational autoencoder, and the deviation between the image block feature vector in the second feature vector sequence and the feature vector with the highest similarity is calculated to obtain the residual vector quantization result of the first vector quantization variational autoencoder, and starting from the second vector quantization variational autoencoder, the residual vector quantization result output by the previous vector quantization variational autoencoder is input into the current vector quantization variational autoencoder, and the feature vector with the highest similarity is searched in the corresponding semantic feature vector set according to the residual vector quantization result output by the previous vector quantization variational autoencoder, and the feature vector with the highest similarity is used as the feature vector search result of the current vector quantization variational autoencoder, and the deviation between the residual vector quantization result output by the previous vector quantization variational autoencoder and the feature vector with the highest similarity is calculated to obtain the residual vector quantization result of the current vector quantization variational autoencoder. After traversing all vector quantization variational autoencoders, the iterative residual vector quantization operation is completed, thereby obtaining the residual vector quantization result and the feature vector search result corresponding to each residual vector quantization operation.
[0072] In step S402, the feature vector search results obtained from each residual vector quantization operation are obtained, and the feature vector search results are arranged into a feature vector sequence according to the generation order of the feature vector search results, so as to construct a third feature vector sequence.
[0073] In a specific embodiment, step S106 specifically includes: inputting the reconstructed image, question information and knowledge content information in the multimodal knowledge base into the multimodal large model, performing question and answer prediction processing, and obtaining the answer result corresponding to the question information. The multimodal large model is obtained by training a preset model based on the sample reconstructed image, the sample question information and the sample knowledge content information of the sample reconstructed image.
[0074] In this embodiment, the multimodal large model is a large language model, and the reconstructed image, question information, and knowledge content information in the multimodal knowledge base are input into the multimodal large model for question-answer prediction processing, and the answer result corresponding to the question information can be obtained. Since the multimodal large model is obtained by training a preset model based on a sample reconstructed image, sample question information for the sample reconstructed image, and sample knowledge content information, and the sample reconstructed image is reconstructed by successively performing visual feature encoding processing, image feature extraction processing, image feature compression processing based on the image feature extraction result, and feature replacement processing using a residual vector quantization method on the sample image, during the training process, the sample reconstructed image and the sample question information for the sample reconstructed image can be input into the preset model to transfer the image semantic information of the sample image to the preset model, prompting the preset model to search for the information with the highest similarity to the combination result of the sample reconstructed image and the sample question information in the sample knowledge content information based on the sample reconstructed image and the sample question information, so that the trained multimodal large model can learn the association between the sample reconstructed image, the sample question information, and the sample knowledge content information, thereby improving the question answering accuracy and knowledge reasoning accuracy of visual question answering.
[0075] In a specific embodiment, see Figure 5 Step S106 may specifically include but is not limited to steps S501 to S503. Figure 5 These two steps are introduced in detail.
[0076] Step S501, combining the reconstructed image and the question information to obtain an input combination result.
[0077] Step S502: input the input combination result into the multimodal large model, perform correlation calculation on the input combination result and the knowledge content information in the multimodal knowledge base, and obtain the correlation calculation result.
[0078] Step S503: outputting the answer result corresponding to the question information according to the correlation calculation result.
[0079] In step S501 to step S503, vector embedding processing is performed on the reconstructed image and the question information, and the image embedding result and the question information embedding result are obtained. The image embedding result and the question information embedding result are combined into an input combination result in a matrix form, and the input combination result is input into the multimodal large model. The multimodal large model calculates the correlation score between the input combination result and the knowledge content information in the multimodal knowledge base, selects the top K knowledge content information with the similarity ranking as candidate knowledge content information (K is a positive integer greater than or equal to 2), and performs question and answer prediction processing based on the candidate knowledge content information, thereby generating an answer result corresponding to the question information.
[0080] In this embodiment, the input combination result can be represented by a matrix Q, which is composed of multiple query vectors Composition, query vector The text embedding q obtained by vector embedding of the question information and the image embedding I obtained by vector embedding of the reconstructed image are formed. The knowledge content information set in the knowledge base can be represented by a matrix D, which is composed of text embedding d obtained by vector embedding of multiple knowledge content information. The expression for obtaining the correlation calculation result is: , in, is the correlation calculation result, is the mth row of matrix Q, is the transpose of the nth row of matrix D, T is the matrix transpose symbol, The query vector The number of is the number of text embeddings d, m∈[1, ],n∈[1, ].
[0081] See also Figure 6 The embodiment of the present application further provides a visual question answering device based on a multimodal large model, which can implement the above-mentioned visual question answering method based on a multimodal large model, and the device includes: The first module 601 is used to obtain the original image and question information for the original image; The second module 602 is used to perform visual feature encoding processing on the original image to obtain a first feature vector sequence; The third module 603 is used to perform image feature extraction processing on the first feature vector sequence and image feature compression processing based on the image feature extraction result to obtain a second feature vector sequence; The fourth module 604 is used to adopt a residual vector quantization method and use a semantic feature vector set to perform feature replacement processing on the second feature vector sequence to obtain a third feature vector sequence; The fifth module 605 is used to perform feature decoding processing on the third feature vector sequence to obtain a reconstructed image; The sixth module 606 is used to combine the knowledge content information in the multimodal knowledge base, perform question-answer prediction processing on the reconstructed image and the question information, and obtain the answer result corresponding to the question information.
[0082] The specific implementation of the visual question answering device based on the multimodal large model is basically the same as the specific implementation example of the visual question answering method based on the multimodal large model mentioned above, and will not be repeated here.
[0083] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment.
[0084] Refer to the following Figure 7 An electronic device 700 according to this embodiment of the present disclosure is described. Figure 7 The electronic device 700 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0085] like Figure 7 As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 710, at least one storage unit 720, a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710), a display unit 740, etc.
[0086] Among them, the storage unit stores program code, and the program code can be executed by the processing unit 710, so that the processing unit 710 executes the steps according to various exemplary embodiments of the present disclosure described in the above-mentioned visual question answering method based on a multimodal large model section of this specification.
[0087] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 7201 and / or a cache storage unit 7202 , and may further include a read-only storage unit (ROM) 7203 .
[0088] The storage unit 720 may also include a program / utility 7204 having a set (at least one) of program modules 7205, such program modules 7205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0089] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0090] The electronic device 700 may also communicate with one or more external devices 700' (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 750. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 760. The network adapter 760 may communicate with other modules of the electronic device 700 via a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0091] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned visual question answering method based on a multimodal large model.
[0092] The visual question answering method, apparatus, device and storage medium based on a multimodal large model provided in the embodiments of the present application obtain a first feature vector sequence containing semantic information of the original image by performing visual feature encoding processing on the original image, and then perform image feature extraction processing and image feature compression processing based on the image feature extraction result on the first feature vector sequence to evaluate the importance of each image block to obtain a second feature vector sequence rich in feature information, and then adopt a residual vector quantization method to perform feature replacement processing on the second feature vector sequence using a semantic feature vector set to obtain a third feature vector sequence that is similar to the semantic information contained in the corresponding semantic feature vector in the multimodal knowledge base, and perform question answering prediction processing on the reconstructed image and question information reconstructed using the third feature vector sequence in combination with the knowledge content information in the multimodal knowledge base to obtain an answer result corresponding to the question information. Since the original image is first subjected to visual feature encoding processing, image feature extraction processing, and feature replacement processing using a semantic feature vector set before question and answer prediction processing, rich semantic information can be extracted from the original image. After evaluating the importance of each image block, image blocks with rich feature information are selected, and feature replacement processing is performed using a preset semantic feature vector set. This makes the semantic information contained in the reconstructed image tend to be the same as the semantic information contained in the corresponding semantic feature vector in the multimodal knowledge base, thereby improving the question answering accuracy and knowledge reasoning accuracy of visual question answering.
[0093] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the implementation of the present disclosure.
[0094] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0095] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program codes contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.
[0096] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0097] Those skilled in the art will appreciate that the above modules can be distributed in the device according to the description of the embodiment, or can be changed accordingly and only used in one or more devices different from the embodiment. The modules of the above embodiments can be combined into one module, or further divided into multiple sub-modules.
[0098] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.
[0099] The exemplary embodiments of the present disclosure are specifically shown and described above. It should be understood that the present disclosure is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present disclosure is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.
Claims
1. A visual question answering method based on a multimodal large model, characterized in that: include: Acquire an original image and question information for the original image; Performing visual feature encoding processing on the original image to obtain a first feature vector sequence; Performing image feature extraction processing on the first feature vector sequence and image feature compression processing based on the image feature extraction result to obtain a second feature vector sequence; Using a residual vector quantization method, using a semantic feature vector set to perform feature replacement processing on the second feature vector sequence to obtain a third feature vector sequence; Performing feature decoding processing on the third feature vector sequence to obtain a reconstructed image; In combination with the knowledge content information in the multimodal knowledge base, question-answer prediction processing is performed on the reconstructed image and the question information to obtain an answer result corresponding to the question information.
2. The visual question answering method based on a multimodal large model according to claim 1, characterized in that: The performing visual feature encoding processing on the original image to obtain a first feature vector sequence includes: Performing image block processing on the original image to obtain multiple image blocks; Performing linear embedding processing and position embedding processing on each of the image blocks to obtain an image block feature vector sequence; the image block feature vector sequence includes a plurality of image block feature vectors, and the image block feature vectors are respectively embedded with relative position information between the image blocks; Based on the self-attention mechanism, feature information of the plurality of image block feature vectors in the image block feature vector sequence is propagated to obtain the first feature vector sequence.
3. The visual question answering method based on a multimodal large model according to claim 1, characterized in that: The performing image feature extraction processing on the first feature vector sequence and image feature compression processing based on the image feature extraction result to obtain a second feature vector sequence includes: According to the feature information amount contained in the image block feature vector in the first feature vector sequence, the image block feature vector is subjected to binary classification processing to obtain a binary distribution of the image block feature vector; Reparameterizing the binary distribution to obtain a binary decision mask; performing feature vector selection on the first feature vector sequence according to the binary decision mask to determine a selected image block feature vector and an unselected image block feature vector; According to the semantic similarity between the selected image block feature vector and the unselected image block feature vector, the unselected image block feature vector is compressed and fused into the selected image block feature vector to obtain the second feature vector sequence.
4. The visual question answering method based on a multimodal large model according to claim 3, characterized in that: The step of compressing and fusing the unselected image block feature vector into the selected image block feature vector according to the semantic similarity between the selected image block feature vector and the unselected image block feature vector to obtain the second feature vector sequence comprises: Performing self-attention calculation on the selected image block feature vectors so that a subsequent selected image block feature vector can only observe a previous selected image block feature vector; Taking the selected image block feature vector as a query and the unselected image block feature vector as a key and a value, the unselected image block feature vector is compressed and fused into the selected image block feature vector through an attention mechanism to obtain the second feature vector sequence.
5. The visual question answering method based on a multimodal large model according to claim 1, characterized in that: The method of using residual vector quantization to perform feature replacement processing on the second feature vector sequence using a semantic feature vector set to obtain a third feature vector sequence includes: An iterative residual vector quantization operation is performed on the second feature vector sequence to obtain a residual vector quantization result and a feature vector search result corresponding to each residual vector quantization operation; the residual vector quantization operation is an operation of searching for a feature vector with the highest similarity to the latest vector to be quantized in the semantic feature vector set corresponding to the iteration; the residual vector quantization result is a deviation between the latest vector to be quantized and the feature vector with the highest similarity to the latest vector to be quantized; the latest vector to be quantized is the residual vector quantization result corresponding to the second feature vector sequence or the last residual vector quantization operation; the feature vector search result is a feature vector searched by the residual vector quantization operation; The third feature vector sequence is constructed using the feature vector search results.
6. The visual question answering method based on a multimodal large model according to claim 1, characterized in that: The step of combining the knowledge content information in the multimodal knowledge base, performing question-answer prediction processing on the reconstructed image and the question information, and obtaining an answer result corresponding to the question information, includes: The reconstructed image, the question information and the knowledge content information in the multimodal knowledge base are input into a multimodal large model to perform question and answer prediction processing to obtain an answer result corresponding to the question information; the multimodal large model is obtained by training a preset model based on a sample reconstructed image, sample question information and sample knowledge content information of the sample reconstructed image.
7. The visual question answering method based on a multimodal large model according to claim 6, characterized in that: The step of inputting the reconstructed image, the question information, and the knowledge content information in the multimodal knowledge base into a multimodal macro model, performing question-answer prediction processing, and obtaining an answer result corresponding to the question information includes: combining the reconstructed image and the question information to obtain an input combination result; Inputting the input combination result into the multimodal large model, performing correlation calculation on the input combination result and the knowledge content information in the multimodal knowledge base, and obtaining a correlation calculation result; According to the correlation calculation result, the answer result corresponding to the question information is output.
8. A visual question answering device based on a multimodal large model, characterized in that: include: The first module is used to obtain an original image and question information for the original image; The second module is used to perform visual feature encoding processing on the original image to obtain a first feature vector sequence; A third module is used to perform image feature extraction processing on the first feature vector sequence and image feature compression processing based on the image feature extraction result to obtain a second feature vector sequence; A fourth module is used to adopt a residual vector quantization method and use a semantic feature vector set to perform feature replacement processing on the second feature vector sequence to obtain a third feature vector sequence; A fifth module is used to perform feature decoding processing on the third feature vector sequence to obtain a reconstructed image; The sixth module is used to combine the knowledge content information in the multimodal knowledge base, perform question-answer prediction processing on the reconstructed image and the question information, and obtain the answer result corresponding to the question information.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the visual question answering method based on a multimodal large model as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the visual question answering method based on a multimodal large model described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Visual question and answer data processing method and device and computer equipment
CN116662497A
Knowledge-enhanced visual question-answering method based on multi-modal information guidance
CN116704198A
Mask-based interactive enhanced image text recognition method and system
CN117710986A
Image processing method and device based on multi-modal information
CN117975211A
Cited By
Automatic test paper marking method and system based on generative artificial intelligence
CN119540972A
Security video description information generation method and device, electronic equipment and readable medium
CN119893045A
Visual large model cue word engineering compiling method for drawing substation terminal strip wiring identification, storage medium and equipment
CN120688453A
Video key frame adaptive extraction method based on working condition complexity
CN121305438A
