CN115331228A - Image text processing method and device, readable medium and electronic equipment - Google Patents

Image text processing method and device, readable medium and electronic equipment Download PDF

Info

Publication number
CN115331228A
CN115331228A CN202211020909.4A CN202211020909A CN115331228A CN 115331228 A CN115331228 A CN 115331228A CN 202211020909 A CN202211020909 A CN 202211020909A CN 115331228 A CN115331228 A CN 115331228A
Authority
CN
China
Prior art keywords
text
visual
image
features
training
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211020909.4A
Other languages
Chinese (zh)
Inventor
潘俊文
边成
张志诚
李永会
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Douyin Vision Co Ltd
Original Assignee
Douyin Vision Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Douyin Vision Co Ltd filed Critical Douyin Vision Co Ltd
Priority to CN202211020909.4A priority Critical patent/CN115331228A/en
Publication of CN115331228A publication Critical patent/CN115331228A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/1444Selective acquisition, locating or processing of specific regions, e.g. highlighted text, fiducial marks or predetermined fields
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/53Querying
    • G06F16/532Query formulation, e.g. graphical querying
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/583Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • G06F16/5846Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content using extracted text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/18Extraction of features or characteristics of the image

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Evolutionary Computation (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Library & Information Science (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Biophysics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Medical Informatics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure relates to an image text processing method, an image text processing device, a readable medium and electronic equipment, and relates to the technical field of electronic information processing, wherein the method comprises the following steps: the method comprises the steps of obtaining a target image and a question text corresponding to the target image, carrying out feature extraction on the target image to obtain image features, carrying out feature extraction on the question text according to the image features to obtain visual text features, determining an answer text corresponding to the question text according to the visual text features, wherein the answer text is used for describing a target object in the target image, and determining identification information according to the visual text features and the image features, wherein the identification information is used for identifying an area where the target object in the target image is located. According to the method, the key information in the question text can be effectively mined by utilizing the image characteristics to assist the characteristic extraction of the question text, the target object in the target image can be accurately identified by utilizing the visual text characteristics to assist the identification of the image characteristics, and the landing of the visual language question and answer with high accuracy and high efficiency is realized.

Description

Image text processing method and device, readable medium and electronic equipment
Technical Field
The present disclosure relates to the field of electronic information processing technologies, and in particular, to an image text processing method and apparatus, a readable medium, and an electronic device.
Background
With the continuous development of the artificial intelligence related technology, the image recognition technology and the natural language processing technology are widely applied, and the life quality of people is effectively improved. For example, visual language Question Answering (English: visual Question Answering, abbreviation: VQA) can effectively help vision-impaired people understand Visual information. The user can capture visual contents through the terminal equipment, then questions are issued to the visual contents in the terminal equipment through the language, and the terminal equipment answers in a natural language mode through recognition of the visual contents. However, the answers are only given in the natural language, and the assistance provided is very limited, and the visual clues are not used as guidance, so that the user cannot magnify the visual clues to view details, and the user cannot judge whether the answers are reliable based on the visual clues, which limits the application of visual language question answering.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, the present disclosure provides a method for processing image text, the method comprising:
acquiring a target image and a problem text corresponding to the target image;
performing feature extraction on the target image to obtain image features;
performing feature extraction on the problem text according to the image features to obtain visual text features;
according to the visual text characteristics, determining an answer text corresponding to the question text, wherein the answer text is used for describing a target object in the target image;
and determining identification information according to the visual text characteristics and the image characteristics, wherein the identification information is used for identifying the region of the target object in the target image.
In a second aspect, the present disclosure provides an image text processing apparatus, the apparatus comprising:
the acquisition module is used for acquiring a target image and a problem text corresponding to the target image;
the first extraction module is used for extracting the features of the target image to obtain image features;
the second extraction module is used for extracting the features of the problem text according to the image features to obtain visual text features;
a first determining module, configured to determine, according to the visual text feature, an answer text corresponding to the question text, where the answer text is used to describe a target object in the target image;
and the second determining module is used for determining identification information according to the visual text characteristics and the image characteristics, wherein the identification information is used for identifying the region of the target object in the target image.
In a third aspect, the present disclosure provides a computer readable medium having stored thereon a computer program which, when executed by a processing apparatus, performs the steps of the method of the first aspect of the present disclosure.
In a fourth aspect, the present disclosure provides an electronic device comprising:
a storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to implement the steps of the method of the first aspect of the present disclosure.
According to the technical scheme, the method comprises the steps of firstly obtaining a target image and a problem text corresponding to the target image, then carrying out feature extraction on the target image to obtain image features, and carrying out feature extraction on the problem text according to the image features to obtain visual text features. And finally, according to the visual text characteristics and the image characteristics, determining the identification information capable of identifying the area where the target object in the target image is located. According to the method, the key information in the question text can be effectively mined by utilizing the image characteristics to assist the characteristic extraction of the question text, the target object in the target image can be accurately identified by utilizing the visual text characteristics to assist the identification of the image characteristics, and the high-accuracy, high-efficiency and end-to-end visual language question-answer landing is realized.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and components are not necessarily drawn to scale. In the drawings:
FIG. 1 is a flow diagram illustrating a method of image text processing according to an exemplary embodiment;
FIG. 2 is a schematic diagram of a process model shown in accordance with an exemplary embodiment;
FIG. 3 is a flow diagram illustrating another method of image text processing according to an exemplary embodiment;
FIG. 4 is a flowchart illustrating a method of training a visual encoder, a visual text encoder, a text decoder, and a text visual decoder, according to an example embodiment;
FIG. 5 is a flow diagram illustrating another method of training a visual encoder, a visual text encoder, a text decoder, and a text visual decoder in accordance with an illustrative embodiment;
FIG. 6 is a block diagram illustrating an image text processing apparatus according to an exemplary embodiment;
FIG. 7 is a block diagram illustrating another image text processing apparatus according to an exemplary embodiment;
FIG. 8 is a block diagram of an electronic device shown in accordance with an example embodiment.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
It is understood that, before the technical solutions disclosed in the embodiments of the present disclosure are used, the user should be informed of the type, the use range, the use scene, etc. of the personal information related to the present disclosure in a proper manner according to the relevant laws and regulations and obtain the authorization of the user.
For example, in response to receiving an active request from a user, a prompt message is sent to the user to explicitly prompt the user that the requested operation to be performed would require the acquisition and use of personal information to the user. Thus, the user can autonomously select whether to provide personal information to software or hardware such as an electronic device, an application program, a server, or a storage medium that performs the operations of the disclosed technical solution, according to the prompt information.
As an optional but non-limiting implementation manner, in response to receiving an active request from the user, the manner of sending the prompt information to the user may be, for example, a pop-up window, and the prompt information may be presented in a text manner in the pop-up window. In addition, a selection control for providing personal information to the electronic device by the user's selection of "agreeing" or "disagreeing" can be carried in the popup.
It is understood that the above notification and user authorization process is only illustrative and is not intended to limit the implementation of the present disclosure, and other ways of satisfying the relevant laws and regulations may be applied to the implementation of the present disclosure.
Meanwhile, it is understood that the data involved in the present technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of the corresponding laws and regulations and the related regulations.
FIG. 1 is a flowchart illustrating a method of image text processing, which may include, as shown in FIG. 1, according to an exemplary embodiment:
step 101, a target image and a problem text corresponding to the target image are obtained.
For example, the execution subject of the present disclosure may be a terminal device, which may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle-mounted terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like, to which the present disclosure is not particularly limited.
When a user needs to understand visual information by means of a terminal device, the terminal device may be used to obtain a target image, where the target image may be an image collected by the user using an image collecting device (e.g., a camera) provided on the terminal device, may also be an image selected by the user in a local storage of the terminal device, and may also be an image obtained by the user using the terminal device on a network. Then, a user can ask a problem for the target image, the user can use the terminal device to input the problem in a text mode, the problem text is obtained by the terminal device, the problem can also be input in a voice mode by the user, and after the voice is obtained by the terminal device, the voice can be recognized and converted into the text to obtain the problem text. For example, the target image is a road image, and the corresponding question text may be "what color is the traffic light? ".
And 102, extracting the features of the target image to obtain image features.
And 103, performing feature extraction on the problem text according to the image features to obtain visual text features.
For example, feature extraction may be performed on the target image to obtain an image Feature capable of characterizing the target image, where the image Feature may be understood as a Feature vector or a Feature Map (english: feature Map) for characterizing the target image. Specifically, feature extraction may be performed on the target image by using an Encoder in a ResNet network or a Transformer, which is not specifically limited in this disclosure. After the image features are obtained, the image features can be used as a reference, feature extraction can be performed on the problem text, and visual text features which are based on the image features and can represent the problem text are obtained. In this way, information of two modalities (a text modality and an image modality) can be included in the visual text feature. It can also be understood that the image features and the question text are merged into a question text with image modality information, thereby extracting visual text features of a text modality. It can also be understood that the image features are used as explanations to assist in the mining of the question text, resulting in visual text features.
And 104, determining an answer text corresponding to the question text according to the visual text characteristics, wherein the answer text is used for describing a target object in the target image.
And 105, determining identification information according to the visual text characteristics and the image characteristics, wherein the identification information is used for identifying the area where the target object is located in the target image.
For example, decoding may be performed based on the visual text features to obtain answer text corresponding to the question text. Specifically, the Decoder in Bert (English: bidirectional Encoder replies from Transformers) can be used to decode the visual text features. The answer text is used for describing a target object in the target image, the answer text corresponds to the question text, and an answer to a question described by the question text is included, that is, the answer text is used for answering the question described by the question text. For example, the target image is a road image, and the corresponding question text is "what color is the traffic light? "then the target object is a traffic light and the answer text may be" green ". As another example, the target image is a medicine image, and the corresponding question text is "how many pills are contained in the medicine box? ", the target object is a pill and the answer text may be" 12". After the answer text is determined, the answer text may be directly displayed on a display screen of the terminal device, or the answer text may be converted into audio to be played through a playing device (e.g., a speaker) of the terminal device, which is not specifically limited in this disclosure.
In order to further provide assistance for the user, the visual text feature may be used as a reference, and the image feature is decoded to obtain identification information capable of identifying an area where the target object is located in the target image. It can also be understood that the identification information is decoded by mapping the visual text features to the image space and fusing the visual text features with the image features to obtain image features with text modality information. It can also be understood that the visual text feature is taken as evidence, and the image feature is focused on the region related to the evidence, so as to capture the region of the target object in the target image. The form of the identification information may be, for example, a mask image (english: mask), and the region where the target object is located in the target image may be identified by superimposing the mask image on the target image. The identification information may also be in the form of a coordinate range for identifying the position of the target object in the target image. The identification information can identify the target object, so that a user can amplify the area where the target object is located to check the details of the target object, and can judge whether the answer text is reliable or not based on the target object in the target image. Because the image characteristics are utilized to assist in extracting the characteristics of the Question text, the key information in the Question text can be effectively mined, the Visual text characteristics are further utilized to assist in identifying the image characteristics, the target object in the target image can be accurately identified, the Visual language Question answering landing (VQAG) is realized, namely, the Question is answered while the evidence supporting the Answer is given, and the accuracy and the efficiency of the Visual language Question answering are improved.
In summary, according to the disclosure, a target image and a problem text corresponding to the target image are first obtained, feature extraction is performed on the target image to obtain an image feature, and feature extraction is performed on the problem text according to the image feature to obtain a visual text feature. And finally, determining the identification information of the area where the target object in the target image can be identified according to the visual text characteristics and the image characteristics. According to the method, the key information in the question text can be effectively mined by utilizing the image characteristics to assist the characteristic extraction of the question text, the target object in the target image can be accurately identified by utilizing the visual text characteristics to assist the identification of the image characteristics, and the visual language question-answer with high accuracy, high efficiency and end-to-end landing is realized.
In an application scenario, a processing model may be trained in advance to implement the image text processing method provided by the present disclosure, and the structure of the processing model may include: a Visual Encoder (english: visual Encoder, abbreviation: VE), a Visual-based linear Encoder (english: VLE), a text Decoder (english: linear Decoder, abbreviation: LD), and a text Visual Decoder (english: linear-based Visual Decoder, abbreviation: LVD). The connection relationship among the visual encoder, the visual text encoder, the text decoder and the text visual decoder is shown in fig. 2, the input of the visual encoder and the input of the visual text encoder are used as the input of the processing model, the output of the visual encoder is used as the input of the visual text encoder and the text visual decoder, the output of the visual text encoder is used as the input of the text visual decoder and the text decoder, and the output of the text visual decoder and the output of the text decoder are used as the output of the processing model.
Accordingly, step 102 may include:
and inputting the target image into a visual encoder for encoding to obtain image characteristics.
Step 103 may include:
and inputting the image characteristics and the question text into a visual text encoder for encoding to obtain visual text characteristics.
Illustratively, as shown in fig. 2, the structure of VE may be, for example, an Encoder in a transform, which includes a plurality of sequentially connected coding layers (only one coding layer is illustrated in the figure, and a plurality of coding layers are not illustrated), each coding layer including a Self-Attention sublayer (denoted as Self-Attention), a Feed-Forward unit (denoted as Feed Forward), and a residual unit. The method comprises the steps of taking a target image as input of a self-attention sublayer, taking the target image as a Query vector (English: Q), a Key vector (English: key, K) and a Value vector (English: value, V) of a self-attention mechanism, coding the target image by the self-attention mechanism, overlapping output of the self-attention sublayer and the target image by a residual error unit, inputting an overlapping result into a feedforward unit, and overlapping output of the feedforward unit and the overlapping result by a residual error unit to obtain image characteristics.
The structure of the VLE is shown in FIG. 2, and includes a Self-Attention layer (denoted as Self-Attention), a Cross-Attention layer (denoted as Cross-Attention), a feedforward unit (denoted as Feed Forward), and a residual unit. The question text may be input from the attention layer, the output from the attention layer and the question text may be superimposed by a residual unit to obtain a first superimposed result, and the first superimposed result may be used as an input of the cross-attention layer together with the image feature. And finally, inputting the second superposition result into the feedforward unit, and superposing the output of the feedforward unit and the second superposition result by using the residual error unit to obtain the visual text characteristics.
Step 104 may include:
and inputting the visual text characteristics into a text decoder for decoding to obtain an answer text.
Step 105 may include:
and inputting the visual text characteristics and the image characteristics into a text visual decoder for decoding to obtain identification information.
Illustratively, the structure of the LD is shown in fig. 2, and for example, a Decoder in Bert may be adopted, which includes a Self-Attention layer (denoted as Self-Attention), a Feed-Forward unit (denoted as Feed Forward), a residual unit, and an MLP (english: multi layer Perceptron, chinese: multi-layer Perceptron). The visual text features can be input into a self-attention layer, the visual text features are simultaneously used as query vectors, key vectors and value vectors of a self-attention mechanism, the self-attention mechanism is used for decoding the visual text features, then the output of the self-attention layer and the visual text features are overlapped by a residual error unit, the overlapping result is input into a feedforward unit, then the output of the feedforward unit and the overlapping result are overlapped by the residual error unit, and finally the answer text is obtained through MLP.
As shown in fig. 2, the LVD has a structure including a Cross Attention layer (denoted as Cross-Attention), a Feed Forward unit (denoted as Feed Forward), a residual error unit, and a convolution partition layer (denoted as Conv), and can input visual text features and image features into the Cross Attention layer, superimpose the output of the Cross Attention layer and the image features using the residual error unit, input the result of the superimposition into the Feed Forward unit, superimpose the output of the Feed Forward unit and the result of the superimposition using the residual error unit, and finally obtain identification information through the convolution partition layer. Therefore, end-to-end visual language question and answer landing can be realized through a uniform framework, and the effect of providing evidence for supporting answers is provided while questions are answered.
Fig. 3 is a flowchart illustrating another image text processing method according to an exemplary embodiment, and as shown in fig. 3, step 103 may include:
and step 1031, inputting the question text into a self-attention layer in the visual text encoder, and encoding the question text by using a self-attention mechanism to obtain text features.
And step 1032, inputting the text features and the image features into a cross attention layer in a visual text encoder, and encoding the text features and the image features by using a cross attention mechanism to obtain the visual text features.
For example, the question text may be input into a self-attention layer in a visual text encoder, and the question text may be simultaneously used as a query vector, a key vector, and a value vector of a self-attention mechanism, and the question text may be encoded by the self-attention mechanism to obtain text features. The text feature only contains the information in the question text. On this basis, the text features and the image features can be input into a cross attention layer in a visual text encoder, the text features are used as query vectors of a cross attention mechanism, the image features are used as key vectors and value vectors of the cross attention mechanism, and the text features and the image features are fused by the cross attention mechanism to obtain the visual text features containing information of two modes (a text mode and an image mode).
Specifically, the text feature and the question text may be superimposed by using a residual error unit to obtain a first addition result, and the first addition result and the image feature are used as the input of the cross attention layer. And taking the first superposition result as a query vector of a cross attention mechanism, taking the image features as a key vector and a value vector of the cross attention mechanism, and obtaining the output of the cross attention layer by using the cross attention mechanism. And finally, inputting the second superposition result into the feedforward unit, and superposing the output of the feedforward unit and the second superposition result by using the residual error unit to obtain the visual text characteristics.
In another implementation, step 105 may include:
and inputting the visual text features and the image features into a cross attention layer of a text visual decoder, taking the image features as query vectors of a cross attention mechanism, taking the visual text features as key vectors and value vectors of the cross attention mechanism, and obtaining identification information by using the cross attention mechanism.
For example, the visual text feature and the image feature may be input into a cross attention layer of a text visual decoder, the image feature is used as a query vector of a cross attention mechanism, the visual text feature is used as a key vector and a value vector of the cross attention mechanism, the cross attention mechanism is used for decoding, and finally, the identification information is obtained through a convolution segmentation layer. Specifically, the output of the cross attention layer and the image characteristics can be overlapped by using a residual error unit, the overlapping result is input into a feed-forward unit, the output of the feed-forward unit and the overlapping result are overlapped by using the residual error unit, and finally the identification information is obtained through a convolution segmentation layer.
FIG. 4 is a flowchart illustrating a method for training a visual encoder, a visual text encoder, a text decoder, and a text visual decoder, as shown in FIG. 4, in accordance with an exemplary embodiment, the visual encoder, the visual text encoder, the text decoder, and the text visual decoder are trained by:
step A, a sample input set and a sample output set are obtained, the sample input set comprises a plurality of sample inputs, the sample inputs comprise training images and training question texts corresponding to the training images, the sample output set comprises sample outputs corresponding to the sample inputs, each sample output comprises training answer texts corresponding to the training question texts and training identification information, the training answer texts are used for describing training objects in the training images, and the training identification information is used for identifying areas where the training objects in the training images are located.
For example, before training a visual encoder, a visual text encoder, a text decoder, and a text visual decoder, a sample input set and a sample output set are obtained for training, wherein the sample input set includes a plurality of sample inputs, and the sample output set includes a sample output corresponding to each sample input. The sample input may include training images and training problem text corresponding to the training images, which may be preprocessed. For example, the training images may be randomly enhanced: random scaling, clipping, random color dithering (brightness, contrast, etc.). And the method can also be used for carrying out truncation processing on overlong training problem texts and zero filling processing on overlong training problem texts. Correspondingly, each sample output comprises a training answer text and training identification information corresponding to the training question text, wherein the training answer text is used for describing a training object in the training image, and the training identification information is used for identifying the area where the training object is located in the training image.
And B, inputting the training image in the sample input into a visual encoder for encoding aiming at each sample input to obtain the characteristics of the training image.
And step C, inputting the training image characteristics and the training problem text in the sample input into a visual text encoder for encoding to obtain the training visual text characteristics.
And D, inputting the training visual text characteristics into a text decoder for decoding to obtain a predicted answer text.
And E, inputting the training visual text characteristics and the training image characteristics into a text visual decoder for decoding to obtain the prediction identification information.
And F, training a visual encoder, a visual text encoder, a text decoder and a text visual decoder according to the predicted answer text, the predicted identification information and the sample output corresponding to the sample input.
In an example, the manner of obtaining the predicted answer text and the predicted identification information is the same as the manner of obtaining the answer text and the identification information, and is not described herein again. And finally, training a visual encoder, a visual text encoder, a text decoder and a text visual decoder according to the predicted answer text, the predicted identification information and the sample output corresponding to the sample input. For example, the text loss can be determined according to the predicted answer text and the training answer text in the corresponding sample output, the recognition loss can be determined according to the predicted identification information and the training identification information in the corresponding sample output, then the total loss can be determined according to the text loss and the recognition loss, and finally the parameters of the neurons in the visual encoder, the visual text encoder, the text decoder and the text visual decoder can be corrected by using a back propagation algorithm aiming at reducing the total loss, wherein the parameters of the neurons can be the Weight (English: weight) and the offset (English: bias) of the neurons, for example. And repeating the steps until the total loss meets a preset condition, for example, the total loss is less than a preset loss threshold value, or the total loss is converged, so as to achieve the aim of training the visual encoder, the visual text encoder, the text decoder and the text visual decoder.
Specifically, the visual encoder, the visual text encoder and the text decoder can be pre-trained by utilizing the pre-training data set, and then the pre-trained visual encoder, the pre-trained visual text encoder and the pre-trained text decoder are jointly trained with the text visual decoder, so that the training efficiency can be improved, and the training calculated amount can be effectively reduced. The vision encoder is used for extracting the characteristics of the images, so that massive images can be acquired from a network and used as a pre-training data set to pre-train the vision encoder. Similarly, a large amount of texts can be acquired from the network as a pre-training data set to pre-train the text decoder. Massive texts and corresponding description texts can be acquired from a network to serve as a pre-training data set, and a visual text encoder is pre-trained.
It should be noted that, in the training process, the initial learning rate may be set as: 5e-5, the optimizer may select AdamW, the batch size may be set to 16, the run may be set to 30, and the training images may be of the size: 512 x 512, the length of the training question text may be 20.
Fig. 5 is a flow chart illustrating another method for training a visual encoder, a visual text encoder, a text decoder, and a text visual decoder according to an example embodiment, where the method for training a visual encoder, a visual text encoder, a text decoder, and a text visual decoder further includes:
and G, performing multiple rounds of training on the visual encoder, the visual text encoder, the text decoder and the text visual decoder by using the sample input set, and taking the parameter set of each round of the visual encoder, the visual text encoder, the text decoder and the text visual decoder as a group of parameter copy sets.
And H, determining an inference parameter set according to the multiple sets of parameter copy sets.
And step I, updating the visual encoder, the visual text encoder, the text decoder and the text visual decoder according to the inference parameter set.
For example, in training the visual encoder, the visual text encoder, the text decoder, and the text visual decoder, a plurality of rounds of training are performed, and one round of training is understood to be the completion of steps B to F for each sample input in the sample input set. Each time a round of training is completed, the resulting set of parameters for the visual encoder, visual text encoder, text decoder, and text visual decoder (including weights for neurons, bias arguments, etc.) may be stored as a set of parameter copy sets. In order to avoid that the training result is only locally optimal, after the training of multiple rounds (for example, 30 rounds) is completed, the inference parameter set can be determined according to multiple sets of parameter copy sets corresponding to the multiple rounds. Specifically, smoothing may be performed on multiple sets of parameter copy sets, and the obtained result is used as an inference parameter set, where the smoothing may be, for example, exponential moving average, or other moving average processing, and this disclosure does not specifically limit this. Finally, the visual encoder, visual text encoder, text decoder, and text visual decoder may be updated according to the set of inference parameters to complete the training process. This makes the visual encoder, visual text encoder, text decoder and text visual decoder more robust and universal.
In summary, according to the disclosure, a target image and a problem text corresponding to the target image are first obtained, feature extraction is performed on the target image to obtain an image feature, and feature extraction is performed on the problem text according to the image feature to obtain a visual text feature. And finally, according to the visual text characteristics and the image characteristics, determining the identification information capable of identifying the area where the target object in the target image is located. According to the method, the key information in the question text can be effectively mined by utilizing the image characteristics to assist the characteristic extraction of the question text, the target object in the target image can be accurately identified by utilizing the visual text characteristics to assist the identification of the image characteristics, and the high-accuracy, high-efficiency and end-to-end visual language question-answer landing is realized.
Fig. 6 is a block diagram illustrating an image text processing apparatus according to an exemplary embodiment, and as shown in fig. 6, the apparatus 200 may include:
an obtaining module 201, configured to obtain a target image and a question text corresponding to the target image.
The first extraction module 202 is configured to perform feature extraction on the target image to obtain an image feature.
And the second extraction module 203 is configured to perform feature extraction on the problem text according to the image features to obtain visual text features.
The first determining module 204 is configured to determine, according to the visual text feature, an answer text corresponding to the question text, where the answer text is used to describe a target object in the target image.
The second determining module 205 is configured to determine identification information according to the visual text feature and the image feature, where the identification information is used to identify an area where a target object in the target image is located.
In one implementation, the first extraction module 202 may be configured to:
and inputting the target image into a visual encoder for encoding to obtain image characteristics.
The second extraction module 203 may be configured to:
and inputting the image characteristics and the question text into a visual text encoder for encoding to obtain the visual text characteristics.
The first determination module 204 may be configured to:
and inputting the visual text characteristics into a text decoder for decoding to obtain an answer text.
The second determination module 205 may be configured to:
and inputting the visual text characteristics and the image characteristics into a text visual decoder for decoding to obtain identification information.
Fig. 7 is a block diagram illustrating another image text processing apparatus according to an exemplary embodiment, and as shown in fig. 7, the second extraction module 203 may include:
the self-attention extracting sub-module 2031 is configured to input the question text into a self-attention layer in the visual text encoder, and encode the question text by using a self-attention mechanism to obtain text features.
And the cross attention extracting sub-module 2032 is configured to input the text features and the image features into a cross attention layer in the visual text encoder, and encode the text features and the image features by using a cross attention mechanism to obtain the visual text features.
In one implementation, the cross attention extraction sub-module 2032 may be used to:
and taking the text features as query vectors of a cross attention mechanism, and taking the image features as key vectors and value vectors of the cross attention mechanism, so as to obtain the visual text features by using the cross attention mechanism.
In another implementation, the second determining module 205 may be configured to:
and inputting the visual text features and the image features into a cross attention layer of a text visual decoder, taking the image features as query vectors of a cross attention mechanism, taking the visual text features as key vectors and value vectors of the cross attention mechanism, and obtaining identification information by using the cross attention mechanism.
In one implementation, the visual encoder, the visual text encoder, the text decoder, and the text visual decoder are trained by:
step A, a sample input set and a sample output set are obtained, the sample input set comprises a plurality of sample inputs, the sample inputs comprise training images and training question texts corresponding to the training images, the sample output set comprises sample outputs corresponding to the sample inputs, each sample output comprises training answer texts corresponding to the training question texts and training identification information, the training answer texts are used for describing training objects in the training images, and the training identification information is used for identifying areas where the training objects in the training images are located.
And B, inputting the training image in the sample input into a visual encoder for encoding aiming at each sample input to obtain the characteristics of the training image.
And step C, inputting the training image characteristics and the training problem text in the sample input into a visual text encoder for encoding to obtain the training visual text characteristics.
And D, inputting the training visual text characteristics into a text decoder for decoding to obtain a predicted answer text.
And E, inputting the training visual text characteristics and the training image characteristics into a text visual decoder for decoding to obtain the prediction identification information.
And F, training a visual encoder, a visual text encoder, a text decoder and a text visual decoder according to the predicted answer text, the predicted identification information and the sample output corresponding to the sample input.
In another implementation, the method for training the visual encoder, the visual text encoder, the text decoder, and the text visual decoder further comprises:
and G, performing multiple rounds of training on the visual encoder, the visual text encoder, the text decoder and the text visual decoder by using the sample input set, and taking the parameter set of each round of the visual encoder, the visual text encoder, the text decoder and the text visual decoder as a group of parameter copy sets.
And H, determining an inference parameter set according to the multiple sets of parameter copy sets.
And step I, updating the visual encoder, the visual text encoder, the text decoder and the text visual decoder according to the inference parameter set.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
In summary, according to the disclosure, a target image and a problem text corresponding to the target image are first obtained, feature extraction is performed on the target image to obtain an image feature, and feature extraction is performed on the problem text according to the image feature to obtain a visual text feature. And finally, according to the visual text characteristics and the image characteristics, determining the identification information capable of identifying the area where the target object in the target image is located. According to the method, the key information in the question text can be effectively mined by utilizing the image characteristics to assist the characteristic extraction of the question text, the target object in the target image can be accurately identified by utilizing the visual text characteristics to assist the identification of the image characteristics, and the high-accuracy, high-efficiency and end-to-end visual language question-answer landing is realized.
Referring now to fig. 8, a schematic diagram of an electronic device (e.g., an execution body of an embodiment of the present disclosure) 300 suitable for use in implementing an embodiment of the present disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 8, the electronic device 300 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 301 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for the operation of the electronic apparatus 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
Generally, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 308 including, for example, magnetic tape, hard disk, etc.; and a communication device 309. The communication means 309 may allow the electronic device 300 to communicate wirelessly or by wire with other devices to exchange data. While fig. 8 illustrates an electronic device 300 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may be alternatively implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 309, or installed from the storage means 308, or installed from the ROM 302. The computer program, when executed by the processing device 301, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the terminal devices, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a target image and a problem text corresponding to the target image; performing feature extraction on the target image to obtain image features; performing feature extraction on the problem text according to the image features to obtain visual text features; according to the visual text characteristics, determining an answer text corresponding to the question text, wherein the answer text is used for describing a target object in the target image; and determining identification information according to the visual text characteristics and the image characteristics, wherein the identification information is used for identifying the region of the target object in the target image.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented by software or hardware. The name of the module does not constitute a limitation to the module itself in some cases, and for example, the acquisition module may also be described as a "module that acquires a target image and a question text".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems on a chip (SOCs), complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, 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 compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In accordance with one or more embodiments of the present disclosure, example 1 provides an image text processing method, including: acquiring a target image and a problem text corresponding to the target image; performing feature extraction on the target image to obtain image features; performing feature extraction on the problem text according to the image features to obtain visual text features; according to the visual text characteristics, determining an answer text corresponding to the question text, wherein the answer text is used for describing a target object in the target image; and determining identification information according to the visual text characteristics and the image characteristics, wherein the identification information is used for identifying the area of the target object in the target image.
Example 2 provides the method of example 1, and the performing feature extraction on the target image to obtain an image feature includes: inputting the target image into a visual encoder for encoding to obtain the image characteristics; the step of performing feature extraction on the problem text according to the image features to obtain visual text features comprises the following steps: inputting the image features and the problem text into a visual text encoder for encoding to obtain the visual text features; the determining the answer text corresponding to the question text according to the visual text features includes: inputting the visual text characteristics into a text decoder for decoding to obtain the answer text; the determining identification information according to the visual text feature and the image feature comprises: and inputting the visual text characteristics and the image characteristics into a text visual decoder for decoding to obtain the identification information.
Example 3 provides the method of example 2, wherein encoding the image feature and the question text input to a visual text encoder to obtain the visual text feature, comprising: inputting the question text into a self-attention layer in the visual text encoder, and encoding the question text by using a self-attention mechanism to obtain text characteristics; and inputting the text features and the image features into a cross attention layer in a visual text encoder, and encoding the text features and the image features by using a cross attention mechanism to obtain the visual text features.
Example 4 provides the method of example 3, wherein encoding the text feature and the image feature using a cross-attention mechanism to obtain the visual text feature, comprising: and taking the text features as query vectors of a cross attention mechanism, and taking the image features as key vectors and value vectors of the cross attention mechanism, so as to obtain the visual text features by using the cross attention mechanism.
Example 5 provides the method of example 2, wherein the inputting the visual text feature and the image feature into a text visual decoder for decoding to obtain the identification information, includes: and inputting the visual text features and the image features into a cross attention layer of the text visual decoder, taking the image features as query vectors of a cross attention mechanism, taking the visual text features as key vectors and value vectors of the cross attention mechanism, and obtaining the identification information by using the cross attention mechanism.
Example 6 provides the methods of examples 1-5, the visual encoder, the visual text encoder, the text decoder, and the text visual decoder trained in the following manner, in accordance with one or more embodiments of the present disclosure: acquiring a sample input set and a sample output set, wherein the sample input set comprises a plurality of sample inputs, the sample inputs comprise training images and training question texts corresponding to the training images, the sample output set comprises sample outputs corresponding to the sample inputs, each sample output comprises a training answer text and training identification information corresponding to the training question texts, the training answer text is used for describing training objects in the training images, and the training identification information is used for identifying areas where the training objects are located in the training images; for each sample input, inputting the training image in the sample input into the visual encoder for encoding to obtain training image features; inputting the training image features and the training problem text in the sample input into the visual text encoder for encoding to obtain training visual text features; inputting the training visual text characteristics into the text decoder for decoding to obtain a predicted answer text; inputting the training visual text features and the training image features into the text visual decoder for decoding to obtain prediction identification information; and training the visual encoder, the visual text encoder, the text decoder and the text visual decoder according to the predicted answer text, the predicted identification information and the sample output corresponding to the sample input.
Example 7 provides the method of example 6, the manner of training the visual encoder, the visual text encoder, the text decoder, and the text visual decoder further comprising: performing a plurality of rounds of training of the visual encoder, the visual text encoder, the text decoder, and the text visual decoder using the sample input set, and taking a set of parameters for the visual encoder, the visual text encoder, the text decoder, and the text visual decoder for each round as a set of parameter copy sets; determining a set of inference parameters according to the multiple sets of parameter copy sets; updating the visual encoder, the visual text encoder, the text decoder, and the text visual decoder according to the set of inference parameters.
Example 8 provides, in accordance with one or more embodiments of the present disclosure, an image text processing apparatus comprising: the acquisition module is used for acquiring a target image and a problem text corresponding to the target image; the first extraction module is used for extracting the features of the target image to obtain image features; the second extraction module is used for extracting the features of the problem text according to the image features to obtain visual text features; a first determining module, configured to determine, according to the visual text feature, an answer text corresponding to the question text, where the answer text is used to describe a target object in the target image; and the second determining module is used for determining identification information according to the visual text characteristics and the image characteristics, wherein the identification information is used for identifying the area of the target object in the target image.
Example 9 provides, in accordance with one or more embodiments of the present disclosure, a computer-readable medium having stored thereon a computer program that, when executed by a processing device, performs the steps of the methods of examples 1-7.
Example 10 provides, in accordance with one or more embodiments of the present disclosure, an electronic device comprising: a storage device having a computer program stored thereon; processing means for executing the computer program in the storage means to implement the steps of the methods of examples 1-7.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims. With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims (10)

1. An image text processing method, characterized in that the method comprises:
acquiring a target image and a problem text corresponding to the target image;
performing feature extraction on the target image to obtain image features;
performing feature extraction on the problem text according to the image features to obtain visual text features;
according to the visual text characteristics, determining an answer text corresponding to the question text, wherein the answer text is used for describing a target object in the target image;
and determining identification information according to the visual text characteristics and the image characteristics, wherein the identification information is used for identifying the area of the target object in the target image.
2. The method according to claim 1, wherein the performing feature extraction on the target image to obtain an image feature comprises:
inputting the target image into a visual encoder for encoding to obtain the image characteristics;
the step of performing feature extraction on the problem text according to the image features to obtain visual text features comprises the following steps:
inputting the image features and the question texts into a visual text encoder for encoding to obtain the visual text features;
the determining the answer text corresponding to the question text according to the visual text features includes:
inputting the visual text characteristics into a text decoder for decoding to obtain the answer text;
determining identification information according to the visual text feature and the image feature, including:
and inputting the visual text characteristics and the image characteristics into a text visual decoder for decoding to obtain the identification information.
3. The method of claim 2, wherein said encoding said image feature and said question text into a visual text encoder to obtain said visual text feature comprises:
inputting the question text into a self-attention layer in the visual text encoder, and encoding the question text by using a self-attention mechanism to obtain text characteristics;
and inputting the text features and the image features into a cross attention layer in a visual text encoder, and encoding the text features and the image features by using a cross attention mechanism to obtain the visual text features.
4. The method of claim 3, wherein said encoding the text feature and the image feature using a cross-attention mechanism to obtain the visual text feature comprises:
and taking the text features as query vectors of a cross attention mechanism, and taking the image features as key vectors and value vectors of the cross attention mechanism, so as to obtain the visual text features by using the cross attention mechanism.
5. The method of claim 2, wherein said inputting the visual text feature and the image feature into a text visual decoder for decoding to obtain the identification information comprises:
and inputting the visual text features and the image features into a cross attention layer of the text visual decoder, taking the image features as query vectors of a cross attention mechanism, taking the visual text features as key vectors and value vectors of the cross attention mechanism, and obtaining the identification information by using the cross attention mechanism.
6. The method of any of claims 2-5, wherein the visual encoder, the visual text encoder, the text decoder, and the text visual decoder are trained by:
acquiring a sample input set and a sample output set, wherein the sample input set comprises a plurality of sample inputs, the sample inputs comprise training images and training question texts corresponding to the training images, the sample output set comprises sample outputs corresponding to the sample inputs, each sample output comprises a training answer text and training identification information corresponding to the training question texts, the training answer text is used for describing training objects in the training images, and the training identification information is used for identifying areas where the training objects are located in the training images;
for each sample input, inputting the training image in the sample input into the visual encoder for encoding to obtain training image features;
inputting the training image features and the training problem text in the sample input into the visual text encoder for encoding to obtain training visual text features;
inputting the training visual text characteristics into the text decoder for decoding to obtain a predicted answer text;
inputting the training visual text features and the training image features into the text visual decoder for decoding to obtain prediction identification information;
and training the visual encoder, the visual text encoder, the text decoder and the text visual decoder according to the predicted answer text, the predicted identification information and the sample output corresponding to the sample input.
7. The method of claim 6, wherein training the visual encoder, the visual text encoder, the text decoder, and the text visual decoder further comprises:
performing a plurality of rounds of training of the visual encoder, the visual text encoder, the text decoder, and the text visual decoder using the sample input set, and taking parameter sets of the visual encoder, the visual text encoder, the text decoder, and the text visual decoder for each round as a set of parameter copy sets;
determining a set of inference parameters according to the multiple sets of parameter copy sets;
updating the visual encoder, the visual text encoder, the text decoder, and the text visual decoder according to the set of inference parameters.
8. An image text processing apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring a target image and a problem text corresponding to the target image;
the first extraction module is used for extracting the features of the target image to obtain image features;
the second extraction module is used for extracting the features of the problem text according to the image features to obtain visual text features;
a first determining module, configured to determine, according to the visual text feature, an answer text corresponding to the question text, where the answer text is used to describe a target object in the target image;
and the second determining module is used for determining identification information according to the visual text characteristics and the image characteristics, wherein the identification information is used for identifying the area of the target object in the target image.
9. A computer-readable medium, on which a computer program is stored, characterized in that the program, when being executed by processing means, carries out the steps of the method of any one of claims 1 to 7.
10. An electronic device, comprising:
a storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to carry out the steps of the method according to any one of claims 1 to 7.
CN202211020909.4A 2022-08-24 2022-08-24 Image text processing method and device, readable medium and electronic equipment Pending CN115331228A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211020909.4A CN115331228A (en) 2022-08-24 2022-08-24 Image text processing method and device, readable medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211020909.4A CN115331228A (en) 2022-08-24 2022-08-24 Image text processing method and device, readable medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN115331228A true CN115331228A (en) 2022-11-11

Family

ID=83926070

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211020909.4A Pending CN115331228A (en) 2022-08-24 2022-08-24 Image text processing method and device, readable medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN115331228A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116110056A (en) * 2022-12-29 2023-05-12 北京百度网讯科技有限公司 Information extraction method and device, electronic equipment and storage medium
CN116486421A (en) * 2023-04-28 2023-07-25 书行科技(北京)有限公司 Image translation and detection method, image model training method and related products
CN116704405A (en) * 2023-05-22 2023-09-05 阿里巴巴(中国)有限公司 Behavior recognition method, electronic device and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116110056A (en) * 2022-12-29 2023-05-12 北京百度网讯科技有限公司 Information extraction method and device, electronic equipment and storage medium
CN116110056B (en) * 2022-12-29 2023-09-26 北京百度网讯科技有限公司 Information extraction method and device, electronic equipment and storage medium
CN116486421A (en) * 2023-04-28 2023-07-25 书行科技(北京)有限公司 Image translation and detection method, image model training method and related products
CN116486421B (en) * 2023-04-28 2024-03-22 书行科技(北京)有限公司 Training method of image translation model and related products
CN116704405A (en) * 2023-05-22 2023-09-05 阿里巴巴(中国)有限公司 Behavior recognition method, electronic device and storage medium

Similar Documents

Publication Publication Date Title
CN115331228A (en) Image text processing method and device, readable medium and electronic equipment
CN111767371B (en) Intelligent question-answering method, device, equipment and medium
US20230394671A1 (en) Image segmentation method and apparatus, and device, and storage medium
CN113313064A (en) Character recognition method and device, readable medium and electronic equipment
CN112883967B (en) Image character recognition method, device, medium and electronic equipment
CN116129452A (en) Method, application method, device, equipment and medium for generating document understanding model
CN115817463B (en) Vehicle obstacle avoidance method, device, electronic equipment and computer readable medium
CN116050496A (en) Determination method and device, medium and equipment of picture description information generation model
CN115578570A (en) Image processing method, device, readable medium and electronic equipment
CN115908640A (en) Method and device for generating image, readable medium and electronic equipment
CN112883968A (en) Image character recognition method, device, medium and electronic equipment
CN114067327A (en) Text recognition method and device, readable medium and electronic equipment
CN110956128A (en) Method, apparatus, electronic device, and medium for generating lane line image
CN116164770B (en) Path planning method, path planning device, electronic equipment and computer readable medium
CN115270981A (en) Object processing method and device, readable medium and electronic equipment
CN115546487A (en) Image model training method, device, medium and electronic equipment
CN115937864A (en) Text overlap detection method, device, medium and electronic equipment
CN112487937B (en) Video identification method and device, storage medium and electronic equipment
CN116244431A (en) Text classification method, device, medium and electronic equipment
CN115408609A (en) Parking route recommendation method and device, electronic equipment and computer readable medium
CN114495081A (en) Text recognition method and device, readable medium and electronic equipment
CN113222050A (en) Image classification method and device, readable medium and electronic equipment
CN115240042B (en) Multi-mode image recognition method and device, readable medium and electronic equipment
CN116129003A (en) Digital face generation method and device, storage medium and electronic equipment
CN115310728B (en) Parking route generation method, device, equipment and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination