Image editing system based on task-based dialogue

Through the combination of the task-based dialogue understanding module and the image editing module, the dialogue history information and current needs are integrated, which solves the problems of historical information forgetting and demand understanding deviation in image editing, and achieves efficient interactive image editing.

CN116450784BActive Publication Date: 2024-09-27BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310118446.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-03
Publication Date
2024-09-27
Estimated Expiration
2043-02-03

AI Technical Summary

Technical Problem

Existing image editing methods are prone to forgetting historical editing information during the continuous image editing process, and have large deviations in understanding user needs, resulting in poor editing results.

Method used

Using an image editing system based on task-based dialogue, the dialogue understanding module is combined with the image editing module, and the encoder, decoder and attention mechanism are used to integrate dialogue history information and current user needs to achieve intelligent editing of images, and through the system reply module Output editing results that meet user needs.

Benefits of technology

It effectively avoids the loss of historical editing information, improves the accuracy of understanding user needs, realizes the continuity and consistency of interactive image editing, and ensures that the edited image meets the user's historical and current needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116450784B
    Figure CN116450784B
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and proposes an image editing system based on task-based dialogue, including a dialogue understanding module, which is used to obtain a dialogue state according to an input dialogue text, wherein the dialogue state includes the attributes and editing degree to be edited by the user; an image editing module, which is used to receive a user input image and a dialogue state, edit the user input image according to the dialogue state, and output the edited image; a system reply module, which is used to output system reply information; the dialogue understanding module includes an encoder, a decoder, a first linear layer and a Softmax function connected in sequence, wherein the encoder and the decoder are both N, and an adapter is set for the output of each decoder. Through the above technical scheme, the problems of the image editing method in the prior art in forgetting historical editing information, understanding deviation of user needs, inaccurate and inflexible system interaction during continuous image editing are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to an image editing system based on task-based dialogue. Background Art

[0002] Image editing is an important task in computer vision and graphics with a wide range of applications. With the development of generative adversarial models such as StyleGAN, latent space-based manipulation methods have attracted increasing attention. These methods first discover specific semantic directions in a pre-trained latent space and then move image features along these directions to achieve the desired edits in the image space. In recent years, visual language cross-modal pre-trained networks have shown strong performance, which has attracted researchers to propose text-based image editing methods. However, existing work performs poorly when performing interactive and continuous image editing with users, and suffers from serious problems such as forgetting historical editing information and misunderstanding of user needs. Summary of the invention

[0003] The present invention proposes an image editing system based on task-based dialogue, which solves the problems of forgetting historical editing information and misunderstanding of user needs in image editing methods in related technologies during continuous image editing.

[0004] The technical solution of the present invention is as follows, comprising:

[0005] A dialogue understanding module, used to obtain a dialogue state according to an input dialogue text, wherein the dialogue state includes the attributes to be edited by the user and the editing degree; the dialogue text includes dialogue history information and current user needs;

[0006] An image editing module, used for receiving a user input image and a dialogue state, editing the user input image according to the dialogue state, and outputting the edited image;

[0007] A system reply module, used for outputting system reply information according to the dialogue text and the edited image;

[0008] The dialogue understanding module includes an encoder, a decoder, a first linear layer and a Softmax function connected in sequence, the encoder and the decoder are both N, an adapter is set for the output of each decoder, and any adapter includes a normalization layer Layer_Norm, a second linear layer Linear, an activation function Relu and a third linear layer Linear connected in sequence. The training steps of the dialogue understanding module specifically include:

[0009] Initializing the encoder and decoder parameters using pre-trained Transformer model parameters;

[0010] For the input dialogue text x, use word embedding to get the word vector x_emb, and then use the encoder to encode x_emb into feature z, specifically:

[0011] z=Encode(x_emb)

[0012] Where Encoder represents the stacked N encoders;

[0013] The word vector y_emb of the feature and output label y is input into N decoders, and the output z' of the i-th decoder is specifically:

[0014] z′=Decoder_i(z,y_emb)

[0015] Where Decoder_i represents the i-th decoder, and the result of the i-th decoder is input into the i-th adapter:

[0016] z′=z′+Linear(Relu(Linear(Layer_Norm(z′))))

[0017] Fix the parameters of the encoder and the decoder, and modify the parameters θ of the adapter until the loss function L θ Within the set range, the loss function L θ Specifically:

[0018]

[0019] Among them, x is the input dialogue text, y is the output label of the dialogue understanding module, |y| represents the length of the output, and P θ represents the output probability, y i represents the i-th output, P θ (y i |y <i ; x) represents y i Output the correct probability.

[0020] Furthermore, the image editing module specifically includes:

[0021] Image inversion encoder, used to obtain the feature w of the user input image;

[0022] Text encoder, used to obtain the latent vector e of the text in the dialogue state t ;

