Portrait generation method, device and equipment

By performing identity feature extraction and target style information processing on the original person image, a target person image that is consistent in appearance with the original person image is generated, which solves the problem of insufficient face similarity and naturalness in the existing technology and improves the quality of portrait generation. .

CN118608375APending Publication Date: 2024-09-06SMARTER SILICON (SHANGHAI) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410660710.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-24
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

The existing Vincentian diagram method is difficult to generate images similar to human faces in portrait generation, and the generated images are less natural.

Method used

By obtaining the original character image and target style information, the preset portrait generation model is used to extract the identity features of the original character image, and based on the identity feature information and target style information, the initial noise image is subjected to multiple denoising processes to generate the target character image.

Benefits of technology

It improves the quality of portrait generation, making the generated image consistent with the appearance of the characters in the original character image, and automatically transfers the target style information, improving the naturalness of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118608375A
    Figure CN118608375A
Patent Text Reader

Abstract

The invention discloses a portrait generation method, apparatus and device. The method comprises the steps of obtaining an original figure image and to-be-generated target style information of the original figure image; and performing identity feature extraction on the original figure image by using a preset portrait generation model to obtain identity feature information, and performing multiple noise reduction processing on the initial noise image based on the identity feature information and the target style information to generate a target figure image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device and equipment for generating a human portrait. Background Art

[0002] Generative models based on deep learning have received more and more attention and have been widely used. In the field of portrait photography, artificial intelligence (AI) generative models have achieved good portrait generation results. Existing face-study methods are difficult to generate images with similar faces due to the lack of prior knowledge of the user's appearance. Although face-swapping methods ensure that faces are similar, the generated images are less natural. Summary of the invention

[0003] The embodiments of the present application are intended to provide a method, apparatus and device for generating a human portrait.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present application provides a method for generating a human portrait, the method comprising:

[0006] Acquire an original character image and target style information to be generated from the original character image;

[0007] The preset portrait generation model is used to extract identity features from the original character image to obtain identity feature information, and based on the identity feature information and the target style information, multiple noise reduction processes are performed on the initial noise image to generate a target character image.

[0008] The present application provides a portrait generation device, including:

[0009] An acquisition module, used to acquire an original character image and target style information to be generated from the original character image;

[0010] The processing module is used to use a preset portrait generation model to extract identity features from the original character image to obtain identity feature information, and based on the identity feature information and the target style information, perform multiple noise reduction processes on the initial noise image to generate a target character image.

[0011] An embodiment of the present application provides a portrait generation device, comprising: a processor, a memory and a communication bus; the communication bus is used to achieve a communication connection between the processor and the memory; the processor is used to execute a computer program stored in the memory to implement the above-mentioned portrait generation method.

[0012] The embodiments of the present application provide a method, apparatus and device for generating a human portrait, the method comprising: obtaining an original human image and target style information to be generated from the original human image; using a preset human portrait generation model to extract identity features from the original human image to obtain identity feature information, and based on the identity feature information and the target style information, performing multiple noise reduction processes on the initial noisy image to generate a target human image. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 A schematic diagram of a process for generating a human portrait provided in an embodiment of the present application;

[0014] Figure 2 A schematic diagram of the structure of an exemplary identity feature extraction network provided in an embodiment of the present application;

[0015] Figure 3 A flowchart of an exemplary noise reduction method provided in an embodiment of the present application;

[0016] Figure 4 A schematic diagram of the structure of an exemplary preset portrait generation model provided in an embodiment of the present application;

[0017] Figure 5 A schematic diagram of the structure of an exemplary identity feature fusion network provided in an embodiment of the present application;

[0018] Figure 6 An exemplary model training process diagram provided in the embodiment of the present application Figure 1 ;

[0019] Figure 7 A schematic diagram of the structure of an exemplary training model provided in an embodiment of the present application;

[0020] Figure 8 An exemplary model training process diagram provided in the embodiment of the present application Figure 2 ;

[0021] Fig. 9 A schematic diagram of an exemplary process for determining total loss information provided in an embodiment of the present application Figure 1 ;

[0022] Fig.10 A schematic diagram of an exemplary process of determining identity loss information provided in an embodiment of the present application;

[0023] Fig.11 A schematic diagram of an exemplary process of determining style loss information provided in an embodiment of the present application;

[0024] Fig.12A schematic diagram of an exemplary process for determining total loss information provided in an embodiment of the present application Figure 2 ;

[0025] Fig.13 A schematic diagram of the structure of a portrait generation device provided in an embodiment of the present application;

[0026] Fig.14 A schematic diagram of the structure of a portrait generation device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] The technical solution in the present application will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present application. It is to be understood that the specific embodiments described herein are only used to explain the related application, rather than to limit the application. It should also be noted that, for ease of description, only the parts related to the related application are shown in the accompanying drawings.

[0028] The present application embodiment provides a method for generating a human portrait, which is implemented by a human portrait generating device, such as Figure 1 As shown, the steps include the following steps S101 and S102:

[0029] S101, obtaining an original character image and target style information to be generated from the original character image.

[0030] In the embodiments of the present application, the portrait generation device is an electronic device with a portrait generation function, which may be a tablet computer, a laptop computer, a PDA, a personal digital assistant (PDA), a desktop computer, etc. The specific portrait generation device is not limited here.

[0031] In an embodiment of the present application, the original character image is a character image to be generated, and the target style information is the style information of the character to be generated in the original character image. For example, the target style information can be style information such as uniform style and college style.

[0032] In an embodiment of the present application, the portrait generation device can directly obtain the original character image and the target style information to be generated from the original character image.

[0033] Exemplarily, the portrait generation device may obtain the original character image from a set of images stored locally on the portrait generation device, or collect the image on site through a camera, or obtain the image from the network through networking. The specific acquisition method may be set according to the actual application and scene requirements, and this application does not limit this. The portrait generation device may obtain the target style information of the original image to be generated by providing a variety of style information for the user to choose from, and determining the style information selected by the user as the target style information, or it may be set based on the original character image or the user may directly input the desired style information. The specific acquisition method may be set according to the actual application and scene requirements, and this application does not limit this.

[0034] S102, using a preset portrait generation model, extracting identity features from the original person image to obtain identity feature information, and performing multiple noise reduction processes on the initial noisy image based on the identity feature information and target style information to generate a target person image.

[0035] In an embodiment of the present application, after acquiring the original person image and the target style information, the portrait generation device uses a preset portrait generation model to extract the identity feature of the original person image to obtain the identity feature information, and then performs multiple denoising processes on the initial noise image based on the identity feature information and the target style information to generate the target person image. The style of the person in the target person image is the style represented by the target style information.

[0036] In an embodiment of the present application, the preset portrait generation model includes an identity feature extraction network for extracting identity features from the original person image to obtain identity feature information. Exemplarily, the identity feature extraction network is a face recognition network, which can be an ArcFace network 20 based on ResNet50, such as Figure 2As shown, it mainly includes input input (21), stage 0 (stage0) 22, stage 1 (stage1) 23, stage 2 (stage2) 24, stage 3 (stage3) 25, stage 4 (stage4) 26, and output (output) 27; stage0 (22) is the input (3, 224, 224) through 64 convolution kernels (CONV) 221 with a size of (7, 7) and a step size of 2, and then passes through a batch normalization layer (BN) 222 and an activation layer (RELU) 223, and finally passes through a maximum pooling layer (MAXPOOL) 224, where the kernel size is (3×3) and the step size is 2; stage1 (23), stage2 (24), stage3 (25), and stage4 (26) are composed of BINK1 (200) and BINK2 (201). Among them, BINK1 has four parameters: C (number of input channels), W (input size, length and width), C1 (number of output channels of the convolutional layer), S (stride of the convolutional layer); BINK2 has two parameters: C (number of input channels), W (input size, length and width).

[0037] Exemplarily, the preset portrait generation model is implemented based on a diffusion model, and the diffusion model is used to perform multiple noise reduction processes on the initial noise image based on the target style information, wherein the initial noise image is a random noise image, for example, Gaussian noise.

[0038] Compared with the existing related technologies, the problem of generated faces being dissimilar or the images being less natural is solved. This application extracts identity features from the original character image and, based on the identity feature information and target style information, performs denoising on the initial noisy image to generate a target character image that is consistent with the appearance of the character in the original character image and automatically transfers the target style information, thereby improving the quality of portrait generation.

[0039] In some embodiments, the preset portrait generation model includes multiple layers of denoising networks connected in sequence, and each layer of denoising network is connected to a corresponding identity feature fusion network. When the portrait generation device executes the above step S102 of "performing multiple denoising processes on the target style information based on the identity feature information to generate a target person image", as Figure 3 As shown, the following steps S301 to S303 may be included:

[0040] Step S301: input the target style information and the initial noise image into the first layer of the denoising network in the multi-layer denoising network for denoising processing to obtain corresponding output information.

[0041] In an embodiment of the present application, the portrait generation device inputs the target style information and the initial noise image into the first layer of the denoising network in the multi-layer denoising network connected in sequence included in the preset portrait generation model for denoising to obtain corresponding output information. Each layer of the denoising network in the multi-layer denoising network can be a Unet network.

[0042] For example, the input target style information may be a school uniform worn by female high school students (a women, JK suit).

[0043] Step S302: for each layer of denoising network, use the corresponding identity feature fusion network to fuse the corresponding output information with the identity feature information to obtain corresponding fusion information, and input the corresponding fusion information into the next layer of denoising network for denoising processing to obtain the output information corresponding to the next layer of denoising network.

