An image description generation method, device, storage medium and electronic equipment

By employing a cascaded diffusion model and a semantic feature-guided image description generation method, the problems of high model complexity and low-quality description are solved, achieving high-quality image description generation.

CN115810068BActive Publication Date: 2026-11-20JINGDONG TECH HLDG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211552342.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-05
Publication Date
2026-11-20
Estimated Expiration
2042-12-05

AI Technical Summary

Technical Problem

Existing image description generation techniques suffer from high model complexity and low-quality descriptive text, especially when reducing model complexity, it is difficult to generate high-quality descriptive text.

Method used

A cascaded diffusion model is adopted, including an image encoding module, a sentence decoding module, and a semantic analysis module. The output sentence is improved step by step through cascading, and the semantic features of the target image are introduced as prior information to guide the generation of descriptive text.

Benefits of technology

While reducing model complexity, the quality of descriptive text sentences and the coherence of visual language alignment are improved, resulting in more accurate descriptive text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115810068B_ABST
    Figure CN115810068B_ABST
Patent Text Reader

Abstract

The application discloses an image description generation method and device, a storage medium and electronic equipment. The method comprises the following steps: acquiring a target image, identifying objects included in the target image to form an object set; inputting the object set into an image description model to obtain a probability set output by the image description model; determining a corresponding word at each word position based on the probability set and a preset word set, and forming a description text of the target image based on the determined word. The image description model comprises a plurality of cascaded diffusion models, and each diffusion model comprises an image encoding module, a sentence decoding module and a semantic analysis module. The output sentence is gradually improved in a cascaded manner, so that the output sentence has better visual language alignment and language coherence. The semantic features of the target image are introduced into each diffusion model to provide guidance, which is beneficial to improving the accuracy of the description text and improving the text quality of the description text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to an image description generation method, apparatus, storage medium, and electronic device. Background Technology

[0002] As one of the fundamental tasks in the fields of vision and language, image description generation technology aims to describe image content using natural language sentences. This technology requires neural network models to perceive visual content in a scene and describe it using human language, simulating the basic ability of human intelligence and naturally linking computer vision and natural language processing.

[0003] In the process of realizing this invention, it was found that the prior art has at least the following technical problems: the current image description generation technology has the problem of high model complexity and dependence on a large amount of computing resources; or, when the model complexity is reduced, there is the problem of generating low-quality descriptive text. Summary of the Invention

[0004] This invention provides an image description generation method, apparatus, storage medium, and electronic device to improve the quality of image description text while reducing model complexity.

[0005] According to one aspect of the present invention, an image description generation method is provided, comprising:

[0006] Acquire a target image, identify the objects included in the target image, and form an object set;

[0007] The object set is input into the image description model to obtain the probability set output by the image description model;

[0008] Based on the probability set and the preset vocabulary set, the corresponding words at each word position are determined, and the descriptive text of the target image is formed based on the determined words.

[0009] The image description model includes multiple cascaded diffusion models. Each diffusion model includes an image encoding module, a sentence decoding module, and a semantic analysis module. The semantic analysis module obtains semantic features based on the object set; the image encoding module obtains encoding features based on the object set; and the sentence decoding module obtains a probability set of the current diffusion model based on the semantic features and the encoding features.

[0010] According to another aspect of the present invention, an image description generation apparatus is provided, comprising:

[0011] The object set extraction module is used to acquire a target image, identify the objects included in the target image, and form an object set.

[0012] The prediction probability determination module is used to input the object set into the image description model to obtain the probability set output by the image description model;

[0013] The descriptive text generation module is used to determine the words corresponding to each word position based on the probability set and the preset word set, and to form the descriptive text of the target image based on the determined words.

[0014] The image description model includes multiple cascaded diffusion models. Each diffusion model includes an image encoding module, a sentence decoding module, and a semantic analysis module. The semantic analysis module obtains semantic features based on the object set; the image encoding module obtains encoding features based on the object set; and the sentence decoding module obtains a probability set of the current diffusion model based on the semantic features and the encoding features.

[0015] Optionally, the output of any of the diffusion models can be skipped to the output of the previous diffusion model. The prediction results of the previous diffusion model and the prediction results of the current diffusion model are then fused and input into the next diffusion model.

[0016] Optionally, the method further includes: acquiring one or more of the following: current state data, previous prediction result data, and previous diffusion model prediction result data:

[0017] Accordingly, the semantic analysis module is also used to obtain semantic features based on one or more of the current state data, the prediction result data of the previous time, and the prediction result data of the previous diffusion model, as well as the object set.

[0018] Optionally, the semantic analysis module includes: a statement retrieval model, a feature integration model, and a semantic analysis model;

[0019] The semantic retrieval model is used to perform sentence retrieval on the object set to obtain the associated sentences of the target image;

[0020] The feature integration model converts the associated statement into a first feature vector, and forms a second feature vector based on one or more of the current state data, the prediction result data of the previous time, and the prediction result data of the previous diffusion model. The first feature vector and the second feature vector are concatenated to obtain a concatenated feature vector.

[0021] The semantic analysis model analyzes and processes the concatenated feature vectors to obtain semantic features.

[0022] Optionally, the sentence decoding module includes a first attention mechanism processing unit, a second attention mechanism processing unit, and a feedforward processing unit;

