Three-dimensional image generation method, device, equipment and storage medium

Through the three-dimensional image generation method, the generative adversarial network and the three-dimensional deformation network are used to calculate the loss value to adjust the network, which solves the problem of low quality of 3D face image generation in the existing technology and achieves higher quality and personalized image generation.

CN114882196BActive Publication Date: 2024-09-10PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210510893.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-11
Publication Date
2024-09-10
Estimated Expiration
2042-05-11

AI Technical Summary

Technical Problem

Due to the limited number of preset images, the existing 3D face image generation method cannot meet user needs in a personalized manner, resulting in low quality of the generated face images.

Method used

Using a three-dimensional image generation method, by obtaining training images and preset networks, including generative adversarial networks and three-dimensional deformation networks, calculate distance loss values, feature loss values ​​and realism loss values, adjust the preset network to build a face shape transfer model, and generate targets 3D image.

Benefits of technology

The quality of three-dimensional image generation is improved. Through the calculation of quantification loss and feature loss values, the network is accurately adjusted, the accuracy of the image is enhanced and the expression features are included, and the authenticity of the image is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114882196B
    Figure CN114882196B
Patent Text Reader

Abstract

The present invention relates to artificial intelligence, and provides a three-dimensional image generation method, device, equipment and storage medium. The method obtains a data source image and a face source image, processes the data source image and the face source image to obtain a generated image, calculates a first three-dimensional deformation coefficient of the face source image and a second three-dimensional deformation coefficient of the generated image, calculates a distance loss value based on the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient, calculates a feature loss value and a authenticity loss value of the generated image and the data source image, adjusts a preset network according to the distance loss value, the feature loss value and the authenticity loss value, obtains a face transfer model, inputs a two-dimensional image to be converted into the face transfer model, obtains an initial image, processes the initial image based on the appearance transfer model, obtains a target three-dimensional image, and improves the image quality. In addition, the present invention also relates to blockchain technology, and the target three-dimensional image can be stored in a blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a three-dimensional image generation method, device, equipment and storage medium. Background Art

[0002] In the current 3D face image generation method, the face of the image to be processed is usually directly replaced by a preset image. However, due to the limited number of preset images, this method cannot meet the personalized needs of users. In order to meet the personalized needs of users, users can select and adjust the preset face shape to meet their personalized needs. However, due to the small number of adjustable bones on the face, the face image generated by the user manually adjusting cannot express the corresponding emotions, resulting in low quality of the generated face image. Summary of the invention

[0003] In view of the above, it is necessary to provide a three-dimensional image generation method, device, equipment and storage medium, which can improve the generation quality of three-dimensional images.

[0004] In one aspect, the present invention provides a three-dimensional image generation method, the three-dimensional image generation method comprising:

[0005] Acquire a training image, wherein the training image includes a data source image and a face shape source image;

[0006] Acquire a preset network, wherein the preset network includes a generative adversarial network and a three-dimensional deformation network;

[0007] Processing the data source image and the face source image based on the generative adversarial network to obtain a generated image of the data source image;

[0008] Calculating a first three-dimensional deformation coefficient of the face source image based on the three-dimensional deformation network, and calculating a second three-dimensional deformation coefficient of the generated image based on the three-dimensional deformation network;

[0009] Calculating a distance loss value between the data source image and the generated image based on the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient;

[0010] Calculating feature loss values ​​of the generated image and the data source image, and calculating authenticity loss values ​​of the generated image and the data source image;

[0011] Adjust the preset network according to the distance loss value, the feature loss value and the authenticity loss value to obtain a face shape transfer model;

[0012] Acquire a two-dimensional image to be converted, and input the two-dimensional image to be converted into the face shape migration model to obtain an initial image;

[0013] The initial image is processed based on a pre-trained appearance transfer model to obtain a target three-dimensional image of the two-dimensional image to be converted.

[0014] According to a preferred embodiment of the present invention, the generative adversarial network includes a generator and a discriminator, and the data source image and the face source image are processed based on the generative adversarial network to obtain a generated image of the data source image, including:

[0015] Extracting facial features of the facial source image;

[0016] Based on the generator, the data source image and the facial features are fused to obtain a first image;

[0017] Labeling the first image to obtain a first training label, and labeling the data source image to obtain a second training label;

[0018] Based on the discriminator, the first image is discriminated to obtain a first predicted label of the first image, and based on the discriminator, the data source image is discriminated to obtain a second predicted label of the data source image;

[0019] If the first predicted label is the same as the first training label, and the second predicted label is the same as the second training label, the first image is determined as the generated image.

[0020] According to a preferred embodiment of the present invention, the three-dimensional deformation network includes a convolution layer, a pooling layer and a fully connected layer, and the first three-dimensional deformation coefficient of the face source image is calculated based on the three-dimensional deformation model, including:

[0021] Extracting features of the face source image based on the convolution layer to obtain image features;

[0022] Performing dimensionality reduction processing on the image features based on the pooling layer to obtain low-dimensional features;

[0023] The low-dimensional feature is processed based on the preset face shape parameters in the fully connected layer to obtain a first face shape deformation coefficient, and the low-dimensional feature is processed based on the preset expression parameters in the fully connected layer to obtain a first expression deformation coefficient;

[0024] The first face shape deformation coefficient and the first appearance deformation coefficient are determined as the first three-dimensional deformation coefficient.

[0025] According to a preferred embodiment of the present invention, the second three-dimensional deformation coefficient includes a second face shape deformation coefficient and a second appearance deformation coefficient, and the calculation formula of the distance loss value is:

[0026]

[0027] Wherein, S1 represents the distance loss value, n represents the maximum dimension value of the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient, and X i represents the value corresponding to the i-th dimension in the first face deformation coefficient, Y i represents the value corresponding to the i-th dimension in the second face shape deformation coefficient, A i represents the value corresponding to the i-th dimension in the first table variable coefficient, B i Represents the value corresponding to the i-th dimension in the second table's variable coefficient.

[0028] According to a preferred embodiment of the present invention, the calculating of the authenticity loss value between the generated image and the data source image comprises:

[0029] Obtaining a first prediction probability of the data source image for the first prediction label from the discriminator, and obtaining a second prediction probability of the generated image for the second prediction label from the discriminator;

[0030] The authenticity loss value is generated according to the first prediction probability and the second prediction probability.

[0031] According to a preferred embodiment of the present invention, the calculation formula of the authenticity loss value is:

[0032]

[0033] Among them, k represents a preset value, p1 represents the first prediction probability, and p2 represents the second prediction probability.

[0034] According to a preferred embodiment of the present invention, the face shape transfer model includes an image transfer model corresponding to the generative adversarial network and a three-dimensional image construction model corresponding to the three-dimensional deformation network, and the inputting of the two-dimensional image to be converted into the face shape transfer model to obtain the initial image includes:

[0035] Performing migration processing on the two-dimensional image to be converted based on the image migration model to obtain a second image;

[0036] Calculating a third three-dimensional deformation coefficient of the second image based on the three-dimensional image building model;

[0037] Obtaining a facial key point reference matrix, a face shape deformation template matrix and an expression deformation template matrix from the three-dimensional image construction model;

[0038] Generate feature code according to the third three-dimensional deformation coefficient, the human face key point reference matrix, the face shape deformation template matrix and the expression deformation template matrix;

[0039] Mapping is performed on the feature code to obtain the initial image.

[0040] On the other hand, the present invention further provides a three-dimensional image generating device, the three-dimensional image generating device comprising:

[0041] An acquisition unit, used for acquiring a training image, wherein the training image includes a data source image and a face shape source image;

[0042] The acquisition unit is further used to acquire a preset network, wherein the preset network includes a generative adversarial network and a three-dimensional deformation network;

[0043] A processing unit, configured to process the data source image and the face source image based on the generative adversarial network to obtain a generated image of the data source image;

[0044] a calculation unit, configured to calculate a first three-dimensional deformation coefficient of the face source image based on the three-dimensional deformation network, and calculate a second three-dimensional deformation coefficient of the generated image based on the three-dimensional deformation network;

[0045] The calculation unit is further used to calculate a distance loss value between the data source image and the generated image based on the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient;

[0046] The calculation unit is further used to calculate the feature loss value of the generated image and the data source image, and calculate the authenticity loss value of the generated image and the data source image;

[0047] An adjustment unit, configured to adjust the preset network according to the distance loss value, the feature loss value, and the authenticity loss value to obtain a face shape transfer model;

[0048] An input unit, used for acquiring a two-dimensional image to be converted, and inputting the two-dimensional image to be converted into the face shape migration model to obtain an initial image;

[0049] The processing unit is further used to process the initial image based on a pre-trained appearance transfer model to obtain a target three-dimensional image of the two-dimensional image to be converted.

[0050] On the other hand, the present invention further provides an electronic device, comprising:

[0051] a memory storing computer readable instructions; and

[0052] A processor executes the computer-readable instructions stored in the memory to implement the three-dimensional image generating method.

[0053] On the other hand, the present invention further proposes a computer-readable storage medium, in which computer-readable instructions are stored. The computer-readable instructions are executed by a processor in an electronic device to implement the three-dimensional image generating method.

[0054] It can be seen from the above technical solutions that the present application can accurately quantify the quantization loss of the generated image and the data source image in the three-dimensional deformation dimension through the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient, and can accurately quantify the loss of the generated adversarial network to the data source image and the face source image by calculating the authenticity loss value of the generated image and the data source image, and can accurately quantify the loss generated when the data source image is converted into the generated image by calculating the feature loss value of the generated image and the data source image, and then combine the distance loss value, the feature loss value and the authenticity loss value to accurately adjust the preset network, improve the training accuracy of the face transfer model, and thus improve the image accuracy of the target three-dimensional image. In addition, since the initial image is constructed through the third three-dimensional deformation coefficient including the face deformation coefficient and the expression deformation coefficient, the target three-dimensional image contains the expression features in the two-dimensional image to be converted, thereby improving the image quality, and the initial image is further processed by the appearance transfer model to further improve the quality of the target three-dimensional image. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 It is a flow chart of a preferred embodiment of the three-dimensional image generating method of the present invention.

[0056] Figure 2 It is a functional module diagram of a preferred embodiment of the three-dimensional image generating device of the present invention.

[0057] Figure 3 It is a schematic diagram of the structure of an electronic device of a preferred embodiment of the present invention for implementing the three-dimensional image generation method. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

[0059] like Figure 1 FIG. 1 is a flow chart of a preferred embodiment of the method for generating a three-dimensional image according to the present invention. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted.

[0060] The three-dimensional image generation method can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0061] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0062] The three-dimensional image generation method is applied to one or more electronic devices, which are devices that can automatically perform numerical calculations and / or information processing according to pre-set or stored computer-readable instructions, and their hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0063] The electronic device may be any electronic product that can perform human-computer interaction with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.

[0064] The electronic device may include a network device and / or a user device. The network device includes, but is not limited to, a single network electronic device, an electronic device group consisting of multiple network electronic devices, or a cloud consisting of a large number of hosts or network electronic devices based on cloud computing.

[0065] The network where the electronic device is located includes, but is not limited to: the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.

[0066] S10, obtaining a training image, wherein the training image includes a data source image and a face shape source image.

[0067] In at least one embodiment of the present invention, the data source image and the face shape source image are not face images of the same person.

[0068] In at least one embodiment of the present invention, the electronic device obtains the training image from a preset face data set, and the data source image and the face shape source image are any images in the preset face data set.

[0069] S11, obtaining a preset network, wherein the preset network includes a generative adversarial network and a three-dimensional deformation network.

[0070] S12, processing the data source image and the face source image based on the generative adversarial network to obtain a generated image of the data source image.

[0071] In at least one embodiment of the present invention, the generated image includes features other than face shape in the data source image and face shape features in the face shape source image.

[0072] In at least one embodiment of the present invention, the generative adversarial network includes a generator and a discriminator, and the processing of the data source image and the face source image based on the generative adversarial network to obtain the generated image of the data source image includes:

[0073] Extracting facial features of the facial source image;

[0074] Based on the generator, the data source image and the facial features are fused to obtain a first image;

[0075] Labeling the first image to obtain a first training label, and labeling the data source image to obtain a second training label;

[0076] Based on the discriminator, the first image is discriminated to obtain a first predicted label of the first image, and based on the discriminator, the data source image is discriminated to obtain a second predicted label of the data source image;

[0077] If the first predicted label is the same as the first training label, and the second predicted label is the same as the second training label, the first image is determined as the generated image.

[0078] By using the discriminator to discriminate the first image and the data source image, the generation capability of the generator can be ensured, thereby improving the accuracy of the generated image.

[0079] Specifically, the electronic device performs fusion processing on the data source image and the facial features based on the generator to obtain a first image including:

[0080] Identify the face shape information of the data source image;

[0081] The face shape information in the data source image is replaced with the face shape features to obtain the first image.

[0082] In other embodiments, if the first predicted label is different from the first training label, or the second predicted label is different from the second training label, a generation parameter in the generator is adjusted.

[0083] By adjusting the generation parameters, the generation capability of the generator can be improved.

[0084] S13, calculating a first three-dimensional deformation coefficient of the face source image based on the three-dimensional deformation network, and calculating a second three-dimensional deformation coefficient of the generated image based on the three-dimensional deformation network.

[0085] In at least one embodiment of the present invention, the three-dimensional deformation network includes a convolution layer, a pooling layer and a fully connected layer, and the electronic device calculates the first three-dimensional deformation coefficient of the face source image based on the three-dimensional deformation model, including:

[0086] Extracting features of the face source image based on the convolution layer to obtain image features;

[0087] Performing dimensionality reduction processing on the image features based on the pooling layer to obtain low-dimensional features;

[0088] The low-dimensional feature is processed based on the preset face shape parameters in the fully connected layer to obtain a first face shape deformation coefficient, and the low-dimensional feature is processed based on the preset expression parameters in the fully connected layer to obtain a first expression deformation coefficient;

[0089] The first face shape deformation coefficient and the first appearance deformation coefficient are determined as the first three-dimensional deformation coefficient.

[0090] The preset face shape parameters and the preset expression parameters refer to the preset parameters based on the three-dimensional deformation model.

[0091] In at least one embodiment of the present invention, the electronic device calculates the second three-dimensional deformation coefficient of the generated image based on the three-dimensional deformation network in a manner similar to the way the electronic device calculates the first three-dimensional deformation coefficient of the facial source image based on the three-dimensional deformation model, and the present invention will not go into details.

[0092] S14: Calculate a distance loss value between the data source image and the generated image based on the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient.

[0093] In at least one embodiment of the present invention, the distance loss value refers to the quantization loss between the generated image and the data source image in the three-dimensional deformation dimension.

[0094] In at least one embodiment of the present invention, the second three-dimensional deformation coefficient includes a second face shape deformation coefficient and a second appearance deformation coefficient, and the distance loss value is calculated as follows:

[0095]

[0096] Wherein, S1 represents the distance loss value, n represents the maximum dimension value of the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient, and X i represents the value corresponding to the i-th dimension in the first face deformation coefficient, Y i represents the value corresponding to the i-th dimension in the second face shape deformation coefficient, A i represents the value corresponding to the i-th dimension in the first table variable coefficient, B i Represents the value corresponding to the i-th dimension in the second table's variable coefficient.

[0097] Through the above implementation, the loss of the generated image and the data source image in the three-dimensional deformation dimension can be accurately quantified.

[0098] S15, calculating the feature loss value of the generated image and the data source image, and calculating the authenticity loss value of the generated image and the data source image.

[0099] In at least one embodiment of the present invention, the feature loss value refers to the loss generated when the data source image is converted into the generated image.

[0100] The authenticity loss value refers to the loss of the generative adversarial network to the data source image and the face source image.