[0044] In the embodiment of the present application, for each layer of the noise reduction network, the portrait generation device will use the corresponding identity feature fusion network to fuse the corresponding output information with the identity feature information, and after obtaining the fusion information, input it to the next layer of the noise reduction network to continue the noise reduction process. In this way, the output information corresponding to each layer of the noise reduction network will be fused with the identity feature information and then input to the next layer of the noise reduction network, which can ensure the consistency of the portrait.

[0045] Step S303: Decode the corresponding fusion information of the last layer of the denoising network in the multi-layer denoising network to obtain the target person image.

[0046] In an embodiment of the present application, the portrait generation device decodes and processes the fusion information corresponding to the last layer of the denoising network in the multi-layer denoising network to obtain the target person image.

[0047] like Figure 4 As shown, an exemplary preset portrait generation model is provided, the preset portrait generation model 41 includes multiple layers of noise reduction networks 42 connected in sequence, and each layer of noise reduction network 42 is connected to a corresponding identity feature fusion network 43. Among them, the preset portrait generation model 41 also includes Figure 2 The identity feature extraction network 44 shown in FIG. 4 is used to extract identity feature information from the input original person image x0 to obtain identity feature information e id The portrait generation device inputs the target style information 45 and the initial noise image 46 into the first layer of the multi-layer noise reduction network 42 for noise reduction processing to obtain the corresponding output information z i ; For each layer of the noise reduction network 42, the portrait generation device will use its corresponding identity feature fusion network 43 to convert the corresponding output information z i and identity information idFusion, get the corresponding fusion information f i , and the corresponding f i The next layer of denoising network 42 is input for denoising processing to obtain the output information f corresponding to the next layer of denoising network 42 i+1 The preset portrait generation model 41 may also include a decoder 47 for converting the last layer of the multi-layer denoising network 42 into the corresponding fusion information f T Decode the image x of the target person T In this way, the fusion information f i The information of the original person image is combined, so that the target person image can maintain the consistency of the face. Exemplarily, the preset portrait generation model is obtained by training based on the diffusion model, and the multi-layer noise reduction network 42 is the Unet network included in the diffusion model.

[0048] In some embodiments, the identity feature fusion network includes a plurality of fusion units connected in sequence; when the portrait generation device performs the above step S302 of "for each layer of the denoising network, using the corresponding identity feature fusion network, fusing the corresponding output information with the identity feature information to obtain the corresponding fusion information", such as Figure 5 As shown, the following steps may also be included: for each layer of the denoising network, using the corresponding multiple fusion units, the corresponding output information and identity feature information are multiple times fused to obtain the corresponding fusion information; wherein the input of the first fusion unit among the multiple fusion units is the output information of the corresponding denoising network; the output and identity feature information of each fusion unit are used as the input of the next fusion unit.

[0049] In an embodiment of the present application, the identity feature fusion network includes a plurality of fusion units connected in sequence, and the portrait generation device uses the corresponding plurality of fusion units to fuse the corresponding output information and the identity feature information for each layer of the denoising network multiple times to obtain the corresponding fusion information. The input of the first fusion unit among the plurality of fusion units is the output information of the corresponding denoising network, and then the output of each fusion unit and the identity feature information are used as the input of the next fusion unit.

[0050] like Figure 5 As shown, an exemplary network structure diagram of an identity feature fusion network 43 is provided, including at least one fusion unit 431, each fusion unit 431 includes a convolution layer 4311, a style transfer network 4312, and an activation layer 4313. Exemplarily, the style transfer network 4312 can be a style transfer algorithm (Adaptive Instance Normalization, AdaIN), and the implementation method of the style transfer algorithm is shown in formula (1):

[0051]

[0052] Among them, z i For output information, e id For identity information, Identity information id The variance, σ(z i ) is the output information z i The variance of i ) is the output information z i The mean of Identity information id The mean of .

[0053] In some embodiments, as shown in Figure 6, the portrait generation device may further perform the following steps S601 to S602:

[0054] Step S601: Obtain a trained standard portrait generation model and a portrait generation model to be trained including an identity feature fusion network.

[0055] In an embodiment of the present application, a portrait generation device can obtain a trained standard portrait generation model and a portrait generation model to be trained including an identity feature fusion network. Exemplarily, the portrait generation model to be trained is a network structure directly copied from a trained standard portrait generation model, wherein the trained standard portrait generation model is a network based on a diffusion model, and the network structure and network parameters of the portrait generation model to be trained and the trained standard portrait generation model involving the diffusion model are consistent. Exemplarily, Figure 7 As shown, the trained standard portrait generation model (see Figure 7 71 in ), and a to-be-trained portrait generation model including an identity feature fusion network (see Figure 7 72 in ), where the portrait generation model to be trained is Figure 4 The network structure of the preset portrait generation model is consistent, but the network parameters are different. The portrait generation model to be trained includes multiple layers of noise reduction networks 73 connected in sequence, each layer of noise reduction network 73 is connected to a corresponding identity feature fusion network 74, such as Figure 2 The identity feature extraction network 75 shown in the figure is connected to the decoder 76, and on this basis, the fusion information output by the identity feature fusion network 74 corresponding to each layer of the denoising network 73 is connected to the decoder 76, and then an identity feature extraction network 75 is connected after the decoder 76. The trained standard portrait generation model includes the trained multiple layers of denoising networks 73 connected in sequence, and a decoder 76 is connected to each layer of the denoising network 73 in the multiple layers of the denoising network 73.

[0056] Step S602: using the standard portrait generation model as a teacher network for self-supervised style feature training, and performing model training on the portrait generation model to be trained as a student network to obtain a preset portrait generation model.

[0057] In the embodiments of the present application, Figure 4 and Figure 7 As shown, the portrait generation device uses the standard portrait generation model 71 as the teacher network for self-supervised style feature training, and performs model training on the portrait generation model 72 to be trained as the student network, so as to obtain the preset portrait generation model 41. In this way, the portrait generation model to be trained is fine-tuned in a self-supervised manner, so that the model can adapt to different migration style features.

[0058] In some embodiments, when the portrait generating device performs the above step S602, Figure 8 As shown, the following steps S801 to S804 may also be included:

[0059] Step S801: obtaining a person sample image and style sample information to be generated from the person sample image, and extracting identity features from the person sample image using a portrait generation model to be trained to obtain sample identity feature information.

[0060] In an embodiment of the present application, a portrait generation device can obtain a sample character image and style sample information to be generated for the sample character image, and then input the sample character image into an identity feature extraction network included in a portrait generation model to be trained to extract identity features to obtain sample identity feature information.

[0061] like Figure 7 As shown, the portrait generation device inputs the sample image of the person into the identity feature extraction network 75 included in the portrait generation model to be trained to extract the identity feature to obtain the sample identity feature information.

[0062] Step S802: Using the standard portrait generation model, based on the style sample information, perform multiple noise reduction processes on the initial noisy image, and decode the information obtained from each noise reduction process to obtain multiple corresponding standard images.

[0063] In an embodiment of the present application, the portrait generation device may use a standard portrait generation model to perform multiple noise reduction processes on the style sample information, and decode the information obtained from each noise reduction process to obtain multiple corresponding standard images. Figure 7As shown, the portrait generation device can use the multi-layer denoising network 73 included in the standard portrait generation model to perform multiple denoising processes on the initial noise image 78 based on style sample information 77 (style sample information in the training stage and target style information in the inference stage), and decode the information obtained from each denoising process to obtain the corresponding multiple standard images x i ′ .

[0064] Step S803: using the portrait generation model to be trained, based on the sample identity feature information and the style sample information, perform multiple noise reduction processes on the initial noisy image, and decode the information obtained from each noise reduction process to obtain multiple corresponding sample images.

[0065] In an embodiment of the present application, the portrait generation device uses the portrait generation model to be trained, performs multiple noise reduction processes on the style sample information based on the sample identity feature information, and decodes the information obtained from each noise reduction process to obtain multiple corresponding sample images. For example, Figure 7 As shown, the portrait generation device inputs the style sample information 77 and the initial noise image 78 into the multi-layer noise reduction network 73, performs multiple noise reduction processes on the initial noise image 78, and uses the identity feature fusion network 74 corresponding to each layer of the noise reduction network 73 to fuse the information obtained from each noise reduction process with the sample identity feature information, and then inputs it into the corresponding decoder 76 to obtain the corresponding sample image x i , to obtain multiple sample images.

[0066] Step S804: Calculate total loss information between multiple standard images and multiple sample images, and adjust model parameters of the portrait generation model to be trained based on the total loss information to obtain a preset portrait generation model.

[0067] In an embodiment of the present application, after obtaining multiple standard images and multiple sample images, the portrait generation device calculates corresponding total loss information based on the multiple standard images and the multiple sample images, and adjusts the model parameters of the portrait generation model to be trained based on the total loss information to obtain a preset portrait generation model.

[0068] In the embodiments of the present application, based on Figure 7 After training and adjusting the model parameters of the training portrait generation model (72), the following can be obtained: Figure 4 The preset portrait generation model shown. In the inference process, the preset portrait generation model used is to remove the decoder 76 after the multi-layer denoising network and the identity feature extraction network 75 in the portrait generation model to be trained (72), and only retain the decoder 76 of the last layer of denoising network.

[0069] Exemplarily, the preset portrait generation model can be applied to generative artificial intelligence (AIGC) scenarios and text-based image scenarios of large language models.

[0070] In some embodiments, when the portrait generation device executes the above step S804 of "calculating the total loss information between the plurality of standard images and the plurality of sample images", Fig. 9 As shown, the method may further include steps S901 to S905:

[0071] Step S901: extract identity features from multiple sample images respectively to obtain corresponding multiple feature information.

[0072] In an embodiment of the present application, the portrait generation device extracts identity features from multiple sample images respectively to obtain corresponding multiple feature information. Figure 7 As shown, the portrait generation device utilizes the identity feature extraction network 75 connected after the decoder 76 to extract the identity features of the corresponding decoded sample image to obtain corresponding multiple feature information.

[0073] Step S902: respectively determine the identity loss information between the plurality of feature information and the sample identity feature information, and obtain corresponding plurality of identity loss information.

[0074] In an embodiment of the present application, after obtaining multiple feature information, the portrait generation device determines the identity loss information between each feature information and the sample feature information, and obtains corresponding multiple identity loss information. Figure 7 As shown, the portrait generation device determines the identity loss information between each feature information in the plurality of feature information and the sample identity feature information like Fig.10 As shown in the figure, an exemplary implementation flowchart of calculating identity loss information is provided to ensure that the image x generated by the model i With the person sample image x s The face consistency of the image x is extracted using the identity feature extraction network I (75) i The identity feature is extracted from the image. This feature information should be consistent with the identity feature information of the original person image (sample identity feature information). In this way, the loss function can realize the supervision of the identity feature. The exemplary implementation method of calculating the identity feature information is shown in formula (2):

[0075]

[0076] in, is the identity loss information, I(x s ) is the sample identity feature information, I(xi ) is the i-th feature information among multiple feature information.

[0077] Step S903: extract intermediate features from the multiple sample images and the multiple standard images respectively to obtain corresponding multiple multi-layer sample intermediate features and multiple multi-layer standard intermediate features.

[0078] In an embodiment of the present application, the portrait generation device extracts intermediate features from multiple sample images and multiple standard images respectively, and obtains corresponding multiple multi-layer sample intermediate features and multiple multi-layer standard intermediate features. Fig.11 As shown, the portrait generation device can use the convolutional neural network VGG111 to extract intermediate features from multiple sample images and multiple standard images, obtain corresponding multiple multi-layer sample intermediate features and multiple multi-layer standard intermediate features, and then calculate style loss information. In order to ensure that the style of the generated image is consistent with that of the image generated by the network, the extraction of intermediate features is set here, and then the style loss information is calculated by aligning the intermediate features.

[0079] Step S904: respectively determine the style loss information of each multi-layer sample intermediate feature information in the plurality of multi-layer sample intermediate feature information and the corresponding multi-layer standard intermediate feature information in the plurality of multi-layer standard intermediate feature information to obtain corresponding multiple style loss information.

[0080] In an embodiment of the present application, after obtaining multiple multi-layer sample intermediate features and multiple multi-layer standard intermediate features, the portrait generation device determines the style loss information of each multi-layer sample intermediate feature information in the multiple multi-layer sample intermediate feature information and the corresponding multi-layer standard intermediate feature information in the multiple multi-layer standard intermediate feature information to obtain corresponding multiple style loss information.

[0081] For example, the implementation method of calculating the style loss information is as shown in formula (3):

[0082]

[0083] in, is the style loss information, n is the number of layers of intermediate feature information, and p j (x i ) is the intermediate feature information of the jth layer of the i-th multi-layer sample, p j (x i ′ ) is the j-th layer of standard intermediate feature information of the i-th multi-layer standard intermediate feature information.

[0084] Step S905: Determine total loss information based on the multiple identity loss information and the multiple style loss information.

[0085] In an embodiment of the present application, after determining multiple pieces of identity loss information and multiple pieces of style loss information, the portrait generation device may determine total loss information based on the multiple pieces of identity loss information and the multiple pieces of style loss information.

[0086] In some embodiments, when the portrait generating device performs the above step S905, Fig.12 As shown, the following steps S1201 to S1202 may also be included:

[0087] Step S1201: Determine the sum of multiple style loss information as total style loss information, and determine the weighted sum of multiple identity loss information as identity loss weighted information.

[0088] In an embodiment of the present application, the portrait generation device can directly determine the sum of multiple style loss information as total style loss information, and weight multiple identity loss information, and then determine the weighted sum of multiple identity loss information as identity loss weighted information.

[0089] Step S1202: Determine the total loss information as the sum of the weighted total style loss information and the weighted identity loss information.

[0090] In an embodiment of the present application, the portrait generation device weights the total style loss information, and determines the sum of the weighted total style loss information and the identity loss weighted information as the total loss information.

[0091] For example, the method for determining the total loss information is as follows:

[0092]

[0093] Among them, λ0 is the weight of the total information of style loss, λ i is the weighted loss information of the ith identity.

[0094] Of course, the same weighting may be used for each identity loss, or different weightings may be applied to each style loss information. The specific settings may be set according to actual needs and application scenarios, and this application does not limit this.

[0095] Exemplarily, the portrait generation method implemented in this application mainly includes a training process and an inference process. The training process includes the following steps: 1. First, pre-train a diffusion model, such as Figure 7, the backbone network F′ (standard portrait generation model) is composed of T UNets (denoising networks), with the text prompt word (77) as input, and the noise is predicted by the Unet network for denoising, so that the initial noise image 78 is gradually generated into a portrait image that meets the text description. Then, the diffusion model network F′ is copied to F (the portrait generation model to be trained), and the Unet parts of the two networks are frozen unchanged during the training phase. The same noise and text are input to the F′ and F networks. Since the noise predicted by the denoising process has a certain randomness, in order to keep the F′ and F networks with consistent output styles, the random seeds (initial noise) of the two networks are set to the same. At the same time, a portrait picture x0 is input as the original image (person sample image), and the identity feature extraction network is used to extract the identity feature e id , the identity feature extraction network is a face recognition model; 2. For the F network, such as Figure 7 In the upper part, the output information z of each Unet network i Then connect an identity feature fusion network, such as Figure 5 The identity feature fusion network uses the AdaIN module (4312) to transform the identity feature e id Integrate into i f i , f i The information of the original portrait image is combined as the input of the next layer of UNet, and f i Input to the decoder to generate image x i , the same method is used for all T layers of Unet networks, and the output image x of the last layer of Unet network is T As the final generated image; 3. For the F′ network, Figure 7 The lower part, as the teacher network for self-supervised training, the output z' of each Unet network i A decoder 76 is also connected to generate the image x′ i , Unet networks maintain normal connections; 4. In order to maintain the image x generated by the F network i and the image x′ generated by the F′ network i The style and content of the F′ network are consistent, and the denoising process of the F′ network is used as a template to guide the training of the model, such as Fig.11 As shown, the image x i and x′ i Input VGG network 111 to extract intermediate features, calculate the perceptual loss by aligning the intermediate features, and calculate the style loss function according to formula (3) to achieve content feature supervision; 5. In order to maintain the image x generated by the F network i The face consistency with the original portrait image x0 is obtained by using the identity feature extraction module I (identity feature extraction network) from the image x iExtract identity features from the image, which should be consistent with the identity features of the original image, such as Figure 5 , calculate the identity loss function according to formula (2) to realize the supervision of identity features; 6. The overall loss function (total loss information) is the weighted sum of the identity feature loss (identity loss information) and the content feature loss (style loss information), where for different layers of UNet networks, the content feature calculates the loss between the corresponding layers of the F network and the F′ network, and the losses between different layers are directly summed. The identity feature calculates the loss between the output of different layers of the F network and the original image, and the large numerical difference of the loss of different layers is balanced by setting hyperparameters; 7. Use a large number of portraits of different people and text descriptions of various styles to complete the above training process. In this way, only one training is required, avoiding fine-tuning the model for each person, reducing the computational cost and time cost. The reasoning process includes the following steps: only retain the identity feature extraction module and the F network (preset portrait generation model), input the portrait image x0 as a reference for the person, input text to represent different styles, complete T denoising processes through the F network, and convert the output x0 of the last layer of the decoder into T As the final generated image (target person image), this avoids the naturalness of the generated image being affected by post-processing and other methods, realizes the end-to-end complete generation process, and improves the quality of the generated image.

[0096] The embodiment of the present application provides a method for generating a portrait, the method comprising: obtaining an original character image and target style information to be generated from the original character image; using a preset portrait generation model to extract identity features from the original character image to obtain identity feature information, and performing multiple noise reduction processes on the target style information based on the identity feature information to generate a target character image. The method for generating a portrait provided by the present application improves the quality of portrait generation by extracting identity features from the original character image and performing noise reduction processes on the target style information based on the identity feature information to generate a target character image that is consistent with the appearance of the character in the original character image and automatically transfers the target style information.

[0097] The present application embodiment provides a portrait generation device, such as Fig.13 As shown, including:

[0098] An acquisition module 1301 is used to acquire an original character image and target style information to be generated from the original character image;

[0099] The processing module 1302 is used to extract identity features from the original person image using a preset portrait generation model to obtain identity feature information, and perform multiple noise reduction processes on the target style information based on the identity feature information to generate a target person image.

[0100] In one embodiment of the present application, the preset portrait generation model includes multiple layers of denoising networks connected in sequence, and each layer of denoising network is connected to a corresponding identity feature fusion network; the processing module 1302 is also used to input the target style information into the first layer of denoising network in the multi-layer denoising network for denoising processing to obtain corresponding output information; for each layer of denoising network, the corresponding output information is fused with the identity feature information using the corresponding identity feature fusion network to obtain corresponding fusion information, and the corresponding fusion information is input into the next layer of denoising network for denoising processing to obtain the corresponding output information of the next layer of denoising network; the corresponding fusion information of the last layer of denoising network in the multi-layer denoising network is decoded to obtain the target person image.