[0023] The first attention mechanism processing unit performs attention mechanism processing on the speech features to obtain the first attention feature;

[0024] The second attention mechanism processing unit performs attention mechanism processing on the semantic attention feature and the encoded feature to obtain the second attention feature;

[0025] The feedforward processing unit processes the second attention feature to obtain the probability set of the current diffusion model.

[0026] Optionally, the probability set includes probability distribution data describing the positions of each word in the text;

[0027] The step of determining the word corresponding to each word position based on the probability set and the preset word set includes:

[0028] For any word position, a weighted average is taken based on the probability distribution data corresponding to the word position and the word position representation to obtain the target mapping position corresponding to the word position.

[0029] Based on the target mapping bit, the word is matched in the preset word set to obtain the word corresponding to the word position.

[0030] Optionally, the training method for the image description model includes:

[0031] Obtain a first training image and a first target statement corresponding to the first training image; perform a first-stage training process on the image description model to be trained based on the first training image and the first target statement to obtain an intermediate image description model, wherein the image description model to be trained is trained using a first loss function in the first stage.

[0032] A second training image is acquired, and a second target statement corresponding to the second training image is determined based on the teacher model. The intermediate image description model is then trained in a second stage based on the second training image and the second target statement to obtain a trained image description model. In the second stage, the image description model to be trained is trained using a second loss function.

[0033] Optionally, the first stage of training the image description model to be trained based on the first training image and the first target statement to obtain an intermediate image description model includes:

[0034] The following training process is executed iteratively, and the intermediate image description model is obtained when the training termination condition is met:

[0035] The first target statement is subjected to noise processing to obtain the state data corresponding to each time point; and the object set of the first training image is extracted.

[0036] The state data and the object set are input into the image description model to be trained to obtain the first prediction data, and the first prediction statement is obtained based on the first prediction data.

[0037] Based on the first loss function determined by the first prediction statement and the first target statement, the model parameters of the image description model to be trained are adjusted.

[0038] Optionally, the first loss function determined based on the first prediction statement and the first target statement includes:

[0039] A first loss term is generated based on the content of the first predicted statement and the first target statement;

[0040] A second loss term is generated based on the first classification label of each word in the first predicted statement and the second classification label of each word in the first target statement;

[0041] The first loss function is determined based on the first loss term and the second loss term.

[0042] Optionally, the teacher model is an autoregressive neural network model, and the second target statement is the output statement of the teacher model after processing the second training image;

[0043] The second stage of training the intermediate image description model based on the second training image and the second target statement to obtain the trained image description model includes:

[0044] The second target statement is subjected to noise processing to obtain the state data corresponding to each time point; and the object set of the second training image is extracted.

[0045] The state data and the object set are input into the intermediate image description model to obtain second prediction data, and multiple second prediction statements are obtained based on the second prediction data, wherein the second prediction statements include the second target statement;

[0046] Based on the second loss function determined by the plurality of second prediction statements, the model parameters of the image description model to be trained are adjusted, wherein the second loss function includes the sentence-level reward function of each second target statement, and the sentence-level reward function includes the positive reward function corresponding to the second target statement.

[0047] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0048] At least one processor; and

[0049] A memory communicatively connected to the at least one processor; wherein,

[0050] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the image description generation method according to any embodiment of the present invention.

[0051] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the image description generation method according to any embodiment of the present invention.

[0052] The technical solution of this invention processes a set of objects in a target image through multiple cascaded diffusion models. Multiple diffusion Transformer structures are stacked to progressively improve the output sentence in a cascaded manner, resulting in better visual-linguistic alignment and linguistic coherence. The semantic features of the target image are introduced into each diffusion model as prior information to guide the generation process of the descriptive text, which helps improve the accuracy and quality of the descriptive text.

[0053] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0054] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0055] Figure 1 This is a flowchart of an image description generation method provided in an embodiment of the present invention;

[0056] Figure 2 This is a schematic diagram of an image description model provided in an embodiment of the present invention;

[0057] Figure 3 This is a schematic diagram of a diffusion model provided in an embodiment of the present invention;

[0058] Figure 4This is a schematic diagram of the structure of an image description generation device provided in an embodiment of the present invention;

[0059] Figure 5 This is a schematic diagram of the structure of an electronic device that implements an embodiment of the present invention. Detailed Implementation

[0060] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0061] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0062] Image description generation models are mainly designed in two ways: autoregressive neural networks and non-autoregressive neural networks. Taking autoregressive neural networks as an example, they can be implemented using the Transformer network model. However, solutions based on the autoregressive decoding paradigm only allow one-way text message passing and typically rely on substantial computational resources; the computational complexity of the model increases quadratically with sentence length. Compared to autoregressive methods that generate sentences word by word, existing techniques like non-autoregressive neural networks decode all words in parallel, thus enabling bidirectional text message passing. However, the performance of non-autoregressive neural networks is lower than that of autoregressive Transformer models. Furthermore, because these existing techniques output all words of a sentence in parallel, they cannot fully utilize sentence order dependencies, leading to word repetition or omissions in the output sentences and resulting in poor-quality predicted description text.