[0101] In at least one embodiment of the present invention, the feature loss value is calculated and generated based on the VGG loss function in the imagenet pre-training algorithm, wherein the VGG loss function belongs to the prior art and the present invention will not elaborate on it.

[0102] In at least one embodiment of the present invention, the electronic device calculating the authenticity loss value between the generated image and the data source image includes:

[0103] Obtaining a first prediction probability of the data source image for the first prediction label from the discriminator, and obtaining a second prediction probability of the generated image for the second prediction label from the discriminator;

[0104] The authenticity loss value is generated according to the first prediction probability and the second prediction probability.

[0105] Specifically, the calculation formula of the authenticity loss value is:

[0106]

[0107] Among them, k represents a preset value, p1 represents the first prediction probability, and p2 represents the second prediction probability.

[0108] The preset value may be a maximum probability value that can be output by the discriminator. For example, the preset value may be 1.

[0109] The predicted probability output by the discriminator can accurately quantify the authenticity loss value.

[0110] S16, adjusting the preset network according to the distance loss value, the feature loss value and the authenticity loss value to obtain a face shape migration model.

[0111] In at least one embodiment of the present invention, the face shape transfer model refers to a model obtained after training the preset network to convergence, and the face shape transfer model is used to construct a three-dimensional image.

[0112] In at least one embodiment of the present invention, the electronic device adjusts the preset network according to the distance loss value, the feature loss value and the authenticity loss value to obtain the face shape transfer model, including:

[0113] Calculate the sum of the distance loss value, the feature loss value and the authenticity loss value to obtain a total loss value;

[0114] The preset network is adjusted based on the total loss value until the total loss value no longer decreases, thereby obtaining the face shape migration model.

[0115] S17, obtaining a two-dimensional image to be converted, and inputting the two-dimensional image to be converted into the face shape migration model to obtain an initial image.

[0116] In at least one embodiment of the present invention, the two-dimensional image to be converted refers to any two-dimensional image that needs to be used to construct a three-dimensional image. The two-dimensional image to be converted may be a face image or an image including a human body posture.

[0117] The initial image refers to a three-dimensional image reconstructed by the face shape migration model from the two-dimensional image to be converted.

[0118] In at least one embodiment of the present invention, the face shape transfer model includes an image transfer model corresponding to the generative adversarial network and a three-dimensional image construction model corresponding to the three-dimensional deformation network, and the electronic device inputs the two-dimensional image to be converted into the face shape transfer model to obtain the initial image, including:

[0119] Performing migration processing on the two-dimensional image to be converted based on the image migration model to obtain a second image;

[0120] Calculating a third three-dimensional deformation coefficient of the second image based on the three-dimensional image building model;

[0121] Obtaining a facial key point reference matrix, a face shape deformation template matrix and an expression deformation template matrix from the three-dimensional image construction model;

[0122] Generate feature code according to the third three-dimensional deformation coefficient, the human face key point reference matrix, the face shape deformation template matrix and the expression deformation template matrix;

[0123] Mapping is performed on the feature code to obtain the initial image.

[0124] The feature code includes a plurality of coordinate points and color information of each coordinate point.

[0125] Specifically, the generating formula of the feature code is: S = S base +B id α+B exp β, where S represents the feature code, S base represents the facial key point reference matrix, B id represents the face shape deformation template matrix, B exp represents the facial deformation template matrix, α represents the third face deformation coefficient in the third three-dimensional deformation coefficient, and β represents the third facial deformation coefficient in the third three-dimensional deformation coefficient.

[0126] S18, processing the initial image based on a pre-trained appearance transfer model to obtain a target three-dimensional image of the two-dimensional image to be converted.

[0127] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned target three-dimensional image, the above-mentioned target three-dimensional image can also be stored in a node of a blockchain.

[0128] In at least one embodiment of the present invention, the pre-trained appearance transfer model is generated by training using a DeepFake algorithm.

[0129] In at least one embodiment of the present invention, the electronic device processes the initial image based on a pre-trained appearance transfer model to obtain a target three-dimensional image of the two-dimensional image to be converted, including:

[0130] Extracting makeup features of the two-dimensional image to be converted based on the pre-trained appearance transfer model;

[0131] The target three-dimensional image is generated according to the makeup features and the initial image.

[0132] Through the above implementation, the target three-dimensional image can restore the makeup features of the two-dimensional image to be converted, thereby improving the authenticity of the target three-dimensional image.

[0133] It can be seen from the above technical solutions that the present application can accurately quantify the quantization loss of the generated image and the data source image in the three-dimensional deformation dimension through the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient, and can accurately quantify the loss of the generated adversarial network to the data source image and the face source image by calculating the authenticity loss value of the generated image and the data source image, and can accurately quantify the loss generated when the data source image is converted into the generated image by calculating the feature loss value of the generated image and the data source image, and then combine the distance loss value, the feature loss value and the authenticity loss value to accurately adjust the preset network, improve the training accuracy of the face transfer model, and thus improve the image accuracy of the target three-dimensional image. In addition, since the initial image is constructed through the third three-dimensional deformation coefficient including the face deformation coefficient and the expression deformation coefficient, the target three-dimensional image contains the expression features in the two-dimensional image to be converted, thereby improving the image quality, and the initial image is further processed by the appearance transfer model to further improve the quality of the target three-dimensional image.