[0023] Semantic Adjustment Module, used to:

[0024] According to the latent vector e of the text t Calculate the vector Q p , as the Query information in the attention mechanism;

[0025] Calculate vectors K and V according to the feature w of the user input image, and use vectors K and V as the Key value and Value value in the attention mechanism respectively;

[0026] Multiply the vector K by the vector Qp to get the correlation weight Attentionp between the text of the dialogue state and the user input image;

[0027] Weight the relevance of Attention p Perform weighted summation with the vector V to obtain the editing direction Δw of the user input image;

[0028] Update the feature w of the user input image along the editing direction Δw to obtain the edited image feature w'=w+Δw;

[0029] The image generator is used for obtaining the edited image according to the edited image feature w'.

[0030] Furthermore, the loss function L of the image editing module is specifically:

[0031] L=L t +L id

[0032]

[0033] L id =1-cos{R(G(w′)),R(G(w))}where L t is the editing loss, L id For identity loss, It is the image encoder in CLIP, G is the image generator, and R is the trained ArcFace network, which is used to recognize the identity information of the person in the user input image.

[0034] Furthermore, it also includes:

[0035] The image quality assessment module is used to evaluate the image quality based on the editing loss L t and identity loss L id Calculating a quality score of the edited image; the quality score is used to input into a system response module; the system response module is specifically used to output system response information according to the quality score and the dialogue text;

[0036] The calculation formula of the quality score is specifically:

[0037] quality=(L t +L id ) / 2.

[0038] The working principle and beneficial effects of the present invention are:

[0039] In the present invention, the dialogue history information and the current user needs are simultaneously input into the dialogue understanding module to obtain the dialogue state, which can reflect the user's historical needs and current needs; then the dialogue state and the user input image are simultaneously input into the image editing module, so that the edited image can meet the user's historical needs and current needs at the same time, avoiding the loss of previously edited attributes after multiple consecutive rounds of editing; the system response module is used to output system response information according to the degree of compliance of the edited image with the user needs (reflected by the dialogue text) to achieve interactive image editing.

[0040] The dialogue understanding module adopts the structure of encoder, decoder, first linear layer and Softmax function. First, the encoder and decoder parameters are initialized using the pre-trained Transformer model parameters to utilize the pre-trained model's perception of semantic information. The adapter is the learnable part of the dialogue understanding module. An adapter is set at the output of each decoder, and a nonlinear mapping is constructed using a linear layer and an activation function. The semantic information understood by the pre-trained model is transferred to the image editing system layer by layer, and the loss function L is designed. θ Fine-tune the parameter θ to ultimately achieve an accurate understanding of user needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0042] Figure 1 is a system block diagram of the present invention;

[0043] Figure 2 This is a training block diagram of the dialogue understanding module and the system response module in the present invention;

[0044] Figure 3 This is a block diagram of the dialogue understanding module in the present invention;

[0045] Figure 4 This is a block diagram of the image editing module in the present invention. DETAILED DESCRIPTION

[0046] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] like Figure 1 As shown, this embodiment proposes an image editing system based on task-based dialogue, including:

[0048] A dialogue understanding module, used to obtain a dialogue state according to an input dialogue text, wherein the dialogue state includes the attributes to be edited by the user and the editing degree; the dialogue text includes dialogue history information and current user needs;

[0049] An image editing module, used for receiving a user input image and a dialogue state, editing the user input image according to the dialogue state, and outputting the edited image;

[0050] A system reply module, used for outputting system reply information according to the dialogue text and the edited image;

[0051] The dialogue understanding module includes an encoder, a decoder, a first linear layer and a Softmax function connected in sequence, the encoder and the decoder are both N, an adapter is set for the output of each decoder, and any adapter includes a normalization layer Layer_Norm, a second linear layer Linear, an activation function Relu and a third linear layer Linear connected in sequence. The training steps of the dialogue understanding module specifically include:

[0052] S100: Initializing the encoder and decoder parameters using pre-trained Transformer model parameters;

[0053] S200: For the input dialogue text x, use word embedding to obtain the word vector x_emb, and then use the encoder to encode x_emb into feature z, specifically:

[0054] z=Encoder(x_emb)

[0055] Where Encoder represents the stacked N encoders;

[0056] S300: Input the word vector y_emb of the feature and output label y to N decoders. The output z' of the i-th decoder is specifically:

[0057] z′=Decoder_i(z,y_emb)

[0058] Where Decoder_i represents the i-th decoder;

[0059] S400: Input the result of the i-th decoder into the corresponding i-th adapter:

[0060] z′=z′+Linear(Relu(Linear(Layer_Norm(z′))))

[0061] Among them, Layer_Norm is layer normalization, Linear is the linear layer, Relu is the activation function, and residual links are used in the adapter to avoid the gradient disappearance problem.