[0063] To address the aforementioned technical problems, embodiments of the present invention provide an image description generation method, see [link to relevant documentation]. Figure 1 , Figure 1This is a flowchart of an image description generation method provided by an embodiment of the present invention. This embodiment is applicable to generating descriptive text for a target image. The method can be executed by an image description generation device, which can be implemented in hardware and / or software and can be configured in electronic devices such as computers, servers, and mobile phones. Figure 1 As shown, the method includes:

[0064] S110. Acquire the target image, identify the objects included in the target image, and form an object set.

[0065] S120. Input the object set into the image description model to obtain the probability set output by the image description model.

[0066] S130. Based on the probability set and the preset vocabulary set, determine the vocabulary corresponding to each vocabulary position, and form the descriptive text of the target image based on the determined vocabulary.

[0067] The target image is the image used for description. This target image can be an image captured in real-time by the image acquisition component of an electronic device, an image locally stored in the electronic device, or an image imported from an external source. Optionally, the target image can be individual frame images from a video. Correspondingly, the descriptive text generated for each frame image is combined according to the temporal relationship of the frame images to form the video description text. Optionally, the descriptive text generated for each frame image can be integrated to eliminate duplicate or invalid descriptive words in adjacent frame images, thereby improving the text quality and readability of the video description text. Optionally, the target image can be a subset of frame images from a video. For example, it can be keyframe images extracted from the video, used as target images, and their descriptive text determined. Further, the video description text can be formed based on the descriptive text of the keyframe images. It is understood that this embodiment does not limit the source and application scenario of the target image. Different subsequent processing can be performed on the descriptive text of the target object in different application scenarios.

[0068] For any target image, the objects included in the target image are extracted to form an object set, which can be achieved, for example, through a pre-set object detection model. Specifically, the target objects are input into the aforementioned object detection model to obtain the object set corresponding to the target image. The object set includes multiple object features, which can be represented as follows: Where k can be the number of objects. D represents each object v Dimensional features.

[0069] The image description model processes the object set corresponding to the target image, and determines the descriptive text corresponding to the target image based on the processing result (i.e., the probability set). Here, the image description model is an improved non-autoregressive model. While reducing model complexity, it provides image semantic information as prior information during the descriptive text generation process, guiding the generation of the descriptive text and reducing the repetition and omission of semantic words.

[0070] The image description model includes multiple cascaded diffusion models. The number of diffusion models is not limited and can be determined based on the accuracy requirements of the description text and factors such as the memory usage and computing power consumption of the models.

[0071] For example, see Figure 2 , Figure 2 This is a schematic diagram of the image description model provided in an embodiment of the present invention. In this model, the output of any diffusion model is connected to the output of the previous diffusion model in a skip connection. The prediction result data of the previous diffusion model and the prediction result data of the current diffusion model are fused together before being input to the next diffusion model. The prediction result data of each diffusion model can be a probability set. Fusing the prediction result data of the previous diffusion model and the prediction result data of the current diffusion model can be done by fusing the probability sets output by the previous diffusion model and the probability sets output by the current diffusion model. Specifically, the probability distributions of the same word position in the two probability sets can be fused. The fusion of probability distributions can be achieved by averaging the corresponding probability data in the two probability sets, etc. The specific method of fusion is not limited.

[0072] The prediction results of each diffusion model are fused with the prediction results of the preceding diffusion model and used as the input information for the next diffusion model. By stacking multiple diffusion models, the output statement is progressively improved in a cascading manner, resulting in better visual-language alignment and linguistic coherence. In some embodiments, the prediction statement corresponding to the current diffusion model can be determined by the fusion probability set after fusion processing.

[0073] Based on the above embodiments, each diffusion model has the same structure. For example, the diffusion model can be based on the diffusion transformer network model, with the addition of a semantic analysis module to provide semantic guidance for the generation process of descriptive text.

[0074] Optionally, any of the diffusion models includes an image encoding module, a sentence decoding module, and a semantic analysis module, wherein the semantic analysis module obtains semantic features based on the object set; the image encoding module obtains encoding features based on the object set; and the sentence decoding module obtains a probability set of the current diffusion model based on the semantic features and the encoding features.

[0075] For example, see Figure 3 , Figure 3 This is a schematic diagram of a diffusion model provided in an embodiment of the present invention.

[0076] In this embodiment, the processing of the target image includes a cyclic processing process with T time steps, where each time step t corresponds to one cyclic processing process, t∈(0,T). At any time step t, the state data of the current time step is acquired and used as the input information for the current iteration. Further, if time step t is not the first iteration time step, the prediction result data of the previous time step is acquired and used as the input information for the current iteration. The prediction result data of the previous time step can be the prediction result data output by the last diffusion model in the previous iteration. Further, for multiple cascaded diffusion models, for diffusion models other than the first diffusion model, the prediction result data of the previous diffusion model in the current iteration can be acquired and used as the input information for that diffusion model in the current iteration. It can be understood that the prediction result data of the previous diffusion model in the current iteration can be the fused prediction result data corresponding to the previous diffusion model.

[0077] Accordingly, for any diffusion model in any iteration, one or more of the following are obtained: the current state data, the prediction result data from the previous time step, and the prediction result data from the previous diffusion model. The current state data can be determined by determining initial state data, adding noise to the initial state data based on the current time t, and then obtaining the current state data. For example, it can be obtained based on the following formula:

[0078]