[0134] like Figure 2 , which is a functional module diagram of a preferred embodiment of the three-dimensional image generating device of the present invention. The three-dimensional image generating device 11 includes an acquisition unit 110, a processing unit 111, a calculation unit 112, an adjustment unit 113 and an input unit 114. The module / unit referred to in the present invention refers to a series of computer-readable instruction segments that can be acquired by the processor 13 and can perform fixed functions, which are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.

[0135] The acquisition unit 110 acquires a training image, where the training image includes a data source image and a face shape source image.

[0136] In at least one embodiment of the present invention, the data source image and the face shape source image are not face images of the same person.

[0137] In at least one embodiment of the present invention, the acquisition unit 110 acquires the training image from a preset face data set, and the data source image and the face shape source image are any images in the preset face data set.

[0138] The acquisition unit 110 acquires a preset network, where the preset network includes a generative adversarial network and a three-dimensional deformable network.

[0139] The processing unit 111 processes the data source image and the face source image based on the generative adversarial network to obtain a generated image of the data source image.

[0140] In at least one embodiment of the present invention, the generated image includes features other than face shape in the data source image and face shape features in the face shape source image.

[0141] In at least one embodiment of the present invention, the generative adversarial network includes a generator and a discriminator, and the processing unit 111 processes the data source image and the face source image based on the generative adversarial network to obtain a generated image of the data source image, including:

[0142] Extracting facial features of the facial source image;

[0143] Based on the generator, the data source image and the facial features are fused to obtain a first image;

[0144] Labeling the first image to obtain a first training label, and labeling the data source image to obtain a second training label;

[0145] Based on the discriminator, the first image is discriminated to obtain a first predicted label of the first image, and based on the discriminator, the data source image is discriminated to obtain a second predicted label of the data source image;

[0146] If the first predicted label is the same as the first training label, and the second predicted label is the same as the second training label, the first image is determined as the generated image.

[0147] By using the discriminator to discriminate the first image and the data source image, the generation capability of the generator can be ensured, thereby improving the accuracy of the generated image.

[0148] Specifically, the processing unit 111 performs fusion processing on the data source image and the facial features based on the generator to obtain a first image including:

[0149] Identify the face shape information of the data source image;

[0150] The face shape information in the data source image is replaced with the face shape features to obtain the first image.

[0151] In other embodiments, if the first predicted label is different from the first training label, or the second predicted label is different from the second training label, a generation parameter in the generator is adjusted.

[0152] By adjusting the generation parameters, the generation capability of the generator can be improved.

[0153] The calculation unit 112 calculates a first three-dimensional deformation coefficient of the face source image based on the three-dimensional deformation network, and calculates a second three-dimensional deformation coefficient of the generated image based on the three-dimensional deformation network.

[0154] In at least one embodiment of the present invention, the three-dimensional deformation network includes a convolution layer, a pooling layer and a fully connected layer, and the calculation unit 112 calculates the first three-dimensional deformation coefficient of the face source image based on the three-dimensional deformation model, including:

[0155] Extracting features of the face source image based on the convolution layer to obtain image features;

[0156] Performing dimensionality reduction processing on the image features based on the pooling layer to obtain low-dimensional features;

[0157] The low-dimensional feature is processed based on the preset face shape parameters in the fully connected layer to obtain a first face shape deformation coefficient, and the low-dimensional feature is processed based on the preset expression parameters in the fully connected layer to obtain a first expression deformation coefficient;

[0158] The first face shape deformation coefficient and the first appearance deformation coefficient are determined as the first three-dimensional deformation coefficient.

[0159] The preset face shape parameters and the preset expression parameters refer to the preset parameters based on the three-dimensional deformation model.

[0160] In at least one embodiment of the present invention, the electronic device calculates the second three-dimensional deformation coefficient of the generated image based on the three-dimensional deformation network in a manner similar to the way the electronic device calculates the first three-dimensional deformation coefficient of the facial source image based on the three-dimensional deformation model, and the present invention will not go into details.

[0161] The calculation unit 112 calculates a distance loss value between the data source image and the generated image based on the first 3D deformation coefficient and the second 3D deformation coefficient.

[0162] In at least one embodiment of the present invention, the distance loss value refers to the quantization loss between the generated image and the data source image in the three-dimensional deformation dimension.

[0163] In at least one embodiment of the present invention, the second three-dimensional deformation coefficient includes a second face shape deformation coefficient and a second appearance deformation coefficient, and the distance loss value is calculated as follows:

[0164]

[0165] Wherein, S1 represents the distance loss value, n represents the maximum dimension value of the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient, and X i represents the value corresponding to the i-th dimension in the first face deformation coefficient, Y i represents the value corresponding to the i-th dimension in the second face shape deformation coefficient, A i represents the value corresponding to the i-th dimension in the first table variable coefficient, B i Represents the value corresponding to the i-th dimension in the second table's variable coefficient.

[0166] Through the above implementation, the loss of the generated image and the data source image in the three-dimensional deformation dimension can be accurately quantified.

[0167] The calculation unit 112 calculates the feature loss value of the generated image and the data source image, and calculates the authenticity loss value of the generated image and the data source image.

[0168] In at least one embodiment of the present invention, the feature loss value refers to the loss generated when the data source image is converted into the generated image.

[0169] The authenticity loss value refers to the loss of the generative adversarial network to the data source image and the face source image.

[0170] In at least one embodiment of the present invention, the feature loss value is calculated and generated based on the VGG loss function in the imagenet pre-training algorithm, wherein the VGG loss function belongs to the prior art and the present invention will not elaborate on it.