[0062] S500: Fix the parameters of the encoder and the decoder, and modify the parameter θ of the adapter until the loss function L θ Within the set range, the loss function L θ Specifically:

[0063]

[0064] Among them, x is the input dialogue text, y is the output label of the dialogue understanding module, |y| represents the length of the output, and P θ represents the output probability, y i represents the i-th output, P θ (y i |y <i ; x) represents y i Output the correct probability.

[0065] In the present invention, the dialogue history information and the current user needs are simultaneously input into the dialogue understanding module to obtain the dialogue state, which can reflect the user's historical needs and current needs; then the dialogue state and the user input image are simultaneously input into the image editing module, so that the edited image can meet the user's historical needs and current needs at the same time, avoiding the loss of previously edited attributes after multiple consecutive rounds of editing; the system response module is used to output system response information according to the degree of compliance of the edited image with the user needs (reflected by the dialogue text) to achieve interactive image editing.

[0066] Among them, since the dialogue understanding module and the system response module can be unified as a natural language sequence generation task, we use a unified model TODIM to model the two modules and perform joint training during training. Specifically, Figure 2 As shown in the figure, we use “translate dialogue to dialogue state” (for dialogue understanding module) and “translate dialogue and image quality to dialogue response” (for system reply module) as task guides; using symbols <user> , <system>Splice the conversation information; use symbols <quality>In this way, the dialogue understanding and system response are unified into a sequence-to-sequence generation task, with the input sequence denoted as x and the output sequence denoted as y.

[0067] Take the dialogue understanding module as an example. Figure 3 As shown in FIG. 1 , the dialogue understanding module adopts the structure of an encoder, a decoder, a first linear layer and a Softmax function. First, the encoder and the decoder parameters are initialized using the pre-trained Transformer model parameters to utilize the pre-trained model's perception of semantic information. The adapter is the learnable part of the dialogue understanding module. An adapter is set at the output of each decoder, and a linear layer and an activation function are used to construct a nonlinear mapping. The semantic information understood by the pre-trained model is transferred to the image editing system layer by layer, and the loss function L is designed. θ Fine-tune the parameter θ to ultimately achieve an accurate understanding of user needs.

[0068] Further, if Figure 4 As shown, the image editing module specifically includes:

[0069] Image inversion encoder, used to obtain the feature w of the user input image;

[0070] Specifically, the user input image is passed through the StyleGAN image inversion encoder with fixed parameters to obtain the image feature w.

[0071] Text encoder, used to obtain the latent vector e of the text in the dialogue state t ;

[0072] Specifically, the text encoder in the fixed-parameter visual text pre-training model CLIP is used to obtain the latent vector e of the text t .

[0073] Semantic Adjustment Module, used to:

[0074] According to the latent vector e of the text t Calculate the vector Q p =e t W Q , as the Query information in the attention mechanism;

[0075] Vectors K and V are calculated based on the feature w of the user input image, and the vectors K and V are used as the Key value and Value value in the attention mechanism respectively; vector K = w W K , vector V = w W V , W Q , W K , W V All are randomly initialized learnable parameters.

[0076] Concatenate vector K with vector Q p Multiply to get the correlation weight between the text of the dialogue state and the user input image Attention p ;

[0077] Weight the relevance of Attention p Perform weighted summation with the vector V to obtain the editing direction Δw of the user input image;

[0078] Update the feature w of the user input image along the editing direction Δw to obtain the edited image feature w'=w+Δw;

[0079] The image generator is used for obtaining the edited image according to the edited image feature w'.

[0080] The calculation process of the semantic adjustment module is as follows:

[0081] Q p =e t W Q , K = w W K , V = w W V , W Q , W K , W V All are randomly initialized learnable parameters;

[0082] Attention p =Softmax(Q p K T )

[0083] Δw=LN(Attention p ×V)

[0084] In this embodiment, the semantic adjustment module firstly passes through the vector K and the vector Q p Multiply to get the correlation weight between text and image features, and then use Attention p The direction of image editing is obtained by weighted summing of V, where LN is the layer normalization LayerNorm. According to actual needs, multiple semantic adjustment modules can be stacked to obtain a more accurate image editing direction. The image features are updated along the image editing direction, and the edited image features w′=w+Δw. Finally, the StyleGAN image generator with fixed parameters is used to obtain the edited image.

[0085] Among them, the latent vector e of the text t The semantic features of are extracted through attention, which can realize the semantic understanding of multiple attributes. When editing images according to the dialogue state, it can be edited according to multiple attributes in the dialogue state.

[0086] During the training process, only the parameters of the semantic adjustment module are learnable. The goal of model training requires that the attributes that the user wants to edit are properly adjusted, and an editing loss is designed for this purpose:

[0087]