[0079] Where x0 is the initial state data, t' = t / T, ∈ ~N(0,I), t ~U(0,T), N is a normal distribution, U is a uniform distribution, and γ(t′) is a monotonically increasing function. The initial state data can be random sentence data determined from a pre-set vocabulary. Since each word in a text sentence is discrete data, in this embodiment, each word is converted into binary data; correspondingly, the initial state data here can be binary data obtained by converting random sentences.

[0080] Based on the above embodiments, one or more of the current state data, the prediction result data of the previous time, and the prediction result data of the previous diffusion model are used as input information for the semantic analysis module. Accordingly, the semantic analysis module is also used to obtain semantic features based on one or more of the current state data, the prediction result data of the previous time, and the prediction result data of the previous diffusion model, as well as the object set, to provide semantic guidance for the generation of descriptive text.

[0081] Specifically, the semantic analysis module includes a statement retrieval model, a feature integration model, and a semantic analysis model. The semantic retrieval model performs statement retrieval on the object set to obtain associated statements for the target image. Here, a pre-set statement training library is provided, containing a large number of pre-defined statements. The statement retrieval model identifies associated statements that match the target image from this large library. This statement training library is updated periodically to ensure the accuracy of the statements. In some embodiments, multiple statement training libraries can be determined based on the application scenario; different application scenarios can correspond to different statement training libraries. Accordingly, associated statements are matched in the corresponding statement training library based on the application scenario of the target image, improving the targeting of associated statement retrieval while reducing the amount of retrieval data.

[0082] The feature integration model converts the associated statement into a first feature vector. For example, this can be achieved by performing feature transformation on the associated statement through an embedding network layer. Alternatively, the associated statement can be converted into binary data, and then processed through a fully connected layer to obtain the first feature vector, such as z. r =FC(Sr), where Sr is the binary data corresponding to the associated statement.

[0083] Simultaneously, the feature integration model also forms a second feature vector based on one or more of the current state data, the prediction result data from the previous time step, and the prediction result data from the previous diffusion model. The first feature vector and the second feature vector are concatenated to obtain a concatenated feature vector. For example, the second feature vector corresponding to the first diffusion model could be... For example, the second feature vector corresponding to a non-first diffusion model could be Where, x t The state data at time t, x0 is the prediction result data from the previous moment. i-1 This represents the prediction results from the previous diffusion model, where i can be the sequence number of the diffusion model. Here, x... t x0 i-1 and These can be binary data. It can be the binary data corresponding to the prediction statement determined based on the probability set in the prediction result data of the previous moment, x0 i-1 It can be the binary data corresponding to the prediction statement determined by the probability set in the prediction results data of the previous diffusion model. Accordingly, the first feature vector and the second feature vector are concatenated to obtain the concatenated feature vector.

[0084] In some embodiments, the perceptual features at the current moment can also be determined, and these perceptual features can be concatenated with a first feature vector and a second feature vector to obtain a concatenated feature vector. The perceptual features at the current moment can be determined by a multilayer perceptron on incremental data at the current moment. For example, the perceptual features at the current moment can be... Accordingly, the first feature vector, the second feature vector, and the perceptual features are concatenated to obtain the concatenated feature vector. For example, the concatenated feature vector can be represented as:

[0085] The semantic analysis model analyzes and processes the concatenated feature vector to obtain semantic features. The semantic analysis model can be a transformer model, which sequentially includes a multi-head self-attention layer, a residual and normalization layer, a feedforward network layer, and another residual and normalization layer. The input information of the semantic analysis model is the concatenated feature vector, and the output information is the semantic features.

[0086] In some embodiments, the image encoder is a transformer model, which includes, for example, a multi-head self-attention layer, a residual and normalization layer, a feedforward network layer, and a residual and normalization layer in sequence. The input information of the image encoder is the object set of the target image, and the output information is the encoded features.

[0087] For example, the processing in an image encoder can be represented as follows:

[0088] V i+1 =FFN(norm(V i +MultiHead(V i V i V i )));

[0089] FFN(Z)=norm(Z+FC(δ(FC(Z))));