[0101] In one embodiment of the present application, the identity feature fusion network includes multiple fusion units connected in sequence; the processing module 1302 is also used to use the corresponding multiple fusion units for each layer of the noise reduction network to fuse the corresponding output information and the identity feature information multiple times to obtain the corresponding fusion information; wherein the input of the first fusion unit among the multiple fusion units is the output information of the corresponding noise reduction network; the output and identity feature information of each fusion unit are used as the input of the next fusion unit.

[0102] In one embodiment of the present application, it also includes: a preset portrait generation model is based on a trained standard portrait generation model as a teacher network for self-supervised style feature training, and the portrait generation model to be trained including the identity feature fusion network is trained as a student network; wherein, the standard portrait generation model is used to perform multiple denoising processes on the initial noisy image based on style sample information, and the information obtained from each denoising process is decoded to obtain a corresponding multiple standard images; the portrait generation model to be trained is used to perform multiple denoising processes on the initial noisy image based on sample identity feature information and style sample information, and the information obtained from each denoising process is decoded to obtain a corresponding multiple sample images; the total loss information between the multiple standard images and the multiple sample images is calculated, and the model parameters of the portrait generation model to be trained are adjusted based on the total loss information to obtain the preset portrait generation model.

[0103] In one embodiment of the present application, it also includes: total loss information is determined based on multiple standard images and multiple sample images; wherein, identity feature extraction is performed on multiple sample images respectively to obtain corresponding multiple feature information; identity loss information between multiple feature information and sample identity feature information is determined respectively to obtain corresponding multiple identity loss information; intermediate feature extraction is performed on multiple sample images and multiple standard images respectively to obtain corresponding multiple multi-layer sample intermediate features and multiple multi-layer standard intermediate features; style loss information of each multi-layer sample intermediate feature information in the multiple multi-layer sample intermediate feature information and the corresponding multi-layer standard intermediate feature information in the multiple multi-layer standard intermediate feature information is determined respectively to obtain corresponding multiple style loss information; total loss information is determined based on multiple identity loss information and multiple style loss information.

[0104] In one embodiment of the present application, it also includes: the total loss information is determined based on multiple identity loss information and multiple style loss information; wherein the sum of the multiple style loss information is determined as the total style loss information, and the weighted sum of the multiple identity loss information is determined as the identity loss weighted information; the weighted sum of the total style loss information and the identity loss weighted information is determined as the total loss information.

[0105] The present application embodiment provides a portrait generation device, such as Fig.14 As shown, the portrait generation device includes: a processor 1401, a memory 1402 and a communication bus 1403;

[0106] A communication bus 1403, used to implement communication connection between the processor 1401 and the memory 1402;

[0107] The processor 1401 is used to execute the computer program stored in the memory 1402 to implement the above-mentioned portrait generation method.

[0108] The embodiment of the present application provides a portrait generation device, which obtains an original character image and target style information to be generated from the original character image; uses a preset portrait generation model to extract identity features from the original character image to obtain identity feature information, and performs multiple noise reduction processes on the target style information based on the identity feature information to generate a target character image. The portrait generation device provided by the present application extracts identity features from the original character image, and performs noise reduction processes on the target style information based on the identity feature information to generate a target character image that is consistent with the appearance of the character in the original character image and automatically transfers the target style information, thereby improving the quality of portrait generation.

[0109] The embodiment of the present application provides a computer-readable storage medium, which stores one or more computer programs, and the one or more computer programs can be executed by one or more processors to implement the above-mentioned portrait generation method. The computer-readable storage medium can be a volatile memory (volatile memory), such as a random access memory (Random-Access Memory, RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (Read-Only Memory, ROM), a flash memory (flash memory), a hard disk (Hard Disk Drive, HDD) or a solid-state drive (Solid-State Drive, SSD); or it can be a respective device including one or any combination of the above-mentioned memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.

[0110] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0111] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart 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 data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0112] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0113] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0114] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A method for generating a human portrait, the method comprising: Acquire an original character image and target style information to be generated from the original character image; The preset portrait generation model is used to extract identity features from the original character image to obtain identity feature information, and based on the identity feature information and the target style information, multiple noise reduction processes are performed on the initial noise image to generate a target character image.

2. The method according to claim 1, wherein the preset portrait generation model comprises multiple layers of denoising networks connected in sequence, and each layer of denoising network is connected to a corresponding identity feature fusion network; and the initial noise image pair is subjected to multiple denoising processes based on the identity feature information and the target style information to generate a target person image, comprising: Inputting the target style information and the initial noise image into the first layer of the denoising network in the multi-layer denoising network for denoising, and obtaining corresponding output information; For each layer of the denoising network, using the corresponding identity feature fusion network, the corresponding output information is fused with the identity feature information to obtain corresponding fusion information, and the corresponding fusion information is input into the next layer of denoising network for denoising processing to obtain the output information corresponding to the next layer of denoising network; The last layer of the denoising network in the multi-layer denoising network is decoded corresponding to the fusion information to obtain the target person image.