[0088] in is the image encoder in CLIP, G is the StyleGAN image generator, w′ is the edited image feature, and w is the image feature of the original image.

[0089] In addition, the identity characteristics of the characters must be kept unchanged during the editing process, so identity loss is designed for this purpose:

[0090] L id =1-cos{R(G(w′)),R(G(w))}

[0091] Where R is the trained ArcFace network used to identify the identity information of people in the image. The total loss of training is:

[0092] L=L t +L id

[0093] Furthermore, it also includes:

[0094] The image quality assessment module is used to evaluate the image quality based on the editing loss L t and identity loss L id Calculating a quality score of the edited image; the quality score is used to input into a system response module; the system response module is specifically used to output system response information according to the quality score and the dialogue text;

[0095] The calculation formula of the quality score is specifically:

[0096] quality=(L t +L id ) / 2.

[0097] Since the image editing module cannot always ensure that the edited image is consistent with the user's needs, this implementation designs an image quality assessment module to evaluate the edited image and obtain a quality score. The quality score is used as a condition and combined with the user's dialogue text to obtain the final system response information through the system response module. For example, when the quality score shows that the edited image is consistent with the user's needs, the system response information is: Editing is complete, do you like it? When the quality score shows that the edited image is inconsistent with the user's needs, the system response information is: It seems that the editing has failed. Do you want to try editing other attributes?

[0098] In addition, the system reply module will take into account the historical editing attributes, such as the following historical dialogue:

[0099] "User: Longer hair"

[0100] "System: OK, do you want to edit the expression?"

[0101] "User: Then try smiling"

[0102] In this case, historically edited attributes should not be suggested again, for example, the system reply should not appear again "Do you want to edit your expression" or "Do you want to make your hair longer", so as to achieve flexible and accurate interactive image editing.

[0103] The quality score is calculated using the editing loss and identity loss of the image editing module, which does not require training and reduces the amount of computation.

[0104] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.< / quality> < / system> < / user>

Claims

1. An image editing system based on task-based dialogue, characterized in that: include: A dialogue understanding module, used to obtain a dialogue state according to an input dialogue text, wherein the dialogue state includes the attributes to be edited by the user and the editing degree; the dialogue text includes dialogue history information and current user needs; An image editing module, used for receiving a user input image and a dialogue state, editing the user input image according to the dialogue state, and outputting the edited image; A system reply module, used for outputting system reply information according to the dialogue text and the edited image; The dialogue understanding module includes an encoder, a decoder, a first linear layer and a Softmax function connected in sequence, the encoder and the decoder are both N, an adapter is set for the output of each decoder, and any adapter includes a normalization layer Layer_Norm, a second linear layer Linear, an activation function Relu and a third linear layer Linear connected in sequence. The training steps of the dialogue understanding module specifically include: Initializing the encoder and decoder parameters using pre-trained Transformer model parameters; For the input dialogue text x, use word embedding to get the word vector x_emb, and then use the encoder to encode x_emb into feature z, specifically: Where Encoder represents the stacked N encoders; The word vector y_emb of the feature and output label y is input into N decoders, and the output z' of the i-th decoder is specifically: Where Decoder_i represents the i-th decoder, and the result of the i-th decoder is input into the i-th adapter: Fix the parameters of the encoder and the decoder, and modify the parameters θ of the adapter until the loss function Within the set range, the loss function Specifically: Among them, x is the input dialogue text, y is the output label of the dialogue understanding module, |y| represents the length of the output, represents the output probability, represents the i-th output, express Output the correct probability; The image editing module specifically includes: Image inversion encoder, used to obtain the feature w of the user input image; Text encoder, used to obtain the latent vector e of the text in the dialogue state t ; Semantic Adjustment Module, used to: According to the latent vector e of the text t Calculate the vector Q p , as the Query information in the attention mechanism; Calculate vectors K and V according to the feature w of the user input image, and use vectors K and V as the Key value and Value value in the attention mechanism respectively; Concatenate vector K with vector Q p Multiply to get the correlation weight between the text of the dialogue state and the user input image Attention p ; Weight the relevance of Attention p Perform weighted summation with the vector V to obtain the editing direction Δw of the user input image; Update the feature w of the user input image along the editing direction Δw to obtain the edited image feature w' = w +Δw; The image generator is used for obtaining the edited image according to the edited image feature w'.

2. The image editing system based on task-based dialogue according to claim 1, characterized in that: The loss function L of the image editing module is specifically: Where L t is the editing loss, L id For identity loss.

3. The image editing system based on task-based dialogue according to claim 2, characterized in that: Also includes: The image quality assessment module is used to evaluate the image quality based on the editing loss L t and identity loss L id Calculating a quality score of the edited image; the quality score is used to input into a system response module; the system response module is specifically used to output system response information according to the quality score and the dialogue text; The calculation formula of the quality score is specifically: 。