[0090] MultiDead(Q,K,V)=Concat(Head1,…Head H W o ;

[0091] Head i =Attention(QW i Q ,KWi K VW i V );

[0092]

[0093] Where FFN is the feedforward layer, MultiHead is the multi-head self-attention layer, norm is the layer normalization, FC is the fully connected layer, Concat(·) is the concatenation operation, δ is the activation function, and W i Q W i K W i V W O Let H be the weight matrix of the i-th head, where H is the number of heads and d is the dimension of each head.

[0094] The semantic analysis model and the image encoder are connected to the sentence decoding module, respectively, and transmit the semantic features and encoded features to the sentence decoding module. The sentence decoding module processes the semantic features and encoded features to obtain a probability set.

[0095] Optionally, the sentence decoding module includes a first attention mechanism processing unit, a second attention mechanism processing unit, and a feedforward processing unit; wherein, the first attention mechanism processing unit includes a multi-head self-attention layer, a residual and a normalization layer, the second attention mechanism processing unit includes a multi-head self-attention layer, a residual and a normalization layer, and the feedforward processing unit includes a feedforward network layer and a residual and a normalization layer.

[0096] The first attention mechanism processing unit performs attention mechanism processing on the speech features to obtain the first attention feature; the second attention mechanism processing unit performs attention mechanism processing on the semantic attention feature and the encoded feature to obtain the second attention feature; and the feedforward processing unit processes the second attention feature to obtain the probability set of the current diffusion model.

[0097] For example, the processing procedure of the feedforward processing unit in the sentence decoding module can be represented as follows:

[0098]

[0099]

[0100] in For encoding features, h i This is the primary attention feature.

[0101] In some embodiments, the feedforward processing unit further includes a linear layer to obtain a probability set, for example... Among them W T It is a weight matrix. and p i ∈R W These are the hidden state vector and probability distribution corresponding to the i-th word, respectively. Multiple probability distributions form a probability set. The probability set includes probability distribution data describing the position of each word in the text.

[0102] The corresponding words are determined by the probability distribution data at each word position, and the words are arranged in order to form the descriptive text of the target image.

[0103] Optionally, determining the word corresponding to each word position based on the probability set and the preset word set includes: for any word position, performing a weighted average based on the probability distribution data corresponding to the word position and the word position representation to obtain the target mapping position corresponding to the word position; and matching the target mapping position in the preset word set to obtain the word corresponding to the word position.

[0104] For any word position, there are w probability distribution data at that word position, where w can be the number of words in a preset word set. Each word in the preset word set corresponds to a word bit representation, which can be a binary representation. By taking a weighted average of the probability distribution data corresponding to the word position and the word bit representation, a target mapping bit corresponding to the word position is obtained. This target mapping bit is then matched against the preset word set to obtain the word corresponding to that word position. In other words, the word corresponding to the target mapping bit is determined as the word corresponding to that word position.

[0105] For example, it can be achieved through To achieve, where b i p is the target mapping bit at the i-th word position. i c For p i The c-th probability in B c It is the position representation of the c-th word in the vocabulary.

[0106] Each diffusion model in the image description model performs the above process. Accordingly, the cascaded diffusion models in the image description model can be represented as follows:

[0107]

[0108] Where M is the total number of stacked diffusion Transformer models, and f1 is the first diffusion Transformer model that meets the above semantic conditions.

[0109] The above-mentioned cascaded diffusion models are processed T times in a loop to obtain the descriptive text corresponding to the target image.

[0110] The technical solution of this embodiment processes the object set of the target image through multiple cascaded diffusion models. Multiple diffusion Transformer structures are stacked to progressively improve the output sentence in a cascaded manner, resulting in better visual-linguistic alignment and linguistic coherence. The semantic features of the target image are introduced into each diffusion model as prior information to guide the generation process of the descriptive text, which helps improve the accuracy and quality of the descriptive text.

[0111] Based on the above embodiments, the image description model can be trained through a two-stage training process to obtain a well-trained image description model. This two-stage training improves the performance of the image description model and enhances the quality of its description of the input image.

[0112] Optionally, the training process of the image description model may be: obtaining a first training image and a first target statement corresponding to the first training image; performing a first-stage training process on the image description model to be trained based on the first training image and the first target statement to obtain an intermediate image description model, wherein the image description model to be trained is trained using a first loss function in the first stage.

[0113] A second training image is acquired, and a second target statement corresponding to the second training image is determined based on the teacher model. The intermediate image description model is then trained in a second stage based on the second training image and the second target statement to obtain a trained image description model. In the second stage, the image description model to be trained is trained using a second loss function.

[0114] In the first stage, the first target statement corresponding to the first training image can be set by the user. In the second stage, the second target statement is automatically output by the teacher model after processing the second training image. During the two training stages, the first target statement only needs to be set in the first stage, reducing the manual annotation work for the training images. The training termination condition for the first stage can be one or more of the following: completing a preset number of training iterations, the trained image description model reaching convergence, or achieving the prediction accuracy requirement of the intermediate image description model. Similarly, the training termination condition for the second stage can be one or more of the following: the trained image description model reaching convergence, or achieving the prediction accuracy requirement of the intermediate image description model.

[0115] In the first stage, the following training process is iteratively executed, and the intermediate image description model is obtained when the training termination condition is met: The first target statement is subjected to noise processing to obtain state data corresponding to each time step; and the object set of the first training image is extracted; the state data and the object set are input into the image description model to be trained to obtain first prediction data, and a first prediction statement is obtained based on the first prediction data; the model parameters of the image description model to be trained are adjusted based on a first loss function determined by the first prediction statement and the first target statement. The noise processing of the first target statement can be obtained using the following formula. Here, x0 represents the state data corresponding to the first target statement, which is the binary data obtained by converting the first target statement. The process of obtaining the first prediction statement will not be elaborated here.

[0116] The first loss function determined based on the first predicted statement and the first target statement includes: generating a first loss term based on the statement content of the first predicted statement and the first target statement; generating a second loss term based on the first classification label of each word in the first predicted statement and the second classification label of each word in the first target statement; and determining the first loss function based on the first loss term and the second loss term.

[0117] The first loss term can be L bit L bit =E t~U(0,T),ε~(0,I) ||f(x t ,γ(t'),V)-x0|| 2 ;

[0118] The second loss term can be the cross-entropy function L. XE The first loss function is based on the cross-entropy function formed by the first classification labels of each word in the first predicted sentence and the second classification labels of each word in the first target sentence. Correspondingly, the first loss function can be the sum of the first loss term and the second loss term. For example, L = L... bit +L XE .

[0119] The first loss function is fed back into the image description model from the training process described above to adjust the model parameters. This training process is repeated until the termination condition of the first stage is met, at which point the image description model trained in the first stage is determined as the intermediate image description model.

[0120] In the second stage, the intermediate image description model is used as the initial image description model for optimization. An autoregressive neural network model is created and used as the teacher model. This autoregressive neural network model is based on high performance, and correspondingly, the second target statement for processing the second training image is a high-quality statement, used as semantic guidance during the training process of the intermediate image description model.

[0121] In the second stage, the following training process is executed cyclically, and a trained image description model is obtained when the termination condition is met: The second target statement is noise-added to obtain state data corresponding to each time step; and the object set of the second training image is extracted; the state data and the object set are input into the intermediate image description model to obtain second prediction data, and multiple second prediction statements are obtained based on the second prediction data, wherein the second prediction statements include the second target statement; based on the second loss function determined by the multiple second prediction statements, the model parameters of the image description model to be trained are adjusted, wherein the second loss function includes the sentence-level reward function of each second target statement, and the sentence-level reward function includes the positive reward function corresponding to the second target statement.

[0122] In the second stage, the second target statement is used as x0 to obtain the state data x at each time step. t The second prediction data includes probability distribution data corresponding to each position of the output sentence. Based on this probability distribution data, multiple second prediction statements can be obtained, which can be collected from a preset vocabulary set. Specifically, for one of the second prediction statements, it is forced to select the vocabulary corresponding to each word position according to the second target statement, instead of sampling from the probability distribution.

[0123] Sentence-level reward functions are generated for each second predicted statement. Quality assessments are performed on different second predicted statements, and the corresponding sentence-level reward functions are determined based on the quality assessment results. These sentence-level reward functions include positive and negative reward functions. The positive reward function corresponding to the second target statement encourages the image description model to produce high-quality instructions while suppressing the possibility of other low-quality sentences (e.g., sentences with repeated words). It is worth noting that when the training of the image description model becomes saturated, if the quality of the predicted statement output by the image description model (measured in CIDEr) is higher than that of the second target statement S... tea The second objective statement S derived from the autoregressive neural network model will be replaced with the second prediction statement estimated by the image description model. tea And continue training.

[0124] For example, the second loss function could be: Where R is the quality evaluation function of the second test statement, which can be the CIDEr metric evaluation function. Correspondingly, the gradient of the second loss function can be expressed as: Where, N y The number of the second prediction statement. For containing the second target statement S tea The second prediction statement.

[0125] It is understandable that the first stage can independently train the image description model to be trained, using the intermediate image description model as the trained image description model; the second stage can independently train the image description model to be trained, obtaining the trained image description model. The process of independently training the image description models in the first and second stages will not be elaborated here.

[0126] Figure 4 This is a schematic diagram of the structure of an image description generation device provided in an embodiment of the present invention. Figure 4 As shown, the device includes:

[0127] Object set extraction module 210 is used to acquire a target image, identify the objects included in the target image, and form an object set;

[0128] The prediction probability determination module 220 is used to input the object set into the image description model to obtain the probability set output by the image description model;

[0129] The description text generation module 230 is used to determine the words corresponding to each word position based on the probability set and the preset word set, and to form the description text of the target image based on the determined words.

[0130] The image description model includes multiple cascaded diffusion models. Each diffusion model includes an image encoding module, a sentence decoding module, and a semantic analysis module. The semantic analysis module obtains semantic features based on the object set; the image encoding module obtains encoding features based on the object set; and the sentence decoding module obtains a probability set of the current diffusion model based on the semantic features and the encoding features.

[0131] The technical solution of this embodiment processes the object set of the target image through multiple cascaded diffusion models. Multiple diffusion Transformer structures are stacked to progressively improve the output sentence in a cascaded manner, resulting in better visual-linguistic alignment and linguistic coherence. The semantic features of the target image are introduced into each diffusion model as prior information to guide the generation process of the descriptive text, which helps improve the accuracy and quality of the descriptive text.

[0132] Based on the above embodiments, optionally, the output of any of the diffusion models can be connected to the output of the previous diffusion model in a skip connection. The prediction result data of the previous diffusion model and the prediction result data of the current diffusion model are fused and then input into the next diffusion model.

[0133] Optionally, based on the above embodiments, the device further includes:

[0134] The data acquisition module is used to acquire one or more of the following: the current state data, the prediction result data from the previous time step, and the prediction result data from the previous diffusion model.

[0135] Accordingly, the semantic analysis module is also used to obtain semantic features based on one or more of the current state data, the prediction result data of the previous time, and the prediction result data of the previous diffusion model, as well as the object set.

[0136] Based on the above embodiments, optionally, the semantic analysis module includes: a statement retrieval model, a feature integration model, and a semantic analysis model;

[0137] The semantic retrieval model is used to perform sentence retrieval on the object set to obtain the associated sentences of the target image;

[0138] The feature integration model converts the associated statement into a first feature vector, and forms a second feature vector based on one or more of the current state data, the prediction result data of the previous time, and the prediction result data of the previous diffusion model. The first feature vector and the second feature vector are concatenated to obtain a concatenated feature vector.

[0139] The semantic analysis model analyzes and processes the concatenated feature vectors to obtain semantic features.

[0140] Based on the above embodiments, optionally, the sentence decoding module includes a first attention mechanism processing unit, a second attention mechanism processing unit, and a feedforward processing unit;

[0141] The first attention mechanism processing unit performs attention mechanism processing on the speech features to obtain the first attention feature;

[0142] The second attention mechanism processing unit performs attention mechanism processing on the semantic attention feature and the encoded feature to obtain the second attention feature;

[0143] The feedforward processing unit processes the second attention feature to obtain the probability set of the current diffusion model.

[0144] Based on the above embodiments, optionally, the probability set includes probability distribution data describing the position of each word in the text;

[0145] The description text generation module 230 is used for:

[0146] For any word position, a weighted average is taken based on the probability distribution data corresponding to the word position and the word position representation to obtain the target mapping position corresponding to the word position.

[0147] Based on the target mapping bit, the word is matched in the preset word set to obtain the word corresponding to the word position.

[0148] Based on the above embodiments, the device further includes:

[0149] The first-stage training module is used to acquire a first training image and a first target statement corresponding to the first training image; and to perform a first-stage training process on the image description model to be trained based on the first training image and the first target statement to obtain an intermediate image description model. In the first stage, the image description model to be trained is trained using a first loss function.

[0150] The second-stage training module is used to acquire the second training image, determine the second target statement corresponding to the second training image based on the teacher model, and perform a second-stage training process on the intermediate image description model based on the second training image and the second target statement to obtain a trained image description model. In the second stage, the image description model to be trained is trained using a second loss function.

[0151] Optionally, the first-stage training module is used for:

[0152] The following training process is executed iteratively, and the intermediate image description model is obtained when the training termination condition is met:

[0153] The first target statement is subjected to noise processing to obtain the state data corresponding to each time point; and the object set of the first training image is extracted.

[0154] The state data and the object set are input into the image description model to be trained to obtain the first prediction data, and the first prediction statement is obtained based on the first prediction data.

[0155] Based on the first loss function determined by the first prediction statement and the first target statement, the model parameters of the image description model to be trained are adjusted.

[0156] Optionally, the first-stage training module is used for:

[0157] A first loss term is generated based on the content of the first predicted statement and the first target statement;

[0158] A second loss term is generated based on the first classification label of each word in the first predicted statement and the second classification label of each word in the first target statement;

[0159] The first loss function is determined based on the first loss term and the second loss term.

[0160] Optionally, the teacher model is an autoregressive neural network model, and the second target statement is the output statement of the teacher model after processing the second training image;

[0161] The second-stage training module is used for:

[0162] The second target statement is subjected to noise processing to obtain the state data corresponding to each time point; and the object set of the second training image is extracted.

[0163] The state data and the object set are input into the intermediate image description model to obtain second prediction data, and multiple second prediction statements are obtained based on the second prediction data, wherein the second prediction statements include the second target statement;

[0164] Based on the second loss function determined by the plurality of second prediction statements, the model parameters of the image description model to be trained are adjusted, wherein the second loss function includes the sentence-level reward function of each second target statement, and the sentence-level reward function includes the positive reward function corresponding to the second target statement.

[0165] The image description generation apparatus provided in the embodiments of the present invention can execute the image description generation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.

[0166] Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0167] like Figure 5As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0168] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0169] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as image description generation methods.

