Image data processing method and device, equipment and storage medium
By iteratively training the bypass generation network and the attribute editing network, the problem of low efficiency and mismatching of object attribute editing in the existing technology is solved, realizing efficient object attribute editing without manual interaction, and enhancing the model's learning ability for editing objects.
Patent Information
- Application Number
- CN202410710266.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-09-03
AI Technical Summary
Existing object attribute editing methods require manual interaction, are cumbersome to operate, and are inefficient. Moreover, the image generation model may forget learned knowledge during iterative training, leading to mismatch problems after object attribute editing.
By iteratively training the bypass generation network and attribute editing network, image distribution text and object attribute editing text are used to generate and edit object images, avoiding iterative training of the image generation model, improving the model's focus on editing objects, and reducing mismatch problems.
It realizes object attribute editing without manual interaction, improves editing efficiency and accuracy, avoids the image generation model forgetting knowledge, enhances the model's learning ability of editing objects, and reduces the risk of mismatching.
Smart Images

Figure CN118587325A
Abstract
Description
Technical Field
[0001] The present application relates to fields such as artificial intelligence technology, and in particular to an image data processing method, device, equipment and storage medium. Background Art
[0002] With the emergence of generative models based on stable diffusion models, significant progress has been made in the field of controllable image generation. Some common applications include making uncommon creative edits to objects (such as objects, people, and animals) to make them present various object attributes (such as horns on a cat's head and rabbit ears on a person). In practice, it is found that in the current object attribute editing scheme, manual interaction is required to mark the position of the object in the image that needs to be edited, and then the position information is regenerated through the training model. This operation is cumbersome, resulting in low efficiency in object attribute editing. Summary of the invention
[0003] The embodiments of the present application provide an image data processing method, apparatus, device and storage medium to improve the efficiency of object attribute editing.
[0004] An embodiment of the present application provides, on one hand, a method for processing image data, including:
[0005] Obtain a first training image-text pair, the first training image-text pair comprising a sample editing image of an editing object, and image distribution text and object attribute editing text corresponding to the sample editing image, the image distribution text describing the object contained in the sample editing image, the object contained in the sample editing image including the editing object, and the object attribute editing text describing the object attribute to be edited of the editing object;
[0006] Generate a predicted object image associated with the image distribution text according to the text representation corresponding to the image distribution text and the latent space representation of the random noise image through a bypass generation network and a trained image generation model;
[0007] By means of an attribute editing network, according to the text representation corresponding to the attribute editing text of the object, the object attribute is edited in the predicted object image to obtain an initial edited image of the edited object, and the predicted object image and the initial edited image are fused to obtain a predicted edited image of the edited object;
[0008] According to the above-mentioned predicted editing image and the above-mentioned sample editing image, the above-mentioned bypass generation network and the above-mentioned attribute editing network are iteratively trained until the above-mentioned bypass generation network and the above-mentioned attribute editing network both meet the conditions for stopping the iterative training, and the bypass generation network after iterative training and the attribute editing network after iterative training are obtained. The above-mentioned image generation model, the above-mentioned bypass generation network after iterative training and the above-mentioned attribute editing network after iterative training are used to generate the editing image of the above-mentioned editing object.
[0009] An embodiment of the present application provides an image data processing device, including:
[0010] an acquisition module, configured to acquire a first training image-text pair, wherein the first training image-text pair includes a sample editing image of an editing object, and image distribution text and object attribute editing text corresponding to the sample editing image, wherein the image distribution text describes the object included in the sample editing image, the object included in the sample editing image includes the editing object, and the object attribute editing text describes the object attribute to be edited of the editing object;
[0011] A generation module, used to generate a predicted object image associated with the image distribution text according to the text representation corresponding to the image distribution text and the latent space representation of the random noise image through a bypass generation network and a trained image generation model;
[0012] An editing module, configured to edit the object attributes of the edited object in the predicted object image according to the text representation corresponding to the object attribute edit text through an attribute editing network, obtain an initial edited image of the edited object, and fuse the predicted object image with the initial edited image to obtain a predicted edited image of the edited object;
[0013] A training module is used to iteratively train the bypass generation network and the attribute editing network according to the predicted editing image and the sample editing image, until the bypass generation network and the attribute editing network both meet the conditions for stopping the iterative training, thereby obtaining the iteratively trained bypass generation network and the iteratively trained attribute editing network. The image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network are used to generate the editing image of the editing object.
[0014] On one hand, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0015] On the one hand, an embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0016] The present application includes but is not limited to the following beneficial effects: by iteratively training the bypass generation network and the attribute editing network, the iteratively trained bypass generation network learns the text representation corresponding to the image distribution text and the latent space representation of the random noise image, generates an object image including the edited object, so that the iteratively trained attribute editing network learns the text representation corresponding to the edited text based on the object attribute, and edits the object attribute of the edited object in the above-mentioned predicted object image. So that the edited image of the edited object can be automatically generated by the iteratively trained bypass generation network and the iteratively trained attribute editing network, without the need for manual interaction, thereby improving the efficiency of object attribute editing. At the same time, it is not necessary to iteratively train the image generation model, so as to avoid the image generation model forgetting the learned knowledge, so that the iteratively trained bypass generation network and the iteratively trained attribute editing network are more focused on learning the knowledge about the edited object, which is conducive to improving the efficiency and accuracy of model training, and avoiding mismatching problems after object attribute editing, such as the mismatching problem can refer to the horns on the cat's head growing on the cow's head. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 It is a schematic diagram of an image data processing system provided by the present application;
[0019] Figure 2 It is a flowchart of an image data processing method provided by the present application;
[0020] Figure 3 This is a schematic diagram of a scenario for obtaining a text representation corresponding to a placeholder string provided by the present application;
[0021] Figure 4 It is a flowchart of an image data processing method provided by the present application;
[0022] Figure 5 is a schematic diagram of a scenario for generating a candidate editing image provided by the present application;
[0023] Figure 6 It is a scene diagram of the training process of an image generation model, an attribute editing network, and a bypass generation network provided in this application;
[0024] Figure 7It is a structural diagram of an attribute editing network, a bypass generation network, and a denoising network provided by this application;
[0025] Figure 8 It is a structural diagram of an attribute editing network provided by this application;
[0026] Fig. 9 It is a schematic diagram of a scene for generating a marked mask object image provided by the present application;
[0027] Fig.10 It is a flowchart of an application process of an image generation model, an iteratively trained bypass generation network, and an iteratively trained attribute editing network provided in an embodiment of the present application;
[0028] Fig.11 is a structural schematic diagram of an image data processing device provided in an embodiment of the present application;
[0029] Fig.12 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0031] The embodiments of the present application may involve artificial intelligence technology, autonomous driving, smart transportation and other fields. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that the machines have the functions of perception, reasoning and decision-making.
[0032] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, pre-trained model technology, operation / interaction systems, mechatronics and other technologies. Among them, the pre-trained model is also called a large model or a basic model. After fine-tuning, it can be widely used in downstream tasks in various major directions of artificial intelligence. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0033] Among them, computer vision technology (Computer Vision, CV) is a science that studies how to make machines "see". To put it more specifically, it refers to machine vision such as using cameras and computers to replace human eyes to identify and measure targets, and further perform graphic processing to make computer processing into images that are more suitable for human eye observation or transmission to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multidimensional data. Large model technology has brought important changes to the development of computer vision technology. Pre-trained models in the visual field such as swin-transformer, ViT, V-MOE, MAE, etc. can be quickly and widely applied to downstream specific tasks after fine tuning. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and map construction, and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition.
[0034] Among them, Machine Learning (ML) is a multi-disciplinary interdisciplinary subject, involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning by induction. The pre-trained model is the latest development of deep learning, which integrates the above technologies.
[0035] This application mainly utilizes machine learning technology and computer vision technology in artificial intelligence technology to iteratively train the bypass generation network and the attribute editing network, so that the iteratively trained bypass generation network can learn the latent space representation based on the text representation corresponding to the image distribution text and the random noise image, generate an object image including the editing object, so that the iteratively trained attribute editing network can learn the text representation corresponding to the editing text based on the object attributes, and edit the object attributes of the above-mentioned editing object in the above-mentioned predicted object image, so that the iteratively trained bypass generation network and the iteratively trained attribute editing network can automatically generate the editing image of the editing object without manual interaction, thereby improving the efficiency of object attribute editing.
[0036] In order to facilitate a clearer understanding of the present application, the image data processing system implementing the present application is first introduced. Figure 1 As shown, the image data processing system includes a server 10 and a terminal cluster, and the terminal cluster may include one or more terminals, and the number of terminals is not limited here. Figure 1 As shown, taking the terminal cluster including 4 terminals as an example, the terminal cluster may specifically include terminal 11a, terminal 12a, terminal 13a, and terminal 14a; it can be understood that terminal 11a, terminal 12a, terminal 13a, and terminal 14a can all be connected to the server 10 through the network, so that each terminal can exchange data with the server 10 through the network connection.
[0037] It is understandable that the server can be an independent physical server, or a server cluster or distributed system composed of at least two physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms. The terminal can specifically refer to a vehicle-mounted terminal, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a screen speaker, a smart TV, a smart watch, etc., but is not limited to this. Each terminal and server can be directly or indirectly connected via wired or wireless communication. At the same time, the number of terminals and servers can be one or at least two, and this application does not limit this.
[0038] Among them, each of the above terminals may be installed with one or more target applications, and the target application here may refer to an application with data processing (such as image processing) functions, such as a target application may include an independent application, a web application, a small program in a host application, etc. Specifically, the target application may refer to a browser application, a shopping application, an application download application, a video playback application, a social application, a content publishing application, a game application, etc.
[0039] The server 10 refers to a device that provides backend services for the target application in the terminal, and the server 10 may include an image generation model, a bypass generation network, and an attribute editing network. The server 10 can be used to iteratively train the bypass generation network and the attribute editing network based on the method provided in this application to obtain an iteratively trained bypass generation network and an iteratively trained attribute editing network; the terminal and the server 10 can provide the user with an edited image of the edited object through the image generation model, the iteratively trained bypass generation network, and the iteratively trained attribute editing network.
[0040] For example, taking terminal 11a as an example, terminal 11a may include a target application, and terminal 11a may log in to the target application based on the basic information of the user, and display the input interface of the target application, where the input page may refer to a generation configuration page for editing an image, etc. The user may input a first training image-text pair through the input interface displayed in terminal 11a, and the first training image-text pair includes an image distribution text, an object attribute editing text, and a sample editing image. Terminal 11a may obtain the first training image-text pair input by the user, and send the first training image-text pair to server 10. Server 10 may be used to iteratively train the bypass generation network and the attribute editing network according to the first training image-text pair and the trained image generation model, until the bypass generation network and the attribute editing network both meet the conditions for stopping iterative training, obtain the iteratively trained bypass generation network and the iteratively trained attribute editing network, and store the iteratively trained bypass generation network and the iteratively trained attribute editing network. Further, the server 10 may receive a generation request for editing an image sent by the terminal 11a, the generation request carrying the object attribute editing text and the image distribution text, and generate an editing image of the editing object according to the object attribute editing text and the image distribution text carried in the generation request through the image generation model, the iteratively trained bypass generation network, and the iteratively trained attribute editing network. The editing image of the editing object is returned to the terminal 11a, so that the terminal 11a can display the received editing image through the target application.
[0041] In one embodiment, after acquiring the image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network, the server 10 can send the image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network to each terminal (taking terminal 11a as an example), and terminal 11a can store the image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network locally, and call the image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network locally through the target application to generate an edited image of the edited object.
[0042] In one embodiment, after acquiring the image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network, the server 10 can send the image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network to the cloud server, and each terminal (taking terminal 11a as an example) can call the image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network in the cloud server through the target application to generate an edited image of the edited object for the user.
[0043] In one embodiment, the edited object may refer to a person, an animal, an item, a game character, etc., and the object attribute editing may include adding, deleting, or replacing object attributes for the edited object. The object attribute editing may include wearing accessories (such as a hat), adding ears, antlers, changing colors, changing textures, etc., such as a cat head with horns. Alternatively, the object attribute editing may include editing the edited object into another object, such as replacing a dog with a cat. Alternatively, the object attribute editing may refer to changing the skin of a game character to construct a new game character.
[0044] It should be noted that the object attribute editing text indicates that an object attribute a that does not belong to the editing object o should appear on the editing object o in the object image. For example, having horns on the head is an object attribute of animals such as deer and cows, but not an object attribute of dogs. If you want to make the dog grow horns on its head in the object image, it is cross-attribute editing, and cross-attribute editing can be used to achieve personalized generation of images.
[0045] The image generation model in the present application may refer to a diffusion model (such as Stable Diffusion v1.5), an open source text image model (Stable Diffusion XL, SDXL), or an upgraded version of other diffusion models. The image generation model in the present application has the ability to generate object images including first-category objects based on text. However, the image generation model does not have the ability to generate object images including specific objects based on text, nor does it have the ability to edit object attributes of specific objects. Therefore, in the present application, it is necessary to train a bypass generation network to generate object images including second-category objects based on text; train an attribute editing network to edit object attributes of the second-category objects, which can avoid mismatch problems after object attribute editing. Among them, the iterative training process for the bypass generation network and the attribute editing network can refer to the method embodiment below.
[0046] It should be noted that the first type of object may refer to an object with common attribute characteristics, such as cats, dogs, cows, etc., and the second type of object may refer to an object with specific attribute characteristics. For example, when the first type of object is a cat, the second type of object may include a short-haired cat, a tabby cat, a ragdoll cat, etc., and when the first type of object is a dog, the second type of object may refer to a pug, a wolfhound, a hound, etc. The editing object in this application may refer to the second type of object. In other words, the image generation model in this application has the ability to generate the general features of the editing object (such as the limbs and body of a short-haired cat), and the bypass generation network after iterative training has the ability to generate the detailed features of the editing object (such as the eye color and tail of a short-haired cat).
[0047] For further information, see Figure 2 , is a flow chart of an image data processing method provided in an embodiment of the present application. Figure 2 As shown, this method can be Figure 1 It can be executed by any terminal in the terminal cluster in Figure 1 can be executed by the server in Figure 1 The terminals and servers in the terminal cluster are used to perform collaborative execution. The devices used to perform the image data processing method in this application can be collectively referred to as computer devices. The method may include the following steps:
[0048] S101. Obtain a first training image-text pair, wherein the first training image-text pair includes a sample editing image of an editing object, and image distribution text and object attribute editing text corresponding to the sample editing image, wherein the image distribution text describes the objects included in the sample editing image, and the objects included in the sample editing image include the editing object, and the object attribute editing text describes the object attributes to be edited of the editing object.
[0049] In the present application, a computer device can obtain a first training image-text pair from local storage or other devices. The first training image-text pair includes a sample editing image, image distribution text, and object attribute editing text. The image distribution text is used to indicate the objects contained in the sample editing image, and the object attribute editing text describes the object attributes to be edited.
[0050] The number of the first training image-text pairs is one or more, the object contained in the sample editing image can be one or more, the object whose object attribute is edited in the sample editing image is called the editing object, and the number of the editing objects can be one or more. The object attribute editing text may include one or more of the editing object text, the editing attribute text, and the object attribute text. The editing object text is used to indicate the object whose object attribute is edited in the sample editing image, the editing attribute text is used to indicate the object attribute to be edited for the editing object, and the object attribute text is used to indicate the editing object and the object attribute to be edited for the editing object.
[0051] The image distribution text and the object attribute editing text may refer to the text obtained by splitting the description text of the edited image to be generated by the computer device. For example, the description text of the edited image to be generated is: Nicolas and an ox, Nicolas with horn (a cat named Nicolas and a cow, Nicolas has horns); the image distribution text t1 is: Nicolas and an ox (a cat named Nicolas and a cow), and the object attribute text t2 is: Nicolas withhorn. The edited object text t2o is: Nicolas (a cat named Nicolas); the edited attribute text t2e is: withhorn (with horns).
[0052] The object attributes of the edited object in the sample edited image meet the requirements of the object attribute edit text, that is, the object attributes of the edited object in the sample edited image have been edited. The sample edited image may be obtained by photographing. For example, if the object attribute edit text indicates that a cat is wearing a hat, the sample edited image may be obtained by photographing a cat wearing a hat. Alternatively, the sample edited image may be obtained by editing the object attributes of the edited object. For example, if the object attribute edit text indicates that the cat's eyes are red, the sample edited image may be obtained by manually editing the color of the cat's eyes in the original image to red.
[0053] S102, generating a predicted object image associated with the above-mentioned image distribution text according to the corresponding text representation of the above-mentioned image distribution text and the latent space representation of the random noise image through a bypass generation network and a trained image generation model.
[0054] In the present application, the bypass generation network may refer to a network to be trained for editing an object image corresponding to an object. A computer device may generate a predicted object image associated with an image distribution text through the bypass generation network and a trained image generation model according to a text representation corresponding to the image distribution text and a latent space representation of a random noise image, that is, the predicted object image includes the object contained in the sample editing image, and the predicted object image includes the editing object (that is, the object to be edited) and may also include an object that does not need to be edited.
[0055] Among them, the text representation corresponding to the image distribution text can refer to the text feature vector, text feature matrix, etc. of the image distribution text. The text feature vector and text feature matrix include text feature values. The text feature values reflect the semantics of the image distribution text. The text representation corresponding to the image distribution text can be obtained by encoding the image distribution text through a text encoding network.
[0056] Among them, the random noise image can be a noise image generated according to a random seed, and the latent space is a representation of compressed data, that is, the latent space representation corresponding to the random noise image can refer to the compression of the pixel space representation corresponding to the random noise image, that is, the dimension of the latent space representation of the random noise image is smaller than the dimension of the pixel space representation of the random noise image, and the latent space representation corresponding to the random noise image can be obtained by encoding the random noise image by an image encoder. The pixel space representation can refer to the image feature vector or image feature matrix of the random noise image; the image feature vector and the image feature matrix include the image feature value of the random noise image, and the image feature value can reflect the color, texture and other characteristics of the random noise image.
[0057] Among them, the text representation corresponding to the image distribution text is used to constrain the distribution characteristics of the object in the predicted object image and the distribution characteristics of the background to meet the requirements of the image distribution text. For example, the image distribution text t1 is: a cat named Nicolas and a cow. The image distribution text t1 is used to constrain the predicted object image to include a cat and a cow, and the cat looks similar to a cat named Nicolas.
[0058] It should be noted that when the placeholder string used to describe the editing object is a string that has not yet appeared in the text editor, it is necessary to encode the marker corresponding to the placeholder string of the editing object, and then convert it into a text representation. The text editor will find the best text representation for the placeholder string, which is conducive to the subsequent accurate acquisition of the text representation corresponding to the image distribution text and the text representation corresponding to the object attribute editing text. There is no need to adjust the parameters of the image generation model and the text encoding network, which saves resources and improves the efficiency of obtaining text representations.
[0059] In one embodiment, the computer device may obtain the text representation corresponding to the placeholder string corresponding to the edit object, which may include: obtaining a second training image-text pair; the second training image-text pair includes a sample object image and an object description text, and the object description text reflects that the sample object image includes the edit object; using the placeholder string corresponding to the edit object to replace the object string associated with the edit object in the object description text to obtain the replaced object description text. The text representation corresponding to the placeholder string is determined according to the replaced object description text and the sample object image through the image generation model and the text encoding network.
[0060] Specifically, the computer device can obtain a second training image-text pair from a local storage or other device, and the second training image-text pair includes a sample object image and an object description text. The sample object image may refer to an image including an edited object. The object in the sample object image includes an edited object. The object in the sample object image may be one or more objects. The object description text is used to describe the object in the sample object image. The object description text includes an object string used to describe the edited object. The object string may include one or more characters. The computer device may use a placeholder string corresponding to the edited object to replace the object string associated with the edited object in the object description text to obtain the replaced object description text. The placeholder string corresponding to the edited object may be a custom string, and the placeholder string is used to mark the string of the object string. Further, the computer device may determine the text representation corresponding to the placeholder string according to the replaced object description text and the sample object image through an image generation model and a text encoding network, and store the text representation corresponding to the placeholder string so that the text representation of the placeholder string can be queried later.
[0061] In one embodiment, the above-mentioned determination of the text representation corresponding to the placeholder string according to the replaced object description text and the sample object image by the above-mentioned image generation model and text encoding network includes: generating an initial text representation of the replaced object description text by the above-mentioned text encoding network; performing noise processing on the above-mentioned sample object image by the above-mentioned image generation model to obtain a noisy object image, and performing denoising processing on the above-mentioned noisy object image according to the above-mentioned initial text representation to obtain a pre-denoised object image. Determining the accuracy of the above-mentioned initial text representation according to the above-mentioned denoised object image and the above-mentioned sample object image; when the accuracy of the above-mentioned initial text representation is greater than the accuracy threshold, determining the text representation corresponding to the placeholder string according to the above-mentioned initial text representation, and storing the text representation corresponding to the placeholder string in the representation dictionary in the above-mentioned text encoding network.
[0062] Specifically, the computer device can generate an initial text representation of the replaced object description text through a text encoding network, and the initial text representation includes a text representation corresponding to the placeholder string and a text representation of the remaining string. The remaining string may refer to a string other than the placeholder string in the replaced object description text, and the text representation corresponding to the placeholder string may be randomly generated. The text representation corresponding to the remaining string may be obtained by querying the text encoding network. The remaining string is a string that has appeared in the text encoding network, that is, the text encoding network stores the text representation corresponding to the remaining string. The computer device can add noise data corresponding to time step T to the sample object image through an image generation model to obtain a noisy object image, and perform T denoising processes on the noisy object image using the initial text representation as a constraint condition to obtain a denoised object image, where T is an integer greater than or equal to 1.
[0063] Furthermore, when the accuracy of the initial text representation is higher, the denoised object image is more similar to the sample object image, and when the accuracy of the initial text representation is relatively low, the difference between the denoised object image and the sample object image is relatively large. Therefore, the computer device can determine the accuracy of the initial text representation based on the denoised object image and the sample object image. When the accuracy of the initial text representation is greater than the accuracy threshold, the computer device can use the text representation corresponding to the placeholder string in the initial text representation as the text representation corresponding to the placeholder string; when the accuracy of the initial text representation is less than or equal to the accuracy threshold, the computer device can regenerate the initial text representation and repeat the above steps. Until the text representation corresponding to the placeholder string is obtained, the text representation corresponding to the placeholder string is stored in the representation dictionary in the above text encoding network.
[0064] For example, Figure 3As shown, the text editing network includes a marking layer 31a, a text representation query layer 32a, a text conversion layer 33a and a representation dictionary 34a. The sample object image 36a of Nicolas's image, the object description text of the sample object image 36a can be: Aphoto of Nicolas (an image including Nicolas), that is, Nicolas can be called an object string, the placeholder string corresponding to the object string is N*, and the replaced object description text can be expressed as: Aphoto ofN*. The computer device can obtain the markers corresponding to each string in the replaced object description text through the marking layer 31a. The markers are used to uniquely mark each string in the replaced object description text, such as the marker of A is 508, the marker of photo is 701, the marker of of is 73, and the marker of N* is *. The representation dictionary 34a records multiple marker characters and the text representations corresponding to the marker characters. The computer device can query the text representations corresponding to each string from the representation dictionary 34a through the text representation query layer 32a according to the markers corresponding to each string in the replaced object description text, and obtain the text representation of A as v 508 , the text representation of photo is v 701 , the text representation of of is v 73 ,Right now Figure 3 The text representation v of N* in * The feature values in are all "?", indicating that the text representation v corresponding to N* is not included in the representation dictionary 34a. * .
[0065] At this time, the computer device can randomly generate a text representation v corresponding to N* through the text conversion layer 33a * , for v 508 、v 801 、v 73 、v * Arrange to obtain an initial text representation. The computer device can add random noise to the sample object image 36a through the image generation model 35a to obtain a random noise image 37a, perform noise processing on the random noise image 37a to obtain a noisy object image 38a, and perform denoising on the latent space representation corresponding to the noisy object image 38a based on the initial text representation to obtain a latent space representation of an initial denoised object image 39a, and decode the latent space representation of the initial denoised object image 39a to obtain a denoised object image 40a. The accuracy of the initial text representation is determined based on the denoised object image 40a and the sample object 35a. When the accuracy of the initial text representation is greater than the accuracy threshold, the computer device can use the text representation corresponding to the placeholder string in the initial text representation as the text representation corresponding to the placeholder string v *, the text representation v corresponding to the placeholder string * , stored in the representation dictionary in the above text encoding network.
[0066] In one example, a computer device obtaining a text representation corresponding to the image distribution text and a text representation corresponding to the object attribute editing text may include: generating a text representation of the object attribute editing text and a text representation of the image distribution text based on the text representation corresponding to the placeholder string, the placeholder string, and the text encoding network.
[0067] Specifically, when it is necessary to generate a text representation of the object attribute editing text and a text representation of the above-mentioned image distribution text, the computer device can generate the text representation of the above-mentioned object attribute editing text and the text representation of the above-mentioned image distribution text based on the text representation corresponding to the above-mentioned placeholder string, the above-mentioned placeholder string, and the above-mentioned text encoding network.
[0068] In one embodiment, the text representation of the object attribute editing text and the text representation of the image distribution text are generated according to the text representation corresponding to the placeholder string, the placeholder string, and the text encoding network, including: using the placeholder string to replace the text representation of the object attribute editing text and the object string in the image distribution text, to obtain the replaced object attribute editing text and the replaced image distribution text. From the representation dictionary of the text editing network, the text representation associated with the replaced object attribute editing text and the text representation associated with the replaced image distribution text are searched; the text representation associated with the replaced object attribute editing text is determined as the text representation of the object attribute editing text, and the text representation associated with the replaced image distribution text is determined as the text representation of the image distribution text.
[0069] For example, the image distribution text t1 is: Nicolas and an ox, and the object attribute text t2 is: Nicolas withhorn. The edit object text t2o is: Nicolas; the edit attribute text t2e is: with horn. The image distribution text t1* after replacement is: N*and an ox, and the object attribute text t2* after replacement is: N*with horn. The edit object text t2o* after replacement is: N*. Since the edit attribute text does not contain the object string corresponding to the edit object, there is no need to replace the string in the edit attribute text, that is, the edit attribute text t2e after replacement is the same as the edit attribute text before replacement, which is: with horn. After obtaining the text representation corresponding to the placeholder string, the computer device may store the text representation corresponding to the placeholder string in the representation dictionary in the text encoding network, use the text representation associated with the replaced image distribution text t1* queried in the representation dictionary as the text representation of the image distribution text t1, use the text representation associated with the replaced object attribute text t2* queried in the representation dictionary as the text representation of the object attribute text t2. Use the text representation associated with the replaced editing object text t2o* queried in the representation dictionary as the text representation of the editing object text t2o, and query the text representation associated with the editing attribute text t2e from the representation dictionary.
[0070] S103. Through the attribute editing network, according to the text representation corresponding to the attribute editing text of the object, the object attributes of the editing object are edited in the predicted object image to obtain the initial editing image of the editing object, and the predicted object image and the initial editing image are fused to obtain the predicted editing image of the editing object.
[0071] In the present application, the attribute editing network may refer to a network to be trained for editing the object attributes of the editing object. The computer device may use the attribute editing network to edit the object attributes of the editing object in the predicted object image according to the text representation corresponding to the object attribute editing text, and obtain the initial editing image of the editing object. Furthermore, by fusing the predicted object image and the initial editing image, a predicted editing image of the editing object is obtained, so that the generation effect of the generated predicted editing image is more natural.
[0072] It should be noted that the initial editing object image here includes the editing object after the object properties are edited, and the predicted object image includes the editing object whose object properties are not edited, as well as other unedited objects and backgrounds. The predicted object image is equivalent to having global features, and the initial editing image has local features. The above-mentioned merging (fusion) of the predicted object image and the initial editing image realizes the merging of global features and local features to make the image generation effect more natural, and allows the generated editing image to have more reasonable effects in global performance and local performance of the object.
[0073] Among them, fusing the above-mentioned predicted object image and the above-mentioned initial editing image to obtain the predicted editing image of the above-mentioned editing object can refer to: adding the characteristic values of the pixel points in the predicted object image and the pixel values of the pixel points in the initial editing image to obtain the predicted editing image.
[0074] Among them, the text representation corresponding to the object attribute editing text is used to constrain the attribute editing network, and the object attributes of the edited object are edited in the predicted object image to achieve controllable editing of the object attributes and avoid mismatching problems after object attribute editing.
[0075] S104. According to the predicted editing image and the sample editing image, the bypass generation network and the attribute editing network are iteratively trained until both the bypass generation network and the attribute editing network satisfy the conditions for stopping the iterative training, thereby obtaining the iteratively trained bypass generation network and the iteratively trained attribute editing network. The image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network are used to generate the editing image of the editing object.
[0076] In the present application, the predicted edited image and the sample edited image can be used to measure the generation accuracy of the bypass generation network for the object image (i.e., the predicted object image), and the accuracy of the object attribute editing of the attribute editing network, that is, the difference between the predicted edited image and the sample edited image is relatively small, indicating that the bypass generation network has a high generation accuracy for the object image, and the accuracy of the object attribute editing of the attribute editing network is high; on the contrary, the difference between the predicted edited image and the sample edited image is relatively large, indicating that the bypass generation network has a low generation accuracy for the object image, and the accuracy of the object attribute editing of the attribute editing network is low. Therefore, the computer device can iteratively train the bypass generation network and the attribute editing network according to the above-mentioned predicted edited image and the above-mentioned sample edited image to improve the generation accuracy of the bypass generation network for the object image, and the accuracy of the object attribute editing of the attribute editing network. Until both the bypass generation network and the attribute editing network satisfy the conditions for stopping iterative training, the iterative training of the bypass generation network and the attribute editing network is suspended, and the bypass generation network that satisfies the conditions for stopping iterative training is determined as the bypass generation network after iterative training, and the attribute editing network that satisfies the conditions for stopping iterative training is determined as the attribute editing network after iterative training.
[0077] The computer device may use the first training image-text pairs of multiple editing objects to iteratively train the bypass generation network and the attribute editing network, so that the bypass generation network after iterative training has the ability to generate object images of multiple editing objects, and the attribute editing network after iterative training has the ability to edit object attributes for multiple editing objects. For example, the multiple editing objects include game characters, a user's cat, a user's dog, a building, etc.
[0078] It should be noted that the conditions for stopping iterative training here may include at least one of the following: a. the number of iterative training of the attribute editing network and the bypass generation network is greater than the number threshold; b. the convergence state of the adjusted bypass generation network and the adjusted attribute editing network is a converged state.
[0079] In one embodiment, until both the bypass generation network and the attribute editing network satisfy the conditions for stopping iterative training, the iteratively trained bypass generation network and the iteratively trained attribute editing network are obtained, including: the computer device can obtain whether the convergence states of the adjusted bypass generation network and the adjusted attribute editing network are in a converged state; when the convergence states of the adjusted bypass generation network and the adjusted attribute editing network are in a converged state, it indicates that the adjusted bypass generation network has high generation accuracy for the object image, and the adjusted attribute editing network has high accuracy in object attribute editing; it can be determined that both the bypass generation network and the attribute editing network satisfy the conditions for stopping iterative training, the adjusted bypass generation network is determined as the iteratively trained bypass generation network, and the adjusted attribute editing network is determined as the iteratively trained attribute editing network.
[0080] Among them, the adjusted bypass generation network here may refer to the one obtained by adjusting the parameters of the bypass generation network based on the processing loss, and the adjusted attribute editing network may refer to the one obtained by adjusting the parameters of the attribute editing network based on the processing loss. The specific implementation process can refer to the embodiment below.
[0081] The convergence state of the adjusted bypass generation network and the adjusted attribute editing network as a converged state may mean that the processing loss of the adjusted bypass generation network and the adjusted attribute editing network is less than the loss threshold; the convergence state of the adjusted bypass generation network and the adjusted attribute editing network as a non-converged state may mean that the processing loss of the adjusted bypass generation network and the adjusted attribute editing network is greater than or equal to the loss threshold. The processing loss may be determined according to the loss function of the image generation model, the loss threshold may be the minimum value of the loss function of the image generation model, or the loss threshold may be determined according to the application scenario of the iteratively trained bypass generation network and the iteratively trained attribute editing network.
[0082] In one embodiment, until both the bypass generation network and the attribute editing network meet the conditions for stopping iterative training, the adjusted bypass generation network and the adjusted attribute editing network are obtained, including: the computer device can count the number of iterative training of the bypass generation network and the attribute editing network, and when the number of iterative training of the bypass generation network and the attribute editing network is greater than the number threshold, it is determined that the bypass generation network and the attribute editing network meet the conditions for stopping iterative training, and the bypass generation network with the number of iterative training greater than the number threshold is determined as the bypass generation network after iterative training, and the attribute editing network with the number of iterative training greater than the number threshold is determined as the attribute editing network after iterative training. The number threshold can be determined according to the application scenarios of the bypass generation network after iterative training and the attribute editing network after iterative training, or determined by the device resources of the computer device.
[0083] Among them, the first training graph-text pairs can be P, and the P first training graph-text pairs can be divided into m batches, and the number of first training graph-text pairs in each batch can be M=P / m; after the parameters of the bypass generation network and the attribute editing network are updated based on a batch of first training graph-text pairs, it can be said that the bypass generation network and the attribute editing network complete one iteration update, and one iteration update can also be called one iteration training. When the parameters of the bypass generation network and the attribute editing network are updated based on m batches of first training graphs, the bypass generation network and the attribute editing network can be said to complete one epoch update, and P is an integer greater than 1.
[0084] The present application includes but is not limited to the following beneficial effects: by iteratively training the bypass generation network and the attribute editing network, the iteratively trained bypass generation network learns the text representation corresponding to the image distribution text and the latent space representation of the random noise image, generates an object image including the edited object, so that the iteratively trained attribute editing network learns the text representation corresponding to the edited text based on the object attribute, and edits the object attribute of the edited object in the above-mentioned predicted object image. So that the edited image of the edited object can be automatically generated by the iteratively trained bypass generation network and the iteratively trained attribute editing network, without the need for manual interaction, thereby improving the efficiency of object attribute editing. At the same time, it is not necessary to iteratively train the image generation model, so as to avoid the image generation model forgetting the learned knowledge, so that the iteratively trained bypass generation network and the iteratively trained attribute editing network are more focused on learning the knowledge about the edited object, which is conducive to improving the efficiency and accuracy of model training, and avoiding mismatching problems after object attribute editing, such as the mismatching problem can refer to the horns on the cat's head growing on the cow's head.
[0085] For further information, see Figure 4 , is a flow chart of an image data processing method provided in an embodiment of the present application. Figure 4 As shown, this method can be Figure 1 It can be executed by any terminal in the terminal cluster in Figure 1 can be executed by the server in Figure 1 The terminals and servers in the terminal cluster are used to perform collaborative execution. The devices used to perform the image data processing method in this application can be collectively referred to as computer devices. The method may include the following steps:
[0086] S201. Obtain a first training image-text pair, wherein the first training image-text pair includes a sample editing image of an editing object, and image distribution text and object attribute editing text corresponding to the sample editing image, wherein the image distribution text describes the objects included in the sample editing image, and the objects included in the sample editing image include the editing object, and the object attribute editing text describes the object attributes to be edited of the editing object.
[0087] S202, generating a predicted object image associated with the above-mentioned image distribution text according to the corresponding text representation of the above-mentioned image distribution text and the latent space representation of the random noise image through a bypass generation network and a trained image generation model.
[0088] In one embodiment, the trained image generation model includes a denoising network and a denoising network, and steps S202 and S203 include: performing denoising processing on the latent space representation of the random noise image through the denoising network to obtain a noisy latent space representation; performing T iterations on the text representation corresponding to the image distribution text and the noisy latent space representation according to the candidate editing images corresponding to the attribute editing network in the previous T-1 iterations through the denoising network and the bypass generation network to obtain the predicted object images corresponding to the above T iterations; T is an integer greater than 1.
[0089] Specifically, the computer device can add noise data corresponding to time step T to the latent space representation of the random noise image through the denoising network to obtain a noisy latent space representation, and through the denoising network and the bypass generation network, perform T iterations on the text representation corresponding to the image distribution text and the noisy latent space representation according to the candidate edited images corresponding to the previous T-1 iterations of the attribute editing network to obtain the predicted object images corresponding to the T iterations.
[0090] Among them, the prediction object image corresponding to the first iteration can be obtained by denoising the above-mentioned noisy latent space representation through the denoising network and the bypass generation network according to the text representation corresponding to the image distribution text. In other words, the prediction object image output by the bypass generation network and the denoising network in the first iteration is: the bypass generation network and the denoising network are generated according to the text representation corresponding to the image distribution text and the latent space representation of the random noise image.
[0091] In one example, the above-mentioned denoising network and the above-mentioned bypass generation network perform T iterations on the text representation corresponding to the above-mentioned image distribution text and the above-mentioned noisy latent space representation according to the candidate edited images corresponding to the previous T-1 iterations of the attribute editing network, and obtain the predicted object images corresponding to the above-mentioned T iterations, including: obtaining the candidate edited image corresponding to the above-mentioned attribute editing network at the i-1 iteration; i is an integer greater than 1 and less than or equal to T; using the above-mentioned denoising network, according to the text representation corresponding to the above-mentioned image distribution text and the latent space representation of the candidate edited image corresponding to the above-mentioned i-1 iteration, generating the first initial object image corresponding to the i-th iteration; using the above-mentioned bypass generation network, according to the text representation corresponding to the above-mentioned image distribution text and the latent space representation of the candidate edited image corresponding to the above-mentioned i-1 iteration, generating the second initial object image corresponding to the i-th iteration. The first initial object image corresponding to the above-mentioned i-th iteration and the second initial object image are merged to obtain the predicted object image corresponding to the above-mentioned i-th iteration.
[0092] Specifically, the computer device can perform denoising processing on the latent space representation of the candidate edited image corresponding to the i-1th iteration by using the above-mentioned denoising network and taking the above-mentioned image distribution text corresponding to the text representation as a constraint condition to generate the first initial object image corresponding to the i-th iteration, which is equivalent to optimizing the edited object, background, and other objects in the candidate edited image corresponding to the i-1th iteration by using the above-mentioned denoising network and taking the above-mentioned image distribution text corresponding to the text representation as a constraint condition to obtain the first initial object image corresponding to the i-th iteration. The computer device can perform denoising processing on the latent space representation of the candidate edited image corresponding to the i-1th iteration by using the above-mentioned bypass generation network and taking the above-mentioned image distribution text corresponding to the text representation as a constraint condition to generate the second initial object image corresponding to the i-th iteration, which is equivalent to optimizing the edited object, background, and other objects after the object attribute is edited in the candidate edited image corresponding to the i-1th iteration by using the above-mentioned bypass generation network and taking the above-mentioned image distribution text corresponding to the text representation as a constraint condition to obtain the second initial object image corresponding to the i-th iteration. The characteristic values of the pixel points in the first initial object image corresponding to the ith iteration and the characteristic values of the pixel points in the second initial object image are summed to obtain the predicted object image corresponding to the ith iteration. By merging the first initial object image and the second initial object image, the object distribution characteristics and background distribution characteristics of the predicted object image can meet the requirements of the image distribution text, which can make the generated edited image more natural.
[0093] The pixel feature values (ie, image feature values) may include pixel color feature values, texture feature values, etc. Other objects may refer to objects in the candidate editing image that do not require object attribute editing. Of course, the candidate editing image may not include other objects.
[0094] It should be noted that when the above-mentioned predicted object image includes the predicted object images corresponding to the bypass generation network and the image generation model in T rounds of iterations, the predicted object image corresponding to the first iteration is generated based on the text representation corresponding to the image distribution text and the noisy latent space representation. Therefore, the predicted object image corresponding to the first iteration includes partial information such as the edited object to be edited for object attributes, the background, and other objects that do not need to be edited for object attributes. The predicted object images after the first iteration are all generated based on the latent space representation corresponding to the candidate edited image of the previous iteration and the text representation corresponding to the image distribution text. Therefore, the predicted object images after the first iteration include the edited object after the object attribute editing, the background, and other objects that do not need to be edited for object attributes.
[0095] The summation process may refer to direct addition process or weighted summation process. When the summation process is weighted summation process, the computer device may weight the feature values of the pixels in the first initial object image according to the weights corresponding to the first initial object image to obtain the weighted feature values of the pixels in the first initial object image; and weight the feature values of the pixels in the second initial object image according to the weights corresponding to the second initial object image to obtain the weighted feature values of the pixels in the second initial object image. The weighted feature values of the pixels in the first initial object image and the weighted feature values of the pixels in the second initial object image are summed to obtain the predicted object image corresponding to the above-mentioned i-th iteration. The weight corresponding to the second initial object image may increase as the number of iterative training of the bypass generation network increases, and the weight corresponding to the first initial object image may decrease as the number of iterative training of the bypass generation network increases.
[0096] In one embodiment, the denoising network includes a first parameter matrix, the bypass generation network includes a second parameter matrix and a third parameter matrix, and the parameter amount of the second parameter matrix and the parameter amount of the third parameter matrix are both smaller than the parameter amount of the first parameter matrix. For example, the first parameter matrix of the denoising network is W O ∈R n×m , the second parameter matrix is A∈R n×d , the third parameter matrix is B∈R d×m, d is much smaller than n, that is, the bypass generated network is a lightweight network with relatively few parameters. By training a lightweight network, it is beneficial to improve training efficiency, reduce the number of training data requirements, and reduce the memory usage of computer devices during network training.
[0097] In one embodiment, the above-mentioned denoising network is used to generate a first initial object image corresponding to the i-th iteration according to the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-1-th iteration, and the above-mentioned bypass generation network is used to generate a second initial object image corresponding to the i-th iteration according to the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-1-th iteration, including: the computer device can multiply the above-mentioned first parameter matrix of the above-mentioned denoising network with the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-1-th iteration to obtain the first initial object image corresponding to the i-th iteration. The computer device can multiply the second parameter matrix of the bypass generation network, the product of the third parameter matrix, the text representation corresponding to the image distribution text, and the latent space representation of the candidate edited image corresponding to the i-1th iteration to obtain the second initial object image corresponding to the i-th iteration, so as to subsequently train the bypass generation network based on the first initial object image and the second initial object image, so as to train a lightweight network and improve training efficiency.
[0098] Among them, the bypass generation network can refer to the LoRA (Low-Rank Adaptation) network, which is essentially an approximate numerical decomposition technology for low-rank decomposition of latent space representation, which can greatly reduce the number of parameters of latent space representation.
[0099] S203. Through the attribute editing network, according to the text representation corresponding to the attribute editing text of the object, the object attributes of the editing object are edited in the predicted object image to obtain the initial editing image of the editing object, and the predicted object image and the initial editing image are merged to obtain the predicted editing image of the editing object.
[0100] In one example, step S203 includes: performing object attribute editing on the editing object in the predicted object image corresponding to the T iterations according to the text representation corresponding to the object attribute editing text through the attribute editing network to obtain the initial editing images corresponding to the T iterations, fusing the initial editing images corresponding to the T iterations and the predicted object image to obtain the candidate editing images corresponding to the T iterations; and determining the candidate editing image corresponding to the T iteration as the predicted editing image of the editing object.
[0101] Specifically, through the attribute editing network, the text representation corresponding to the above object attribute editing text is used as a constraint condition, and the object attribute is edited in the editing object in the predicted object image corresponding to the above T iterations, and the initial editing image corresponding to the above T iterations is obtained. The initial editing image corresponding to the above T iterations is added to the predicted object image to obtain the candidate editing image corresponding to the above T iterations. The candidate editing image corresponding to the T iteration is determined as the predicted editing image of the editing object.
[0102] For example, take the image distribution text as: an image of a cat and a cow, and the object attribute editing text is used to indicate that there are horns on the cat's head (the horns here are cow horns). Figure 5 As shown, the computer device can obtain the predicted object image 51a output by the bypass generation network and the denoising network at the i-1 iteration, and the initial edited image 52a output by the attribute editing network at the i-1 iteration; the initial edited image 52a corresponding to the i-1 iteration is fused with the predicted object image 51a to obtain the candidate edited image 53a corresponding to the i-1 iteration. Entering the i-th iteration, the bypass generation network and the denoising network are used to optimize the image regions where the cat and the cow are located in the candidate edited image corresponding to the i-1 iteration with the text representation of the image distribution text, and generate the predicted object image 54a corresponding to the i-th iteration. Through the attribute editing network, with the text representation corresponding to the attribute editing text as the constraint condition, the predicted object image 54a corresponding to the i-th iteration performs object attribute editing optimization on the above-mentioned edited object, and obtains the initial edited image 55a corresponding to the i-th iteration. The initial edited image 55a corresponding to the i-th iteration and the predicted object image 54a corresponding to the i-th iteration are fused to obtain the candidate edited image 56a corresponding to the i-th iteration. Comparing the predicted object image 51a obtained at the i-1th iteration with the predicted object image 54a obtained at the i-th iteration, it can be seen that the cat and cow in the predicted object image 54a are more realistic, that is, the predicted object image 54a can better reflect the details of the cat and cow. Comparing the initial edited image 52a obtained at the i-1th iteration with the initial edited image 55a obtained at the i-th iteration, it can be seen that the horns of the cat in the initial edited image 55a are more realistic. Comparing the candidate edited image 53a obtained at the i-1th iteration with the candidate edited image 56a obtained at the i-th iteration, it can be seen that the generation effect of the cat with horns on its head in the candidate edited image 56a is more natural, that is, the fusion between the horns and the cat is more natural.
[0103] For example, Figure 6As shown, the image generation model 61a includes a denoising network 62a, a denoising network 63a, and an image decoding network 65a; the denoising network 63a includes multiple QKV units, and the bypass generation network 66a includes multiple QKV units, and a QKV unit in the bypass generation network 66a corresponds to a QKV in the denoising network 63a. Take the denoising network 63a and the bypass generation network 66a as an example to illustrate that the four QKV units are included. The four QKV units in the denoising network 63a are QKV1, QKV2, QKV3, and QKV4; the four QKV units in the bypass generation network 66a are QKV5, QKV6, QKV7, and QKV8, QKV1 corresponds to QKV5, QKV2 corresponds to QKV6, QKV3 corresponds to QKV7, and QKV4 corresponds to QKV8. The attribute editing network 67a can be composed of one or more QKV units. Figure 6 In the example, the attribute editing network 67a includes a QKV unit, marked as QKV9.
[0104] During the training process, Figure 6 As shown, the computer device can perform sum processing on the random noise image and the data x to obtain the latent space representation Z of the random noise image, the data x is 0, and the latent space representation Z of the random noise image is subjected to noise processing through the noise adding network 62a to obtain the noisy latent space representation Z T The text encoding network 64a generates the text representations corresponding to the replaced image distribution text t1*, the replaced object attribute text t2*, the replaced editing object text t2o*, and the editing attribute text t2e. The denoising network 63a and the bypass generation network 66a generate the noisy latent space representation Z according to the text representation corresponding to the replaced image distribution text t1*. T Perform denoising to obtain the predicted object image corresponding to the first iteration ( Figure 6 ), through the attribute editing network 67a, according to the text representations corresponding to the replaced object attribute text t2*, the replaced editing object text t2o*, and the editing attribute text t2e, the object attribute editing is performed on the editing object in the predicted object image corresponding to the first iteration to obtain the initial editing image corresponding to the first iteration ( Figure 6 The latent space representation of the initial edited image corresponding to the first iteration and the latent space representation of the predicted object image are merged to obtain the latent space representation Z′ corresponding to the candidate edited image corresponding to the first iteration. T-1 , and so on, by performing T iterations, the latent space representation Z′ of the candidate edited image corresponding to the T-th iteration can be obtained. The latent space representation Z′ of the candidate edited image is decoded through the image decoding network 65a to obtain the candidate edited image Y corresponding to the T-th iteration.
[0105] Figure 7 The schematic diagram of the bypass generation network, denoising network, and attribute editing network is shown. Figure 7 The denoising network in includes a downsampling subnetwork, an upsampling subnetwork and a spatial conversion layer. The downsampling subnetwork includes 2 cascaded QKV units (i.e., QKV1, QKV2), 2 cascaded residual blocks (residual block 1, residual block 2), and the upsampling subnetwork includes 2 cascaded QKV units (i.e., QKV3, QKV4), 2 cascaded residual blocks (residual block 3, residual block 4). The bypass network also includes 4 QKV units, namely QKV5, QKV6, QKV7, and QKV8. The structures of QKV5, QKV6, QKV1, and QKV2 are the same, and the structures of QKV3, QKV4, QKV7, and QKV8 are the same. Among them, the control information corresponding to each QKV unit in the bypass generation network and each QKV unit in the denoising network are all text representations corresponding to the image distribution text. The attribute network is connected to QKV4 in the downsampling subnetwork, the attribute editing network includes a QKV unit, and the control information corresponding to the QKV unit in the attribute editing network is the text representation corresponding to the object attribute editing text.
[0106] Among them, Q (Query) refers to to match others, indicating the information to be controlled, K (Key) refers to to be matched, indicating the information to be controlled, and V (Value) refers to information to be extracted, indicating the information of the input feature. Taking QKV1 in the denoising network as an example, Q in QKV1 represents the noisy latent space representation Z T , KV in QKV1 represents the text representation corresponding to the image distribution text.
[0107] It should be noted that each QKV unit in the image generation model has a first parameter matrix, and each QKV unit in the bypass generation network, the bypass object positioning layer in the attribute editing network, and the bypass attribute editing layer all have a second parameter matrix and a third parameter matrix. In other words, the bypass generation network and the attribute editing network to be trained in this application have a small number of parameters, which realizes lightweight training of the bypass generation network and the attribute editing network, improves training efficiency, and reduces the amount of training samples required for training.
[0108] In one embodiment, the attribute editing network includes an object positioning subnetwork, an attribute generation subnetwork, and an attribute editing subnetwork; the object attribute editing text includes an editing object text, an editing attribute text, and an object attribute text; the attribute editing network performs object attribute editing on the editing object in the predicted object images corresponding to the T iterations, according to the text representation corresponding to the object attribute editing text, to obtain the initial editing images corresponding to the T iterations, including: the computer device can mark the image area of the predicted object image corresponding to the i-th iteration of the editing object through the object positioning subnetwork, according to the text representation corresponding to the editing object text, to obtain a marked object image; i is an integer greater than 1 and less than or equal to T. The computer device can add object attributes to the marked image area in the marked object image under the constraint condition (i.e., driven) of the text representation corresponding to the object attribute text through the attribute generation subnetwork, to obtain the added marked object image. Through the above-mentioned attribute editing subnetwork, with the text representation corresponding to the above-mentioned object attribute text as a constraint condition, the above-mentioned object attributes in the above-mentioned added marked object image are adjusted to the target part of the above-mentioned editing object, and the initial editing image corresponding to the above-mentioned i-th iteration is obtained to ensure that the added object attributes are integrated with the editing object.
[0109] It should be noted that the marking process here refers to marking the image area where the edited object is located, marking the feature values of the pixels in other image areas as invalid values (such as 0), and the marked object image here only includes the edited object whose object properties have not been edited, that is, the feature values of the pixels in the image area other than the edited object in the marked object image are all 0. The added marked object image includes the edited object after the object properties are edited, and the feature values of the pixels in other image areas are all 0.
[0110] For example, the image distribution text is: a cat named Nicolas and a cow, and the attribute object edit text indicates that the cat has horns, then the labeled object image includes a cat named Nicolas, and the edited labeled object image includes a cat named Nicolas with horns on its head, and the feature values of the pixels in other image areas are all 0. The horns of the cat in the edited labeled object image here are in the image area where the cat is located, but may not be on the cat's head. Therefore, it is necessary to use the text representation corresponding to the above object attribute text as a constraint condition, adjust the above object attributes in the above added labeled object image to the target part of the above edited object, and obtain the initial edited image corresponding to the above i-th iteration.
[0111] It should be noted that the target part may refer to the part of the editing object that is associated with the object attribute to be edited. For example, if the object attribute to be edited is the horn, the target part may refer to the head; if the object attribute to be edited is the color of the eyes, the target part may refer to the eyes.
[0112] In one embodiment, the object localization subnetwork includes an original object localization layer, a bypass object localization layer, and an object mask layer; the object localization subnetwork, according to the text representation corresponding to the edit object text, performs a marking process on the image area of the edit object in the predicted object image corresponding to the i-th iteration to obtain a marked object image, including: the computer device can perform an activation process on the image area of the edit object in the predicted object image corresponding to the i-th iteration through the original object localization layer according to the text representation corresponding to the edit object text, to obtain a first activated object image; the activation process here is equivalent to performing an image enhancement process on the image area where the edit object is located in the predicted object image, such as increasing the feature value of the pixel point in the image area where the edit object is located. Through the bypass object localization layer, according to the text representation corresponding to the edit object text, the image area of the edit object in the predicted object image corresponding to the i-th iteration is activated to obtain a second activated object image. The feature values of the pixels in the first object activation image and the feature values of the pixels in the second activation object image are summed to obtain a merged object image; through the object mask layer, according to the predicted object image corresponding to the i-th iteration, the image area of the edited object in the merged object image is marked to obtain a marked object image. By performing multiple activation processes on the image area where the edited object is located, it is helpful to accurately locate the edited object that needs object attribute editing, so as to avoid the mismatch problem after object attribute editing.
[0113] It should be noted that the summation process here may refer to direct addition process or weighted summation process. When the summation process is weighted summation process, the computer device may weight the feature values of the pixels in the first activated object image according to the weights corresponding to the first activated object image to obtain the weighted feature values of the pixels in the first activated object image; and weight the feature values of the pixels in the second activated object image according to the weights corresponding to the second activated object image to obtain the weighted feature values of the pixels in the second activated object image. The weighted feature values of the pixels in the first activated object image and the weighted feature values of the pixels in the second activated object image are summed to obtain a merged object image. The weight corresponding to the second activated object image may increase as the number of iterative training of the bypass object positioning layer increases, and the weight corresponding to the first activated object image may decrease as the number of iterative training of the bypass object positioning layer increases.
[0114] Among them, the original object positioning layer 81a, the bypass object positioning layer 82a, the attribute generation subnetwork 84a, the original attribute editing layer 85a, and the bypass attribute editing layer 86a may refer to QKV units, wherein the original object positioning layer 81a may refer to the original object positioning layer in the image generation model, and the bypass object positioning layer 82a may be an object positioning layer to be trained and used to locate the image region where the edited object is located. The original attribute editing layer 85a may be an original attribute editing layer in the image generation model, and the bypass attribute editing layer 86a is an attribute editing layer to be trained and used to edit the object attributes of the edited object.
[0115] In one embodiment, the above-mentioned bypass object positioning layer activates the image area of the above-mentioned editing object in the predicted object image corresponding to the above-mentioned i-th iteration according to the text representation corresponding to the above-mentioned editing object text to obtain the second activated object image, including: the computer device can determine the similarity between the text representation corresponding to the above-mentioned editing object text and the latent space representations corresponding to the multiple image areas in the predicted object image corresponding to the above-mentioned i-th iteration according to the similarity algorithm through the above-mentioned bypass object positioning layer. From the multiple image areas in the predicted object image corresponding to the above-mentioned i-th iteration, the image area with the maximum similarity is screened out. The screened image area is determined as the target image area of the above-mentioned editing object in the predicted object image corresponding to the above-mentioned i-th iteration; the feature value of the above-mentioned target image area in the predicted object image corresponding to the above-mentioned i-th iteration is increased to obtain the second activated object image.
[0116] The similarity algorithm may refer to cosine similarity, a similarity algorithm based on MinHash, or the like.
[0117] It should be noted that the text representation corresponding to the edit object text belongs to the text modality, and the latent space representation corresponding to the image area belongs to the image modality. Therefore, the similarity between the text representation corresponding to the edit object text and the latent space representation corresponding to the image area can be called cross-modal similarity. It can be seen that the image area where the edit object is located is located through the cross-modal similarity between the text representation corresponding to the edit object text and the generation process features (the latent space representation corresponding to the image area), so as to limit the object attribute editing to the image area, which can avoid the mismatch problem of the newly added object attributes and improve the accuracy of object attribute editing.
[0118] The multiple image regions in the prediction object image may be obtained by dividing the prediction object image according to the size of the editing object.
[0119] In one embodiment, the above-mentioned object mask layer is used to mark the image region of the edited object in the merged object image according to the predicted object image corresponding to the i-th iteration to obtain the marked object image, including: the computer device can perform mask processing on the merged object image through the object mask layer to obtain the masked object image; determine the maximum connected domain in the masked object image according to the feature values of the pixels in the masked object image; mark the image region of the edited object in the masked object image according to the maximum connected domain in the masked object image to obtain the marked masked object image. The computer device can multiply the latent space representation corresponding to the marked masked object image and the latent space representation of the predicted object image corresponding to the i-th iteration to obtain the marked object image.
[0120] Specifically, the computer device can update the feature values of the first type of pixels in the merged object image to valid values and update the feature values of the second type of pixels to invalid values through the object mask layer to obtain the mask object image. Connect the pixels whose feature values in the mask object image are valid values to obtain at least one connected domain in the mask object image, determine the area of each connected domain, and determine the connected domain with the largest area among the at least two connected domains as the maximum connected domain of the mask object image. Detect whether the edited object is completely located in the maximum connected domain. If so, mark the maximum connected domain in the mask object image as the image area of the edited object to obtain the marked mask object image. If not, expand the maximum connected domain in the mask object image until the expanded maximum connected domain includes the complete edited object to obtain the marked mask object image. Multiply the latent space representation of the marked mask object image with the latent space representation of the predicted object image corresponding to the i-th iteration to obtain the marked object image.
[0121] It should be noted that mask processing may refer to updating the feature value of the first type of pixel points in the merged object image to a valid value, and updating the feature value of the second type of pixel points to an invalid value, the first type of pixel points are the pixel points in the merged object image whose feature value is greater than the feature threshold, and the second type of pixel points are the pixel points in the merged object image whose feature value is less than or equal to the feature threshold. The feature threshold here may be s times the maximum feature value in the merged object image, and s may be adjusted, such as 0.5, 0.2, etc.
[0122] For example, Figure 8As shown, the object positioning subnetwork, attribute generation subnetwork 84a, and attribute editing subnetwork in the attribute editing network, the object positioning subnetwork may include the original object positioning layer 81a, the bypass object positioning layer 82a, and the object mask layer 83a, and the attribute editing subnetwork may include the original attribute editing layer 85a and the bypass attribute editing layer 86a. Obtain the predicted object image feat1 corresponding to the denoising network and the bypass generation network at the i-th iteration, through the original object positioning layer 81a, according to the text representation corresponding to the replaced editing object text t2o*, activate the image area where the editing object in the predicted object image feat1 is located, and obtain the first activated object image, activate the image area where the editing object in the predicted object image feat1 is located through the bypass positioning layer 82a, and obtain the second activated image, perform weighted sum processing on the feature values of the pixels of the first activated object image and the feature values of the pixels of the second activated object image, and obtain the merged object image feat1o. Through the object mask layer, mask, mark, and other processing are performed on the above-mentioned merged object image to obtain a marked masked object image. The computer device can multiply the latent space representation corresponding to the marked mask object image and the latent space representation of the predicted object image corresponding to the above-mentioned i-th iteration to obtain the marked object image. Through the attribute generation subnetwork 84a, under the drive of the text representation corresponding to the replaced editing attribute text t2e, the object attributes are generated in the image area where the editing object in the marked object image is located, and the added marked object image feat1e1 is obtained. Through the original attribute editing layer 85a, driven by the text representation corresponding to the replaced object attribute text t2*, the above-mentioned object attributes in the above-mentioned added marked object image are adjusted to the target part of the above-mentioned editing object, and the edited image f0 is obtained. Through the bypass attribute editing layer 86a, driven by the text representation corresponding to the replaced object attribute text t2*, the above-mentioned object attributes in the above-mentioned added marked object image are adjusted to the target part of the above-mentioned editing object, and the edited image f1 is obtained. The edited image f0 and the edited image f1 are weighted summed to obtain the initial edited image feat1e2 corresponding to the i-th iteration. It can be expressed as: initial edited image feat1e2 = edited image f1*a + edited image f0*(1-a), where a is the weight of edited image f1, and its value increases with the number of iterative training of the bypass attribute editing network. Further, the initial edited image feat1e2 corresponding to the i-th iteration is fused with the predicted object image feat1 to obtain the candidate edited image corresponding to the i-th iteration. Figure 8 The M in here stands for merge.
[0123] It should be noted that when the predicted object image feat1 has multiple objects, such as cats and cows, when the cat is the editing object, the computer device can increase the characteristic values of the pixel points in the image area where the cat is located in the predicted object image feat1 to activate the image area where the cat is located. At this time, when the distance between the cow and the cat is very close, the cow may also be weakly activated, that is, the increase in the characteristic value corresponding to the cow is less than the increase in the characteristic value corresponding to the cat. However, this weak activation easily causes the object attribute editing to be misplaced (i.e., mismatched). Based on this, it is necessary to find the maximum connected domain through the object mask layer to avoid the mismatch problem.
[0124] For example, Fig. 9 As shown, after obtaining the merged object image feat1o, the computer device can update the feature value of the first type of pixel points in the merged object image feat1o to a valid value (such as 1), and update the feature value of the second type of pixel points to an invalid value (such as 0) through the object mask layer, so as to obtain the mask object image f3. The pixels whose feature values in the mask object image f3 are valid are connected to obtain a connected image f4, which includes multiple connected domains. The largest connected domain is selected from the multiple connected domains included in the connected image f4, and the feature values of the pixels in the largest connected domain are marked as invalid values, and the feature values of the pixels outside the largest connected domain are marked as invalid values, so as to obtain the initial marked image f5. The largest connected domain of the initial marked image f5 is expanded to obtain the marked mask object image f6, which includes the target image area of the editing object, the target area is obtained by expanding the connected domain, the feature values of the pixels in the target area are valid values, and the feature values of the pixels outside the target area in the marked mask object image f6 are invalid values. That is, considering that the feature threshold of 0.5 times the maximum eigenvalue may exclude the edge of the coded object, the maximum connected domain needs to be expanded to include the edge of the coded object. Take 0.2 times the maximum eigenvalue as the updated feature threshold, and continue to take connected areas with eigenvalues greater than the updated feature threshold outside the maximum connected domain until no more are taken, and the target image area is obtained. Alternatively, take the leftmost, rightmost, top and bottom positions of the maximum connected domain so that the final connected domain is a rectangle to obtain the target image area.
[0125] S204: Determine the processing losses of the bypass generation network and the attribute editing network according to the predicted edited image and the sample edited image.
[0126] In the present application, a computer device can calculate the difference between a predicted edited image and a sample edited image, and determine the processing loss of the bypass generation network and the attribute editing network according to the difference. The processing loss is used to reflect the accuracy of the bypass generation network in generating the object image and the accuracy of the object attribute editing of the attribute editing network.
[0127] Among them, the computer device can perform difference processing on the characteristic values of pixel points in the predicted editing image and the characteristic values of pixel points in the sample editing image to obtain the difference between the predicted editing image and the sample editing image, wherein there is a positive correlation between the difference and the processing loss, that is, the greater the difference, the greater the processing loss; conversely, the smaller the difference, the smaller the processing loss.
[0128] S205. Determine the convergence status of the bypass generation network and the attribute editing network according to the processing loss.
[0129] In the present application, when the processing loss is greater than or equal to the loss threshold, the computer device can determine that the convergence state of the iteratively trained bypass generation network and the iteratively trained attribute editing network is an unconverged state. When the processing loss is less than the loss threshold, the computer device can determine that the convergence state of the iteratively trained bypass generation network and the iteratively trained attribute editing network is a converged state.
[0130] S206: When the convergence states of the bypass generation network and the attribute editing network are in an unconverged state, adjusting the parameters of the bypass generation network and the parameters of the attribute editing network according to the processing loss.
[0131] In the present application, when the convergence state of the bypass generation network and the attribute editing network is a converged state, the bypass generation network is used as the bypass generation network after iterative training, and the attribute editing network is used as the attribute editing network after iterative training, and the training of the bypass generation network and the attribute editing network is terminated. When the convergence state of the bypass generation network and the attribute editing network is an unconverged state, the parameters of the bypass generation network and the parameters of the attribute editing network are adjusted according to the processing loss to obtain the adjusted bypass generation network and the adjusted attribute editing network.
[0132] S207, until the bypass generation network and the attribute editing network satisfy the conditions for stopping iterative training, and obtain the iteratively trained bypass generation network and the iteratively trained attribute editing network; the image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network are used to generate the edited image of the edited object.
[0133] In the present application, when the convergence state of the adjusted bypass generation network and the adjusted attribute editing network is an unconverged state, the parameters of the adjusted bypass generation network and the parameters of the adjusted attribute editing network continue to be adjusted. Until the convergence state of the adjusted bypass generation network and the adjusted attribute editing network is a converged state, the adjustment of the parameters of the adjusted bypass generation network and the parameters of the adjusted attribute editing network is suspended, and it is determined that the above-mentioned bypass generation network and the above-mentioned attribute editing network both meet the conditions for stopping iterative training, and the adjusted bypass generation network is determined as the bypass generation network after iterative training, and the adjusted attribute editing network is determined as the attribute editing network after iterative training, and the bypass generation network after iterative training and the attribute editing network after iterative training are stored.
[0134] In one embodiment, the computer device may obtain a request for generating an edit image of the edit object, and generate N random noise images according to N random seeds, where N is a positive integer. The N edit images of the edit object are generated according to the text representation of the object attribute edit text in the generation request, the text representation of the image distribution text, and the latent space representations corresponding to the N random noise images, through the image generation model, the iteratively trained bypass generation network, and the iteratively trained attribute editing network.
[0135] Specifically, after receiving the generation request, the computer device can randomly generate N random numbers, use the N random numbers as N random seeds, generate N random noise images based on the N random seeds, call the image generation model and the iteratively trained bypass generation model, and generate the jth object image according to the image distribution text in the generation request and the jth random noise image. Through the iteratively trained attribute editing network, according to the object attribute editing text in the generation request, the object attribute editing is performed on the edited object in the jth object image to obtain the jth edited image, and so on until N edited images are obtained.
[0136] It should be noted that the implementation process of generating edited images by the above-mentioned image generation model, the above-mentioned bypass generation network after iterative training, and the above-mentioned attribute editing network after iterative training can refer to the implementation process described in the previous article and will not be repeated here.
[0137] It should be noted that the bypass generation network after iterative training and the attribute editing network after iterative training both have generalization capabilities, that is, the attribute editing network after iterative training has the ability to generate object images of new editing objects, and the attribute editing network after iterative training has the ability to edit object attributes for new editing objects. The new editing objects refer to editing objects that have not appeared in the first training image-text pair. Therefore, the image distribution text carried in the generation request may be the same as or different from the image distribution text in the training image-text pair, and the object attribute editing text carried in the generation request may be the same as or different from the object attribute editing text in the training image-text pair. The editing object in the predicted object image may be the same as or different from the editing object in the object image generated based on the generation request.
[0138] For example, Fig.10 As shown, the application process of the image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network can include the following steps S301 to S303: S301, user input: image distribution text, edit object text, edit attribute text, object attribute text; that is, the computer device can receive a generation request, which includes the image distribution text, edit object text, edit attribute text, and object attribute text input by the user. S302, call the image generation model, the iteratively trained bypass generation network, and the iteratively trained attribute editing network; that is, the computer device can call the image generation model, the iteratively trained bypass generation network, and the iteratively trained attribute editing network to generate an edited image. Specifically, S302 includes the following steps S3021 to S3023: S3021, N random seeds; the computer device can randomly generate N random numbers and use the N random numbers as N random seeds; S3022, generate under different random seeds; generate N random noise images based on N random seeds, call the image generation model, the bypass generation network after iterative training, and the attribute editing network after iterative training, based on the latent space representation corresponding to the distribution of N random noise images, the image distribution text, the editing object text, the editing attribute text, and the text representation corresponding to the object attribute text, generate N edited images. S3023, return multiple edited images, that is, return N edited images. S303, display multiple edited images; the computer device can display N edited images for users to choose, and can generate personalized edited images for users.
[0139] The present application includes but is not limited to the following beneficial effects: by iteratively training the bypass generation network and the attribute editing network, the iteratively trained bypass generation network learns the text representation corresponding to the image distribution text and the latent space representation of the random noise image, generates an object image including the edited object, so that the iteratively trained attribute editing network learns the text representation corresponding to the edited text based on the object attribute, and edits the object attribute of the edited object in the above-mentioned predicted object image. So that the edited image of the edited object can be automatically generated by the iteratively trained bypass generation network and the iteratively trained attribute editing network, without the need for manual interaction, thereby improving the efficiency of object attribute editing. At the same time, it is not necessary to iteratively train the image generation model, so as to avoid the image generation model forgetting the learned knowledge, so that the iteratively trained bypass generation network and the iteratively trained attribute editing network are more focused on learning the knowledge about the edited object, which is conducive to improving the efficiency and accuracy of model training, and avoiding mismatching problems after object attribute editing, such as the mismatching problem can refer to the horns on the cat's head growing on the cow's head.
[0140] See also Fig.11 , is a schematic diagram of the structure of an image data processing device provided in an embodiment of the present application. Fig.11 As shown, the image data processing device may include:
[0141] The acquisition module 1111 is used to acquire a first training image-text pair, wherein the first training image-text pair includes a sample editing image of an editing object, and an image distribution text and an object attribute editing text corresponding to the sample editing image, wherein the image distribution text describes the object included in the sample editing image, the object included in the sample editing image includes the editing object, and the object attribute editing text describes the object attribute to be edited of the editing object;
[0142] A generation module 1112 is used to generate a prediction object image associated with the image distribution text according to the text representation corresponding to the image distribution text and the latent space representation of the random noise image through a bypass generation network and a trained image generation model;
[0143] The editing module 1113 is used to perform object attribute editing on the edited object in the predicted object image according to the text representation corresponding to the object attribute editing text through the attribute editing network to obtain an initial edited image of the edited object, and fuse the predicted object image with the initial edited image to obtain a predicted edited image of the edited object;
[0144] The training module 1114 is used to iteratively train the bypass generation network and the attribute editing network according to the predicted editing image and the sample editing image, until the bypass generation network and the attribute editing network both meet the conditions for stopping the iterative training, and obtain the iteratively trained bypass generation network and the iteratively trained attribute editing network. The image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network are used to generate the editing image of the editing object.
[0145] Optionally, the trained image generation model includes a denoising network and a denoising network;
[0146] The generation module 1112 is specifically used for:
[0147] The latent space representation of the random noise image is subjected to noise processing by the above-mentioned noise adding network to obtain a noisy latent space representation;
[0148] Through the denoising network and the bypass generation network, according to the candidate edited images corresponding to the attribute editing network in the previous T-1 iterations, the text representation corresponding to the image distribution text and the noisy latent space representation are iterated T times to obtain the predicted object images corresponding to the T iterations; T is an integer greater than 1;
[0149] Optionally, the editing module 1113 is specifically configured to perform object attribute editing on the edited objects in the predicted object images corresponding to the T iterations according to the text representation corresponding to the object attribute editing text through the attribute editing network, obtain initial edited images corresponding to the T iterations, fuse the initial edited images corresponding to the T iterations and the predicted object images, and obtain candidate edited images corresponding to the T iterations;
[0150] The candidate edited image corresponding to the Tth iteration is determined as the predicted edited image of the above-mentioned edited object.
[0151] Optionally, the generating module 1112 is specifically used for:
[0152] Obtain the candidate edited image corresponding to the i-1th iteration of the attribute editing network above; i is an integer greater than 1 and less than or equal to T;
[0153] Generate a first initial object image corresponding to the i-th iteration through the denoising network according to the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-th iteration; generate a second initial object image corresponding to the i-th iteration through the bypass generation network according to the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-th iteration;
[0154] The first initial object image corresponding to the i-th iteration and the second initial object image are merged to obtain a predicted object image corresponding to the i-th iteration.
[0155] Optionally, the denoising network includes a first parameter matrix, the bypass generation network includes a second parameter matrix and a third parameter matrix, and the parameter amount of the second parameter matrix and the parameter amount of the third parameter matrix are both smaller than the parameter amount of the first parameter matrix;
[0156] Optionally, the generating module 1112 is specifically used for:
[0157] The first parameter matrix of the denoising network is multiplied by the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-1th iteration to obtain a first initial object image corresponding to the i-th iteration;
[0158] The second parameter matrix of the bypass generation network, the product of the third parameter matrix, the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-1th iteration are multiplied to obtain the second initial object image corresponding to the i-th iteration.
[0159] Optionally, the attribute editing network includes an object positioning subnetwork, an attribute generation subnetwork, and an attribute editing subnetwork; the object attribute editing text includes an editing object text, an editing attribute text, and an object attribute text;
[0160] Optionally, the editing module 1113 is specifically configured to mark the image area in the predicted object image corresponding to the edited object at the i-th iteration through the object localization subnetwork according to the text representation corresponding to the edited object text, to obtain a marked object image; i is an integer greater than 1 and less than or equal to T;
[0161] By means of the attribute generation subnetwork, according to the text representation corresponding to the object attribute text, the object attribute is added to the marked image region in the marked object image to obtain the marked object image after the addition;
[0162] Through the attribute editing subnetwork, according to the text representation corresponding to the object attribute text, the object attribute in the added marked object image is adjusted to the target part of the edited object, and the initial edited image corresponding to the i-th iteration is obtained.
[0163] Optionally, the object localization subnetwork includes an original object localization layer, a bypass object localization layer and an object mask layer;
[0164] Optionally, the editing module 1113 is specifically configured to: activate the image region of the editing object in the predicted object image corresponding to the i-th iteration through the original object positioning layer according to the text representation corresponding to the editing object text, to obtain a first activated object image;
[0165] By means of the bypass object positioning layer, according to the text representation corresponding to the editing object text, an activation process is performed on the image region of the editing object in the predicted object image corresponding to the i-th iteration to obtain a second activated object image;
[0166] Merging the first object activation image and the second object activation image to obtain a merged object image;
[0167] Through the object mask layer, according to the predicted object image corresponding to the i-th iteration, the image region of the editing object in the merged object image is marked to obtain a marked object image.
[0168] Optionally, the editing module 1113 is specifically configured to determine, through the bypass object positioning layer, the similarity between the text representation corresponding to the editing object text and the latent space representations corresponding to the multiple image regions in the prediction object image corresponding to the i-th iteration;
[0169] Selecting an image region with the maximum similarity from the plurality of image regions in the prediction target image corresponding to the i-th iteration;
[0170] The screened image region is determined as the target image region of the edited object in the prediction object image corresponding to the i-th iteration;
[0171] The feature value of the target image area in the predicted object image corresponding to the i-th iteration is increased to obtain a second activated object image.
[0172] Optionally, the editing module 1113 is specifically configured to perform mask processing on the merged object image through the object mask layer to obtain a masked object image;
[0173] Determining a maximum connected domain in the mask object image according to feature values of pixels in the mask object image;
[0174] According to the maximum connected domain in the mask object image, marking is performed on the image region of the editing object in the mask object image to obtain a marked mask object image;
[0175] A marked object image is generated according to the marked mask object image and the predicted object image corresponding to the i-th iteration.
[0176] Optionally, a training module 1114 is used to determine the processing losses of the bypass generation network and the attribute editing network according to the predicted edited image and the sample edited image;
[0177] Determining the convergence status of the bypass generation network and the attribute editing network according to the processing loss;
[0178] When the convergence states of the bypass generation network and the attribute editing network are in an unconverged state, parameters of the bypass generation network and parameters of the attribute editing network are adjusted according to the processing loss.
[0179] Optionally, the generating module 1112 is specifically used for:
[0180] Acquire a second training image-text pair; the second training image-text pair includes a sample object image and an object description text, wherein the object description text reflects that the sample object image includes the edited object;
[0181] Using the placeholder string corresponding to the edit object to replace the object string associated with the edit object in the object description text, to obtain the replaced object description text;
[0182] Determine the text representation corresponding to the placeholder string according to the replaced object description text and the sample object image through the image generation model and the text encoding network;
[0183] According to the text representation corresponding to the placeholder string, the placeholder string, and the text encoding network, a text representation of the object attribute editing text and a text representation of the image distribution text are generated, and the text representation corresponding to the placeholder string is stored in the representation dictionary in the text encoding network.
[0184] The generation module 1112 is specifically used for:
[0185] Using the placeholder character string, replace the text representation of the object attribute editing text and the object character string in the image distribution text, to obtain the replaced object attribute editing text and the replaced image distribution text;
[0186] Querying, from the representation dictionary of the text editing network, a text representation associated with the replaced object attribute editing text and a text representation associated with the replaced image distribution text;
[0187] The text representation associated with the replaced object attribute editing text is determined as the text representation of the object attribute editing text, and the text representation associated with the replaced image distribution text is determined as the text representation of the image distribution text.
[0188] Optionally, the generating module 1112 is specifically used for:
[0189] Generate an initial text representation of the replaced object description text through the text encoding network;
[0190] By using the image generation model, the sample object image is subjected to noise addition processing to obtain a noisy object image, and according to the initial text representation, the noisy object image is subjected to denoising processing to obtain a pre-denoised object image;
[0191] Determining the accuracy of the initial text representation according to the denoised object image and the sample object image;
[0192] When the accuracy of the initial text representation is greater than the accuracy threshold, a text representation corresponding to the placeholder character string is determined according to the initial text representation.
[0193] Optionally, the generating module 1112 is specifically used for:
[0194] Obtaining a request for generating an edit image of the edit object;
[0195] Generate N random noise images based on N random seeds; N is a positive integer;
[0196] Through the above-mentioned image generation model, the above-mentioned iteratively trained bypass generation network and the above-mentioned iteratively trained attribute editing network, N edited images of the above-mentioned editing object are generated according to the text representation of the object attribute editing text in the above-mentioned generation request, the text representation of the image distribution text, and the latent space representations corresponding to the above-mentioned N random noise images.
[0197] When it is necessary to explain, the image data processing device in the present application can be used to execute the description of the above-mentioned image data processing method in the corresponding embodiment of the previous text. When the image data processing device executes the description of the image data processing method of the previous text, the beneficial effects brought about can refer to the beneficial effects described in the embodiment corresponding to the image data processing method of the previous text, and will not be repeated here.
[0198] The present application includes but is not limited to the following beneficial effects: by iteratively training the bypass generation network and the attribute editing network, the iteratively trained bypass generation network learns the text representation corresponding to the image distribution text and the latent space representation of the random noise image, generates an object image including the edited object, so that the iteratively trained attribute editing network learns the text representation corresponding to the edited text based on the object attribute, and edits the object attribute of the edited object in the above-mentioned predicted object image. So that the edited image of the edited object can be automatically generated by the iteratively trained bypass generation network and the iteratively trained attribute editing network, without the need for manual interaction, thereby improving the efficiency of object attribute editing. At the same time, it is not necessary to iteratively train the image generation model, so as to avoid the image generation model forgetting the learned knowledge, so that the iteratively trained bypass generation network and the iteratively trained attribute editing network are more focused on learning the knowledge about the edited object, which is conducive to improving the efficiency and accuracy of model training, and avoiding mismatching problems after object attribute editing, such as the mismatching problem can refer to the horns on the cat's head growing on the cow's head.
[0199] See also Fig.12 , is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.12 As shown, the above-mentioned computer device 1000 may refer to a terminal or a server, including: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, in some embodiments, the user interface 1003 may include a display screen (DcSPlay), a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WC-FC interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatileMeMory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device away from the aforementioned processor 1001. As Fig.12 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a computer program.
[0200] exist Fig.12 In the computer device 1000 shown, the network interface 1004 can provide network communication functions; the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call the computer program stored in the memory 1005 to implement the steps in the various method embodiments of the present application.
[0201] The present application includes but is not limited to the following beneficial effects: by iteratively training the bypass generation network and the attribute editing network, the iteratively trained bypass generation network learns the text representation corresponding to the image distribution text and the latent space representation of the random noise image, generates an object image including the edited object, so that the iteratively trained attribute editing network learns the text representation corresponding to the edited text based on the object attribute, and edits the object attribute of the edited object in the above-mentioned predicted object image. So that the edited image of the edited object can be automatically generated by the iteratively trained bypass generation network and the iteratively trained attribute editing network, without the need for manual interaction, thereby improving the efficiency of object attribute editing. At the same time, it is not necessary to iteratively train the image generation model, so as to avoid the image generation model forgetting the learned knowledge, so that the iteratively trained bypass generation network and the iteratively trained attribute editing network are more focused on learning the knowledge about the edited object, which is conducive to improving the efficiency and accuracy of model training, and avoiding mismatching problems after object attribute editing, such as the mismatching problem can refer to the horns on the cat's head growing on the cow's head.
[0202] It should be understood that the computer device described in the embodiments of the present application can execute the description of the above-mentioned image data processing method in the corresponding embodiments above, and can also execute the description of the above-mentioned image data processing device in the corresponding embodiments above, which will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated.
[0203] The data collection and processing in this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in practice, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0204] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the above-mentioned computer-readable storage medium stores a computer program executed by the image data processing device mentioned above, and the above-mentioned computer program includes program instructions. When the above-mentioned processor executes the above-mentioned program instructions, it can execute the description of the above-mentioned image data processing method in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0205] As an example, the above program instructions may be deployed on a computer device for execution, or deployed on at least two computer devices at one location for execution, or executed on at least two computer devices distributed at at least two locations and interconnected through a communication network. At least two computer devices distributed at at least two locations and interconnected through a communication network may constitute a blockchain network.
[0206] The computer-readable storage medium may be the image data processing device provided in any of the aforementioned embodiments or the central storage unit of the computer device, such as a hard disk or a memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SMART Medca card, SMC), a secure digital (Secure dcgctal, SD) card, a flash card (flash card), etc. equipped on the computer device. Further, the computer-readable storage medium may also include both the central storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0207] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish between contents in different media, rather than to describe a specific order. In addition, the terms "including" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules that are not listed, or may optionally include other step units inherent to these processes, methods, devices, products, or equipment.
[0208] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0209] The embodiment of the present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the description of the image data processing method and the decoding method in the above corresponding embodiment is implemented, so it will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the embodiment of the computer program product involved in the present application, please refer to the description of the method embodiment of the present application.
[0210] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0211] The method and related apparatus provided by the embodiment of the present application are described with reference to the method flow chart and / or structural diagram provided by the embodiment of the present application. Specifically, each process and / or box in the method flow chart and / or structural diagram, as well as the combination of the processes and / or boxes in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable network connection device to generate a machine, so that the instructions executed by the processor of the computer or other programmable network connection device generate instructions for implementing the process in the process. Figure 1 A process or multiple processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable network-connected device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable network connected device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A flow or multiple flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.
[0212] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A method for processing image data, characterized in that: include: Acquire a first training image-text pair, the first training image-text pair comprising a sample editing image of an editing object, and image distribution text and object attribute editing text corresponding to the sample editing image, the image distribution text describing the object contained in the sample editing image, the object contained in the sample editing image including the editing object, and the object attribute editing text describing the object attribute to be edited of the editing object; Generate a predicted object image associated with the image distribution text according to the text representation corresponding to the image distribution text and the latent space representation of the random noise image through a bypass generation network and a trained image generation model; By means of an attribute editing network, according to the text representation corresponding to the object attribute editing text, the object attribute editing is performed on the editing object in the predicted object image to obtain an initial editing image of the editing object, and the predicted object image and the initial editing image are fused to obtain a predicted editing image of the editing object; According to the predicted editing image and the sample editing image, the bypass generation network and the attribute editing network are iteratively trained until both the bypass generation network and the attribute editing network meet the conditions for stopping iterative training, thereby obtaining the iteratively trained bypass generation network and the iteratively trained attribute editing network. The image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network are used to generate an editing image of the editing object.
2. The method according to claim 1, characterized in that The trained image generation model includes a denoising network and a denoising network; The method of generating a predicted object image associated with the image distribution text by using a bypass generation network and a trained image generation model according to the text representation corresponding to the image distribution text and the latent space representation of the random noise image comprises: By means of the noise adding network, the latent space representation of the random noise image is subjected to noise adding processing to obtain a noisy latent space representation; Through the denoising network and the bypass generation network, according to the candidate edited images corresponding to the attribute editing network in the previous T-1 iterations, the text representation corresponding to the image distribution text and the noisy latent space representation are iterated T times to obtain the predicted object images corresponding to the T iterations; T is an integer greater than 1; The method of editing the object attributes of the edited object in the predicted object image according to the text representation corresponding to the object attribute edit text through the attribute editing network to obtain an initial edited image of the edited object, and fusing the predicted object image and the initial edited image to obtain a predicted edited image of the edited object includes: By using the attribute editing network, according to the text representation corresponding to the object attribute editing text, the edited object in the predicted object image corresponding to the T iterations is edited to obtain the initial edited images corresponding to the T iterations, and the initial edited images corresponding to the T iterations and the predicted object image are fused to obtain the candidate edited images corresponding to the T iterations; The candidate edited image corresponding to the Tth iteration is determined as the predicted edited image of the edited object.
3. The method according to claim 2, characterized in that The method of performing T iterations on the text representation corresponding to the image distribution text and the noisy latent space representation according to the candidate edited images respectively corresponding to the attribute editing network in the previous T-1 iterations through the denoising network and the bypass generation network to obtain the predicted object images respectively corresponding to the T iterations includes: Obtain a candidate edited image corresponding to the attribute editing network at the i-1th iteration; i is an integer greater than 1 and less than or equal to T; Generate a first initial object image corresponding to the i-th iteration by using the denoising network according to the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-th iteration; generate a second initial object image corresponding to the i-th iteration by using the bypass generation network according to the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-th iteration; The first initial object image and the second initial object image corresponding to the i-th iteration are merged to obtain the predicted object image corresponding to the i-th iteration; the predicted object image corresponding to the 1st iteration is generated based on the text representation corresponding to the image distribution text and the noisy latent space representation.
4. The method according to claim 3, characterized in that The denoising network includes a first parameter matrix, the bypass generation network includes a second parameter matrix and a third parameter matrix, and the parameter amount of the second parameter matrix and the parameter amount of the third parameter matrix are both smaller than the parameter amount of the first parameter matrix; The method of generating a first initial object image corresponding to the i-th iteration by the denoising network according to the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-1-th iteration, and generating a second initial object image corresponding to the i-th iteration by the bypass generation network according to the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-1-th iteration, includes: Multiplying the first parameter matrix of the denoising network with the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-1th iteration to obtain a first initial object image corresponding to the i-th iteration; The second parameter matrix of the bypass generation network, the product of the third parameter matrix, the text representation corresponding to the image distribution text and the latent space representation of the candidate edited image corresponding to the i-1th iteration are multiplied to obtain the second initial object image corresponding to the i-th iteration.
5. The method according to claim 2, characterized in that The attribute editing network includes an object positioning sub-network, an attribute generation sub-network, and an attribute editing sub-network; the object attribute editing text includes an editing object text, an editing attribute text, and an object attribute text; The method of editing the object attributes of the edited object in the predicted object images corresponding to the T iterations by the attribute editing network according to the text representation corresponding to the object attribute editing text, and obtaining the initial edited images corresponding to the T iterations respectively, comprises: By means of the object localization subnetwork, according to the text representation corresponding to the edit object text, the image region in the predicted object image corresponding to the edit object in the i-th iteration is marked to obtain a marked object image; i is an integer greater than 1 and less than or equal to T; By means of the attribute generation subnetwork, according to the text representation corresponding to the object attribute text, the object attribute is added in the marked image region in the marked object image to obtain the marked object image after the addition; Through the attribute editing subnetwork, according to the text representation corresponding to the object attribute text, the object attribute in the added marked object image is adjusted to the target part of the editing object, and the initial editing image corresponding to the i-th iteration is obtained.
6. The method according to claim 5, characterized in that The object localization subnetwork includes an original object localization layer, a bypass object localization layer, and an object mask layer; The object localization subnetwork is used to mark the image area in the predicted object image corresponding to the edit object in the i-th iteration according to the text representation corresponding to the edit object text, so as to obtain the marked object image, including: Through the original object positioning layer, according to the text representation corresponding to the editing object text, an activation process is performed on the image area of the editing object in the predicted object image corresponding to the i-th iteration to obtain a first activated object image; By means of the bypass object localization layer, according to the text representation corresponding to the editing object text, an activation process is performed on the image region of the editing object in the predicted object image corresponding to the i-th iteration to obtain a second activated object image; Merging the first object activation image and the second object activation image to obtain a merged object image; Through the object mask layer, according to the predicted object image corresponding to the i-th iteration, a marking process is performed on the image region of the editing object in the merged object image to obtain a marked object image.
7. The method according to claim 6, characterized in that The step of performing activation processing on an image region of the edit object in the predicted object image corresponding to the i-th iteration through the bypass object positioning layer according to the text representation corresponding to the edit object text to obtain a second activated object image includes: Determining, by the bypass object positioning layer, the similarity between the text representation corresponding to the editing object text and the latent space representations respectively corresponding to the plurality of image regions in the prediction object image corresponding to the i-th iteration; Selecting an image region with the maximum similarity from a plurality of image regions in the prediction target image corresponding to the i-th iteration; Determine the screened image area as the target image area of the editing object in the prediction object image corresponding to the i-th iteration; The feature value of the target image area in the predicted object image corresponding to the i-th iteration is increased to obtain a second activated object image.
8. The method according to claim 6, characterized in that The step of marking the image region of the edited object in the merged object image according to the predicted object image corresponding to the i-th iteration through the object mask layer to obtain the marked object image comprises: Performing mask processing on the merged object image through the object mask layer to obtain a masked object image; Determining a maximum connected domain in the mask object image according to feature values of pixels in the mask object image; According to the maximum connected domain in the mask object image, marking is performed on the image region of the editing object in the mask object image to obtain a marked mask object image; A marked object image is generated according to the marked mask object image and the predicted object image corresponding to the i-th iteration.
9. The method according to claim 1, characterized in that The iterative training of the bypass generation network and the attribute editing network according to the predicted editing image and the sample editing image comprises: Determining processing losses of the bypass generation network and the attribute editing network according to the predicted edited image and the sample edited image; determining, based on the processing loss, a convergence state of the bypass generation network and the attribute editing network; When the convergence states of the bypass generation network and the attribute editing network are in a non-convergence state, parameters of the bypass generation network and parameters of the attribute editing network are adjusted according to the processing loss.
10. The method according to claim 1, characterized in that The method further comprises: Acquire a second training image-text pair; the second training image-text pair includes a sample object image and an object description text, wherein the object description text reflects that the sample object image includes the edit object; Using the placeholder string corresponding to the editing object to replace the object string associated with the editing object in the object description text, to obtain the replaced object description text; Determine, by means of the image generation model and the text encoding network, a text representation corresponding to the placeholder string according to the replaced object description text and the sample object image; According to the text representation corresponding to the placeholder string, the placeholder string, and the text encoding network, a text representation of the object attribute editing text and a text representation of the image distribution text are generated, and the text representation corresponding to the placeholder string is stored in a representation dictionary in the text encoding network.
11. The method according to claim 10, characterized in that The step of generating the text representation of the object attribute editing text and the text representation of the image distribution text according to the text representation corresponding to the placeholder string, the placeholder string, and the text encoding network includes: Using the placeholder character string to replace the text representation of the object attribute editing text and the object character string in the image distribution text, to obtain the replaced object attribute editing text and the replaced image distribution text; querying, from the representation dictionary of the text editing network, a text representation associated with the replaced object attribute editing text and a text representation associated with the replaced image distribution text; The text representation associated with the replaced object attribute editing text is determined as the text representation of the object attribute editing text, and the text representation associated with the replaced image distribution text is determined as the text representation of the image distribution text.
12. The method according to claim 10, characterized in that The determining, through the image generation model and the text encoding network, a text representation corresponding to the placeholder string according to the replaced object description text and the sample object image, includes: Generate an initial text representation of the replaced object description text through the text encoding network; The sample object image is subjected to a noise adding process by the image generation model to obtain a noisy object image, and the noisy object image is subjected to a denoising process according to the initial text representation to obtain a pre-denoised object image; Determining the accuracy of the initial text representation based on the denoised object image and the sample object image; When the accuracy of the initial text representation is greater than the accuracy threshold, a text representation corresponding to the placeholder string is determined according to the initial text representation.
13. The method according to claim 1, characterized in that The method further comprises: Obtaining a request for generating an edit image of the edit object; Generate N random noise images based on N random seeds; N is a positive integer; Through the image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network, N edited images of the edited object are generated according to the text representation of the object attribute editing text in the generation request, the text representation of the image distribution text, and the latent space representations corresponding to the N random noise images.
14. An image data processing device, characterized in that: include: An acquisition module is used to acquire a first training image-text pair, wherein the first training image-text pair includes a sample editing image of an editing object, and an image distribution text and an object attribute editing text corresponding to the sample editing image, wherein the image distribution text describes the object included in the sample editing image, the object included in the sample editing image includes the editing object, and the object attribute editing text describes the object attribute to be edited of the editing object; A generation module, configured to generate a predicted object image associated with the image distribution text according to the text representation corresponding to the image distribution text and the latent space representation of the random noise image through a bypass generation network and a trained image generation model; An editing module, configured to edit the object attributes of the edited object in the predicted object image according to the text representation corresponding to the object attribute edit text through an attribute editing network, obtain an initial edited image of the edited object, and fuse the predicted object image with the initial edited image to obtain a predicted edited image of the edited object; A training module is used to iteratively train the bypass generation network and the attribute editing network according to the predicted editing image and the sample editing image, until the bypass generation network and the attribute editing network both meet the conditions for stopping iterative training, thereby obtaining the iteratively trained bypass generation network and the iteratively trained attribute editing network. The image generation model, the iteratively trained bypass generation network and the iteratively trained attribute editing network are used to generate an editing image of the editing object.
15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 13 are implemented.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.