[0171] In at least one embodiment of the present invention, the calculating unit 112 calculates the authenticity loss value between the generated image and the data source image, including:

[0172] Obtaining a first prediction probability of the data source image for the first prediction label from the discriminator, and obtaining a second prediction probability of the generated image for the second prediction label from the discriminator;

[0173] The authenticity loss value is generated according to the first prediction probability and the second prediction probability.

[0174] Specifically, the calculation formula of the authenticity loss value is:

[0175]

[0176] Among them, k represents a preset value, p1 represents the first prediction probability, and p2 represents the second prediction probability.

[0177] The preset value may be a maximum probability value that can be output by the discriminator. For example, the preset value may be 1.

[0178] The predicted probability output by the discriminator can accurately quantify the authenticity loss value.

[0179] The adjustment unit 113 adjusts the preset network according to the distance loss value, the feature loss value and the authenticity loss value to obtain a face shape transfer model.

[0180] In at least one embodiment of the present invention, the face shape transfer model refers to a model obtained after training the preset network to convergence, and the face shape transfer model is used to construct a three-dimensional image.

[0181] In at least one embodiment of the present invention, the adjusting unit 113 adjusts the preset network according to the distance loss value, the feature loss value and the authenticity loss value to obtain the face shape transfer model, which includes:

[0182] Calculate the sum of the distance loss value, the feature loss value and the authenticity loss value to obtain a total loss value;

[0183] The preset network is adjusted based on the total loss value until the total loss value no longer decreases, thereby obtaining the face shape migration model.

[0184] The input unit 114 obtains a two-dimensional image to be converted, and inputs the two-dimensional image to be converted into the face shape migration model to obtain an initial image.

[0185] In at least one embodiment of the present invention, the two-dimensional image to be converted refers to any two-dimensional image that needs to be used to construct a three-dimensional image. The two-dimensional image to be converted may be a face image or an image including a human body posture.

[0186] The initial image refers to a three-dimensional image reconstructed by the face shape migration model from the two-dimensional image to be converted.

[0187] In at least one embodiment of the present invention, the face shape transfer model includes an image transfer model corresponding to the generative adversarial network and a three-dimensional image construction model corresponding to the three-dimensional deformation network. The input unit 114 inputs the two-dimensional image to be converted into the face shape transfer model, and the initial image obtained includes:

[0188] Performing migration processing on the two-dimensional image to be converted based on the image migration model to obtain a second image;

[0189] Calculating a third three-dimensional deformation coefficient of the second image based on the three-dimensional image building model;

[0190] Obtaining a facial key point reference matrix, a face shape deformation template matrix and an expression deformation template matrix from the three-dimensional image construction model;

[0191] Generate feature code according to the third three-dimensional deformation coefficient, the human face key point reference matrix, the face shape deformation template matrix and the expression deformation template matrix;

[0192] Mapping is performed on the feature code to obtain the initial image.

[0193] The feature code includes a plurality of coordinate points and color information of each coordinate point.

[0194] Specifically, the generating formula of the feature code is: S = S base +B id α+B exp β, where S represents the feature code, S base represents the facial key point reference matrix, B id represents the face shape deformation template matrix, B exp represents the facial deformation template matrix, α represents the third face deformation coefficient in the third three-dimensional deformation coefficient, and β represents the third facial deformation coefficient in the third three-dimensional deformation coefficient.

[0195] The processing unit 111 processes the initial image based on a pre-trained appearance transfer model to obtain a target three-dimensional image of the two-dimensional image to be converted.

[0196] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned target three-dimensional image, the above-mentioned target three-dimensional image can also be stored in a node of a blockchain.

[0197] In at least one embodiment of the present invention, the pre-trained appearance transfer model is generated by training using a DeepFake algorithm.

[0198] In at least one embodiment of the present invention, the processing unit 111 processes the initial image based on a pre-trained appearance transfer model to obtain a target three-dimensional image of the two-dimensional image to be converted, including:

[0199] Extracting makeup features of the two-dimensional image to be converted based on the pre-trained appearance transfer model;

[0200] The target three-dimensional image is generated according to the makeup features and the initial image.

[0201] Through the above implementation, the target three-dimensional image can restore the makeup features of the two-dimensional image to be converted, thereby improving the authenticity of the target three-dimensional image.

[0202] It can be seen from the above technical solutions that the present application can accurately quantify the quantization loss of the generated image and the data source image in the three-dimensional deformation dimension through the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient, and can accurately quantify the loss of the generated adversarial network to the data source image and the face source image by calculating the authenticity loss value of the generated image and the data source image, and can accurately quantify the loss generated when the data source image is converted into the generated image by calculating the feature loss value of the generated image and the data source image, and then combine the distance loss value, the feature loss value and the authenticity loss value to accurately adjust the preset network, improve the training accuracy of the face transfer model, and thus improve the image accuracy of the target three-dimensional image. In addition, since the initial image is constructed through the third three-dimensional deformation coefficient including the face deformation coefficient and the expression deformation coefficient, the target three-dimensional image contains the expression features in the two-dimensional image to be converted, thereby improving the image quality, and the initial image is further processed by the appearance transfer model to further improve the quality of the target three-dimensional image.

[0203] like Figure 3 FIG. 1 is a schematic diagram of the structure of an electronic device of a preferred embodiment of the method for generating three-dimensional images according to the present invention.