[0170] In some embodiments, the image description generation method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the image description generation method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the image description generation method by any other suitable means (e.g., by means of firmware).

[0171] 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 products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0172] Computer programs for implementing the image description generation method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs can be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0173] This invention also provides a computer-readable storage medium storing computer instructions for causing a processor to execute an image description generation method, the method comprising:

[0174] Acquire a target image, identify the objects included in the target image, and form an object set;

[0175] The object set is input into the image description model to obtain the probability set output by the image description model;

[0176] Based on the probability set and the preset vocabulary set, the corresponding words at each word position are determined, and the descriptive text of the target image is formed based on the determined words.

[0177] The image description model includes multiple cascaded diffusion models. Each diffusion model includes an image encoding module, a sentence decoding module, and a semantic analysis module. The semantic analysis module obtains semantic features based on the object set; the image encoding module obtains encoding features based on the object set; and the sentence decoding module obtains a probability set of the current diffusion model based on the semantic features and the encoding features.

[0178] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0179] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, 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 sound input, voice input, or tactile input).

[0180] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0181] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0182] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0183] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. An image description generation method, characterized in that, include: Acquire a target image, identify the objects included in the target image, and form an object set; The object set is input into the image description model to obtain the probability set output by the image description model; Based on the probability set and the preset vocabulary set, the corresponding words at each word position are determined, and the descriptive text of the target image is formed based on the determined words. The image description model includes multiple cascaded diffusion models. Each diffusion model includes an image encoding module, a sentence decoding module, and a semantic analysis module. The semantic analysis module obtains semantic features based on the object set; the image encoding module obtains encoding features based on the object set; and the sentence decoding module obtains a probability set of the current diffusion model based on the semantic features and the encoding features.

