Question and answer information generation method and device and multi-modal large model training method and device
By combining multi-modal large models with deep learning technology, text and image information in the target image is obtained and answer information is generated, which solves the accuracy and cost problems of traditional problem-solving methods and achieves an efficient problem-solving method.
Patent Information
- Application Number
- CN202410796817.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-09-03
AI Technical Summary
Traditional problem-solving methods rely on high-cost database data quality, lack of accuracy, and cannot effectively handle target images containing problem content and accompanying images.
A large multi-modal model is used to generate answer information by obtaining text modal information and image modal information in the target image, combined with deep learning technology, such as Transformer image encoder, text encoder and multi-modal decoder.
It improves the accuracy of answer information and reduces implementation costs. It is suitable for target images containing question content and accompanying pictures to meet the needs of different scenarios.
Smart Images

Figure CN118586502A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to the generation of question and answer information in the fields of computer vision, deep learning, and large models, as well as a method and device for training a multimodal large model. Background Art
[0002] Intelligent problem-solving systems play an important role in modern education. For example, they can greatly improve learning efficiency and help students understand and master knowledge points faster by providing real-time answer information. They can also identify weak links in students' learning through data analysis and provide targeted learning suggestions. Summary of the invention
[0003] The present disclosure provides a method and device for generating question and answer information and training a multimodal large model.
[0004] A method for generating question and answer information, comprising:
[0005] Acquire a target image to be processed, wherein the target image includes the content of the question to be answered and a picture corresponding to the content of the question;
[0006] Respectively obtain text modal information corresponding to the question content and image modal information corresponding to the picture;
[0007] The text modal information and the image modal information are combined and a multimodal large model is used to determine the answer information corresponding to the question content.
[0008] A multimodal large model training method, comprising:
[0009] Acquire a training sample, wherein the training sample includes: modality information and a label corresponding to a training image, wherein the modality information includes: text modality information corresponding to the question content in the training image and image modality information corresponding to a picture in the training image, wherein the picture is a picture corresponding to the question content, and the label includes answer information corresponding to the question content;
[0010] The multimodal large model is trained using the training samples, and the multimodal large model is used to determine the answer information corresponding to the question content in the target image to be processed according to the modal information corresponding to the target image to be processed, and the target image includes the question content to be answered and the corresponding picture of the question content.
[0011] A device for generating question and answer information, comprising: an image acquisition module, an information acquisition module and a result generation module;
[0012] The image acquisition module is used to acquire a target image to be processed, wherein the target image includes the content of the question to be answered and the accompanying image corresponding to the content of the question;
[0013] The information acquisition module is used to respectively acquire text modality information corresponding to the question content and image modality information corresponding to the picture;
[0014] The result generation module is used to combine the text modal information and the image modal information and use a multimodal large model to determine the answer information corresponding to the question content.
[0015] A multimodal large model training device, comprising: a sample acquisition module and a model training module;
[0016] The sample acquisition module is used to acquire training samples, wherein the training samples include: modal information and labels corresponding to the training images, wherein the modal information includes: text modal information corresponding to the question content in the training images and image modal information corresponding to the pictures in the training images, wherein the pictures are pictures corresponding to the question content, and the labels include answer information corresponding to the question content;
[0017] The model training module is used to train the multimodal large model using the training samples. The multimodal large model is used to determine the answer information corresponding to the question content in the target image to be processed based on the modal information corresponding to the target image to be processed. The target image includes the question content to be answered and the corresponding picture of the question content.
[0018] An electronic device, comprising:
[0019] at least one processor; and
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described above.
[0022] A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the method as described above.
[0023] A computer program product comprises a computer program / instruction, wherein the computer program / instruction implements the method described above when executed by a processor.
[0024] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0026] Figure 1 A flowchart of an embodiment of a method for generating question and answer information disclosed in the present invention;
[0027] Figure 2 A schematic diagram of the implementation process of the method for generating question and answer information disclosed in the present invention;
[0028] Figure 3 A flowchart of an embodiment of the multimodal large model training method disclosed in the present invention;
[0029] Figure 4 Schematic diagram of the composition structure of an embodiment 400 of a device for generating question and answer information according to the present disclosure;
[0030] Figure 5 It is a schematic diagram of the composition structure of an embodiment 500 of the multimodal large model training device described in the present disclosure;
[0031] Figure 6 A schematic block diagram of an electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0032] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0033] In addition, it should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0034] Figure 1 Flow chart of an embodiment of the method for generating question and answer information disclosed in the present invention. Figure 1 As shown, the following specific implementation methods are included.
[0035] In step 101, a target image to be processed is obtained, wherein the target image includes the content of the question to be answered and the accompanying image corresponding to the content of the question.
[0036] In step 102, text modal information corresponding to the question content and image modal information corresponding to the accompanying picture are obtained respectively.
[0037] In step 103, the text modal information and the image modal information are combined to determine the answer information corresponding to the question content using a multimodal large model.
[0038] In the traditional problem-solving method, after obtaining the question content uploaded by the user, it is usually searched in the database to retrieve the closest answer information and return it to the user. However, the accuracy of this method is heavily dependent on the quality of the data in the database, and the construction of a high-quality database requires high costs.
[0039] The scheme described in the above method embodiment proposes an end-to-end problem-solving method with graphic understanding ability, which can respectively obtain text modal information corresponding to the problem content in the target image and image modal information corresponding to the accompanying picture in the target image, and can combine these two modal information and use a multimodal large model to determine the answer information corresponding to the problem content. By combining different modal information, the accuracy of the obtained answer information can be improved, and the implementation cost is reduced compared with the traditional method. Moreover, it is applicable to target images that include both problem content and accompanying pictures, as well as target images that only include problem content, so as to meet the usage requirements of different scenarios. Among them, when the target image only includes problem content, it is equivalent to the acquired image modal information being empty.
[0040] A multimodal large model refers to a large language model that is trained by combining multiple modal information such as text, images, video, and audio. The large language model is a deep learning model trained based on massive text data. It can not only generate natural language text, but also deeply understand the meaning of the text and handle various natural language tasks.
[0041] In practical applications, if a user needs to obtain the answer information corresponding to a math problem in a book, he can take a photo of the math problem and upload the photo as the target image. The math problem can be a scenario problem with a picture in the primary school stage, a plane geometry and solid geometry problem in the junior high and high school stages, etc.
[0042] Assume that the math problem is: The lengths of the sides of the following figure are as shown in the figure, so what is the area of the figure? and it is accompanied by a corresponding figure, then "The lengths of the sides of the following figure are as shown in the figure, so what is the area of the figure" is the content of the problem, and the figure is the corresponding picture of the problem content.
[0043] For the target image, the text modal information corresponding to the question content and the image modal information corresponding to the accompanying picture can be obtained respectively.
[0044] In some embodiments of the present disclosure, problematic content can be extracted from a target image, and text features corresponding to the problematic content can be obtained, and the text features are used as text modal information; and accompanying pictures can be extracted from a target image, and image features corresponding to the accompanying pictures can be obtained, and the image features are used as image modal information.
[0045] That is, for the question content and accompanying pictures required for generating answer information, corresponding features can be obtained respectively, thereby providing comprehensive and accurate reference information for the generation of answer information, thereby improving the accuracy of the generated answer information.
[0046] In some embodiments of the present disclosure, when extracting the problematic content from the target image, optical character recognition (OCR) may be performed on the target image to obtain the recognized problematic content.
[0047] Specifically, in some embodiments of the present disclosure, a visual transformer (ViT) can be used to extract features of the target image to obtain a first feature sequence, and then the first feature sequence can be input into a transformer decoder with an M-layer structure to obtain an output second feature sequence, where M is a positive integer. The second feature sequence can then be input into a multilayer perceptron (MLP) to obtain identified problem content.
[0048] The lengths of the first characteristic sequence and the second characteristic sequence are both greater than 1 and may be the same. In addition, the specific value of M may be determined according to actual needs, such as 12.
[0049] It can be seen that the above OCR recognition method adopts an autoregressive model and improves the accuracy of the final question content through multi-layer processing.
[0050] In some embodiments of the present disclosure, when extracting a matching picture from a target image, image detection may be performed on the target image to obtain a detected matching picture.
[0051] Specifically, in some embodiments of the present disclosure, a deep residual network (ResNet) can be used to extract features of the target image to obtain N feature maps, where N is a positive integer greater than 1, and the N feature maps correspond to different levels respectively. Then, a feature pyramid network (FPN) can be used to fuse the N feature maps to obtain a fused feature map. Then, the fused feature map can be stretched into a one-dimensional feature map, and the one-dimensional feature map can be input into a Transformer decoder with a P-layer structure, where P is a positive integer. Then, the output of the Transformer decoder can be respectively input into a first feed-forward neural network (FFN) and a second FFN to obtain scores corresponding to each candidate picture frame output by the first FFN and each candidate picture frame output by the second FFN, and the pictures in the candidate picture frames whose scores are greater than a predetermined threshold can be used as detected pictures.
[0052] That is, for the target image, ResNet can be used as a feature extractor to extract multi-level feature maps. The specific value of N can be determined according to actual needs, such as 4. Accordingly, compared with the original width and height of the target image, four feature maps with widths and heights of 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the original width and height can be extracted respectively. After that, these feature maps can be fused using FPN to obtain a fused feature map, and the width and height of the fused feature map are 1 / 4 of the original width and height. After that, the fused feature map can be stretched into a one-dimensional feature map, that is, the two-dimensional feature map with width and height is stretched into a one-dimensional feature map. There is no restriction on how to stretch it. For example, as a possible implementation method, assuming that the fused feature map is 3*4 (the number is only for example, and it may be much larger in reality), that is, it includes 12 elements, then the rows can be spliced in the order of the first row, the second row and the third row, so as to obtain the stretched one-dimensional feature map. Furthermore, the one-dimensional feature map can be input into a Transformer decoder with a P-layer structure, and the specific value of P can be determined according to actual needs, such as 6, and then the output of the Transformer decoder can be respectively input into the first FFN and the second FFN, and accordingly, the first FFN will output each candidate picture frame, and the second FFN will output the scores (confidence scores) corresponding to each candidate picture frame, and the pictures in the candidate picture frames with scores greater than a predetermined threshold can be used as detected pictures. The specific value of the threshold can also be determined according to actual needs. For example, assuming that the first FFN outputs a total of 3 candidate picture frames, and the score corresponding to one of the candidate picture frames is greater than the threshold, then the picture in the candidate picture frame can be used as the detected picture, and assuming that the scores corresponding to two of the candidate picture frames are both greater than the threshold, then the pictures in these two candidate picture frames can be used as detected pictures.
[0053] Through the above processing, the matching image in the target image can be determined efficiently and accurately, thus laying a good foundation for subsequent processing.
[0054] Furthermore, for the question content and accompanying pictures extracted from the target image, corresponding text features and image features can be obtained respectively.
[0055] In some embodiments of the present disclosure, a tokenizer may be used to encode the question content, thereby obtaining text features corresponding to the question content.
[0056] Tokenizer is an existing mature model. Accordingly, using Tokenizer to encode question content can improve processing efficiency and the accuracy of obtained text features.
[0057] In addition, in some embodiments of the present disclosure, the following processing can be performed for any matching image: ResNet is used to extract features of the matching image to obtain N feature maps, where N is a positive integer greater than 1, and the N feature maps correspond to different levels respectively. FPN is then used to fuse the N feature maps to obtain a fused feature map, and the fused feature map is then stretched into a one-dimensional feature map, and the obtained one-dimensional feature map is used as the image feature corresponding to the matching image.
[0058] Assuming that there are multiple illustrations, each illustration can be processed in the above manner, so that the image features corresponding to each illustration can be obtained, and all illustration information can be fully and accurately obtained, thereby improving the accuracy of the subsequently generated answer information.
[0059] The acquired text features can be used as text modal information, and the acquired image features can be used as image modal information. Then, the text modal information and the image modal information can be combined to determine the answer information corresponding to the question content using a multimodal large model.
[0060] In some embodiments of the present disclosure, the multimodal large model may include: a Transformer image encoder, a Transformer text encoder and a Transformer multimodal decoder. Accordingly, the text modality information can be used as the input of the Transformer text encoder to obtain the output language feature sequence, and the image modality information can be used as the input of the Transformer image encoder to obtain the output visual feature sequence. Then, the language feature sequence and the visual feature sequence can be used as the input of the Transformer multimodal decoder to obtain the output answer information.
[0061] That is, based on the input text features and image features, the corresponding language feature sequence and visual feature sequence can be determined respectively, and then the information of the two dimensions of language feature sequence and visual feature sequence can be combined to determine the final answer information, thereby improving the accuracy of the obtained answer information.
[0062] In some embodiments of the present disclosure, the Transformer image encoder and the Transformer text encoder may adopt the same structure, which may include: an embedding layer and W stacked encoder layers, W is a positive integer greater than 1, and each encoder layer may respectively include: a multi-head self-attention layer and an FFN, wherein the embedding layer is used to add position coding information to the input content, the output of the embedding layer is used as the input of the first encoder layer, and each encoder layer other than the first encoder layer uses the output of the adjacent previous encoder layer as input, and the output of the multi-head attention layer in each encoder layer is used as the input of the FFN in the encoder layer.
[0063] In the scheme disclosed in the present invention, the length of the obtained text features and image features can be L, such as one-dimensional feature maps with a length of L, where L is a positive integer greater than 1, and the specific value can be determined according to actual needs.
[0064] The Transformer image encoder and the Transformer text encoder in the solution described in the present disclosure may both adopt a standard Transformer encoder structure.
[0065] In the one-dimensional feature map with a length of L, each element can have multiple dimensional features. Then, inputting the one-dimensional feature map with a length of L into the Transformer encoder is equivalent to inputting a matrix of size L*d into the Transformer encoder, where d represents the number of dimensions, such as 256 or 512. For each element, the embedding layer can obtain its corresponding position code respectively, and can add the position code to each dimensional feature in the element. For example, assuming that the value of d is 256, then for any element, the position code corresponding to the position of the element in the one-dimensional feature map can be first obtained, and then the position code can be added to the 256 dimensional features in the element respectively. After being processed by the embedding layer, the result is still an L*d matrix, but the position information is integrated into it. After that, the L*d matrix output by the embedding layer can be input to the first encoder layer of multiple stacked encoder layers, each of which is mainly composed of a multi-head self-attention layer and FFN. The multi-head self-attention layer is the core component of the encoder layer. For the input L×d matrix, three matrices of query (Q, Query), key (K, Key) and value (V, Value) can be generated through linear transformation. Each matrix is L×d in size. These matrices are divided into multiple heads, and the dimensions of each head are L×(d / h), h represents the number of attention heads. Each head calculates self-attention independently and obtains an L×(d / h) output. After that, the outputs of all heads can be spliced, and the spliced results can be restored to L×d matrices through linear transformation. Furthermore, the restored L×d matrix can be layer normalized and residually connected (i.e., post-processed), and the processing result can be added to the original input matrix (the input content of the encoder layer) to ensure the stability of the gradient, and then the addition result can be input into FFN to obtain the desired output result.
[0066] The structure of the Transformer multimodal decoder is not limited, and a structure similar to that of the Transformer encoder can be used. The output of the Transformer text encoder and the output of the Transformer image encoder are used as the input of the Transformer multimodal decoder. The Transformer multimodal decoder can predict the answer information corresponding to the question content in an autoregressive manner based on the input content through operations such as vocabulary mapping.
[0067] Combined with the above introduction, Figure 2 FIG. 1 is a schematic diagram of the implementation process of the method for generating question and answer information described in the present disclosure. Figure 2As shown, for the target image, OCR recognition and image detection can be performed on it respectively, so as to obtain the question content and the accompanying picture extracted from the target image, and then the extracted question content can be text encoded to obtain the text features corresponding to the question content, and the image features of the extracted accompanying picture can be extracted to obtain the image features corresponding to the accompanying picture, and then the obtained text features can be used as the input of the Transformer text encoder in the multimodal large model to obtain the language feature sequence output by the Transformer text encoder, and the obtained image features can be used as the input of the Transformer image encoder in the multimodal large model to obtain the visual feature sequence output by the Transformer image encoder, and then the obtained language feature sequence and visual feature sequence can be used as the input of the Transformer multimodal decoder in the multimodal large model to obtain the answer information corresponding to the output question content.
[0068] The multimodal large model can be obtained by pre-training. The following is an explanation of the training method of the multimodal large model.
[0069] Figure 3 Flow chart of an embodiment of the multimodal large model training method described in the present disclosure. Figure 3 As shown, the following specific implementation methods are included.
[0070] In step 301, a training sample is obtained, and the training sample includes: modal information and labels corresponding to the training image, the modal information includes: text modal information corresponding to the question content in the training image and image modal information corresponding to the illustration in the training image, the illustration is the illustration corresponding to the question content, and the label includes answer information corresponding to the question content.
[0071] In step 302, the multimodal large model is trained using training samples. The multimodal large model is used to determine the answer information corresponding to the question content in the target image based on the modal information corresponding to the target image to be processed. The target image includes the question content to be answered and the corresponding picture of the question content.
[0072] By adopting the scheme described in the above method embodiment, a multimodal large model can be trained, so that for a target image including question content and corresponding accompanying pictures, the multimodal large model can be used to combine the text modal information corresponding to the question content and the image modal information corresponding to the accompanying pictures to determine the answer information corresponding to the question content, thereby improving the accuracy of the obtained answer information.
[0073] In some embodiments of the present disclosure, the text modal information corresponding to the question content may include: text features corresponding to the question content, and the image modal information corresponding to the accompanying picture may include: image features corresponding to the accompanying picture.
[0074] In addition, in some embodiments of the present disclosure, the multimodal large model may include: a Transformer image encoder, a Transformer text encoder and a Transformer multimodal decoder, wherein the input of the Transformer image encoder is image modal information, and the output is a visual feature sequence, the input of the Transformer text encoder is text modal information, and the output is a language feature sequence, and the input of the Transformer multimodal decoder is a visual feature sequence and a language feature sequence, and the output is the answer information.
[0075] There is no restriction on how to obtain training samples. For example, taking a math problem as an example, you can take a photo or capture a math problem in a book to obtain a training image, and you can obtain the text modality information corresponding to the problem content in the training image and the image modality information corresponding to the picture in the training image. In addition, the calculated or found solution information of the math problem can be used as a label. In the same way, multiple training samples can be constructed, and then the constructed training samples can be used to train the multimodal large model.
[0076] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the described order of actions, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present disclosure. In addition, for parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0077] The above is an introduction to the method embodiment. The following is a further explanation of the scheme disclosed in the present invention through an apparatus embodiment.
[0078] Figure 4 FIG. 4 is a schematic diagram of the structure of the apparatus for generating question and answer information according to the present disclosure. Figure 4 As shown, it includes: an image acquisition module 401, an information acquisition module 402 and a result generation module 403.
[0079] The image acquisition module 401 is used to acquire a target image to be processed, wherein the target image includes the content of the question to be answered and the accompanying image corresponding to the content of the question.
[0080] The information acquisition module 402 is used to respectively acquire text modal information corresponding to the question content and image modal information corresponding to the accompanying picture.
[0081] The result generation module 403 is used to combine the text modal information and the image modal information and use the multimodal large model to determine the answer information corresponding to the question content.
[0082] The scheme described in the above-mentioned device embodiment provides an end-to-end problem-solving method with graphic understanding capability, which can respectively obtain text modal information corresponding to the problem content in the target image and image modal information corresponding to the accompanying picture in the target image, and can combine these two modal information and use a multimodal large model to determine the answer information corresponding to the problem content. By combining different modal information, the accuracy of the obtained answer information can be improved, and the implementation cost is reduced compared to the traditional method. Moreover, it is applicable to target images that include both problem content and accompanying pictures, as well as target images that only include problem content, thereby meeting the usage requirements of different scenarios. Among them, when the target image only includes problem content, it is equivalent to the acquired image modal information being empty.
[0083] In some embodiments of the present disclosure, the information acquisition module 402 can extract problem content from the target image, and can obtain text features corresponding to the problem content, and use the text features as text modal information, and can extract accompanying pictures from the target image, and can obtain image features corresponding to the accompanying pictures, and use the image features as image modal information.
[0084] In some embodiments of the present disclosure, when extracting problematic content from a target image, the information acquisition module 402 may perform OCR recognition on the target image to obtain the recognized problematic content.
[0085] Specifically, in some embodiments of the present disclosure, the information acquisition module 402 can use ViT to extract features of the target image to obtain a first feature sequence, and then the first feature sequence can be input into a Transformer decoder with an M-layer structure to obtain an output second feature sequence, where M is a positive integer. The second feature sequence can then be input into the MLP to obtain the identified problem content.
[0086] In some embodiments of the present disclosure, when extracting the accompanying image from the target image, the information acquisition module 402 may perform image detection on the target image to obtain the detected accompanying image.
[0087] Specifically, in some embodiments of the present disclosure, the information acquisition module 402 may use ResNet to extract features of the target image to obtain N feature maps, where N is a positive integer greater than 1, and the N feature maps correspond to different levels respectively. Then, FPN may be used to fuse the N feature maps to obtain a fused feature map, and then the fused feature map may be stretched into a one-dimensional feature map, and the one-dimensional feature map may be input into a Transformer decoder with a P-layer structure, where P is a positive integer. Then, the outputs of the Transformer decoder may be input into the first FFN and the second FFN respectively to obtain scores corresponding to each candidate picture frame output by the first FFN and each candidate picture frame output by the second FFN, and the pictures in the candidate picture frames having scores greater than a predetermined threshold may be used as detected pictures.
[0088] Furthermore, for the question content and accompanying pictures extracted from the target image, the information acquisition module 402 can respectively acquire corresponding text features and image features.
[0089] In some embodiments of the present disclosure, the information acquisition module 402 may use a word segmenter to encode the question content, thereby obtaining text features corresponding to the question content.
[0090] In addition, in some embodiments of the present disclosure, the information acquisition module 402 can perform the following processing for any matching image: use ResNet to extract features of the matching image to obtain N feature maps, where N is a positive integer greater than 1, and the N feature maps correspond to different levels respectively; then use FPN to fuse the N feature maps to obtain a fused feature map, and then stretch the fused feature map into a one-dimensional feature map, and use the obtained one-dimensional feature map as the image feature corresponding to the matching image.
[0091] The acquired text features can be used as text modal information, and the acquired image features can be used as image modal information. Then, the result generation module 403 can combine the text modal information and the image modal information and use the multimodal large model to determine the answer information corresponding to the question content.
[0092] In some embodiments of the present disclosure, the multimodal large model may include: a Transformer image encoder, a Transformer text encoder and a Transformer multimodal decoder. Accordingly, the result generation module 403 may use the text modality information as the input of the Transformer text encoder to obtain the output language feature sequence, and use the image modality information as the input of the Transformer image encoder to obtain the output visual feature sequence, and then use the language feature sequence and the visual feature sequence as the input of the Transformer multimodal decoder to obtain the output answer information.
[0093] In some embodiments of the present disclosure, the Transformer image encoder and the Transformer text encoder may adopt the same structure, which may include: an embedding layer and W stacked encoder layers, W is a positive integer greater than 1, and each encoder layer may respectively include: a multi-head self-attention layer and an FFN, wherein the embedding layer is used to add position coding information to the input content, the output of the embedding layer is used as the input of the first encoder layer, and each encoder layer other than the first encoder layer uses the output of the adjacent previous encoder layer as input, and the output of the multi-head attention layer in each encoder layer is used as the input of the FFN in the encoder layer.
[0094] Figure 5 FIG. 5 is a schematic diagram of the structure of the multi-modal large model training device embodiment 500 described in the present disclosure. Figure 5 As shown, it includes: a sample acquisition module 501 and a model training module 502.
[0095] The sample acquisition module 501 is used to obtain training samples, which include: modal information and labels corresponding to the training images, the modal information includes: text modal information corresponding to the question content in the training image and image modal information corresponding to the illustrations in the training image, the illustrations are illustrations corresponding to the question content, and the labels include answer information corresponding to the question content.
[0096] The model training module 502 is used to train the multimodal large model using training samples. The multimodal large model is used to determine the answer information corresponding to the question content in the target image based on the modal information corresponding to the target image to be processed. The target image includes the question content to be answered and the corresponding picture of the question content.
[0097] By adopting the scheme described in the above-mentioned device embodiment, a multimodal large model can be trained, so that for a target image including question content and corresponding accompanying pictures, the multimodal large model can be used to combine the text modal information corresponding to the question content and the image modal information corresponding to the accompanying pictures to determine the answer information corresponding to the question content, thereby improving the accuracy of the obtained answer information.
[0098] In some embodiments of the present disclosure, the text modal information corresponding to the question content may include: text features corresponding to the question content, and the image modal information corresponding to the accompanying picture may include: image features corresponding to the accompanying picture.
[0099] In addition, in some embodiments of the present disclosure, the multimodal large model may include: a Transformer image encoder, a Transformer text encoder and a Transformer multimodal decoder, wherein the input of the Transformer image encoder is image modal information, and the output is a visual feature sequence, the input of the Transformer text encoder is text modal information, and the output is a language feature sequence, and the input of the Transformer multimodal decoder is a visual feature sequence and a language feature sequence, and the output is the answer information.
[0100] Figure 4 and Figure 5 The specific working process of the illustrated device embodiment can refer to the relevant description in the aforementioned method embodiment and will not be described in detail.
[0101] In summary, the solution described in the present disclosure proposes an end-to-end problem-solving method, which has been significantly improved in terms of applicability and problem-solving accuracy compared to traditional implementation methods.
[0102] The scheme disclosed in the present invention can be applied to the field of artificial intelligence, especially computer vision, deep learning, and large models. Artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It has both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing. Artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0103] In addition, the images and the like in the embodiments described in this disclosure are not targeted at a specific user and do not reflect the personal information of a specific user. In the technical solution of this disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0104] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0105] Figure 6A schematic block diagram of an electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0106] like Figure 6 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 to a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0107] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0108] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI, Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSP, Digital Signal Processing), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as the methods described in the present disclosure. For example, in some embodiments, the methods described in the present disclosure may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the methods described in the present disclosure may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute the method described in the present disclosure in any other appropriate manner (for example, by means of firmware).
[0109] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard parts (ASSPs), system on chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0110] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0111] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory (EPROM, Electronically Programmable Read-Only Memory), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM, Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0112] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a cathode ray tube (CRT) or a liquid crystal display (LCD) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0113] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by digital data communication (e.g., a communication network) in any form or medium. Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0114] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0115] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0116] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for generating question and answer information, comprising: Acquire a target image to be processed, wherein the target image includes the content of the question to be answered and a picture corresponding to the content of the question; Respectively obtain text modal information corresponding to the question content and image modal information corresponding to the picture; The text modal information and the image modal information are combined and a multimodal large model is used to determine the answer information corresponding to the question content.
2. The method according to claim 1, wherein: The step of respectively obtaining text modal information corresponding to the question content and image modal information corresponding to the picture includes: Extracting the question content from the target image, and obtaining text features corresponding to the question content, and using the text features as the text modal information; The accompanying image is extracted from the target image, and image features corresponding to the accompanying image are obtained, and the image features are used as the image modality information.
3. The method according to claim 2, wherein: The extracting the question content from the target image comprises: performing optical character recognition on the target image to obtain the recognized question content; The extracting the matching picture from the target image includes: performing image detection on the target image to obtain the detected matching picture.
4. The method according to claim 3, wherein: The optical character recognition is performed on the target image to obtain the identified problem content, which includes: Extracting features from the target image using a visual converter to obtain a first feature sequence; Inputting the first feature sequence into a conversion decoder having an M-layer structure to obtain an output second feature sequence, where M is a positive integer; The second feature sequence is input into a multi-layer perceptron to obtain the identified question content.
5. The method according to claim 3, wherein: The performing image detection on the target image to obtain the detected matching image comprises: Using a deep residual network to extract features from the target image, to obtain N feature maps, where N is a positive integer greater than 1, and the N feature maps correspond to different levels respectively; Using a feature pyramid network to fuse the N feature maps to obtain a fused feature map; Stretching the fused feature map into a one-dimensional feature map, and inputting the one-dimensional feature map into a conversion decoder having a P-layer structure, where P is a positive integer; Inputting the output of the conversion decoder into a first feedforward neural network and a second feedforward neural network respectively, to obtain scores corresponding to each candidate picture frame output by the first feedforward neural network and each candidate picture frame output by the second feedforward neural network; The pictures in the candidate picture frame with scores greater than a predetermined threshold are taken as the detected pictures.
6. The method according to claim 2, wherein: The obtaining of the text features corresponding to the question content includes: encoding the question content by using a word segmenter to obtain the text features corresponding to the question content.
7. The method according to claim 2, wherein: The obtaining of the image features corresponding to the picture includes: Using a deep residual network to extract features from the image, obtaining N feature maps, where N is a positive integer greater than 1, and the N feature maps correspond to different levels respectively; Using a feature pyramid network to fuse the N feature maps to obtain a fused feature map; The fused feature map is stretched into a one-dimensional feature map, and the one-dimensional feature map is used as the image feature corresponding to the matching image.
8. The method according to any one of claims 1 to 7, wherein: The multimodal large model includes: a conversion image encoder, a conversion text encoder and a conversion multimodal decoder; The combining of the text modal information and the image modal information to determine the answer information corresponding to the question content using a multimodal large model includes: Using the text modality information as input to the conversion text encoder to obtain an output language feature sequence; Using the image modality information as input to the conversion image encoder to obtain an output visual feature sequence; The language feature sequence and the visual feature sequence are used as inputs of the conversion multimodal decoder to obtain the output answer information.
9. The method according to claim 8, wherein: The conversion image encoder and the conversion text encoder adopt the same structure, which includes: an embedding layer and W stacked encoder layers, W is a positive integer greater than 1, and each encoder layer includes: a multi-head self-attention layer and a feedforward neural network; Among them, the embedding layer is used to add position coding information to the input content, the output of the embedding layer is used as the input of the first encoder layer, and each encoder layer other than the first encoder layer takes the output of the adjacent previous encoder layer as input, and the output of the multi-head attention layer in each encoder layer is used as the input of the feedforward neural network in the encoder layer.
10. A multimodal large model training method, comprising: Acquire a training sample, wherein the training sample includes: modality information and a label corresponding to a training image, wherein the modality information includes: text modality information corresponding to the question content in the training image and image modality information corresponding to a picture in the training image, wherein the picture is a picture corresponding to the question content, and the label includes answer information corresponding to the question content; The multimodal large model is trained using the training samples, and the multimodal large model is used to determine the answer information corresponding to the question content in the target image to be processed according to the modal information corresponding to the target image to be processed, and the target image includes the question content to be answered and the corresponding picture of the question content.
11. The method according to claim 10, wherein: The text modality information corresponding to the question content includes: text features corresponding to the question content; The image modality information corresponding to the picture includes: image features corresponding to the picture.
12. The method according to claim 10 or 11, wherein: The multimodal large model includes: a conversion image encoder, a conversion text encoder and a conversion multimodal decoder; The input of the conversion image encoder is the image modality information, and the output is a visual feature sequence; The input of the conversion text encoder is the text modality information, and the output is a language feature sequence; The input of the conversion multimodal decoder is the visual feature sequence and the language feature sequence, and the output is the answer information.
13. A device for generating question and answer information, comprising: Image acquisition module, information acquisition module and result generation module; The image acquisition module is used to acquire a target image to be processed, wherein the target image includes the content of the question to be answered and the accompanying image corresponding to the content of the question; The information acquisition module is used to respectively acquire text modality information corresponding to the question content and image modality information corresponding to the picture; The result generation module is used to combine the text modal information and the image modal information and use a multimodal large model to determine the answer information corresponding to the question content.
14. The device according to claim 13, wherein: The information acquisition module extracts the question content from the target image, obtains text features corresponding to the question content, and uses the text features as the text modal information; extracts the accompanying picture from the target image, obtains image features corresponding to the accompanying picture, and uses the image features as the image modal information.
15. The device according to claim 14, wherein: The information acquisition module performs optical character recognition on the target image to obtain the recognized question content, and performs image detection on the target image to obtain the detected matching image.
16. The device according to claim 15, wherein: The information acquisition module uses a visual converter to extract features from the target image to obtain a first feature sequence, inputs the first feature sequence into a conversion decoder with an M-layer structure to obtain an output second feature sequence, where M is a positive integer, and inputs the second feature sequence into a multi-layer perceptron to obtain the identified problem content.
17. The device according to claim 15, wherein: The information acquisition module uses a deep residual network to extract features from the target image to obtain N feature maps, where N is a positive integer greater than 1, and the N feature maps correspond to different levels respectively. A feature pyramid network is used to fuse the N feature maps to obtain a fused feature map, and the fused feature map is stretched into a one-dimensional feature map. The one-dimensional feature map is input into a conversion decoder with a P-layer structure, where P is a positive integer. The outputs of the conversion decoder are respectively input into a first feedforward neural network and a second feedforward neural network to obtain scores corresponding to each candidate picture frame output by the first feedforward neural network and each candidate picture frame output by the second feedforward neural network, and the picture in the candidate picture frame with a score greater than a predetermined threshold is used as the detected picture.
18. The device according to claim 14, wherein: The information acquisition module uses a word segmenter to encode the question content to obtain the text features corresponding to the question content.
19. The device according to claim 14, wherein: The information acquisition module uses a deep residual network to extract features from the accompanying image to obtain N feature maps, where N is a positive integer greater than 1, and the N feature maps correspond to different levels respectively. A feature pyramid network is used to fuse the N feature maps to obtain a fused feature map, and the fused feature map is stretched into a one-dimensional feature map, and the one-dimensional feature map is used as the image feature corresponding to the accompanying image.
20. The device according to any one of claims 13 to 19, wherein: The multimodal large model includes: a conversion image encoder, a conversion text encoder and a conversion multimodal decoder; The result generation module uses the text modality information as the input of the conversion text encoder to obtain the output language feature sequence, uses the image modality information as the input of the conversion image encoder to obtain the output visual feature sequence, uses the language feature sequence and the visual feature sequence as the input of the conversion multimodal decoder to obtain the output answer information.
21. The device according to claim 20, wherein: The conversion image encoder and the conversion text encoder adopt the same structure, which includes: an embedding layer and W stacked encoder layers, W is a positive integer greater than 1, and each encoder layer includes: a multi-head self-attention layer and a feedforward neural network; Among them, the embedding layer is used to add position coding information to the input content, the output of the embedding layer is used as the input of the first encoder layer, and each encoder layer other than the first encoder layer takes the output of the adjacent previous encoder layer as input, and the output of the multi-head attention layer in each encoder layer is used as the input of the feedforward neural network in the encoder layer.
22. A multimodal large model training device, comprising: Sample acquisition module and model training module; The sample acquisition module is used to acquire training samples, wherein the training samples include: modal information and labels corresponding to the training images, wherein the modal information includes: text modal information corresponding to the question content in the training images and image modal information corresponding to the pictures in the training images, wherein the pictures are pictures corresponding to the question content, and the labels include answer information corresponding to the question content; The model training module is used to train the multimodal large model using the training samples. The multimodal large model is used to determine the answer information corresponding to the question content in the target image to be processed based on the modal information corresponding to the target image to be processed. The target image includes the question content to be answered and the corresponding picture of the question content.
23. The device according to claim 22, wherein: The text modality information corresponding to the question content includes: text features corresponding to the question content; The image modality information corresponding to the picture includes: image features corresponding to the picture.
24. The device according to claim 22 or 23, wherein: The multimodal large model includes: a conversion image encoder, a conversion text encoder and a conversion multimodal decoder; The input of the conversion image encoder is the image modality information, and the output is a visual feature sequence; The input of the conversion text encoder is the text modality information, and the output is a language feature sequence; The input of the conversion multimodal decoder is the visual feature sequence and the language feature sequence, and the output is the answer information.
25. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 12.
26. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1 to 12.
27. A computer program product, comprising a computer program / instruction, which implements the method according to any one of claims 1 to 12 when executed by a processor.