[0204] In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer-readable instructions stored in the memory 12 and executable on the processor 13, such as a three-dimensional image generation program.

[0205] Those skilled in the art will understand that the schematic diagram is merely an example of the electronic device 1 and does not constitute a limitation on the electronic device 1. The electronic device 1 may include more or fewer components than shown in the diagram, or a combination of certain components, or different components. For example, the electronic device 1 may also include input and output devices, network access devices, buses, etc.

[0206] The processor 13 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 13 is the computing core and control center of the electronic device 1, and uses various interfaces and lines to connect various parts of the entire electronic device 1, and executes the operating system of the electronic device 1 and various installed applications, program codes, etc.

[0207] Exemplarily, the computer-readable instructions may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules / units may be a series of computer-readable instruction segments capable of completing specific functions, which are used to describe the execution process of the computer-readable instructions in the electronic device 1. For example, the computer-readable instructions may be divided into an acquisition unit 110, a processing unit 111, a calculation unit 112, an adjustment unit 113, and an input unit 114.

[0208] The memory 12 can be used to store the computer-readable instructions and / or modules, and the processor 13 implements various functions of the electronic device 1 by running or executing the computer-readable instructions and / or modules stored in the memory 12, and calling the data stored in the memory 12. The memory 12 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the electronic device, etc. The memory 12 can include non-volatile and volatile memories, such as: a hard disk, a memory, a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other storage devices.

[0209] The memory 12 may be an external memory and / or an internal memory of the electronic device 1. Furthermore, the memory 12 may be a memory in a physical form, such as a memory stick, a TF card (Trans-flash Card), and the like.

[0210] If the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also instruct the relevant hardware to complete it through computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium. When the computer-readable instructions are executed by the processor, the steps of the above-mentioned various method embodiments can be implemented.

[0211] The computer-readable instructions include computer-readable instruction codes, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM).

[0212] The blockchain referred to in the present invention is a new application model of computer technologies such as distributed three-dimensional image generation, point-to-point transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.

[0213] Combination Figure 1 The memory 12 in the electronic device 1 stores computer-readable instructions to implement a three-dimensional image generation method, and the processor 13 can execute the computer-readable instructions to implement:

[0214] Acquire a training image, wherein the training image includes a data source image and a face shape source image;

[0215] Acquire a preset network, wherein the preset network includes a generative adversarial network and a three-dimensional deformation network;

[0216] Processing the data source image and the face source image based on the generative adversarial network to obtain a generated image of the data source image;

[0217] Calculating a first three-dimensional deformation coefficient of the face source image based on the three-dimensional deformation network, and calculating a second three-dimensional deformation coefficient of the generated image based on the three-dimensional deformation network;

[0218] Calculating a distance loss value between the data source image and the generated image based on the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient;

[0219] Calculating feature loss values ​​of the generated image and the data source image, and calculating authenticity loss values ​​of the generated image and the data source image;

[0220] Adjust the preset network according to the distance loss value, the feature loss value and the authenticity loss value to obtain a face shape transfer model;

[0221] Acquire a two-dimensional image to be converted, and input the two-dimensional image to be converted into the face shape migration model to obtain an initial image;

[0222] The initial image is processed based on a pre-trained appearance transfer model to obtain a target three-dimensional image of the two-dimensional image to be converted.

[0223] Specifically, the specific implementation method of the processor 13 for the above-mentioned computer readable instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0224] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0225] The computer-readable storage medium stores computer-readable instructions, wherein the computer-readable instructions are used to implement the following steps when executed by the processor 13:

[0226] Acquire a training image, wherein the training image includes a data source image and a face shape source image;

[0227] Acquire a preset network, wherein the preset network includes a generative adversarial network and a three-dimensional deformation network;

[0228] Processing the data source image and the face source image based on the generative adversarial network to obtain a generated image of the data source image;

[0229] Calculating a first three-dimensional deformation coefficient of the face source image based on the three-dimensional deformation network, and calculating a second three-dimensional deformation coefficient of the generated image based on the three-dimensional deformation network;

[0230] Calculating a distance loss value between the data source image and the generated image based on the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient;

[0231] Calculating feature loss values ​​of the generated image and the data source image, and calculating authenticity loss values ​​of the generated image and the data source image;

[0232] Adjust the preset network according to the distance loss value, the feature loss value and the authenticity loss value to obtain a face shape transfer model;

[0233] Acquire a two-dimensional image to be converted, and input the two-dimensional image to be converted into the face shape migration model to obtain an initial image;

[0234] The initial image is processed based on a pre-trained appearance transfer model to obtain a target three-dimensional image of the two-dimensional image to be converted.

[0235] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0236] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0237] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.

[0238] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices mentioned can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0239] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A three-dimensional image generation method, characterized in that: The three-dimensional image generation method comprises: Acquire a training image, wherein the training image includes a data source image and a face shape source image; Acquire a preset network, wherein the preset network includes a generative adversarial network and a three-dimensional deformation network; Processing the data source image and the face source image based on the generative adversarial network to obtain a generated image of the data source image; Calculating a first three-dimensional deformation coefficient of the face source image based on the three-dimensional deformation network, and calculating a second three-dimensional deformation coefficient of the generated image based on the three-dimensional deformation network; Calculating a distance loss value between the data source image and the generated image based on the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient; Calculating feature loss values ​​of the generated image and the data source image, and calculating authenticity loss values ​​of the generated image and the data source image; Adjust the preset network according to the distance loss value, the feature loss value and the authenticity loss value to obtain a face shape transfer model; Acquire a two-dimensional image to be converted, and input the two-dimensional image to be converted into the face shape migration model to obtain an initial image; The initial image is processed based on a pre-trained appearance transfer model to obtain a target three-dimensional image of the two-dimensional image to be converted.