2. The method according to claim 1, characterized in that, The output of any of the diffusion models is connected to the output of the previous diffusion model in a skip connection. The prediction results of the previous diffusion model and the prediction results of the current diffusion model are fused together and then input into the next diffusion model.

3. The method according to claim 1, characterized in that, The method further includes: Obtain one or more of the following: the current state data, the prediction results from the previous time step, and the prediction results from the previous diffusion model. Accordingly, the semantic analysis module is also used to obtain semantic features based on one or more of the current state data, the prediction result data of the previous time, and the prediction result data of the previous diffusion model, as well as the object set.

4. The method according to claim 3, characterized in that, The semantic analysis module includes: a statement retrieval model, a feature integration model, and a semantic analysis model; The statement retrieval model is used to perform statement retrieval on the object set to obtain the associated statements of the target image; The feature integration model converts the associated statement into a first feature vector, and forms a second feature vector based on one or more of the current state data, the prediction result data of the previous time, and the prediction result data of the previous diffusion model. The first feature vector and the second feature vector are concatenated to obtain a concatenated feature vector. The semantic analysis model analyzes and processes the concatenated feature vectors to obtain semantic features.

5. The method according to claim 1, characterized in that, The sentence decoding module includes a first attention mechanism processing unit, a second attention mechanism processing unit, and a feedforward processing unit; The first attention mechanism processing unit performs attention mechanism processing on the semantic features to obtain the first attention feature; The second attention mechanism processing unit performs attention mechanism processing on the first attention feature and the encoded feature to obtain the second attention feature; The feedforward processing unit processes the second attention feature to obtain the probability set of the current diffusion model.