3. According to the method of claim 2, the identity feature fusion network comprises a plurality of fusion units connected in sequence; for each layer of the denoising network, using the corresponding identity feature fusion network, fusing the corresponding output information with the identity feature information to obtain the corresponding fusion information, comprising: For each layer of the denoising network, using the corresponding multiple fusion units, the corresponding output information and the identity feature information are fused multiple times to obtain the corresponding fused information; Among them, the input of the first fusion unit among the multiple fusion units is the output information corresponding to the denoising network; the output of each fusion unit and the identity feature information serve as the input of the next fusion unit.

4. The method according to claim 1, further comprising: Obtain a trained standard portrait generation model and a portrait generation model to be trained including an identity feature fusion network; The standard portrait generation model is used as a teacher network for self-supervised style feature training, and the portrait generation model to be trained as a student network is trained to obtain the preset portrait generation model.

5. The method according to claim 4, wherein the standard portrait generation model is used as a teacher network for self-supervised style feature training to perform model training on the portrait generation model to be trained as a student network to obtain the preset portrait generation model, comprising: Acquire a person sample image and style sample information to be generated of the person sample image, and use the portrait generation model to be trained to extract identity features from the person sample image to obtain sample identity feature information; Using the standard portrait generation model, based on the style sample information, the initial noise image is subjected to multiple noise reduction processes, and the information obtained from each noise reduction process is decoded to obtain a corresponding plurality of standard images; Using the portrait generation model to be trained, based on the sample identity feature information and the style sample information, the initial noise image is subjected to multiple noise reduction processes, and information obtained from each noise reduction process is decoded to obtain multiple corresponding sample images; The total loss information between the multiple standard images and the multiple sample images is calculated, and the model parameters of the portrait generation model to be trained are adjusted based on the total loss information to obtain the preset portrait generation model.

6. The method according to claim 5, wherein the calculating the total loss information between the plurality of standard images and the plurality of sample images comprises: Extracting identity features from the plurality of sample images respectively to obtain corresponding plurality of feature information; respectively determining identity loss information between the plurality of feature information and the sample identity feature information to obtain corresponding plurality of identity loss information; Extracting intermediate features from the plurality of sample images and the plurality of standard images respectively to obtain corresponding plurality of multi-layer sample intermediate features and plurality of multi-layer standard intermediate features; Respectively determine style loss information of each multi-layer sample intermediate feature information in the plurality of multi-layer sample intermediate feature information and corresponding multi-layer standard intermediate feature information in the plurality of multi-layer standard intermediate feature information to obtain corresponding multiple style loss information; The total loss information is determined based on the plurality of identity loss information and the plurality of style loss information.

7. The method according to claim 6, wherein determining the total loss information based on the plurality of identity loss information and the plurality of style loss information comprises: determining a sum of the plurality of style loss information as style loss total information, and determining a weighted sum of the plurality of identity loss information as identity loss weighted information; The total loss information is determined as the sum of the weighted sum of the style loss total information and the identity loss weighted information.

8. A portrait generating device, comprising: An acquisition module, used to acquire an original character image and target style information to be generated from the original character image; The processing module is used to use a preset portrait generation model to extract identity features from the original character image to obtain identity feature information, and based on the identity feature information and the target style information, perform multiple noise reduction processes on the initial noise image to generate a target character image.

9. The device according to claim 8, wherein the preset portrait generation model comprises multiple layers of denoising networks connected in sequence, and each layer of the denoising network is connected to a corresponding identity feature fusion network; The processing module is further used to input the target style information and the initial noise image into the first layer of the denoising network in the multi-layer denoising network for denoising processing to obtain corresponding output information; for each layer of the denoising network, using the corresponding identity feature fusion network, the corresponding output information is fused with the identity feature information to obtain corresponding fusion information, and the corresponding fusion information is input into the next layer of the denoising network for denoising processing to obtain the output information corresponding to the next layer of the denoising network; the last layer of the denoising network in the multi-layer denoising network is decoded corresponding to the fusion information to obtain the target person image.

10. The apparatus according to claim 8, further comprising: The preset portrait generation model is based on the trained standard portrait generation model as the teacher network for self-supervised style feature training, and the portrait generation model to be trained including the identity feature fusion network is trained as the student network; wherein, the standard portrait generation model is used to perform multiple denoising processes on the initial noise image based on the style sample information, and the information obtained from each denoising process is decoded to obtain a corresponding multiple standard images; the portrait generation model to be trained is used to perform multiple denoising processes on the initial noise image based on the sample identity feature information and the style sample information, and the information obtained from each denoising process is decoded to obtain a corresponding multiple sample images; the total loss information between the multiple standard images and the multiple sample images is calculated, and the model parameters of the portrait generation model to be trained are adjusted based on the total loss information to obtain the preset portrait generation model.

11. A portrait generating device, characterized in that: include: processor, memory, and communications bus; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute the computer program stored in the memory to implement the portrait generation method according to any one of claims 1 to 7.