2. The three-dimensional image generation method according to claim 1, characterized in that: The generative adversarial network includes a generator and a discriminator. The data source image and the face source image are processed based on the generative adversarial network to obtain a generated image of the data source image, including: Extracting facial features of the facial source image; Based on the generator, the data source image and the facial features are fused to obtain a first image; Labeling the first image to obtain a first training label, and labeling the data source image to obtain a second training label; Based on the discriminator, the first image is discriminated to obtain a first predicted label of the first image, and based on the discriminator, the data source image is discriminated to obtain a second predicted label of the data source image; If the first predicted label is the same as the first training label, and the second predicted label is the same as the second training label, the first image is determined as the generated image.

3. The three-dimensional image generation method according to claim 1, characterized in that: The three-dimensional deformation network includes a convolution layer, a pooling layer and a fully connected layer, and the first three-dimensional deformation coefficient of the face source image is calculated based on the three-dimensional deformation model, including: Extracting features of the face source image based on the convolution layer to obtain image features; Performing dimensionality reduction processing on the image features based on the pooling layer to obtain low-dimensional features; The low-dimensional feature is processed based on the preset face shape parameters in the fully connected layer to obtain a first face shape deformation coefficient, and the low-dimensional feature is processed based on the preset expression parameters in the fully connected layer to obtain a first expression deformation coefficient; The first face shape deformation coefficient and the first appearance deformation coefficient are determined as the first three-dimensional deformation coefficient.

4. The three-dimensional image generation method according to claim 3, characterized in that: The second three-dimensional deformation coefficient includes a second face shape deformation coefficient and a second surface deformation coefficient. The calculation formula of the distance loss value is: Wherein, S1 represents the distance loss value, n represents the maximum dimension value of the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient, and X i represents the value corresponding to the i-th dimension in the first face deformation coefficient, Y i represents the value corresponding to the i-th dimension in the second face shape deformation coefficient, A i represents the value corresponding to the i-th dimension in the first table variable coefficient, B i Represents the value corresponding to the i-th dimension in the second table's variable coefficient.

5. The three-dimensional image generation method according to claim 2, characterized in that: The calculating of the authenticity loss value between the generated image and the data source image comprises: Obtaining a first prediction probability of the data source image for the first prediction label from the discriminator, and obtaining a second prediction probability of the generated image for the second prediction label from the discriminator; The authenticity loss value is generated according to the first prediction probability and the second prediction probability.

6. The three-dimensional image generation method according to claim 5, characterized in that: The calculation formula of the truth loss value is: Among them, k represents a preset value, p1 represents the first prediction probability, and p2 represents the second prediction probability.

7. The three-dimensional image generation method according to claim 1, characterized in that: The face shape transfer model includes an image transfer model corresponding to the generative adversarial network and a three-dimensional image construction model corresponding to the three-dimensional deformation network, and the inputting of the two-dimensional image to be converted into the face shape transfer model to obtain the initial image includes: Performing migration processing on the two-dimensional image to be converted based on the image migration model to obtain a second image; Calculating a third three-dimensional deformation coefficient of the second image based on the three-dimensional image building model; Obtaining a facial key point reference matrix, a face shape deformation template matrix and an expression deformation template matrix from the three-dimensional image construction model; Generate feature code according to the third three-dimensional deformation coefficient, the human face key point reference matrix, the face shape deformation template matrix and the expression deformation template matrix; Mapping is performed on the feature code to obtain the initial image.

8. A three-dimensional image generating device, characterized in that: The three-dimensional image generating device comprises: An acquisition unit, used for acquiring a training image, wherein the training image includes a data source image and a face shape source image; The acquisition unit is further used to acquire a preset network, wherein the preset network includes a generative adversarial network and a three-dimensional deformation network; A processing unit, configured to process the data source image and the face source image based on the generative adversarial network to obtain a generated image of the data source image; a calculation unit, configured to calculate a first three-dimensional deformation coefficient of the face source image based on the three-dimensional deformation network, and calculate a second three-dimensional deformation coefficient of the generated image based on the three-dimensional deformation network; The calculation unit is further used to calculate a distance loss value between the data source image and the generated image based on the first three-dimensional deformation coefficient and the second three-dimensional deformation coefficient; The calculation unit is further used to calculate the feature loss value of the generated image and the data source image, and calculate the authenticity loss value of the generated image and the data source image; An adjustment unit, configured to adjust the preset network according to the distance loss value, the feature loss value, and the authenticity loss value to obtain a face shape transfer model; An input unit, used for acquiring a two-dimensional image to be converted, and inputting the two-dimensional image to be converted into the face shape migration model to obtain an initial image; The processing unit is further used to process the initial image based on a pre-trained appearance transfer model to obtain a target three-dimensional image of the two-dimensional image to be converted.

9. An electronic device, characterized in that: The electronic device comprises: a memory storing computer-readable instructions; and A processor executes the computer-readable instructions stored in the memory to implement the three-dimensional image generation method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the three-dimensional image generation method according to any one of claims 1 to 7.