6. The method according to claim 1, characterized in that, The probability set includes probability distribution data describing the position of each word in the text; The step of determining the word corresponding to each word position based on the probability set and the preset word set includes: For any word position, a weighted average is taken based on the probability distribution data corresponding to the word position and the word position representation to obtain the target mapping position corresponding to the word position. Based on the target mapping bit, the word is matched in the preset word set to obtain the word corresponding to the word position.

7. The method according to claim 1, characterized in that, The training method for the image description model includes: Obtain a first training image and a first target statement corresponding to the first training image; perform a first-stage training process on the image description model to be trained based on the first training image and the first target statement to obtain an intermediate image description model, wherein the image description model to be trained is trained using a first loss function in the first stage. A second training image is acquired, and a second target statement corresponding to the second training image is determined based on the teacher model. The intermediate image description model is then trained in a second stage based on the second training image and the second target statement to obtain a trained image description model. In the second stage, the image description model to be trained is trained using a second loss function.

8. The method according to claim 7, characterized in that, The first stage of training the image description model to be trained based on the first training image and the first target statement to obtain an intermediate image description model includes: The following training process is executed iteratively, and the intermediate image description model is obtained when the training termination condition is met: The first target statement is subjected to noise processing to obtain the state data corresponding to each time point; and the object set of the first training image is extracted. The state data and the object set are input into the image description model to be trained to obtain the first prediction data, and the first prediction statement is obtained based on the first prediction data. Based on the first loss function determined by the first prediction statement and the first target statement, the model parameters of the image description model to be trained are adjusted.

9. The method according to claim 8, characterized in that, The first loss function determined based on the first prediction statement and the first target statement includes: A first loss term is generated based on the content of the first predicted statement and the first target statement; A second loss term is generated based on the first classification label of each word in the first predicted statement and the second classification label of each word in the first target statement; The first loss function is determined based on the first loss term and the second loss term.

10. The method according to claim 7, characterized in that, The teacher model is an autoregressive neural network model, and the second target statement is the output statement of the teacher model after processing the second training image. The second stage of training the intermediate image description model based on the second training image and the second target statement to obtain the trained image description model includes: The following training process is executed iteratively. When the training termination condition is met, the trained image description model is obtained: The second target statement is subjected to noise processing to obtain the state data corresponding to each time point; and the object set of the second training image is extracted. The state data and the object set are input into the intermediate image description model to obtain second prediction data, and multiple second prediction statements are obtained based on the second prediction data, wherein the second prediction statements include the second target statement; Based on the second loss function determined by the plurality of second prediction statements, the model parameters of the image description model to be trained are adjusted, wherein the second loss function includes the sentence-level reward function of each second target statement, and the sentence-level reward function includes the positive reward function corresponding to the second target statement.

11. An image description generation apparatus, characterized in that, include: The object set extraction module is used to acquire a target image, identify the objects included in the target image, and form an object set. The prediction probability determination module is used to input the object set into the image description model to obtain the probability set output by the image description model; The descriptive text generation module is used to determine the words corresponding to each word position based on the probability set and the preset word set, and to form the descriptive text of the target image based on the determined words. The image description model includes multiple cascaded diffusion models. Each diffusion model includes an image encoding module, a sentence decoding module, and a semantic analysis module. The semantic analysis module obtains semantic features based on the object set; the image encoding module obtains encoding features based on the object set; and the sentence decoding module obtains a probability set of the current diffusion model based on the semantic features and the encoding features.

12. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the image description generation method according to any one of claims 1-10.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the image description generation method according to any one of claims 1-10.

Citation Information

Patent Citations

  • Image description model generation method and generation device and storage medium

    CN111813978A

  • Text generation method and device and model training method and device

    CN114926835A