Image generation method, device, equipment and storage medium
By obtaining virtual face features from the face feature library and using Gaussian distribution parameters to generate virtual face features, combined with the target feature decoding network and diffusion network, the problem of insufficient efficiency and quality of virtual face image generation in the existing technology is solved, and High-quality and efficient virtual face image generation.
Patent Information
- Application Number
- CN202411047943.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-08-01
AI Technical Summary
Existing virtual face image generation methods cannot effectively generate virtual face images of different virtual objects on a large scale, and the quality of the generated virtual face images is poor.
By obtaining virtual face features from the face feature database, determining the first face parameter and the second face parameter, characterizing the Gaussian distribution center position and discrete degree of the face feature, generating virtual face features, and using the target feature decoding network and diffusion network to generate high-quality virtual face images.
It improves the generation efficiency and quality of virtual face images, has high applicability, can generate multiple virtual face images corresponding to the same virtual object, and improves the richness of virtual face features and the naturalness of the image.
Smart Images

Figure CN118570588B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to an image generation method, apparatus, device and storage medium. Background Art
[0002] With the continuous development of computer technology, the open source of large-scale real face databases has greatly promoted the development of face recognition research. However, in order to protect personal information security, the use of virtual face images has become the mainstream solution in the development process of face recognition algorithm models.
[0003] Current methods for generating virtual face images are usually unable to effectively generate virtual face images of different virtual objects on a large scale, and the quality of the generated virtual face images is poor. Summary of the invention
[0004] The embodiments of the present application provide an image generation method, apparatus, device and storage medium, which can improve the generation efficiency and quality of virtual face images and have high applicability.
[0005] On the one hand, an embodiment of the present application provides an image generation method, the method comprising:
[0006] Acquire a first virtual face feature from a face feature library, wherein the face feature library includes at least one virtual face feature;
[0007] Generating at least one target virtual facial feature of the same virtual object according to the first virtual facial feature;
[0008] For each of the above target virtual facial features, generating at least one virtual facial image according to the target virtual facial feature, wherein the virtual facial images generated based on the above target virtual facial features correspond to the same virtual object;
[0009] Each virtual face feature in the above face feature library is determined based on the following method:
[0010] Determine a first face parameter and a second face parameter, wherein the first face parameter and the second face parameter are used to represent a center position and a discrete degree of a Gaussian distribution corresponding to a group of facial features, respectively;
[0011] Generate virtual facial features based on the first facial parameter and the second facial parameter.
[0012] On the other hand, an embodiment of the present application provides an image generating device, the device comprising:
[0013] A feature acquisition module, configured to acquire a first virtual face feature from a face feature library, wherein the face feature library includes at least one virtual face feature;
[0014] A feature generation module, used to generate at least one target virtual face feature of the same virtual object according to the first virtual face feature;
[0015] An image generation module, configured to generate at least one virtual face image for each of the target virtual face features according to the target virtual face features, wherein the virtual face images generated based on the target virtual face features correspond to the same virtual object;
[0016] Each virtual face feature in the face feature library is determined by the feature generation module based on the following method:
[0017] Determine a first face parameter and a second face parameter, wherein the first face parameter and the second face parameter are used to represent a center position and a discrete degree of a Gaussian distribution corresponding to a group of facial features, respectively;
[0018] Generate virtual facial features based on the first facial parameter and the second facial parameter.
[0019] On the other hand, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein the processor and the memory are connected to each other;
[0020] The memory is used to store computer programs;
[0021] The above-mentioned processor is used to execute the image generation method provided in the embodiment of the present application when calling the above-mentioned computer program.
[0022] On the other hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the image generation method provided by the embodiment of the present application.
[0023] On the other hand, an embodiment of the present application provides a computer program product, which includes a computer program. When the above computer program is executed by a processor, the image generation method provided by the embodiment of the present application is implemented.
[0024] In the embodiment of the present application, by continuously determining the first face parameter and the second face parameter, virtual face features corresponding to different virtual objects that conform to the distribution of face features can be generated, thereby improving the quality of the final virtual face image generation. And for the virtual face features corresponding to each virtual object, by generating multiple target virtual face features corresponding to the same virtual object, the face feature expansion of the same virtual object can be achieved, so that multiple virtual face images of the same virtual object can be generated according to the multiple target virtual face features, thereby improving the generation efficiency and quality of virtual face images, and having high applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0026] Figure 1 It is a schematic diagram of the principle of the image generation method provided in the embodiment of the present application;
[0027] Figure 2 It is a flowchart of the image generation method provided in the embodiment of the present application;
[0028] Figure 3 is a schematic diagram of a process for determining virtual face features provided in an embodiment of the present application;
[0029] Figure 4 It is a schematic diagram of the network training process provided by an embodiment of the present application;
[0030] Figure 5 It is a schematic diagram of a process for generating target virtual facial features provided by an embodiment of the present application;
[0031] Figure 6 It is a schematic diagram of a process for generating a virtual face image provided by an embodiment of the present application;
[0032] Figure 7 is another schematic diagram of a process for generating a virtual face image provided by an embodiment of the present application;
[0033] Figure 8 It is a schematic diagram of the stages of the image generation method provided in the embodiment of the present application;
[0034] Fig. 9 is a schematic diagram of the structure of an image generating device provided in an embodiment of the present application;
[0035] Fig.10 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0037] The image generation method provided in the embodiment of the present application can be applied to the field of artificial intelligence, and can be used to generate virtual face images for training face recognition models and application research of related downstream tasks. The specific method can be determined based on the actual application scenario requirements and is not limited here.
[0038] See also Figure 1 , Figure 1 Schematic diagram of the principle of the image generation method provided in the embodiment of the present application. Figure 1 As shown, the facial feature library 101 includes at least one virtual facial feature, and each virtual facial feature may correspond to a different virtual object. For the device 102, the device 102 may obtain any virtual facial feature (such as a first virtual facial feature) from the facial feature library 101, and generate at least one virtual facial image corresponding to the same virtual object according to the first virtual facial feature.
[0039] For the device 102, the device 102 may generate at least one target virtual face feature of the same virtual object according to the first virtual face feature. For each target virtual face feature, the device 102 may generate at least one virtual face image 103 according to the target virtual face feature.
[0040] Each virtual face feature in the face feature library 101 may be determined by the device 102 based on the following method:
[0041] Determine a first face parameter and a second face parameter, the first face parameter is used to characterize the center position of the Gaussian distribution corresponding to a group of face features, and the second face parameter is used to characterize the degree of dispersion of the Gaussian distribution corresponding to the group of face features;
[0042] The first facial parameter and the second facial parameter are mapped into virtual facial features.
[0043] The device 102 may be a server or a terminal, which is not limited here.
[0044] Among them, the server can be an independent physical server, such as a video server, streaming media server, etc., or it can be a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms. There is no restriction here.
[0045] The terminal may be a smart phone, a tablet computer, a laptop computer, a desktop computer (including a display), a smart watch, a vehicle terminal, an aircraft, a smart home appliance (such as a smart TV) or a wearable device, etc., without limitation.
[0046] See also Figure 2 , Figure 2 is a flow chart of the image generation method provided in the embodiment of the present application. Figure 2 As shown, the data processing method provided in the embodiment of the present application may include the following steps:
[0047] S21, obtaining a first virtual facial feature from a facial feature library.
[0048] In some feasible implementations, the facial feature library includes multiple virtual facial features, and each virtual facial feature corresponds to a different virtual object. That is, each virtual facial feature in the facial feature library is a facial feature of a virtual object that does not exist in reality, rather than a facial feature of a real object that exists in reality. For example, each virtual facial feature in the facial feature library can be a facial feature of a fictional character in a movie.
[0049] That is, each virtual facial feature in the facial feature library can be understood as a description of the facial information of a virtual object, which is specifically used to characterize the identity information of the corresponding virtual object, so as to distinguish it from the virtual facial features of other virtual objects or the facial features of real objects.
[0050] For example, for the first virtual facial feature in the facial feature library, the first virtual facial feature is the facial feature of the target virtual object. The first virtual facial feature is used to describe the facial information of the target virtual object, and the identity information of the target virtual object can be determined based on the first virtual facial feature, rather than the identity information of other virtual objects or real objects.
[0051] In some feasible implementations, each virtual face feature in the face feature library is determined based on the following method:
[0052] Determine a first facial parameter and a second facial parameter, and generate a virtual facial feature according to the first facial parameter and the second facial parameter.
[0053] Among them, the first face parameter is used to characterize the center position or average value of the Gaussian distribution corresponding to a group of facial features, and is used to represent the "typical" or "average" features of an individual or a category of faces. The second face parameter is used to characterize the degree of dispersion of the Gaussian distribution corresponding to a group of facial features, and specifically reflects the fluctuation of the group of facial features relative to the first face parameter. The larger the second face parameter, the more dispersed the distribution of facial features; the smaller the second face parameter, the more concentrated the distribution of facial features.
[0054] As an example, the first facial parameter may be a mean of a corresponding Gaussian distribution, and the second facial parameter may be a standard deviation of the corresponding Gaussian distribution.
[0055] That is, when determining a virtual facial feature, the first facial parameter and the second facial parameter can be sampled from the Gaussian distribution corresponding to the facial feature, and then the first facial parameter and the second facial parameter are mapped to a virtual facial feature of a virtual object.
[0056] Among them, the feature similarity between each virtual face feature in the face feature library is less than a preset similarity threshold, so that each virtual face feature in the face feature library corresponds to a different virtual object, that is, has different identity information.
[0057] Among them, the first facial parameter and the second facial parameter corresponding to each virtual facial feature can be randomly determined, such as randomly determining a Gaussian distribution corresponding to a group of facial features, determining the first facial parameter according to the center position or average value of the Gaussian distribution, and determining the second facial parameter according to the degree of discreteness of the Gaussian distribution.
[0058] Alternatively, the first facial parameters and the second facial parameters corresponding to each virtual facial feature can be different groups of predetermined preset facial parameters, each group of preset facial parameters includes a preset first facial parameter and a preset second facial parameter, and the preset first facial parameter in each group of preset facial parameters represents the center position or average value of the Gaussian distribution corresponding to a set of facial features, and the preset second facial parameter standard represents the degree of discreteness of the Gaussian distribution corresponding to the same set of facial features.
[0059] Alternatively, when generating any virtual facial feature, any candidate first facial parameter in the first set may be used as the first facial parameter determined this time, and any candidate second facial parameter in the second set may be used as the second facial parameter determined this time. Wherein, each candidate first facial parameter included in the first set is the center position or average value of the Gaussian distribution corresponding to different facial feature sets, and each candidate second facial parameter included in the second set is the degree of discreteness of the Gaussian distribution corresponding to different facial feature sets.
[0060] Based on this, combined Figure 3 , Figure 3 It is a schematic diagram of the process of determining virtual face features provided in an embodiment of the present application.
[0061] like Figure 3 As shown, when determining a virtual facial feature, a first facial parameter and a second facial parameter can be determined, and the first facial parameter and the second facial parameter can be input into a pre-trained target feature decoding network to map the first facial parameter and the second facial parameter into a virtual facial feature.
[0062] Furthermore, the similarity between the virtual facial feature and each virtual facial feature in the facial feature library can be determined. When the feature similarity between the virtual facial feature and each virtual facial feature in the facial feature library is less than a preset similarity threshold, it can be considered that the virtual object corresponding to the virtual facial feature is different from the virtual objects corresponding to other virtual facial features in the facial feature library, so that the virtual facial feature can be added to the facial feature library. When the feature similarity between the virtual facial feature and at least one virtual facial feature in the facial feature library is greater than or equal to the preset similarity threshold, it can be considered that the virtual object corresponding to the virtual facial feature is the same as the virtual object corresponding to at least one virtual facial feature in the facial feature library, so that the virtual facial feature is not added to the facial feature library, and the first facial parameter and the second facial parameter are re-determined, and the method is repeated based on the newly determined first facial parameter and the second facial parameter. Figure 3 The process shown.
[0063] Wherein, each time a virtual facial feature is determined, the first facial parameter and the second facial parameter need to be re-determined, so as to ensure that the virtual facial features in the facial feature library correspond to different virtual objects respectively.
[0064] Optionally, when generating virtual facial features based on the first facial parameters and the second facial parameters, the first facial parameters and the second facial parameters may be input into a pre-trained target feature decoding network to obtain a virtual facial feature of a virtual object.
[0065] Among them, the above-mentioned target feature decoding network can be obtained through pre-training.
[0066] In some feasible implementations, when training a target feature decoding network, a training sample set may be determined first, where the training sample set includes a plurality of real face images.
[0067] Among them, the real face images in the training sample set can be obtained from an existing face database or other open source databases, or existing face images can be obtained from the Internet. The specific requirements can be determined based on the actual application scenario and are not limited here.
[0068] Furthermore, after the training sample set is determined, each real face image in the training sample set can be input into the initial feature extraction network of the initial model to obtain real face features.
[0069] Among them, for each real face image, when inputting it into the initial feature extraction network, the size of the real face image can be first transformed to the input size of the initial feature extraction network, such as transforming the size of the real face image to 512×512, and normalizing the image pixel value to a fixed range, such as [-1, 1]. Further, the processed real face image can be read, and the read data can be input into the initial feature extraction network as a sample to obtain the corresponding real face image.
[0070] The initial feature extraction network may be an existing face recognition model or network structure, and is not limited here.
[0071] Furthermore, for each real face feature, the real face feature can be input into the initial feature encoding network of the initial model to obtain the first face sample parameter and the second face sample parameter.
[0072] The initial feature encoding network is used to map the real face feature into a Gaussian distribution, and extract the first face sample parameter and the second face sample parameter from the Gaussian distribution.
[0073] Among them, the first face sample parameter is used to characterize the center position or average value after the real face feature is mapped to the Gaussian distribution, and is used to represent the "typical" or "average" feature of the real face feature. The second face sample parameter is used to characterize the degree of dispersion after the real face feature is mapped to the Gaussian distribution, and specifically reflects the fluctuation of the real face feature relative to the first face sample parameter. The larger the second face sample parameter, the more dispersed the distribution of the real face feature; the smaller the second face parameter, the more concentrated the distribution of the real face feature.
[0074] Among them, the initial feature encoding network may include convolution calculation, nonlinear activation function (Relu) calculation, pooling calculation, full connection, and various transformer structures or operations.
[0075] Furthermore, for each real facial feature, after obtaining the first facial sample parameters and the second facial sample parameters corresponding to the real facial feature, the first facial sample parameters and the second facial sample parameters can be input into the initial feature decoding network of the initial model, so that the first facial sample parameters and the second facial sample parameters that obey the Gaussian distribution can be mapped into virtual facial features through the initial feature decoding network.
[0076] Among them, the initial feature decoding network may include convolution calculation, nonlinear activation function (Relu) calculation, pooling calculation, full connection, and various transformer structures or operations.
[0077] Furthermore, the total training loss can be determined based on each real facial feature and the corresponding virtual facial feature, and the initial model can be iteratively trained based on the training sample set until the total training loss meets the training end condition, and the training is stopped, and the initial feature decoding network when the training is stopped is determined as the above-mentioned target feature decoding network.
[0078] Among them, during the iterative training process, the entire network of the first initial module can be trained and optimized based on the gradient descent method (such as stochastic gradient descent, stochastic gradient descent with momentum term, adam, adagard, etc.) until the total training loss meets the training end condition.
[0079] Among them, the total training loss meets the termination condition, which can be that the total training loss is less than a preset value, or the total training loss corresponding to a certain number of consecutive iterative training is less than a preset value. The specific condition can be determined based on the actual application scenario requirements and is not limited here.
[0080] In some feasible implementations, when determining the total training loss based on each real facial feature and the corresponding virtual facial feature, the similarity distance between the real facial feature and the corresponding virtual facial feature can be determined, and the similarity distance can be determined as the total training loss.
[0081] Among them, the similarity distance between the real facial features and the corresponding virtual facial features is used to characterize the difference between the real facial features and the corresponding virtual facial features.
[0082] As an example, the total training loss can be determined based on:
[0083]
[0084] in, is the real face feature, is the corresponding virtual face feature, It represents the Euclidean norm between the real face features and the corresponding virtual face features, that is, the similarity distance between the two.
[0085] Optionally, when the total training loss is determined according to the real facial features and the corresponding virtual facial features, the first training loss may also be determined according to the real facial features and the corresponding virtual facial features.
[0086] The first training loss may be a similarity distance between a real face feature and a corresponding virtual face feature, and is used to characterize the difference between the real face feature and the corresponding virtual face feature.
[0087] As an example, the first training loss may be determined based on:
[0088]
[0089] in, is the real face feature, is the corresponding virtual face feature, It represents the Euclidean norm between the real face features and the corresponding virtual face features, that is, the similarity distance between the two.
[0090] Furthermore, the second training loss may be determined according to the first face sample parameters, the second face sample parameters, and the mean and standard deviation of a standard Gaussian distribution.
[0091] Among them, the second training loss is used to characterize the difference between the Gaussian distribution obtained by mapping the real face features and the standard Gaussian distribution.
[0092] The second training loss can be determined by determining the KL divergence between the Gaussian distribution obtained by mapping the real face features and the standard Gaussian distribution.
[0093] As an example, the second training loss may be determined based on:
[0094]
[0095] in, The first face sample parameter in dimension i The value of , that is, the Gaussian distribution obtained by mapping the real face features corresponds to the dimension i The mean of The second face sample parameter is in dimension i The value of , that is, the Gaussian distribution obtained by mapping the real face features corresponds to the dimension i The variance of the first face sample parameter and the second face sample parameter is d , the above formula is used to determine the KL divergence between the Gaussian distribution obtained by mapping the real face features and the standard Gaussian distribution. The mean of the standard Gaussian distribution is 0 and the variance is 1.
[0096] Based on this, when determining the total training loss based on the first training loss and the second training loss, the sum of the first training loss and the second training loss can be determined as the total training loss, or the weighted sum of the first training loss and the second training loss can be determined as the total training loss. The specific amount can be determined based on the actual application scenario requirements and is not limited here.
[0097] As an example, the total training loss L can be determined based on the following:
[0098]
[0099] in, is the first training loss, is the second training loss.
[0100] As an example, the total training loss L can also be determined based on the following method:
[0101]
[0102] in, is the first training loss, is the second training loss, is the first loss weight, is the second loss weight.
[0103] It should be noted that the virtual face features and real face features in the embodiments of the present application are high-dimensional vectors, and their dimensions can be expressed as d And the dimensions of the first face parameter, the second face parameter, the first face sample parameter and the second face sample parameter are also d .
[0104] Combine the following Figure 4 The training process of the target feature decoding network is further explained. Figure 4 As shown, Figure 4 Schematic diagram of the network training process provided by the embodiment of the present application. Figure 4 In the method, after determining a training sample set including a plurality of real face images, each real face image can be input into an initial feature extraction network of an initial model to obtain a real face feature. For each real face feature, the real face feature can be input into an initial feature encoding network of an initial model to obtain a first face sample parameter and a second face sample parameter, and then the first face sample parameter and the second face sample parameter can be input into an initial feature decoding network of an initial model to obtain a virtual face feature corresponding to the real face feature.
[0105] Furthermore, the total training loss is determined based on each real face feature and the corresponding virtual face feature, and it is determined whether the total training loss meets the training end submission. If not, the initial model is trained again based on the training sample set until the total training loss meets the training end conditions, and the training is stopped, and the initial feature decoding network at the time of stopping training is determined as the target feature decoding network.
[0106] In this step, the target feature decoding network obtained through training can map the first facial parameters and the second facial parameters determined from the Gaussian distribution corresponding to the facial features into virtual facial features that conform to the real facial features, thereby ensuring that the virtual facial image generated based on the virtual facial features has a higher quality.
[0107] S22: Generate at least one target virtual facial feature of the same virtual object based on the first virtual facial feature.
[0108] In some feasible implementations, the first virtual facial feature and each target virtual facial feature corresponding to the first virtual facial feature correspond to the same virtual object. That is, when the first virtual facial feature is used to represent the identity information of the target virtual object, each target virtual facial feature generated according to the first virtual facial feature is also used to represent the identity information of the target virtual object.
[0109] In other words, the first virtual facial feature and the various target virtual facial features generated based on the first virtual facial feature are differentiated descriptions or expressions of the facial information of the target virtual object. Based on the first virtual facial feature and the corresponding target virtual facial features, the identity information of the target virtual object can be determined.
[0110] In some feasible embodiments, when generating at least one target virtual facial feature of the same virtual object based on the first virtual facial feature, since the first virtual facial feature is a high-dimensional vector, the vector elements of any one or more dimensions in the first virtual facial feature can be adjusted, so that the adjusted virtual facial feature can be determined as at least one target virtual facial feature of the same virtual object.
[0111] In some feasible embodiments, when generating at least one target virtual facial feature of the same virtual object based on the first virtual facial feature, the first number of target virtual facial features to be generated can also be determined, that is, how many target facial features of the same virtual object need to be generated can be determined, and the first number of initial virtual facial features can be constructed.
[0112] The dimension of each initial virtual facial feature is consistent with the dimension of the first virtual facial feature, and each vector element of each initial virtual facial feature is a preset value.
[0113] In other words, after determining the first number, the first number of initial virtual facial features can be initialized, and then the vector elements of each initial virtual facial feature can be adjusted through the first virtual facial feature to obtain the first number of target facial features corresponding to the same virtual object.
[0114] Optionally, each initial virtual facial feature is used to generate a target virtual facial feature, that is, each target virtual facial feature finally generated is generated based on an initial virtual facial feature. When a first number of target virtual facial features of the same virtual object are generated based on the first virtual facial feature and each initial virtual facial feature, the expected feature similarity between each initial virtual facial feature and the first virtual facial feature can be predetermined, that is, the expected feature similarity between the target virtual facial feature generated based on each initial virtual facial feature and the first virtual facial feature.
[0115] Among them, the expected feature similarity between each initial virtual facial feature and the first virtual facial feature is within a preset similarity range, and the upper and lower thresholds of the preset similarity range can be determined according to the actual application scenario requirements. For example, the above-mentioned preset similarity range can be (0.8, 0.9). When the similarity is 1, it means that they are exactly the same, and when the similarity is 0, it means that they are completely different. There is no restriction here.
[0116] Furthermore, each initial virtual facial feature is iteratively normalized, and after each normalization process, the actual feature similarity between each normalized initial virtual facial feature and the first virtual facial feature is determined, and the similarity loss is determined based on the actual feature similarity and the expected feature similarity corresponding to each initial virtual facial feature.
[0117] The similarity loss is used to characterize the difference between the actual feature similarity and the expected feature similarity between the initial virtual face feature and the first virtual face feature.
[0118] During the iterative normalization process, each time the similarity loss is determined, it is determined whether the similarity loss meets the iteration end condition. When the similarity loss does not meet the iteration end condition, the next iterative normalization process is performed. When the similarity loss meets the iteration end submission, it means that the actual feature similarity between each initial virtual facial feature obtained in the current iteration link and the first virtual facial feature is close to the actual feature similarity. At this time, the iteration can be stopped, and each normalized initial virtual facial feature obtained when the iteration is stopped is determined as the first number of target virtual facial features of the same virtual object.
[0119] Among them, the above initial virtual face features can be represented by matrix Y To express, Y The dimension is m × d , m is the first quantity, d is the dimension of the initial virtual face feature, matrix Y Each row of represents an initial virtual face feature. When the first virtual face feature is w, the similarity between each initial virtual face feature (or normalized initial virtual face feature) and the first virtual face feature can be expressed as , T Indicates transpose.
[0120] in, For one m A dimensional vector, each element of which is used to represent the actual feature similarity between an initial virtual face feature and the first virtual face feature.
[0121] Specifically, when determining the similarity loss according to the actual feature similarity and the expected feature similarity corresponding to each initial virtual facial feature, the similarity difference between each actual feature similarity and the corresponding expected feature similarity may be determined.
[0122] As an example, For one m dimensional vector, each element of which is used to represent the actual feature similarity between an initial virtual face feature and the first virtual face feature, v For one m dimensional vector, each element of which is used to represent the expected feature similarity between an initial virtual face feature and the first virtual face feature. And The expected feature similarity and the actual feature similarity at the same position in v correspond to the same initial virtual face feature.
[0123] In this case, the similarity difference between each actual feature similarity and the corresponding expected feature similarity can be expressed as , Likewise for one m dimensional vector, each element of which is used to represent the similarity difference between an actual feature similarity and the corresponding expected feature similarity.
[0124] Further, after determining the similarity difference between each actual feature similarity and the corresponding expected feature similarity, the similarity loss may be determined according to each similarity difference.
[0125] For example, the sum of the similarity differences can be determined, and the sum of the similarities can be determined as the similarity loss. K It can be expressed as:
[0126]
[0127] For another example, the sum of the similarity differences may be determined, and the average of the similarity sums may be determined, that is, the average similarity difference of the similarity differences may be determined and determined as the similarity loss. K It can be expressed as:
[0128]
[0129] Combine the following Figure 5 The method for generating the target virtual facial features provided in the embodiment of the present application is further explained. Figure 5 FIG. 1 is a flow chart of generating target virtual face features provided by an embodiment of the present application. Figure 5 As shown, after obtaining the first virtual facial feature, the first number of target virtual facial features to be generated can be determined, and the first number of initial virtual facial features can be constructed, that is, an intra-class feature matrix is generated. The dimension of the intra-class feature matrix is m × d , m is the first quantity, d is the dimension of the initial virtual face feature, and each row of the intra-class feature matrix represents an initial virtual face feature.
[0130] Further, the expected feature similarity between each initial virtual facial feature and the first virtual facial feature is determined, each expected feature similarity is within a preset similarity interval, and each initial virtual facial feature is used to generate a target virtual facial feature. After that, each initial virtual facial feature in the intra-class feature matrix can be normalized, and the actual feature similarity between each normalized initial virtual facial feature and the first virtual facial feature is determined, and then the similarity loss is determined according to each actual feature similarity and each expected feature similarity.
[0131] Furthermore, if the similarity loss meets the iteration end condition, each normalized initial virtual face feature is determined as the first number of target virtual face features of the same virtual object. If the similarity loss does not meet the iteration end condition, the normalized intra-class feature matrix is further normalized, and the actual feature similarity between the normalized initial virtual face feature and the first virtual face feature is calculated again, and then the similarity loss is determined according to each actual feature similarity and each expected feature similarity, until the similarity loss meets the iteration end condition.
[0132] Optionally, when generating at least one target virtual facial feature based on the first virtual facial feature, the first virtual facial feature, the dimension of the first virtual facial feature, the first quantity, and the upper and lower thresholds of the preset similarity interval can also be input into a pre-trained feature generation model to obtain the first number of target virtual facial features of the same virtual object.
[0133] The feature generation model includes an intra-class feature matrix generation module, which is used to generate a feature matrix based on the dimension of the first virtual face feature. d And the first quantity m ,get m × d The intra-class feature matrixY ,matrix Y Each row of represents an initial virtual face feature.
[0134] The feature generation model includes an expected similarity generation module, which is used to generate the expected similarity according to the first number m And the upper and lower thresholds of the preset similarity interval are obtained as m The intra-class similarity vector of follows Gaussian distribution v , each element of the vector is used to represent the expected feature similarity between an initial virtual face feature and the first virtual face feature, and each expected feature similarity is within the preset similarity interval formed by the aforementioned upper and lower similarity thresholds.
[0135] The feature generation model includes a normalization module, which is used to normalize each initial virtual face feature in the intra-class feature matrix to obtain an identity feature located in a hyperspherical space.
[0136] Among them, the feature generation model includes a similarity loss calculation module, which is used to calculate the normalized intra-class feature matrix Y Each initial virtual face feature and the first virtual face feature w The actual feature similarity is calculated based on the expected feature similarity and the actual feature similarity. K .
[0137] The feature generation model continuously normalizes each initial virtual facial feature of the intra-class feature matrix through an iterative process until the similarity loss meets the iteration stop condition, so that the actual feature similarity between each initial virtual facial feature of the intra-class feature matrix and the first virtual facial feature approaches the corresponding expected feature similarity, and finally obtains the first number of target virtual facial features.
[0138] Among them, the above-mentioned feature generation model can be trained based on the aforementioned target virtual facial feature generation method, and during the training process, the model is continuously optimized based on the gradient descent method (such as stochastic gradient descent, stochastic gradient descent with momentum term, adam, adagard, etc.), and finally the above-mentioned feature generation model is obtained.
[0139] In this step, for each virtual facial feature, by determining multiple target virtual facial features with high similarity, the intra-class expansion of the virtual facial features of the same virtual object can be achieved, thereby improving the richness of the virtual facial features corresponding to the same virtual object, thereby improving the richness of the virtual facial image while improving the generation efficiency of the virtual facial image.
[0140] S23: for each target virtual facial feature, generate at least one virtual facial image of the same virtual object according to the target virtual facial feature.
[0141] In some feasible implementations, for each target virtual facial feature, the target virtual facial feature may be input into a pre-trained image generation model to generate at least one virtual facial image of the same virtual object.
[0142] In some feasible implementations, for each target virtual facial feature, at least one noise image may be determined when generating a virtual facial image.
[0143] For each noise image, the target virtual face feature may be iteratively processed a preset number of times according to the noise image, and a virtual face image may be generated according to the target feature obtained in the last iterative process.
[0144] Each iteration process is implemented in the following way:
[0145] The target features obtained in the previous iteration process are subjected to noise processing according to the noise image to obtain noise processing features, and the target features of this iteration process are generated according to the noise processing features obtained in this iteration process.
[0146] The target feature of the first iteration process is generated by noise processing features obtained by performing noise processing on the target virtual face features according to the noise image.
[0147] Among them, in each iteration process, the target virtual face feature can be first fused with the target feature obtained in the previous iteration process to obtain a fused feature, and then the fused feature can be noise-processed according to the noise image to obtain a noise-processed feature, and the target feature of this iteration process can be generated according to the noise-processed feature obtained in this iteration process.
[0148] The above noise processing process can be implemented based on a diffusion network, that is, the target virtual face features are subjected to noise addition and denoising processes based on the diffusion network to obtain the final noise processing features.
[0149] As an example, a diffusion network can be represented as follows:
[0150]
[0151] Among them, the output of the diffusion network (noise processing characteristics) is , represents a diffusion network, t is the iteration step, y is the target virtual face feature, is the noise coefficient determined based on the noise image.
[0152] Based on this, for each target virtual facial feature, when multiple noise images are determined, multiple virtual facial images of the same virtual object can be generated based on the multiple noise images and the target virtual facial feature.
[0153] Among them, any of the above noise images is randomly generated, and can also be a preset noise image, which is not limited here.
[0154] See also Figure 6 , Figure 6 Schematic diagram of a process for generating a virtual face image provided by an embodiment of the present application. Figure 6 As shown, for each target virtual face feature, after determining a noise image, the noise image and the target virtual face feature can be input into a diffusion network, and the diffusion network performs noise processing on the target virtual face feature according to the noise image to obtain a noise processing feature. Further, the target feature can be generated according to the noise processing feature.
[0155] Furthermore, it is determined whether the current number of iterations reaches the preset number of iteration steps. If it reaches it, a virtual face image is generated according to the target feature of this iteration. If it does not reach it, the target feature obtained in this iteration is input into the diffusion network, and the diffusion network performs noise processing on the target feature input this time according to the noise image to obtain the noise processing feature, so that the target feature can be generated according to the obtained noise processing feature. Similarly, after the target feature is obtained in the last iteration process that reaches the preset number of iteration steps, a virtual face feature can be generated according to the target feature.
[0156] In each iteration process, when generating the target feature according to the noise processing feature obtained in the iteration process, the noise quantity feature can be normalized to obtain the target feature.
[0157] Optionally, for each of the above-mentioned iterative processes, when generating target features based on the noise processing features obtained in this iterative process, the target features obtained in the previous iterative process can also be subjected to identity constraint processing to obtain identity features that carry the identity information of the virtual object corresponding to the first virtual facial features, and then the noise processing features and identity features obtained in this iterative process are fused to obtain the target features.
[0158] For the first iteration process, the corresponding target virtual face features may be processed with identity constraints to obtain identity features.
[0159] Among them, when fusing the noise processing features and the identity features, the noise processing features and the identity features can be added to obtain the target features, or the noise processing features and the identity features can be input into a pre-trained feature fusion model to obtain the target features. The specific features can be determined based on the actual application scenario requirements and are not limited here.
[0160] Among them, in each iteration process, the target virtual face feature can be first fused with the target feature obtained in the previous iteration process to obtain a fused feature, and then the fused feature is processed with identity constraints to obtain an identity feature, and the target feature of this iteration process is generated based on the noise processing feature and identity feature obtained in this iteration process.
[0161] Among them, the above-mentioned identity constraint processing process can be implemented based on an identity constraint network, that is, identity constraints are performed on the noise processing features based on the identity constraint network, so that the virtual face image finally generated is more consistent with the virtual object corresponding to the first virtual face feature.
[0162] As an example, the identity constraint network can be represented as follows:
[0163]
[0164] Among them, the output (identity feature) of the identity constraint network is , is the identity coefficient of the virtual object corresponding to the first virtual face feature, For face recognition models, is the target feature obtained in the previous iteration process, t is the iteration step, y is the target virtual face feature, T represents transpose, Represents the derivative symbol.
[0165] See also Figure 7 , Figure 7 FIG. 1 is another schematic diagram of a process for generating a virtual face image provided by an embodiment of the present application. Figure 7 As shown, for each target virtual face feature, after determining a noise image, the noise image and the target virtual face feature can be input into a diffusion network, and the diffusion network performs noise processing on the target virtual face feature according to the noise image to obtain a noise processing feature. At the same time, the target virtual face feature can be input into an identity constraint network to obtain an identity feature carrying the identity information of the virtual object corresponding to the first virtual face feature.
[0166] Furthermore, the identity features and the noise processing features are fused to obtain the target features, and it is determined whether the current iteration step meets the preset number of iterations. If so, a virtual face image is generated based on the target features of this iteration. If not, the target features obtained in this iteration are input into the diffusion network and the identity constraint network, and the diffusion network performs noise processing on the target features input this time according to the noise image to obtain the noise processing features, and the identity constraint network performs identity constraint processing on the target features input this time to obtain the identity features, and then the identity features and noise processing features obtained in this iteration are fused to obtain the target features. Similarly, after the target features are obtained in the last iteration process that reaches the preset number of iterations, a virtual face feature can be generated based on the target features.
[0167] Based on the above-mentioned method of generating virtual facial images, for any target virtual facial feature corresponding to the first virtual facial feature, multiple facial images corresponding to the same virtual object can be generated through multiple noise images. In the case of generating multiple target virtual facial features according to the first virtual facial feature, multiple virtual facial images corresponding to the same virtual object as the first virtual facial feature can be generated according to each target virtual facial feature.
[0168] Among them, the virtual facial image generated in the embodiment of the present application is a facial image of a virtual object, and the virtual object mentioned in the embodiment of the present application is the same as a normal person, but does not have any identity information of a normal person, that is, the virtual object is a fictitious identity information.
[0169] Combine the following Figure 8 The image generation method provided in the embodiment of the present application is further explained. Figure 8 Schematic diagram of the stages of the image generation method provided in the embodiment of the present application. Figure 8 As shown, the image generation method provided in the embodiment of the present application includes a virtual face feature acquisition stage and an image generation stage.
[0170] Among them, the stage of obtaining virtual facial features includes the target feature decoding network training link, the virtual facial feature determination link and the virtual facial feature intra-class expansion link.
[0171] Among them, the target feature decoding network training link is used to train the target feature decoding network that can map the first face parameter and the second face parameter to the virtual face feature according to the training sample set. The virtual feature determination link is used to map the first face parameter and the second face parameter obtained by random sampling to the virtual face feature that is consistent with the Gaussian distribution of the real face feature through the target feature decoding network. The virtual face feature intra-class expansion link is used to expand each virtual face feature in the face feature library intra-class to obtain multiple target virtual face features corresponding to the same virtual object, that is, to obtain multiple target virtual face features that have a high degree of similarity with the virtual face feature.
[0172] Among them, the implementation methods of each link in the stage of obtaining virtual facial features are as shown above and will not be repeated here.
[0173] Among them, the image generation stage mainly includes the link of generating virtual face images, which is used to generate multiple virtual face images of the same virtual object based on the noise image and the target virtual face features corresponding to a virtual face feature.
[0174] Among them, the implementation methods of each link in the image generation stage are as shown above and will not be repeated here.
[0175] In the embodiment of the present application, since many random phenomena in nature and social sciences, such as adult height, blood pressure, IQ and facial features, follow or approximately follow the statistical characteristics of Gaussian distribution, and in the application process of facial features, the algorithms used in tasks such as feature extraction, feature dimensionality reduction and face recognition are based on the fact that facial features obey Gaussian distribution or approximate Gaussian distribution, it is possible to achieve rapid identification of relevant persons and achieve stable and efficient purposes based on the mathematical properties of Gaussian distribution (such as differentiability and integrability). Therefore, due to the universality, naturalness, mathematical simplicity and wide application of Gaussian distribution in machine learning, and the distribution of facial features in nature is close to Gaussian distribution, virtual facial features corresponding to different virtual objects can be generated by determining the first facial parameters and the second facial parameters that conform to Gaussian distribution, so that the feature distribution of virtual facial features of different virtual objects is the same as the feature distribution of real facial features of real objects in nature. At the same time, the identity information of different virtual objects can be distinguished, thereby ensuring the quality of the final virtual facial image generation and the differences between virtual facial objects corresponding to different virtual objects. Furthermore, for the virtual facial features corresponding to each virtual object, the facial feature expansion of the same virtual object can be achieved by generating multiple target virtual facial features corresponding to the same virtual object, so that multiple virtual facial images of the same virtual object can be generated according to the multiple target virtual facial features, thereby improving the generation efficiency and quality of virtual facial images and having high applicability.
[0176] The training sample set, facial feature library, generated virtual facial image, relevant data involved in the virtual facial image generation process, and relevant data involved in the model training process in the embodiments of the present application can be stored in a preset storage space, which includes but is not limited to cloud storage, database, blockchain, etc., which can be determined based on the actual application scenario requirements and is not limited here.
[0177] The generation process of the virtual face image and the training process of the related models in the embodiments of the present application can be implemented based on cloud computing. In addition, the above-mentioned target feature decoding network, feature generation model, image generation model, diffusion network, identity constraint network, face recognition model, etc. can be trained based on the machine learning (ML) field of artificial intelligence (AI), as well as cloud computing (cloud computing), artificial intelligence cloud services and other technologies in cloud technology (cloud technology).
[0178] Among them, the acquisition and actual application of real face images in the embodiments of this application are strictly in accordance with the requirements of relevant national laws and regulations, and the informed consent or separate consent of the relevant information subjects is obtained, and the subsequent data use and processing behavior is carried out within the scope of authorization of laws and regulations and relevant information subjects. It can be understood that in the specific implementation of this application, when the personal data of the relevant information subjects (such as real face images, etc.) is involved, when the above embodiments of this application are applied to specific products or technologies, it is necessary to obtain the permission or consent of the relevant information subjects, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions.
[0179] See also Fig. 9 , Fig. 9 : is a schematic diagram of the structure of an image generation device provided in an embodiment of the present application. The image generation device provided in an embodiment of the present application includes:
[0180] A feature acquisition module 91 is used to acquire a first virtual face feature from a face feature library, wherein the face feature library includes at least one virtual face feature;
[0181] A feature generation module 92, configured to generate at least one target virtual face feature of the same virtual object according to the first virtual face feature;
[0182] An image generating module 93 is used to generate at least one virtual face image for each of the above target virtual face features according to the target virtual face features, wherein the virtual face images generated based on the above target virtual face features correspond to the same virtual object;
[0183] Each virtual face feature in the face feature library is determined by the feature generation module 92 based on the following method:
[0184] Randomly determine a first face parameter and a second face parameter, wherein the first face parameter and the second face parameter are respectively used to characterize a center position and a discrete degree of a Gaussian distribution corresponding to a group of facial features;
[0185] Generate virtual facial features based on the first facial parameter and the second facial parameter.
[0186] In some feasible implementations, the feature generation module 92 is used to:
[0187] Inputting the first face parameter and the second face parameter into a target feature decoding network to obtain a virtual face feature;
[0188] The target feature decoding network is obtained by training the image generation device through the training module based on the following method:
[0189] Determine a training sample set, wherein the training sample set includes a plurality of real face images;
[0190] Input each of the above real face images into the initial feature extraction network of the initial model to obtain real face features;
[0191] For each of the above-mentioned real facial features, the real facial feature is input into the initial feature encoding network of the above-mentioned initial model to obtain a first facial sample parameter and a second facial sample parameter, and the first facial sample parameter and the second facial sample parameter are input into the initial feature decoding network of the above-mentioned initial model to obtain a virtual facial feature corresponding to the real facial feature; the first facial sample parameter and the second facial sample parameter are respectively used to characterize the central position and the degree of dispersion after the real facial feature is mapped to a Gaussian distribution;
[0192] The total training loss is determined according to each of the above-mentioned real face features and the corresponding virtual face features, and the above-mentioned initial model is iteratively trained according to the above-mentioned training sample set until the above-mentioned total training loss meets the training end condition, and the training is stopped, and the initial feature decoding network when the training is stopped is determined as the above-mentioned target feature decoding network.
[0193] In some feasible implementations, the feature generation module 92 is used to:
[0194] Determine a first training loss according to each of the above-mentioned real human face features and the corresponding virtual human face features, wherein the above-mentioned first training loss is used to characterize the difference between each of the above-mentioned real human face features and the corresponding virtual human face features;
[0195] Determine a second training loss according to the first face sample parameter, the second face sample parameter, and the mean and standard deviation of a standard Gaussian distribution, wherein the second training loss is used to characterize the difference between a Gaussian distribution obtained by mapping real face features and a standard Gaussian distribution;
[0196] The total training loss is determined according to the first training loss and the second training loss.
[0197] In some feasible implementations, the feature similarity between any two of the virtual facial features in the facial feature library is less than a preset similarity threshold.
[0198] In some feasible implementations, the feature generation module 92 is used to:
[0199] Determining a first number of target virtual facial features to be generated, and constructing the first number of initial virtual facial features;
[0200] A first number of target virtual facial features of the same virtual object are generated according to the first virtual facial feature and each of the initial virtual facial features.
[0201] In some feasible implementations, the feature generation module 92 is used to:
[0202] Determining an expected feature similarity between each of the initial virtual facial features and the first virtual facial feature, each of the expected feature similarities being within a preset similarity interval, and each of the initial virtual facial features being used to generate a target virtual facial feature;
[0203] Iteratively normalizing each of the initial virtual facial features, determining the actual feature similarity between each normalized initial virtual facial feature and the first virtual facial feature after each normalization process, and determining the similarity loss according to each of the actual feature similarities and each of the expected feature similarities;
[0204] During the iterative normalization process, the iteration is stopped when the similarity loss meets the iteration end condition, and each normalized initial virtual facial feature at the time of stopping the iteration is determined as the first number of target virtual facial features of the same virtual object.
[0205] In some feasible implementations, the feature generation module 92 is used to:
[0206] Determining a similarity difference between each of the above actual feature similarities and the corresponding expected feature similarities;
[0207] A similarity loss is determined based on each of the above similarity differences.
[0208] In some feasible implementations, the image generation module 93 is used to:
[0209] determining at least one noise image;
[0210] For each of the noise images, performing a preset number of iterative processing on the target virtual face features according to the noise image, and generating a virtual face image according to the target features obtained in the last iterative process;
[0211] Each iteration is achieved in the following way:
[0212] According to the noise image, noise processing is performed on the target feature obtained in the previous iteration process to obtain a noise processing feature, and the target feature is generated according to the noise processing feature obtained in this iteration process;
[0213] The target feature of the first iteration process is generated by noise processing features obtained by performing noise processing on the target virtual face features according to the noise image.
[0214] In some feasible implementations, the image generation module 93 is used to:
[0215] Performing identity constraint processing on the target feature obtained in the previous iteration process to obtain an identity feature that carries the identity information of the virtual object corresponding to the first virtual face feature;
[0216] The noise processing features obtained in this iterative process are combined with the above identity features to obtain the target features;
[0217] Among them, the identity features of the first iteration process are obtained after identity constraint processing is performed on the corresponding target virtual face features.
[0218] In a specific implementation, the image generation device can execute the above-mentioned Figure 2 For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.
[0219] See also Fig.10 , Fig.10 Schematic diagram of the structure of the electronic device provided in the embodiment of the present application. Fig.10As shown, the electronic device 1000 in this embodiment may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned electronic device 1000 may also include: an object interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the object interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the object interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (NVM), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Fig.10 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, an object interface module, and a device control application program.
[0220] exist Fig.10 In the electronic device 1000 shown, the network interface 1004 can provide a network communication function; the object interface 1003 is mainly used to provide an input interface for the object; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:
[0221] Acquire a first virtual face feature from a face feature library, wherein the face feature library includes at least one virtual face feature;
[0222] Generating at least one target virtual facial feature of the same virtual object according to the first virtual facial feature;
[0223] For each of the above target virtual facial features, generating at least one virtual facial image according to the target virtual facial feature, wherein the virtual facial images generated based on the above target virtual facial features correspond to the same virtual object;
[0224] Each virtual face feature in the face feature library is determined by the processor 1001 based on the following method:
[0225] Randomly determine a first face parameter and a second face parameter, wherein the first face parameter and the second face parameter are respectively used to characterize a center position and a discrete degree of a Gaussian distribution corresponding to a group of facial features;
[0226] Generate virtual facial features based on the first facial parameter and the second facial parameter.
[0227] In some feasible implementations, the processor 1001 is configured to:
[0228] Inputting the first face parameter and the second face parameter into a target feature decoding network to obtain a virtual face feature;
[0229] The target feature decoding network is trained based on the following method:
[0230] Determine a training sample set, wherein the training sample set includes a plurality of real face images;
[0231] Input each of the above real face images into the initial feature extraction network of the initial model to obtain real face features;
[0232] For each of the above-mentioned real facial features, the real facial feature is input into the initial feature encoding network of the above-mentioned initial model to obtain a first facial sample parameter and a second facial sample parameter, and the first facial sample parameter and the second facial sample parameter are input into the initial feature decoding network of the above-mentioned initial model to obtain a virtual facial feature corresponding to the real facial feature; the first facial sample parameter and the second facial sample parameter are respectively used to characterize the central position and the degree of dispersion after the real facial feature is mapped to a Gaussian distribution;
[0233] The total training loss is determined according to each of the above-mentioned real face features and the corresponding virtual face features, and the above-mentioned initial model is iteratively trained according to the above-mentioned training sample set until the above-mentioned total training loss meets the training end condition, and the training is stopped, and the initial feature decoding network when the training is stopped is determined as the above-mentioned target feature decoding network.
[0234] In some feasible implementations, the processor 1001 is configured to:
[0235] Determine a first training loss according to each of the above-mentioned real human face features and the corresponding virtual human face features, wherein the above-mentioned first training loss is used to characterize the difference between each of the above-mentioned real human face features and the corresponding virtual human face features;
[0236] Determine a second training loss according to the first face sample parameter, the second face sample parameter, and the mean and standard deviation of a standard Gaussian distribution, wherein the second training loss is used to characterize the difference between a Gaussian distribution obtained by mapping real face features and a standard Gaussian distribution;
[0237] The total training loss is determined according to the first training loss and the second training loss.
[0238] In some feasible implementations, the feature similarity between any two of the virtual facial features in the facial feature library is less than a preset similarity threshold.
[0239] In some feasible implementations, the processor 1001 is configured to:
[0240] Determining a first number of target virtual facial features to be generated, and constructing the first number of initial virtual facial features;
[0241] A first number of target virtual facial features of the same virtual object are generated according to the first virtual facial feature and each of the initial virtual facial features.
[0242] In some feasible implementations, the processor 1001 is configured to:
[0243] Determining an expected feature similarity between each of the initial virtual facial features and the first virtual facial feature, each of the expected feature similarities being within a preset similarity interval, and each of the initial virtual facial features being used to generate a target virtual facial feature;
[0244] Iteratively normalizing each of the initial virtual facial features, determining the actual feature similarity between each normalized initial virtual facial feature and the first virtual facial feature after each normalization process, and determining the similarity loss according to each of the actual feature similarities and each of the expected feature similarities;
[0245] During the iterative normalization process, the iteration is stopped when the similarity loss meets the iteration end condition, and each normalized initial virtual facial feature at the time of stopping the iteration is determined as the first number of target virtual facial features of the same virtual object.
[0246] In some feasible implementations, the processor 1001 is configured to:
[0247] Determining a similarity difference between each of the above actual feature similarities and the corresponding expected feature similarities;
[0248] A similarity loss is determined based on each of the above similarity differences.
[0249] In some feasible implementations, the processor 1001 is configured to:
[0250] determining at least one noise image;
[0251] For each of the noise images, performing a preset number of iterative processing on the target virtual face features according to the noise image, and generating a virtual face image according to the target features obtained in the last iterative process;
[0252] Each iteration is achieved in the following way:
[0253] According to the noise image, noise processing is performed on the target feature obtained in the previous iteration process to obtain a noise processing feature, and the target feature is generated according to the noise processing feature obtained in this iteration process;
[0254] The target feature of the first iteration process is generated by noise processing features obtained by performing noise processing on the target virtual face features according to the noise image.
[0255] In some feasible implementations, the processor 1001 is configured to:
[0256] Performing identity constraint processing on the target feature obtained in the previous iteration process to obtain an identity feature that carries the identity information of the virtual object corresponding to the first virtual face feature;
[0257] The noise processing features obtained in this iterative process are combined with the above identity features to obtain the target features;
[0258] Among them, the identity features of the first iteration process are obtained after identity constraint processing is performed on the corresponding target virtual face features.
[0259] It should be understood that in some feasible implementations, the processor 1001 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the type of device.
[0260] In a specific implementation, the electronic device 1000 can execute the above-mentioned functions through its built-in functional modules. Figure 2 For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.
[0261] The present application also provides a computer-readable storage medium, which stores a computer program and is executed by a processor to implement Figure 2For the methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.
[0262] The computer-readable storage medium may be an internal storage unit of the image generating device or electronic device provided in any of the aforementioned embodiments, such as a hard disk or memory of the electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the electronic device. The computer-readable storage medium may also include a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. Further, the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the electronic device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0263] The present invention provides a computer program product, which includes a computer program. The computer program is executed by a processor. Figure 2 The methods provided in each step.
[0264] The terms "first", "second", etc. in the claims, specification and drawings of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or electronic device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or electronic devices. Mentioning "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. Displaying the phrase at various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. The term "and / or" used in the present application specification and the attached claims refers to any combination of one or more of the items listed in association and all possible combinations, and includes these combinations.
[0265] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0266] The above disclosure is only the preferred embodiment of the present application, which cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. An image generation method, characterized in that: The method comprises: Acquire a first virtual human face feature from a human face feature library, wherein the human face feature library includes at least one virtual human face feature; generating at least one target virtual facial feature of the same virtual object according to the first virtual facial feature; For each of the target virtual facial features, generating at least one virtual facial image according to the target virtual facial feature, wherein the virtual facial images generated based on the target virtual facial features correspond to the same virtual object; Wherein, each virtual face feature in the face feature library is determined based on the following method: Determine a first face parameter and a second face parameter, wherein the first face parameter and the second face parameter are respectively used to characterize a center position and a discrete degree of a Gaussian distribution corresponding to a group of facial features; Generate virtual facial features according to the first facial parameters and the second facial parameters.
2. The method according to claim 1, characterized in that Generating a virtual facial feature according to the first facial parameter and the second facial parameter includes: Inputting the first facial parameter and the second facial parameter into a target feature decoding network to obtain a virtual facial feature; The target feature decoding network is trained based on the following method: Determine a training sample set, wherein the training sample set includes a plurality of real face images; Inputting each of the real face images into the initial feature extraction network of the initial model to obtain real face features; For each of the real facial features, the real facial feature is input into the initial feature encoding network of the initial model to obtain a first facial sample parameter and a second facial sample parameter, and the first facial sample parameter and the second facial sample parameter are input into the initial feature decoding network of the initial model to obtain a virtual facial feature corresponding to the real facial feature; the first facial sample parameter and the second facial sample parameter are respectively used to characterize the center position and the degree of dispersion after the real facial feature is mapped to a Gaussian distribution; The total training loss is determined according to each of the real facial features and the corresponding virtual facial features, the initial model is iteratively trained according to the training sample set, and the training is stopped when the total training loss meets the training end condition, and the initial feature decoding network when the training is stopped is determined as the target feature decoding network.
3. The method according to claim 2, characterized in that The determining of the total training loss according to each of the real face features and the corresponding virtual face features comprises: Determine a first training loss according to each of the real human face features and the corresponding virtual human face features, wherein the first training loss is used to characterize the difference between each of the real human face features and the corresponding virtual human face features; Determine a second training loss according to the first face sample parameter, the second face sample parameter, and the mean and standard deviation of a standard Gaussian distribution, wherein the second training loss is used to characterize the difference between a Gaussian distribution obtained by mapping real face features and a standard Gaussian distribution; A total training loss is determined according to the first training loss and the second training loss.
4. The method according to claim 1, characterized in that: The feature similarity between any two virtual facial features in the facial feature library is less than a preset similarity threshold.
5. The method according to claim 1, characterized in that The step of generating at least one target virtual facial feature of the same virtual object according to the first virtual facial feature comprises: Determining a first number of target virtual facial features to be generated, and constructing the first number of initial virtual facial features; A first number of target virtual facial features of the same virtual object are generated according to the first virtual facial features and each of the initial virtual facial features.
6. The method according to claim 5, characterized in that The step of generating a first number of target virtual facial features of the same virtual object according to the first virtual facial features and the initial virtual facial features includes: Determining an expected feature similarity between each of the initial virtual facial features and the first virtual facial feature, each of the expected feature similarities being within a preset similarity interval, and each of the initial virtual facial features being used to generate a target virtual facial feature; Iteratively normalizing each of the initial virtual facial features, determining an actual feature similarity between each normalized initial virtual facial feature and the first virtual facial feature after each normalization process, and determining a similarity loss based on each actual feature similarity and each expected feature similarity; In the iterative normalization process, the iteration is stopped when the similarity loss meets the iteration end condition, and each normalized initial virtual face feature when the iteration is stopped is determined as the first number of target virtual face features of the same virtual object.
7. The method according to claim 6, characterized in that The determining of the similarity loss according to each of the actual feature similarities and each of the expected feature similarities includes: Determining a similarity difference between each of the actual feature similarities and the corresponding expected feature similarities; A similarity loss is determined according to each of the similarity differences.
8. The method according to claim 1, characterized in that For each of the target virtual facial features, generating at least one virtual facial image according to the target virtual facial features includes: determining at least one noise image; For each of the noise images, performing a preset number of iterative processing on the target virtual face feature according to the noise image, and generating a virtual face image according to the target feature obtained in the last iterative process; Each iteration is achieved in the following way: According to the noise image, noise processing is performed on the target feature obtained in the previous iteration process to obtain a noise processing feature, and the target feature is generated according to the noise processing feature obtained in this iteration process; The target feature of the first iteration process is generated by noise processing features obtained by performing noise processing on the target virtual face features according to the noise image.
9. The method according to claim 8, characterized in that The generating target features according to the noise processing features obtained in this iterative process includes: Performing identity constraint processing on the target feature obtained in the previous iteration process to obtain an identity feature that carries the identity information of the virtual object corresponding to the first virtual face feature; The noise processing feature obtained in this iterative process is fused with the identity feature to obtain the target feature; Among them, the identity features of the first iteration process are obtained after identity constraint processing is performed on the corresponding target virtual face features.
10. An image generating device, characterized in that: The device comprises: A feature acquisition module, configured to acquire a first virtual face feature from a face feature library, wherein the face feature library includes at least one virtual face feature; A feature generation module, used to generate at least one target virtual face feature of the same virtual object according to the first virtual face feature; An image generation module, configured to generate at least one virtual face image for each target virtual face feature according to the target virtual face feature, wherein the virtual face images generated based on the target virtual face features correspond to the same virtual object; Wherein, each virtual face feature in the face feature library is determined by the feature generation module based on the following method: Determine a first face parameter and a second face parameter, wherein the first face parameter and the second face parameter are respectively used to characterize a center position and a discrete degree of a Gaussian distribution corresponding to a group of facial features; Generate virtual facial features according to the first facial parameters and the second facial parameters.
11. An electronic device, characterized in that: comprising a processor and a memory, wherein the processor and the memory are connected to each other; The memory is used to store computer programs; The processor is configured to execute the method according to any one of claims 1 to 9 when calling the computer program.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 9.
13. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
