Face personalized editing method, device and equipment based on diffusion model
Through the face personalized editing method based on the diffusion model, the face feature information is extracted and integrated, which solves the problems of low similarity and single dimension in face editing in the existing technology, and generates a face with high similarity and strong sense of reality. Image, suitable for practical applications.
Patent Information
- Application Number
- CN202410164736.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-05
- Publication Date
- 2024-08-30
AI Technical Summary
Existing face personalized editing methods have problems such as low similarity in generated faces, single editing dimensions, and unrealistic images, making it difficult to effectively implement them in practical applications.
Using a face personalized editing method based on the diffusion model, by obtaining the face image to be edited and the guide face image, inputting the pre-trained face personalized editing model, including the face processing module, encoding module and diffusion model, extracting And integrate facial feature information, attribute information and expression classification feature vectors, perform multi-dimensional editing, and use preset loss functions for pixel-level supervision to generate more realistic and natural face images.
The generated face images can maintain high similarity and editing controllability, obtain more realistic and delicate face images, improve the generalization of content generation capabilities, and have high versatility and practical application significance.
Smart Images

Figure CN118570364A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a method, device and equipment for personalized face editing based on a diffusion model. Background Art
[0002] Artificial intelligence is regarded as a new innovative field. The application scenarios of this technology are constantly expanding, entering many fields of life and production, and gradually changing the production and service methods of traditional industries. With the continuous and large-scale investment in artificial intelligence, it can currently bring stable value to various industries. Among them, one of the directions with the highest technology utilization rate is the field of image vision. The automatic generation technology of artificial intelligence content is particularly prominent, and image-guided generation of image content has become a hot research and application direction. Image-guided image generation technology refers to generating a new image by inputting an image and superimposing personalized prompt words as a guide. Compared with the traditional rule-based image generation method, this method is more flexible and creative. Most of the artificial intelligence technologies related to image generation are based on diffusion large models or generative adversarial networks. Thanks to the generalization ability of diffusion large models, the image generation solutions based on diffusion large models have made continuous breakthroughs and are more mature in practical applications. Personalized face editing refers to modifying the angle, expression, and lighting of the face. The synthesis of faces based on generative adversarial networks has a significant disadvantage, which easily leads to a decrease in face similarity. Therefore, diffusion large model technology is a good choice for realizing personalized face editing.
[0003] With the development of image-guided image generation technology, many AI-based solutions for personalized face editing have been proposed. Among them, the method based on the diffusion large model stands out and can generate personalized face images with a certain accuracy. However, many current humanized face editing solutions have obvious problems, such as low similarity of generated faces, long image generation time, single editing dimension and unrealistic images, which makes it difficult to implement in actual applications. Summary of the invention
[0004] In view of this, the purpose of the present invention is to propose a method, device, equipment and computer program product for personalized face editing based on a diffusion model, aiming to solve the problems of existing personalized face editing methods such as low generated face similarity, single editing dimension and unrealistic images.
[0005] To achieve the above object, the present invention provides a method for personalized face editing based on a diffusion model, the method comprising:
[0006] Acquire a face image to be edited and a guide face image, wherein the face image to be edited is a single face image or a single-frame face image in an extracted video;
[0007] The face image to be edited and the guide face image are input into a pre-trained face personalized editing model, wherein the face personalized editing model includes a face processing module, an encoding module and a diffusion model; wherein,
[0008] Inputting the face image to be edited and the guide face image into the face processing module, respectively obtaining two sets of face attribute information corresponding to the face image to be edited and the guide face image, face feature information corresponding to the face image to be edited, and an expression classification feature vector corresponding to the guide face image;
[0009] Inputting the facial feature information, the two sets of facial attribute information and the expression classification feature vector into the encoding module to obtain facial guidance information, weight values, reconstructed facial guidance information and expression guidance information;
[0010] The face guide information, the weight value, the reconstructed face guide information and the expression guide information are integrated and input into the diffusion model with the text encoding information to obtain a face editing result image.
[0011] Preferably, the face processing module includes a face feature extraction module, a face attribute extraction module and an expression classification module; the face image to be edited and the guide face image are input into the face processing module, and two groups of face attribute information corresponding to the face image to be edited and the guide face image, face feature information corresponding to the face image to be edited and an expression classification feature vector corresponding to the guide face image are obtained respectively, including:
[0012] Inputting the face image to be edited into the face feature extraction module to obtain the face feature information;
[0013] Inputting the face image to be edited and the guide face image into the face attribute extraction module to obtain two sets of face attribute information respectively;
[0014] The guide face image is input into the expression classification module to obtain the expression classification feature vector.
[0015] Preferably, the encoding module includes a face encoding module and an expression encoding module; the step of inputting the face feature information, the two sets of face attribute information and the expression classification feature vector into the encoding module to obtain face guide information, weight values, reconstructed face guide information and expression guide information comprises:
[0016] Inputting the facial feature information into the facial encoding module to obtain the facial guidance information;
[0017] The expression classification feature vector is input into the expression encoding module to obtain the expression guidance information.
[0018] Preferably, the encoding module includes a facial image reconstruction encoding module and a coefficient encoding module, the coefficient encoding module includes an expression coefficient encoding module and a posture coefficient encoding module; the facial attribute information includes a facial shape coefficient, an expression coefficient, posture information and an illumination coefficient; the facial feature information, two groups of facial attribute information and the expression classification feature vector are input into the encoding module to obtain facial guidance information, weight values, reconstructed facial guidance information and expression guidance information, including:
[0019] Subtracting the two groups of expression coefficients and the two groups of posture information from each other to obtain expression differences and posture differences;
[0020] Inputting the expression difference and the posture difference into an expression coefficient encoding module and a posture coefficient encoding module respectively, and correspondingly obtaining the weight values including a first weight value and a second weight value;
[0021] Replacing the shape coefficient of the guide face image with the shape coefficient corresponding to the face image to be edited, so as to input the shape coefficient into a 3D face reconstruction module, and obtaining a 3D vertex mesh for face reconstruction;
[0022] The face reconstruction three-dimensional vertex mesh is transformed by mesh and plane pixel mapping to obtain a face depth image;
[0023] Superimposing the illumination coefficient corresponding to the guide face image on the reconstructed three-dimensional vertex mesh of the face to obtain a face brightness image;
[0024] The face depth image and the face brightness image are input into a reconstructed face image encoding module to obtain the reconstructed face guide information.
[0025] Preferably, the training process of the face personalized editing model includes:
[0026] Constructing a training data set includes obtaining a preset number of spoken-word videos, extracting different video frames of the same face in the same spoken-word video as data pairs, and cropping the video frames according to a preset size to obtain corresponding face training images, wherein the data pairs include the same face with different angles, expressions, and lighting differences;
[0027] The training data set is input into the model for training, and the model is optimized through a preset loss function to obtain the trained face personalized editing model.
[0028] Preferably, the preset loss function is Loss=αLoss photo+βLoss exp-pose +γLoss emoji , where α, β, and γ are the weight coefficients of each loss;
[0029] By Loss Photo Calculate the consistency loss between the guide face image and the output face image;
[0030] By Loss exp-pose Calculate the consistency loss of the expression coefficient and posture information corresponding to the guide face image and the output face image;
[0031] By Loss emoji Calculate the consistency loss of the expression classification feature vector corresponding to the guide face image and the output face image.
[0032] Preferably,
[0033] L photo =||mask face ×(image guide -f(image guide ,embed text ,embeds * ))||, where mask face Represents a binary image of the face area, image guide represents the input face image, f() represents the diffusion model, embed text Indicates text encoding information, embeds * It represents the integration result of the guidance information;
[0034] L exp-pose =||EXP guide -ft(result)[′exp′]||+||Pose guide -ft(result)[′pose′]||, where EXP guide represents the expression coefficient corresponding to the guided face image, ft() represents the face attribute extraction module, [′exp′] represents the expression coefficient corresponding to the generated face image, Pose guide represents the pose information corresponding to the guided face image, [′pose′] represents the pose information corresponding to the generated face image; L emoji =||Vector emoji -Emoji(result)||, where Vector emoji It represents the feature vector guiding the expression classification of the face image, and Emoji() represents the expression classification module.
[0035] To achieve the above object, the present invention also provides a human face personalized editing device based on a diffusion model, the device comprising:
[0036] An acquisition unit, used for acquiring a face image to be edited and a guide face image, wherein the face image to be edited is a single face image or a single-frame face image in an extracted video;
[0037] A processing unit is used to input the face image to be edited and the guide face image into a pre-trained face personalized editing model, wherein the face personalized editing model includes a face processing module, an encoding module and a diffusion model; wherein,
[0038] A first processing unit, configured to input the face image to be edited and the guide face image into the face processing module, and obtain two sets of face attribute information corresponding to the face image to be edited and the guide face image, face feature information corresponding to the face image to be edited, and an expression classification feature vector corresponding to the guide face image;
[0039] A second processing unit, configured to input the facial feature information, the two sets of facial attribute information, and the expression classification feature vector into the encoding module to obtain facial guidance information, weight values, reconstructed facial guidance information, and expression guidance information;
[0040] The third processing unit is used to integrate the face guide information, the weight value, the reconstructed face guide information and the expression guide information and input them into the diffusion model with the text encoding information to obtain a face editing result image.
[0041] In order to achieve the above-mentioned objectives, the present invention also proposes a face personalized editing device based on a diffusion model, comprising a processor, a memory, and a computer program stored in the memory, wherein the computer program is executed by the processor to implement the steps of a face personalized editing method based on a diffusion model as described in the above-mentioned embodiment.
[0042] In order to achieve the above-mentioned purpose, the present invention also proposes a computer-readable storage medium, on which a computer program is stored. The computer program is executed by a processor to implement the steps of a diffusion model-based face personalized editing method as described in the above-mentioned embodiment.
[0043] In order to achieve the above-mentioned purpose, the present invention also proposes a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of a personalized face editing method based on a diffusion model as described in the above-mentioned embodiment.
[0044] Beneficial effects:
[0045] The above scheme obtains the face image to be edited and the guide face image, and inputs the face personalized editing model constructed based on the diffusion model to perform face personalized editing, and generates a face editing result image. By utilizing the diffusion large model, the generated face image can maintain the face information of the face image to be edited and the editing information of the guide face image, and generate a face image with high similarity and strong editing controllability, so as to obtain a more realistic and natural face image.
[0046] The above scheme can edit multiple dimensions of the face at one time by extracting multiple information of the input face image, and map the information of multiple dimensions to the feature space suitable for the diffusion model by combining multiple feature encoding modules, ensuring that the final generated face image can have similarity and accurate editing. The use of the diffusion large model can greatly improve the generalization of content generation capabilities, and can directly edit multiple dimensions of face information at one time in limited data.
[0047] The above scheme supervises the generated face images at the pixel level and feature space through the preset loss function, which ensures that the generated face images are more realistic and delicate. The face personalized editing method proposed in this paper not only has a significant breakthrough in effect, but also has high versatility and practical application significance. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present invention 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0049] Figure 1 A flowchart of a method for personalized face editing based on a diffusion model is provided in accordance with an embodiment of the present invention.
[0050] Figure 2 A schematic diagram of the overall process of face editing provided by an embodiment of the present invention.
[0051] Figure 3 A schematic diagram of the structure of a diffusion model-based face personalized editing device provided by one embodiment of the present invention.
[0052] The realization of the purpose, functional features and advantages of the invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0054] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
[0055] The content of the present invention is described in detail below with reference to embodiments.
[0056] Reference Figure 1 The figure is a flow chart of a method for personalized face editing based on a diffusion model provided by an embodiment of the present invention.
[0057] In this embodiment, the method includes:
[0058] S11, obtaining a face image to be edited and a guide face image, wherein the face image to be edited is a single face image or a single-frame face image in an extracted video;
[0059] S12, inputting the face image to be edited and the guide face image into a pre-trained face personalized editing model, wherein the face personalized editing model includes a face processing module, an encoding module and a diffusion model; wherein,
[0060] S12-1, inputting the face image to be edited and the guide face image into the face processing module, respectively obtaining two sets of face attribute information corresponding to the face image to be edited and the guide face image, face feature information corresponding to the face image to be edited, and an expression classification feature vector corresponding to the guide face image;
[0061] S12-2, inputting the facial feature information, the two sets of facial attribute information and the expression classification feature vector into the encoding module to obtain facial guidance information, weight values, reconstructed facial guidance information and expression guidance information;
[0062] S12-3, integrating the face guide information, the weight value, the reconstructed face guide information and the expression guide information and inputting them into the diffusion model together with the text encoding information to obtain a face editing result image.
[0063] Further, the face processing module includes a face feature extraction module, a face attribute extraction module and an expression classification module; in step S12-1, the face image to be edited and the guide face image are input into the face processing module, and two sets of face attribute information corresponding to the face image to be edited and the guide face image, face feature information corresponding to the face image to be edited and an expression classification feature vector corresponding to the guide face image are obtained respectively, including:
[0064] S12-1-1, inputting the face image to be edited into the face feature extraction module to obtain the face feature information;
[0065] S12-1-2, inputting the face image to be edited and the guide face image into the face attribute extraction module to obtain two sets of face attribute information respectively;
[0066] S12-1-3, input the guide facial image into the expression classification module to obtain the expression classification feature vector.
[0067] Further, the encoding module includes a face encoding module and an expression encoding module; in step S12-2, the face feature information, the two groups of face attribute information and the expression classification feature vector are input into the encoding module to obtain face guide information, weight value, reconstructed face guide information and expression guide information, including:
[0068] S12-2-1, inputting the facial feature information into the facial encoding module to obtain the facial guidance information;
[0069] S12-2-2, input the expression classification feature vector into the expression encoding module to obtain the expression guidance information.
[0070] Further, the encoding module includes a reconstructed face image encoding module and a coefficient encoding module, the coefficient encoding module includes an expression coefficient encoding module and a posture coefficient encoding module; the face attribute information includes a face shape coefficient, an expression coefficient, posture information and an illumination coefficient; in step S12-2, the face feature information, two groups of face attribute information and the expression classification feature vector are input into the encoding module to obtain face guide information, weight value, reconstructed face guide information and expression guide information, including:
[0071] S12-2-3, subtracting the two groups of expression coefficients and the two groups of posture information respectively to obtain expression differences and posture differences;
[0072] S12-2-4, inputting the expression difference and the posture difference into an expression coefficient encoding module and a posture coefficient encoding module respectively, and correspondingly obtaining the weight values including a first weight value and a second weight value;
[0073] S12-2-5, replacing the shape coefficient of the guide face image with the shape coefficient corresponding to the face image to be edited, and inputting it into a 3D face reconstruction module to obtain a 3D vertex mesh for face reconstruction;
[0074] S12-2-6, transforming the three-dimensional vertex mesh of the face reconstruction by mesh and plane pixel mapping to obtain a face depth image;
[0075] S12-2-7, superimposing the illumination coefficient corresponding to the guide face image on the reconstructed three-dimensional vertex mesh of the face to obtain a face brightness image;
[0076] S12-2-8, input the face depth image and the face brightness image into the reconstructed face image encoding module to obtain the reconstructed face guidance information.
[0077] Reference Figure 2 In this embodiment, two face images are input, one of which is the face image to be edited. source , the other is the guide face image image guide , through the three-dimensional face reconstruction scheme, the face editing information of the guiding face image is extracted, combined with the face image to be edited, and a real face result image is output through the constructed neural network model. The face result image can maintain the face information of the face image to be edited and the editing information of the guiding face image.
[0078] Specifically, two face images (face image to be edited image source And guide the face image image guide ) as the input of the network, and then pass through the face attribute extraction module, wherein the face attribute extraction module is constructed based on the face three-dimensional deformation statistical model (3DMM), and two sets of face attribute information are obtained respectively. The face attribute information includes the face shape coefficient ID∈R 60 , expression coefficient EXP∈R 52 , posture information Pose∈R 3 , illumination coefficient Light∈R 3x9The expression coefficient and posture information corresponding to the face image to be edited and the guide face image are subtracted, and the result is used as the expression difference EXP between the two images. diff and posture differencePose diff The shape coefficients in the face attribute information obtained by guiding the face image are replaced with the shape coefficients corresponding to the face image to be edited, and then input into the 3D face reconstruction module (the 3D face reconstruction module is a neural network model built based on the facescape 3D statistical model), and the 3D vertex mesh of face reconstruction is obtained. In order to further maintain the consistency of the face feature space and eliminate the interference of the discreteness of the mesh in the image space, the corresponding 2D face depth image image is generated in the mesh space range. depth (The 2D face depth image is obtained by changing the 3D vertex mesh of the face reconstruction to the corresponding plane pixel point, and then calculating the corresponding pixel value). In addition, by superimposing the illumination coefficient of the corresponding guide face image on the 3D vertex mesh of the face reconstruction, a 2D face brightness image image of the mesh space range is generated. light The face image is guided through a 7-dimensional expression classification module (the expression classification module is built based on the resnet50 model) and the corresponding expression classification feature vector Vector is output. emoji .
[0079] Before inputting the diffusion model, the difference information needs to be encoded consistently. source The face feature extraction module is input, and the output face feature information is further encoded by the face encoding module to obtain the face guide information embed face ∈R n×768 The expression difference and posture difference are input into the expression coefficient encoding module and the posture coefficient encoding module respectively, and the weight values weight exp ∈R n and weight value weight pose ∈R n The 2D face depth image and 2D face brightness image obtained by reconstructing the mesh are extracted through the reconstructed face image encoding module to convert the features in the image into the guide information embed for reconstructing the face. depth-light ∈R n×768 . Input the expression classification feature vector into the expression encoding module and output the expression guidance information embed emoji ∈R 1×768 . Integrate the above guide information embeds * =(concat(embed face ,embed face ×weight exp,embed face ×weight pose ,embed deptj-light ,embed emoji )), and embed the text encoding information text Inject them together into the stable diffusion model f, and output the final edited face result image result = f (image source ,embed text ,embeds * ), where image source Represents the input face image a to be edited. Among them, the face encoding module, expression coefficient encoding module, posture coefficient encoding module, reconstructed face image encoding module and expression encoding module are convolutional neural network modules constructed by convolutional layers, fully connected layers, etc. according to the task.
[0080] Furthermore, the training process of the face personalized editing model includes:
[0081] Constructing a training data set includes obtaining a preset number of spoken-word videos, extracting different video frames of the same face in the same spoken-word video as data pairs, and cropping the video frames according to a preset size to obtain corresponding face training images, wherein the data pairs include the same face with different angles, expressions, and lighting differences;
[0082] The training data set is input into the model for training, and the model is optimized through a preset loss function to obtain the trained face personalized editing model.
[0083] The preset loss function is Loss = αLoss photo +βLoss exp-pose +γLoss emoji , where α, β, and γ are the weight coefficients of each loss;
[0084] By Loss Photo Calculate the consistency loss between the guide face image and the output face image;
[0085] By Loss exp-pose Calculate the consistency loss of the expression coefficient and posture information corresponding to the guide face image and the output face image;
[0086] By Loss emoji Calculate the consistency loss of the expression classification feature vector corresponding to the guide face image and the output face image.
[0087] In this embodiment, 10k oral videos are used as training data sets. The videos are from real scenes in natural environments, and the gender and race distribution of the characters in the videos is balanced. Before training, the videos need to be preprocessed, including extracting different video frames of the same person's face in the same video as data pairs, where the guide image is selected from the video frames of the same person's face at different times in the video. The data pairs mainly include the differences in angle, expression, and lighting of the same person's face. Combined with the face detection frame results, the extracted video frames are cropped into 512x512 size face images.
[0088] Use Loss=αLoss photo +βLoss exp-pose +γLoss emoji Calculate the value of the overall loss and update the network parameters through back propagation. Stop training after 20,000 iterations. In the formula, α, β, and γ are the weight coefficients of each loss.
[0089] Since the data pairs have the same face ID information, through L photo Calculate the consistency loss between the guide face image and the output face image, L photo =‖mask face ×(image guide -f(image source ,embed text ,embeds * ))||, where mask face A binary image representing the face area. A value of 1 indicates a face area, otherwise it is 0. This value can be obtained using the current face segmentation algorithm. f() represents the diffusion model. image guide represents the input guide face image, embed text Indicates text encoding information, embeds * Represents the integration result of the guidance information.
[0090] By L exp-pose Calculate the consistency loss of the expression coefficient and posture information corresponding to the generated face image and the guide face image, L exp-pose =||EXP guide -ft(result)[′exp′]||+||Pose guide -ft(result)[′pose′]||, EXP guide represents the expression coefficient corresponding to the guided face image, ft() represents the face attribute extraction module, [′exp′] represents the expression coefficient corresponding to the generated face image, Pose guideThe pose information corresponding to the guide face image is represented by [′pose′], and the pose information corresponding to the generated face image is represented by [′pose′]. This supervision can effectively ensure the accuracy of expression editing, and the generated face image can be consistent with the angle of the guide face image, thereby improving the accuracy of the generated face image.
[0091] By L emoji Calculate the consistency loss of the expression classification feature vector corresponding to the generated face image and the guide face image, L emoji =||Vector emoji -Emoji(result)||, Vector emoji represents the expression classification feature vector guiding the face image, and Emoji() represents the facial expression feature extraction (expression classification module). The smaller the difference between the two, the more consistent the generated face image is in terms of subtle expression semantics.
[0092] After the network training is completed, an edited face result image can be output by inputting two face images. However, for the generation of videos, a frame-by-frame editing method is adopted, and each face video frame is input into the model, and the result obtained is the editing result of the video.
[0093] Reference Figure 3 FIG. 1 is a schematic diagram of the structure of a diffusion model-based personalized face editing device provided by an embodiment of the present invention.
[0094] In this embodiment, the device 20 includes:
[0095] An acquisition unit 21 is used to acquire a face image to be edited and a guide face image, wherein the face image to be edited is a single face image or a single-frame face image in an extracted video;
[0096] The processing unit 22 is used to input the face image to be edited and the guide face image into a pre-trained face personalized editing model, wherein the face personalized editing model includes a face processing module, an encoding module and a diffusion model; wherein:
[0097] A first processing unit, configured to input the face image to be edited and the guide face image into the face processing module, and obtain two sets of face attribute information corresponding to the face image to be edited and the guide face image, face feature information corresponding to the face image to be edited, and an expression classification feature vector corresponding to the guide face image;
[0098] A second processing unit, configured to input the facial feature information, the two sets of facial attribute information, and the expression classification feature vector into the encoding module to obtain facial guidance information, weight values, reconstructed facial guidance information, and expression guidance information;
[0099] The third processing unit is used to integrate the face guide information, the weight value, the reconstructed face guide information and the expression guide information and input them into the diffusion model with the text encoding information to obtain a face editing result image.
[0100] Each unit module of the device 20 can respectively execute the corresponding steps in the above method embodiment, so each unit module will not be described in detail here. Please refer to the description of the above corresponding steps for details.
[0101] The embodiment of the present invention further provides a device for personalized face editing based on a diffusion model, the device comprising the device for personalized face editing based on a diffusion model as described above, wherein the device for personalized face editing based on a diffusion model can be used Figure 3 The structure of the embodiment can be executed accordingly. Figure 1 The technical solution of the method embodiment shown has similar implementation principles and technical effects. For details, please refer to the relevant records in the above embodiments, which will not be repeated here.
[0102] The device includes: a mobile phone, a digital camera, a tablet computer, or other devices with a camera function, or a device with an image processing function, or a device with an image display function. The device may include components such as a memory, a processor, an input unit, a display unit, and a power supply.
[0103] Among them, the memory can be used to store software programs and modules, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as an image playback function, etc.), etc.; the data storage area may store data created according to the use of the device, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory may also include a memory controller to provide the processor and the input unit with access to the memory.
[0104] The input unit can be used to receive input digital or character or image information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, the input unit of this embodiment includes not only a camera, but also a touch-sensitive surface (such as a touch display) and other input devices.
[0105] The display unit can be used to display information input by the user or information provided to the user and various graphical user interfaces of the device, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit may include a display panel, and optionally, the display panel may be configured in the form of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc. Further, the touch-sensitive surface may cover the display panel, and when the touch-sensitive surface detects a touch operation on or near it, it is transmitted to the processor to determine the type of touch event, and then the processor provides a corresponding visual output on the display panel according to the type of touch event.
[0106] The embodiment of the present invention further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the memory in the above embodiment; or a computer-readable storage medium that exists independently and is not installed in a device. The computer-readable storage medium stores at least one instruction, which is loaded and executed by a processor to implement Figure 1 The face personalized editing method based on the diffusion model is shown. The computer readable storage medium can be a read-only memory, a disk or an optical disk, etc.
[0107] The embodiment of the present invention also provides a computer program product, including a computer program / instruction, which is loaded and executed by a processor to implement Figure 1 The personalized face editing method based on diffusion model is shown.
[0108] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, equipment embodiment and storage medium embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0109] Furthermore, in this document, the terms "comprises," "comprising," or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device that includes the element.
[0110] The above description shows and describes the preferred embodiments of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the invention, through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art shall not depart from the spirit and scope of the present invention, and shall be within the scope of protection of the claims attached to the present invention.
Claims
1. A personalized face editing method based on a diffusion model, characterized in that: The method comprises: Acquire a face image to be edited and a guide face image, wherein the face image to be edited is a single face image or a single-frame face image in an extracted video; The face image to be edited and the guide face image are input into a pre-trained face personalized editing model, wherein the face personalized editing model includes a face processing module, an encoding module and a diffusion model; wherein, Inputting the face image to be edited and the guide face image into the face processing module, respectively obtaining two sets of face attribute information corresponding to the face image to be edited and the guide face image, face feature information corresponding to the face image to be edited, and an expression classification feature vector corresponding to the guide face image; Inputting the facial feature information, the two sets of facial attribute information and the expression classification feature vector into the encoding module to obtain facial guidance information, weight values, reconstructed facial guidance information and expression guidance information; The face guide information, the weight value, the reconstructed face guide information and the expression guide information are integrated and input into the diffusion model with the text encoding information to obtain a face editing result image.
2. According to the diffusion model-based personalized face editing method of claim 1, it is characterized in that: The face processing module includes a face feature extraction module, a face attribute extraction module and an expression classification module; the face image to be edited and the guide face image are input into the face processing module, and two groups of face attribute information corresponding to the face image to be edited and the guide face image, face feature information corresponding to the face image to be edited and an expression classification feature vector corresponding to the guide face image are obtained respectively, including: Inputting the face image to be edited into the face feature extraction module to obtain the face feature information; Inputting the face image to be edited and the guide face image into the face attribute extraction module to obtain two sets of face attribute information respectively; The guide face image is input into the expression classification module to obtain the expression classification feature vector.
3. The method for personalized face editing based on diffusion model according to claim 1, characterized in that: The encoding module includes a face encoding module and an expression encoding module; the face feature information, two groups of face attribute information and the expression classification feature vector are input into the encoding module to obtain face guide information, weight value, reconstructed face guide information and expression guide information, including: Inputting the facial feature information into the facial encoding module to obtain the facial guidance information; The expression classification feature vector is input into the expression encoding module to obtain the expression guidance information.
4. The method for personalized face editing based on diffusion model according to claim 1, characterized in that: The encoding module includes a facial image reconstruction encoding module and a coefficient encoding module, the coefficient encoding module includes an expression coefficient encoding module and a posture coefficient encoding module; the facial attribute information includes a facial shape coefficient, an expression coefficient, posture information and an illumination coefficient; the facial feature information, two groups of facial attribute information and the expression classification feature vector are input into the encoding module to obtain facial guidance information, weight values, reconstructed facial guidance information and expression guidance information, including: Subtracting the two groups of expression coefficients and the two groups of posture information from each other to obtain expression differences and posture differences; Inputting the expression difference and the posture difference into an expression coefficient encoding module and a posture coefficient encoding module respectively, and correspondingly obtaining the weight values including a first weight value and a second weight value; Replacing the shape coefficient of the guide face image with the shape coefficient corresponding to the face image to be edited, so as to input the shape coefficient into a 3D face reconstruction module, and obtaining a 3D vertex mesh for face reconstruction; The face reconstruction three-dimensional vertex mesh is transformed by mesh and plane pixel mapping to obtain a face depth image; Superimposing the illumination coefficient corresponding to the guide face image on the reconstructed three-dimensional vertex mesh of the face to obtain a face brightness image; The face depth image and the face brightness image are input into a reconstructed face image encoding module to obtain the reconstructed face guide information.
5. The method for personalized face editing based on diffusion model according to claim 1, characterized in that: The training process of the face personalized editing model includes: Constructing a training data set includes obtaining a preset number of spoken-word videos, extracting different video frames of the same face in the same spoken-word video as data pairs, and cropping the video frames according to a preset size to obtain corresponding face training images, wherein the data pairs include the same face with different angles, expressions, and lighting differences; The training data set is input into the model for training, and the model is optimized through a preset loss function to obtain the trained face personalized editing model.
6. The method for personalized face editing based on diffusion model according to claim 5, characterized in that: The preset loss function is Loss = αLoss photo +βLoss exp-pose +γLoss emoji , where α, β, and γ are the weight coefficients of each loss; By Loss photo Calculate the consistency loss between the guide face image and the output face image; By Loss exp-pose Calculate the consistency loss of the expression coefficient and posture information corresponding to the guide face image and the output face image; By Loss emoji Calculate the consistency loss of the expression classification feature vector corresponding to the guide face image and the output face image.
7. The method for personalized face editing based on diffusion model according to claim 6, characterized in that: L photo =||mask face ×(image guide -f(image guide ,embed text ,embeds * ))||, In the formula, mask face Represents a binary image of the face area, image guide represents the input face image, f() represents the diffusion model, embed text Indicates text encoding information, embeds * It represents the integration result of the guidance information; L exp-pose = ||EXP guide -ft(result)[′exp′]||+||Pose guide -ft(result)[′pose′]||, where EXP guide represents the expression coefficient corresponding to the guided face image, ft() represents the face attribute extraction module, [′exp′] represents the expression coefficient corresponding to the generated face image, Pose guide represents the pose information corresponding to the guiding face image, and [′pose′] represents the pose information corresponding to the generated face image; L emoji =||Vector emoji -Emoji(result)||, where Vector emoji It represents the feature vector guiding the expression classification of the face image, and Emoji() represents the expression classification module.
8. A personalized face editing device based on a diffusion model, characterized in that: The device comprises: An acquisition unit, used for acquiring a face image to be edited and a guide face image, wherein the face image to be edited is a single face image or a single-frame face image in an extracted video; A processing unit is used to input the face image to be edited and the guide face image into a pre-trained face personalized editing model, wherein the face personalized editing model includes a face processing module, an encoding module and a diffusion model; wherein, A first processing unit, configured to input the face image to be edited and the guide face image into the face processing module, and obtain two sets of face attribute information corresponding to the face image to be edited and the guide face image, face feature information corresponding to the face image to be edited, and an expression classification feature vector corresponding to the guide face image; A second processing unit, configured to input the facial feature information, the two sets of facial attribute information, and the expression classification feature vector into the encoding module to obtain facial guidance information, weight values, reconstructed facial guidance information, and expression guidance information; The third processing unit is used to integrate the face guide information, the weight value, the reconstructed face guide information and the expression guide information and input them into the diffusion model with the text encoding information to obtain a face editing result image.
9. A face personalized editing device based on a diffusion model, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory, wherein the computer program is executed by the processor to implement the steps of a diffusion model-based face personalized editing method as described in any one of claims 1 to 7.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of a method for personalized face editing based on a diffusion model as described in any one of claims 1 to 7 are implemented.
