Model training, face image quality scoring method, electronic device and storage medium
By constructing a feature encoding network and a cluster center network, combining it with a classification probability model, and using unlabeled labels and a small amount of labeled data, the problem of time-consuming and labor-intensive facial image quality scoring is solved, and fast and accurate facial image quality scoring is achieved.
Patent Information
- Application Number
- CN202210731159.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-24
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-06-24
AI Technical Summary
Existing technologies make it difficult to quickly and effectively evaluate the quality of facial images, especially under the influence of factors such as lighting, posture angle, contrast, completeness, blur and expression. Facial image quality scores rely on time-consuming and labor-intensive manual annotation datasets.
A feature encoding network and a cluster center network are constructed. Through a joint training method, a large amount of unlabeled labels and a small amount of labeled data are used to generate feature vectors and cluster centers of facial images. Combined with the classification probability model, rapid scoring of facial image quality is achieved.
It reduces the workload of data labeling, improves the efficiency of model training, realizes the facial image quality scoring under weak supervision conditions, and can quickly and accurately evaluate the quality of facial images.
Smart Images

Figure CN115063374B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of facial image processing, and in particular to a model training, facial image quality scoring method, electronic device and storage medium. Background Art
[0002] Machine learning is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. It is the core of artificial intelligence and the fundamental way to make computers intelligent.
[0003] Training data refers to the data used to train the algorithm model in the machine learning process. The algorithm learns from this training data. It uses this training data to find relationships, form understanding, make decisions, and assess confidence. The better the quality of the training data, the better the model's performance.
[0004] Facial image quality is affected by factors such as lighting, facial pose angle, facial contrast, facial integrity, facial blur, exaggerated expression, and heavy makeup. Therefore, some methods use multiple submodules corresponding to factors affecting facial image quality, such as submodules that detect facial blur, integrity, and pose angle. Industry experts then use the output of each submodule to comprehensively assign a facial image quality score. However, collecting and annotating the datasets required for this method is time-consuming and labor-intensive, making it difficult to quickly score facial image quality. Summary of the Invention
[0005] The purpose of the embodiments of the present invention is to provide a model training, a facial image quality scoring method, an electronic device and a storage medium, which can realize the rapid scoring of facial image quality.
[0006] To solve the above technical problems, an embodiment of the present invention provides a model training method, including: constructing a feature encoding network for extracting facial feature vectors from facial images, the facial feature vectors being samples that obey a first normal distribution; constructing a cluster center network for generating two cluster center vectors describing facial images as good quality and bad quality, the two cluster center vectors being samples that obey a second normal distribution respectively; constructing a classification probability model, the classification probability model being used to generate classification probability values for facial images that belong to good quality and bad quality respectively; using unlabeled facial images as training samples, jointly training the feature encoding network, the cluster center network and the classification probability model to obtain trained feature encoding networks and cluster center networks; wherein the loss of the joint training includes: the distance loss of the facial feature vector approaching the two cluster center vectors with the corresponding classification probability value, and the distance loss between the first normal distribution obeyed by the facial feature vector corresponding to the facial image labeled as good quality and the second normal distribution obeyed by the two cluster center vectors respectively.
[0007] In order to solve the above technical problems, an embodiment of the present invention also provides a facial image quality scoring method, comprising the following steps: inputting the facial image to be identified into a feature coding model to obtain the facial feature vector corresponding to the facial image to be identified as the third normal distribution that the sample obeys; determining the quality of the facial image to be identified based on the distance between the facial feature vector corresponding to the facial image to be identified as the third normal distribution that the sample obeys and the two cluster center vectors output by the cluster center model as the fourth normal distribution that the samples obey; the feature coding model and the cluster center model are trained by the above-mentioned model training method.
[0008] An embodiment of the present invention also provides an electronic device, comprising: at least one processor; a memory communicatively connected to the at least one processor; the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can execute the above-mentioned model training method or facial image quality scoring method.
[0009] An embodiment of the present invention also provides a computer-readable storage medium storing a computer program, which implements the above-mentioned model training method or facial image quality scoring method when executed by a processor.
[0010] In an embodiment of the present invention, a feature encoding model is constructed to encode facial images, representing the facial images as facial feature vectors. A cluster center model and a classification probability model are constructed to calculate the facial feature vectors and cluster the facial images into two cluster centers of good quality and poor quality. By representing the facial feature vectors of the facial images and the cluster center vectors of the good quality facial image classification and the poor quality facial image classification, respectively, with a normal distribution, image calculations are converted into correlation calculations between different normal distributions. Joint training of the feature encoding network, cluster center network, and classification probability model using a large number of unlabeled facial images and a small number of good quality labeled facial images as training samples can effectively reduce the workload of data labeling and improve model training efficiency. The loss used in joint training uses a distance loss based on the proximity of facial feature vectors to two cluster center vectors with corresponding classification probabilities. This effectively divides facial feature vectors into cluster center vectors corresponding to good and bad quality categories. Furthermore, using the distance loss between the facial feature vectors corresponding to a small number of facial images labeled as good quality as the first normal distribution of the samples and the two cluster center vectors as the second normal distribution of the samples, the two cluster centers trained on unlabeled samples can be verified and distinguished as good and bad quality cluster centers, ultimately determining the cluster center vectors of the good and bad quality cluster centers. Based on the trained feature encoding network and cluster center network, the quality of the face image to be recognized can be scored, realizing the weakly supervised facial image quality scoring process.
[0011] In addition, the feature coding network includes: a feature coding model and a first generation module; constructing a feature coding network for extracting a facial feature vector from a facial image, wherein the facial feature vector as a sample obeys a first normal distribution, including: constructing a feature coding model whose input is a facial image and output is a first mean vector and a first standard deviation vector; sampling from the standard normal distribution through the first generation module to obtain a first sampling value vector, and constructing the first normal distribution through the following formula:
[0012]
[0013] Among them, z n (b) is the face feature vector; s n (b) is the first sampling value vector, mu n (b) is the first mean vector, var n (b)is the first standard deviation vector, b = 1, 2…, B; B is the batch size of the training samples, and n is the vector length. In this application, a first sampling value vector is obtained by sampling from a standard normal distribution, with the first mean vector as the mean and the first standard deviation vector as the standard deviation. This constructs a first normal distribution, reduces the dimensionality of the image features, and describes the facial feature vector obtained by encoding the facial image using a normal distribution.
[0014] In addition, the cluster center network includes: a cluster center model and a second generation module; constructing a cluster center network for generating two cluster center vectors describing the face image as good quality and bad quality, the two cluster center vectors respectively serving as samples obeying a second normal distribution, including: constructing a cluster center model, which has no input and outputs two vector expressions for describing the face image as good quality and bad quality, each vector expression including a second mean vector and a second standard deviation vector; sampling from the standard normal distribution through the second generation module to obtain a second sampling value vector, and constructing the second normal distribution through the following formula:
[0015]
[0016] Among them, C k,n is the cluster center vector; ss n is the second sampling value vector, C k,1,n is the second mean vector, C k,2,n is the second standard deviation vector; k = 1, 2 represent good quality and bad quality, respectively, and n is the vector length. In this application, a second sample value vector is obtained by sampling from a standard normal distribution, and a second mean vector is used as the mean and a second standard deviation vector is used as the standard deviation to construct a second normal distribution. This allows the cluster center vectors corresponding to the two cluster centers to be described by a normal distribution.
[0017] In addition, constructing the distance loss between the two cluster centers to which the facial features correspond to the classification probability values includes: calculating the distance loss between the two cluster centers to which the facial features correspond to the classification probability values by the following formula:
[0018]
[0019] Among them, loss c is the distance loss between the two cluster centers of the facial features with corresponding classification probability values, J k (b) is the classification probability value of the face image belonging to good quality and bad quality, var n (b) is the first standard deviation vector, z n (b) is the face feature vector, C k,nis the cluster center vector, α2 is a hyperparameter, B is the batch size of the training samples; b = 1, 2…, B; k = 1, 2, representing good quality and bad quality, respectively; and n is the vector length. In this application, the facial feature classification process is constrained by using the classification probabilities of good and bad quality facial images, the first standard deviation vector, the facial feature vector, and the cluster center vector. This controls the facial feature vectors to be evenly distributed around the two categories. Furthermore, through joint training, the classification method of the classification probability model, the selection of cluster centers for the two categories, and the control of the face encoding method can be constrained.
[0020] In addition, the loss of joint training also includes the classification probability value uniformity loss. Constructing the classification probability value uniformity loss includes: calculating the classification probability value uniformity loss through the following formula:
[0021]
[0022] Among them, loss y is the uniformity loss of classification probability value, J k (b) Here, α1 is the probability of a facial image being classified as good or bad quality, α2 is a hyperparameter, B is the batch size of the training sample, b = 1, 2…, B, and k = 1, 2, representing good and bad quality, respectively. In this application, the classification probability uniformity loss is constructed using the classification probabilities of facial images being classified as good or bad quality. This controls the uniformity of the probability of the facial images in the training sample being biased between the two classifications, thereby constraining the encoding method of the feature encoding model and the classification method of the classification probability model. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] One or more embodiments are exemplarily illustrated by pictures in the corresponding drawings. These exemplifications do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements. Unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0024] Figure 1 This is a flowchart of the steps of a model training method provided according to one embodiment of the present invention;
[0025] Figure 2 This is a flowchart of a facial image quality scoring method according to an embodiment of the present invention;
[0026] Figure 3 FIG. 1 is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, each embodiment of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be understood by those skilled in the art that in each embodiment of the present invention, many technical details are provided to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in this application can be implemented. The division of the following embodiments is for convenience of description and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined with each other and referenced to each other under the premise that there is no contradiction.
[0028] The embodiment of the present invention relates to a model training method. The specific process is as follows Figure 1 shown.
[0029] Step 101, constructing a feature encoding network for extracting facial feature vectors from facial images, wherein the facial feature vectors as samples obey a first normal distribution;
[0030] Step 102: construct a cluster center network for generating two cluster center vectors describing the facial image as good quality and bad quality, wherein the two cluster center vectors are respectively used as samples to obey a second normal distribution;
[0031] Step 103: construct a classification probability model, which is used to generate classification probability values for the face image being of good quality or bad quality;
[0032] Step 104: Using unlabeled face images as training samples, jointly train the feature encoding network, cluster center network, and classification probability model to obtain trained feature encoding network and cluster center network.
[0033] Among them, the loss of joint training includes: the distance loss of the facial feature vector close to the two cluster center vectors with the corresponding classification probability value, and the distance loss between the first normal distribution obeyed by the facial feature vector corresponding to the face image marked as good quality as the sample and the second normal distribution obeyed by the two cluster center vectors as the samples.
[0034] The model training method of this embodiment is used in electronic devices capable of machine learning, such as computers, tablets, and mobile phones. Since training data refers to the data used to train the algorithm model during machine learning, obtaining good training data is a key issue in machine learning. In facial image processing algorithms, facial image quality is affected by factors such as lighting, facial pose angle, facial contrast, facial integrity, facial blur, exaggerated expression, and the intensity of makeup. Therefore, some methods use multiple submodules corresponding to factors affecting facial image quality, such as submodules that separately detect facial blur, integrity, and pose angle. Industry experts then comprehensively assign facial image quality scores based on the outputs of each submodule. However, collecting and annotating the datasets this method relies on is time-consuming and labor-intensive. Others have labeled facial images based on subjective human perception scores, constructed deep learning networks, and performed supervised training to directly obtain scoring models that align with human perception. However, the numerous factors that influence facial image quality make accurately annotating quality scores extremely difficult, if not impossible, making rapid facial image quality scoring difficult.
[0035] In an embodiment of the present invention, a large number of unlabeled face images and a small number of face images labeled as good quality are used as training samples to jointly train the feature encoding network, cluster center network and classification probability model, which can effectively reduce the workload of data labeling and improve the efficiency of model training.
[0036] The following is a detailed description of the implementation details of the model training method of this embodiment. The following content is only provided for easy understanding of the implementation details and is not necessary for the implementation of this solution.
[0037] In step 101, the electronic device constructs a feature encoding network for extracting facial feature vectors from a facial image. The facial feature vectors, as samples, follow a first normal distribution. The feature encoding network can select and encode the facial image based on dimensions such as contrast, brightness, and grayscale. Alternatively, the network can extract the facial structure from the facial image and encode different organs separately for use in calculating facial posture angles, facial contrast, facial integrity, facial blur, facial exaggeration, and makeup intensity. The resulting feature vectors can be one-dimensional, two-dimensional, three-dimensional, or even N-dimensional.
[0038] In one example, a feature coding network includes: a feature coding model and a first generation module; constructing a feature coding network for extracting facial features from a facial image, wherein the facial feature vector as a sample obeys a first normal distribution, which is achieved by constructing a feature coding model whose input is a facial image and whose output is a first mean vector and a first standard deviation vector.
[0039] The feature encoding model can be recorded as E, and the trainable parameters of E are recorded as w E , the input of E is a face image, and the output is two one-dimensional feature vectors of length N, namely the first mean vector and the first standard deviation vector, respectively denoted as mu n and var n , where n = 1, 2, 3, ..., N, N is a hyperparameter greater than 2, set based on experience, for example, N = 128.
[0040] Specifically, each time the electronic device performs model training, it randomly selects B different face images from the data set and records them as x. (b) , where b = 1, 2, 3, ..., B, B is a positive integer hyperparameter, set according to experience, for example, B = 64, and x (b) Input into the feature encoding model E in sequence, then the first mean vector obtained can be recorded as mu n (b) and the first standard deviation vector var n (b) .
[0041] The electronic device determines, through the first generation module, that facial feature vectors of the facial images, as samples, follow a first normal distribution with a first mean vector as the mean and a first standard deviation vector as the standard deviation. The electronic device can construct the first normal distribution in an N-dimensional Euclidean space, or another N-dimensional space, to map all facial images input to the feature encoding model into facial feature vectors.
[0042] In one example, after obtaining a sampling value vector by sampling in a preset number field, a first normal distribution may be constructed based on the sampling value vector.
[0043] Specifically, the electronic device can sample B (corresponding to B images of a sample) times from the standard normal distribution, sampling n values each time, recorded as the first sampling value vector s n (b) , according to mu n (b) var n (b) and s n (b) Calculate the intermediate vector z n (b) , to describe the first normal distribution. The sampling from the standard normal distribution can be random sampling or sampling according to a preset interval.
[0044] In one example, a first sampling value vector is obtained by sampling from a standard normal distribution through a first generation module, and a first normal distribution is constructed using the following formula:
[0045]
[0046] Among them, z n (b) is the face feature vector, s n (b) is the first sampling value vector, mu n (b) is the first mean vector, var n (b) is the first standard deviation vector, b=1,2…,B; B is the batch size of the training sample, that is, the number of face images used in each training batch, n is the vector length, represents element-wise addition, Represents element-wise multiplication.
[0047] In this embodiment, a first sampling value vector is obtained by sampling from a standard normal distribution, and a first mean vector is used as the mean and a first standard deviation vector is used as the standard deviation to construct a first normal distribution, reduce the dimensionality of the image features, and describe the facial feature vector obtained by encoding the facial image with a normal distribution.
[0048] In step 102, the electronic device constructs a cluster center network for generating two cluster center vectors describing facial images of good quality and poor quality. The two cluster center vectors, as samples, each follow a second normal distribution. The cluster center network can be a single-layer network or a multi-layer network. The cluster center network is used to calculate the locations of the two cluster centers describing good quality and poor quality. The location information is expressed as a vector, specifically described by a second mean vector and a second standard deviation vector.
[0049] In one example, a cluster center network includes: a cluster center model and a second generation module; constructing a cluster center network for generating two cluster center vectors describing a facial image as good quality and bad quality, the two cluster center vectors respectively serving as samples obeying a second normal distribution, which is achieved in the following manner: constructing a cluster center model, which has no input and outputs two vector expressions for describing a facial image as good quality and bad quality, each vector expression including a second mean vector and a second standard deviation vector.
[0050] The cluster center model can be recorded as C, and the trainable parameter of C is recorded as w c , C has no input, and the output is the vector expression of two cluster centers. Each cluster center is represented by two one-dimensional feature vectors of length N, namely the second mean vector and the second standard deviation vector.
[0051] The output of cluster center model C is recorded as C k,m,n, where k represents two categories (k=1 is good quality category, k=2 is bad quality category), m represents two vectors (m=1 is mean vector, m=2 is standard deviation vector), and n represents the vector length, i.e. C k,m,n Represents two categories k, each category corresponds to two vectors m, and the length of each vector is n. Correspondingly, C 1,1,n The second mean vector of the good quality cluster center, C 1,2,n Represents the second standard deviation vector of good quality cluster centers, C 2,1,n The second mean vector of the bad quality cluster centers, C 2,2,n A vector representing the second standard deviation of bad quality cluster centers.
[0052] The electronic device determines, through the second generation module, that the cluster center vector of each cluster center, as a sample, follows a second normal distribution having the second mean vector as the mean and the second standard deviation vector as the standard deviation in the vector representation of the cluster center. The electronic device can construct the second normal distribution in N-dimensional Euclidean space or other N-dimensional space to represent the cluster center vectors corresponding to the two cluster centers output by the cluster center model.
[0053] In one example, after obtaining a sampling value vector by sampling in a preset number field, a second normal distribution may be constructed based on the sampling value vector.
[0054] Specifically, the electronic device can sample n times from the standard normal distribution to obtain n values, which are recorded as the second sampling value vector ss n , according to C k,1,n 、C k,2,n and ss n Calculate the cluster center vector C k,n , to describe the second normal distribution. Among them, the sampling from the standard normal distribution can be random sampling or sampling according to a preset interval. The second sampling value vector ss n You can also use the first sample value vector s n (b) .
[0055] In one example, the second generation module can be used to sample from a standard normal distribution to obtain a second sample value vector, and the second normal distribution can be constructed using the following formula:
[0056]
[0057] Among them, C k,n is the cluster center vector, which obeys the second normal distribution as a sample; ss n is the second sampling value vector, C k,1,n is the second mean vector, C k,2,nis the second standard deviation vector; k = 1, 2, representing good quality and bad quality respectively, n is the vector length, represents element-wise addition, Represents element-wise multiplication.
[0058] In this embodiment, a second sampling value vector is obtained by sampling from a standard normal distribution, and a second normal distribution is constructed with a second mean vector as the mean and a second standard deviation vector as the standard deviation, so that the cluster center vectors corresponding to the two cluster centers are described by a normal distribution respectively.
[0059] In step 103, the electronic device constructs a classification probability model, which is used to generate classification probabilities for the facial image being of good quality or poor quality. The classification probability model can cluster facial feature vectors into two categories and output the degree of bias between the facial feature vectors and the two categories as a probability value. For example, this can be implemented based on algorithms such as the K-means algorithm, the K-medoids algorithm, and the CLARANS algorithm.
[0060] In an example, the classification probability model is denoted by J, and the trainable parameters of J are denoted by w J Its input is a one-dimensional feature vector of length N, that is, the face feature vector. The output of the penultimate layer network is a one-dimensional vector of length 2. The last layer is a conventional softmax layer. The output of softmax is the probability value obtained after normalizing the two values (that is, the corresponding good quality classification and bad quality classification) in the one-dimensional vector output of the penultimate layer network (for example: the output of the penultimate layer network is (2, 3), then the probability values obtained after normalization are 40% and 60%).
[0061] The output of J is denoted as J k (b) , where k = 1, 2, J k is the probability of the two categories of classification output (k = 1 is the good quality category, k = 2 is the bad quality category), that is, J1 is the probability that this face feature vector is the good quality category, J2 is the probability that this face feature vector is the bad quality category, b = 1, 2…, B; B is the batch size of the training sample, and different values correspond to different input face images.
[0062] In step 104, the electronic device uses the unlabeled face image as a training sample to jointly train the feature encoding network, the cluster center network and the classification probability model to obtain a trained feature encoding network and cluster center network; the loss of the joint training includes: the distance loss of the face feature vector close to the two cluster center vectors with the corresponding classification probability value, and the distance loss between the first normal distribution obeyed by the face feature vector corresponding to the face image labeled as good quality and the second normal distribution obeyed by the two cluster center vectors. The joint training means that based on the coupling between the various models, the loss corresponding to the output of one model is used to calculate the parameters of multiple models, or the loss corresponding to the output of multiple models is used to calculate the parameters of one model, or the loss corresponding to the output of multiple models is used to calculate the parameters of multiple models.
[0063] In one example, constructing the distance loss between the two cluster centers to which facial features correspond to classification probability values can be achieved in the following way: by calculating the distance between each facial feature vector and the corresponding vector of the centers of the two classifications, and counting the minimum, maximum, mean, median, etc. of the distance between the facial feature vector and the classification center in each classification, analyzing the facial feature classification loss, or other algorithms that calculate whether the facial feature vectors are evenly distributed in the two classifications, to construct the facial feature classification loss.
[0064] In one example, the distance loss between the two cluster centers of facial features and corresponding classification probability values is calculated using the following formula:
[0065]
[0066] Among them, loss c is the distance loss between the two cluster centers of the facial features with corresponding classification probability values, J k (b) is the classification probability value of the face image belonging to good quality and bad quality, var n (b) is the first standard deviation vector, z n (b) is the face feature vector, C k,n is the cluster center vector, α2 is a hyperparameter, B is the batch size of training samples; b = 1, 2…, B; k = 1, 2, representing good quality and bad quality respectively; n is the vector length.
[0067] In this embodiment, the classification process of facial features is constrained by using the classification probability values of the facial image belonging to good quality and bad quality, the first standard deviation vector, the facial feature vector and the cluster center vector, and the facial feature vector is controlled to be evenly distributed around the two categories. Moreover, through joint training, the classification method of the classification probability model and the selection of the cluster centers of the two categories, as well as the control of the facial encoding method, can be constrained.
[0068] In one example, the electronic device can calculate the distance loss between the first normal distribution and the second normal distribution corresponding to a good-quality facial image by using the distance between the mean vectors between the first normal distribution and the second normal distribution (i.e., the first mean vector and the second mean vector) as the distance between the first normal distribution and the second normal distribution, or calculate the distance loss based on the divergence (such as KL divergence, JS divergence).
[0069] In one example, the electronic device constructs a distance loss between a first normal distribution and a second normal distribution corresponding to a face image labeled as having good quality in the following manner:
[0070] Input B good-quality face images into the feature encoding model (E) to obtain B good-quality first mean vectors and B good-quality first standard deviation vectors, record the mean of the B good-quality first mean vectors as the good-quality mean vector, and record the mean of the B good-quality first standard deviation vectors as the good-quality standard deviation vector;
[0071] Determine that the good quality facial feature vectors of the good quality facial image as samples obey the first normal distribution of good quality with the first mean vector of good quality as the mean and the first standard deviation vector of good quality as the standard deviation;
[0072] The distance loss between the first normal distribution and the second normal distribution corresponding to the good quality face image is calculated by the following formula:
[0073]
[0074] Among them, loss f is the distance loss between the first normal distribution and the second normal distribution corresponding to the good quality face image, KL(*1||*2) represents the Kullback-Leibler divergence of *1 and *2; p(zg n ) represents zg n The probability distribution of zg n As a sample, the mean is a good quality mean vector (mugm n ), standard deviation is the good quality standard deviation vector (vargm n ) of the normal distribution; p(C 1,n ) represents the cluster center vector C of good quality1,n The probability distribution of C 1,n As a sample, the second mean vector C is of good quality. 1,1,n , the standard deviation is the second standard deviation vector C of good quality 1,2,n Normal distribution, p(C 2,n ) represents the cluster center vector C of bad quality 2,n The probability distribution of C 2,n As the sample obeys the second mean vector C with bad quality 2,1,n , the standard deviation is the second standard deviation vector C of bad quality 2,2,n Normal distribution, n is the length of the vector.
[0075] In this embodiment, the loss is minimized f Equivalent to the expectation zg n As the sample obeys a distribution close to C 1,n As the sample obeys the distribution, and far away from C 2,n As the sample obeys the distribution, we know which of the two cluster centers is the center C of the good quality face image. 1,n .
[0076] In this embodiment, by representing the good quality facial feature vector with a first normal distribution, calculating the distance between the first normal distribution and the second normal distribution corresponding to the good quality facial image by divergence, constructing a loss constraint on the distance between the first normal distribution and the second normal distribution corresponding to the good quality facial image, and confirming the categories of the two classified cluster centers, that is, determining which cluster center is a good quality cluster center and which is a bad quality cluster center, the feature encoding model, the cluster center model, and the classification probability model can be constrained.
[0077] In one example, the loss of joint training also includes facial feature loss. The facial feature loss can be calculated by performing the same processing on the original facial image and the facial feature vector, then extracting features from the processed facial image and the facial feature vector, and comparing whether the extracted features are similar.
[0078] In an example, the face feature loss can be constructed as follows:
[0079] Construct an image restoration model whose input is a facial feature vector and output is a tensor in the shape of a facial image. Add the image restoration model to the joint training process and calculate the facial feature loss using the following formula:
[0080]
[0081] Among them, loss e is the face feature loss, x (b)For face images, dx (b) is a tensor of the shape of the face image, α4 is a hyperparameter, and B is the batch size of the training samples; b = 1, 2…, B.
[0082] Among them, the image restoration model is recorded as G, and the trainable parameters of G are recorded as w G , the input of G is a one-dimensional feature vector of length N, that is, the face feature vector, and the output is a tensor of image shape, denoted as dx, to assist E training. Then z n (b) Input into the image restoration model G, and we can get z n (b) The corresponding image tensor dx (b) .
[0083] In this embodiment, by constructing an image restoration model, the loss of facial features can be measured by performing feature encoding on a verified facial image, restoring the encoded result back to an image, and then calculating the difference between the restored image and the original facial image. Through joint training, the feature encoding model is subjected to loss constraints and trained.
[0084] In one example, the joint training loss also includes classification probability uniformity loss. The classification probability uniformity loss can be calculated by calculating the distance between each facial feature vector and the corresponding center vectors of the two classifications. The classification probability uniformity loss can be calculated based on the numerical ratio of the distance values, the density of the facial feature vector positions within the two classifications, or other algorithms that can measure the uniformity of the bias probability of the training sample facial image between the two classifications.
[0085] In one example, the classification probability uniformity loss is calculated using the following formula:
[0086]
[0087] Among them, loss y is the uniformity loss of classification probability value, J k (b) is the classification probability value of the face image belonging to good quality and bad quality, α1 is a hyperparameter, B is the batch size of training samples, which is the number of face images used in each batch training; b = 1, 2…, B; k = 1, 2, representing good quality and bad quality respectively.
[0088] In this embodiment, the classification probability values of the facial images belonging to good quality and bad quality can be used to construct a classification probability value uniformity loss to control the uniformity of the bias probability of the facial images of the training samples between the two classifications, thereby constraining the encoding method of the feature encoding model and the classification method of the classification probability model.
[0089] In one example, the loss function of the joint training can be obtained by simply adding the facial feature loss, the classification probability value uniformity loss, the facial feature classification loss, and the distance loss between the first normal distribution and the second normal distribution corresponding to the facial image labeled as good quality, or it can be obtained by weighting the facial feature loss, the classification probability value uniformity loss, the facial feature classification loss, and the distance loss between the first normal distribution and the second normal distribution corresponding to the facial image labeled as good quality.
[0090] In an example, the loss function for joint training is set as follows:
[0091] loss=loss e +loss y +loss c +loss f …………………(7)
[0092] α4 is a hyperparameter greater than 0 and is set based on experience, for example, α4 = 1.0.
[0093] Electronic devices can optimize the parameters of E, G, C, and J based on conventional deep learning network optimization methods, such as gradient descent:
[0094]
[0095] Use conventional methods to determine whether E, G, C, and J have converged. For example, determine whether the training has reached a specified number of times or the loss has no longer decreased significantly. If E, G, C, and J have converged, stop training; otherwise, start a new round of training.
[0096] The steps of the various methods above are divided only for the purpose of clear description. During implementation, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process without changing the core design of the algorithm and process are all within the scope of protection of this patent.
[0097] The embodiment of the present invention also relates to a method for scoring the quality of facial images. The specific process is as follows: Figure 2 shown.
[0098] Step 201: Input the face image to be recognized into the feature coding model to obtain the face feature vector corresponding to the face image to be recognized as the third normal distribution obeyed by the sample;
[0099] Step 202, determine the quality of the face image to be identified based on the distance between the facial feature vector corresponding to the face image to be identified as the third normal distribution obeyed by the sample and the two cluster center vectors output by the cluster center model as the fourth normal distribution obeyed by the sample; the feature encoding model and the cluster center model are trained by the above-mentioned model training method.
[0100] The following is a detailed description of the implementation details of the face image quality scoring method of this embodiment. The following content is only provided for ease of understanding and is not necessary for implementing this solution.
[0101] The third normal distribution of this embodiment and the first normal distribution in the above embodiment are both the normal distributions that the facial feature vector corresponding to the facial image obtained by inputting the facial image into the feature encoding model is used as the sample to obey. The fourth normal distribution and the second normal distribution in the above embodiment are both the normal distributions that the two cluster center vectors output by the cluster center model are used as the samples to obey.
[0102] However, the first normal distribution is the feature encoding model used during model training, and the facial feature vectors obtained by encoding the input facial image follow the normal distribution as samples. The third normal distribution is the feature encoding model that has been trained, and the facial feature vectors obtained by encoding the input facial image follow the normal distribution as samples. The second normal distribution is the normal distribution that the two cluster center vectors output by the cluster center model during model training follow as samples. The fourth normal distribution is the normal distribution that the two cluster center vectors output by the trained cluster center model follow as samples. Since the model training process is the process of modifying and iteratively calculating the values of the model training parameters, the feature encoding model corresponding to the first normal distribution is a feature encoding model that has not yet been trained and whose parameters have not yet been determined, while the feature encoding model corresponding to the third normal distribution is a feature encoding model that has already been trained and whose parameters have been determined. The cluster center model corresponding to the second normal distribution is a cluster center model that has not yet been trained and whose parameters have not yet been determined, while the cluster center model corresponding to the fourth normal distribution is a cluster center model that has already been trained and whose parameters have been determined. Therefore, this embodiment uses the third normal distribution and the first normal distribution, and the fourth normal distribution and the second normal distribution to distinguish the models before and after the joint training.
[0103] In step 201, the electronic device records the face image to be rated as x, inputs x into the trained feature encoding model E, and obtains the first mean vector mux corresponding to the face image to be recognized n and the first standard deviation vector varx n , let the output of C be C k,m,n ;
[0104] The facial feature vector of the face image to be scored is recorded as zx n , calculate zx n As the third normal distribution obeyed by the sample, that is, for mux n varx n Calculate zx in a similar way to formula (1) n .
[0105] In step 202, the electronic device calculates the distance between the third normal distribution and the fourth normal distribution of the two cluster centers, and determines the quality of the face image to be recognized according to the size of the distance.
[0106] zx n As the third normal distribution of the sample to the good quality cluster center vector C 1,n As the distance d of the fourth normal distribution that the sample follows g , zx n As the sample obeys the third normal distribution to the cluster center vector C of bad quality 2,n As the distance d of the fourth normal distribution that the sample follows b :
[0107] In one example, the distance between the third normal distribution to which the facial feature vector corresponding to the face image to be recognized is taken as a sample and the fourth normal distribution to which the two cluster center vectors output by the cluster center model are taken as samples is calculated by the following formula:
[0108] d g =KL(p(zx n )||p(C 1,n ))…………………(8)
[0109] d b =KL(p(zx n )||p(C 2,n ))…………………(9)
[0110] Among them, d g The distance between the third normal distribution and the cluster center vector of the good quality cluster center as the sample obeys the fourth normal distribution, d b is the distance between the third normal distribution and the cluster center vector of the bad quality cluster center as the sample obeying the fourth normal distribution, KL(*1||*2) represents the Kullback-Leibler divergence of *1 and *2; p(zx n ) represents zx n The probability distribution of zx n The facial feature vector, as a sample, obeys the third normal distribution, p(C 1,n) represents the cluster center vector C of good quality 1,n The probability distribution of C 1,n As a sample, the second mean vector C is of good quality. 1,1,n , the standard deviation is the second standard deviation vector C of good quality 1,2,n Normal distribution, p(C 2,n ) represents the cluster center vector C of bad quality 2,n The probability distribution of C 2,n As the sample obeys the second mean vector C with bad quality 2,1,n , the standard deviation is the second standard deviation vector C of bad quality 2,2,n Normal distribution, n is the vector length;
[0111] The quality score socre of the face image to be recognized is calculated using the following formula:
[0112]
[0113] In this embodiment, by calculating the distance between the third normal distribution and the two second normal distributions using divergence, the quality of the facial image can be measured by the distance between the normal distribution corresponding to the facial image and the second normal distribution corresponding to the cluster center of good quality, and the second normal distribution corresponding to the cluster center of bad quality, thereby achieving quantification of the scoring criteria and further achieving scoring of the facial image.
[0114] In a specific embodiment, by constructing the following four models, based on the four models, the training of the face image quality scoring model is implemented in a weakly supervised training manner, and the trained model is used to score the face image quality.
[0115] 1. Construct a deep learning convolutional network E as a feature encoding model, and the trainable parameters of E are recorded as w E , the input of E is a face image, and the output is two one-dimensional feature vectors of length N, respectively denoted as the mean vector mu n and standard deviation vector var n , where n = 1, 2, 3, ..., N, N is a hyperparameter greater than 2, set based on experience, for example, N = 128;
[0116] 2. Construct a deep learning convolutional network G as the image restoration model. The trainable parameters of G are denoted as w G , the input of G is a one-dimensional feature vector of length N, and the output is a tensor of image shape, denoted as dx;
[0117] 3. Construct a deep learning network C as the cluster center model, and the trainable parameter of C is denoted as w c, C has no input, and the output is the vector expression of two cluster centers. Each cluster center is represented by two one-dimensional feature vectors of length N, that is, a mean vector and a standard deviation vector. The output is 4 1xN vectors, represented as 2×2×N feature vectors;
[0118] 4. Construct a deep learning network J as a classification probability model, and the trainable parameters of J are recorded as w J , its input is a one-dimensional feature vector of length N, the output of the penultimate layer is a one-dimensional vector of length 2, and the last layer is a conventional softmax layer. The output of softmax is the probability value obtained by normalizing the two values in the one-dimensional vector output by the penultimate layer (for example: if the output of the penultimate layer is (2, 3), the normalized probability value is 40% and 60%). Among them, J is used to perform binary classification on the input vector.
[0119] The training methods of the four models are as follows:
[0120] Step 1: Select N from the dataset g Zhang, as the good quality face image as the good quality subset D g , where N g It is a hyperparameter greater than 1 and can be set based on experience. For example, N g =200, except D in the data set g The remaining face image dataset is recorded as the remaining subset D, that is, the current dataset is divided into the good quality subset D g And the remaining subset D (D contains both good quality and bad quality face images, and all face images are unlabeled);
[0121] Step 2: Randomly select B different face images from the remaining subset D and record them as x (b) , where b=1,2,3,…,B, B is less than N g A positive integer hyperparameter (the number of B samples taken each time should be less than the number of images in the good quality subset Dg), set based on experience, for example, B = 64;
[0122] Step 3: x (b) Input into the feature encoding model E in sequence to obtain the average value vector (i.e. the first mean vector) mu n (b) and the standard deviation vector (i.e. the first standard deviation vector) var n (b) ;
[0123] Step 4: Sample B (corresponding to B images of a sample) times from the standard normal distribution, sampling n values each time, recorded as the sampling value (first sampling value vector) s n(b) ; According to the mean value vector mu n (b) , standard deviation vector var n (b) and the sample value s n (b) Calculate the intermediate vector z n (b) (i.e., facial feature vector):
[0124]
[0125] in and Respectively represent element-by-element addition and element-by-element multiplication between vectors (multiplication takes precedence over addition);
[0126] Step 5: The intermediate vector z n (b) Input to the image restoration model G to obtain the intermediate vector z n (b) The corresponding image tensor (i.e., the tensor of the face image shape) dx (b) ;
[0127] Step 6: The intermediate vector z n (b) Input into the classification probability model J, and get J k (b) (i.e., the probability of the face image belonging to good quality and bad quality), where k = 1, 2 (k = 1 is the good quality category, k = 2 is the bad quality category), by calculating the loss y (i.e., classification probability uniformity loss) imposes loss constraints on E and J.
[0128]
[0129] Where α1 is a hyperparameter, which is set based on experience, for example, α1 = 1.0;
[0130] Step 7: Randomly collect N values from the standard normal distribution and record them as sampling values ss n , (i.e. the second sampling value vector), the output of the cluster center model C is recorded as C k,m,n , where k represents two categories (k=1 is good quality category, k=2 is bad quality category), m represents two vectors (m=1 is mean vector, m=2 is standard deviation vector), and n represents vector length (such as 128 bits), that is, C k,m,n Represents two categories k, each category corresponds to two vectors m, and the length of each vector is n.
[0131] According to the sampling value ss nThe vector representation of the two categories output by model C (a total of four vectors) can be calculated by the following formula: k,n :
[0132]
[0133] C k,m,n It is a 2x2xN vector, where k takes values of 1 and 2, representing two categories describing good quality / bad quality face images respectively, and m takes values of 1 and 2, representing the vector representation of each category, that is, the vector representation includes the mean vector mu and the standard deviation vector var.
[0134] With the previous calculation z n (b) The process is the same as that of , where the cluster center vector C is calculated k,n It is also based on the “resampling process (ss n )". The C obtained after sampling calculation k,n As the sample obeys the normal distribution, since k=1,2, there are "2" normal distributions here, and each cluster center vector corresponds to a normal distribution. It can be considered that C k,n The characteristics of the two cluster centers are described.
[0135] According to the following loss formula (i.e., face feature classification loss), loss constraints are imposed on E, C, and J.
[0136]
[0137] Where α2 is a hyperparameter, which is set based on experience, for example, α2 = 1.0;
[0138] Step 8: From the good quality subset D g Randomly take B face images and input them into E to get a good quality mean vector mug n (b) and good quality standard deviation vector varg n (b) , and calculate the average value of these two types of vectors: the average value of the good quality mean vector mugm n , the average value of the good quality standard deviation vector vargm n :
[0139]
[0140]
[0141] Same as the previous formula (1), this describes the average mu and average var of B good-quality face images after E encoding.
[0142]
[0143] zg n Describes the cluster center vector of a good quality face image.
[0144] Step 9: Calculate the distance loss between the first normal distribution and the second normal distribution corresponding to the good quality face image:
[0145]
[0146] Where KL(*1||*2) represents the Kullback-Leibler divergence of *1 and *2, p(zg n ) represents zg n The probability distribution of zg n As a sample, the mean is mugm n , standard deviation is vargm n Normal distribution, p(C 1,n ) means C 1,n The probability distribution of C 1,n As a sample, the mean is C 1,1,n , the standard deviation is C 1,2,n Normal distribution, p(C 2,n ) means C 2,n The probability distribution of C 2,n As a sample, the mean is C 2,1,n , the standard deviation is C 2,2,n Normal distribution.
[0147] Where α3 is a hyperparameter greater than 0, which is set based on experience, for example, α3 = 0.05;
[0148] Previous article C k,n Two cluster centers of good quality and bad quality are described, but it is not known which center corresponds to good quality and which center corresponds to bad quality. Step 9 distinguishes C by the center composed of the average features of a small number of good quality face images. k,n Describes the quality of cluster centers.
[0149] Minimize loss f Equivalent to the expectation zg n As the sample obeys a distribution close to C 1,n As the sample obeys the distribution, and far away from C 2,n As the sample obeys the distribution, we know which of the two cluster centers is the center of the good quality face image (C 1,n ).
[0150] Step 10. Calculate the loss function:
[0151]
[0152] Where α4 is a hyperparameter greater than 0, which is set based on experience, for example, α4 = 1.0;
[0153] Step 11: Optimize the parameters of E, G, C, and J according to conventional deep learning network optimization methods:
[0154]
[0155] Step 12: Determine whether E, G, C, and J have converged according to conventional methods, such as whether the training has reached a specified number of times or the loss has no longer decreased significantly. If E, G, C, and J have converged, proceed to step 13; otherwise, proceed to step 2.
[0156] Step 13: Output the trained E, G, C, and J.
[0157] The steps for scoring the quality of face images include:
[0158] Step 1: Load E and C after the deep learning network training step is completed, and record the face image to be quality-scored as x;
[0159] Step 2: Input x into E to get mux n and varx n , let the output of C be C k,m,n ;
[0160] Step 3. Calculate zx n (for mux n varx n The intermediate vector calculated by formula 1, that is, the facial feature vector of the face image to be scored) is used as the distance from the normal distribution obeyed by the sample to the normal distribution of the two cluster centers, that is: zx n The distance d from the normal distribution of the sample to the good quality cluster center vector as the normal distribution of the sample g 、zx n The distance d from the normal distribution followed by the sample to the cluster center vector of the bad quality as the normal distribution followed by the sample b :
[0161] d g =KL(p(zx n )||p(C 1,n ))…………………(8)
[0162] d b =KL(p(zx n )||p(C 2,n ))…………………(9)
[0163] Where KL(*1||*2) represents the Kullback-Leibler divergence of *1 and *2, p(zx n ) represents zx n The probability distribution of zx n As a sample, the mean is mux n , with standard deviation of varx n Normal distribution, p(C 1,n ) means C 1,n The probability distribution of C 1,n As a sample, the mean is C 1,1,n , the standard deviation is C 1,2,n Normal distribution, p(C 2,n ) means C 2,n The probability distribution of C 2,n As a sample, the mean is C 2,1,n , the standard deviation is C 2,2,n Normal distribution.
[0164] Step 4: Calculate the score of the face image x to be evaluated:
[0165]
[0166] Output score score.
[0167] It is not difficult to find that this embodiment corresponds to the above embodiment and can be implemented in conjunction with the above embodiment. The relevant technical details mentioned in the above embodiment are still valid in this embodiment and will not be repeated here to reduce repetition. Accordingly, the relevant technical details mentioned in this embodiment can also be applied to the above embodiment.
[0168] The steps of the various methods above are divided only for the purpose of clear description. During implementation, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process without changing the core design of the algorithm and process are all within the scope of protection of this patent.
[0169] An embodiment of the present invention also relates to an electronic device, such as Figure 3 As shown, it includes: at least one processor 301; a memory 302 that is communicatively connected to the at least one processor; wherein the memory 302 stores instructions that can be executed by the at least one processor 301, and the instructions are executed by the at least one processor 301 to execute the method of any of the above embodiments.
[0170] The memory 302 and processor 301 are connected using a bus. The bus can include any number of interconnected buses and bridges, connecting various circuits of one or more processors 301 and memory 302. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits. These are all well known in the art and are therefore not described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single component or multiple components, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Information processed by the processor 301 is transmitted over a wireless medium via an antenna. Furthermore, the antenna receives information and transmits it to the processor 301.
[0171] The processor 301 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. The memory 302 can be used to store information used by the processor when performing operations.
[0172] An embodiment of the present invention relates to a computer-readable storage medium storing a computer program, which implements the above method embodiment when executed by a processor.
[0173] That is, those skilled in the art will understand that all or part of the steps in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a program, which is stored in a storage medium and includes a number of instructions for causing a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps in the various embodiments of the present application. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., various media that can store program code.
Claims
1. A model training method, characterized in that: include: Constructing a feature encoding network for extracting facial feature vectors from facial images, wherein the facial feature vectors as samples obey a first normal distribution; Constructing a cluster center network for generating two cluster center vectors describing a facial image as having good quality and bad quality, wherein the two cluster center vectors are respectively used as samples to obey a second normal distribution; Constructing a classification probability model, wherein the classification probability model is used to generate classification probability values of the face image being of good quality and bad quality respectively; Using unlabeled face images as training samples, jointly training the feature encoding network, the cluster center network, and the classification probability model to obtain the trained feature encoding network and the cluster center network; The loss of the joint training includes: a distance loss between the facial feature vector and the two cluster center vectors at the corresponding classification probability value, and a distance loss between a first normal distribution obeyed by a facial feature vector corresponding to a face image labeled as good quality and a second normal distribution obeyed by the two cluster centers respectively; The feature encoding network includes: a feature encoding model and a first generation module for constructing the first normal distribution; The input of the feature coding model is a face image, and the output is a first mean vector and a first standard deviation vector; The cluster center network includes: a cluster center model and a second generation module for constructing the second normal distribution; The cluster center model has no input and outputs two vector expressions for describing the facial image as good quality and bad quality, each of the vector expressions including a second mean vector and a second standard deviation vector; Calculating the distance loss of the facial feature vector close to the two cluster center vectors with the corresponding classification probability value includes: The distance loss between the facial features and the classification probability values belonging to the two cluster centers is calculated using the following formula: in, loss c is the distance loss between the two cluster centers corresponding to the classification probability value of the facial feature, is the classification probability value of the face image belonging to good quality and bad quality, is the first standard deviation vector, is the facial feature vector, is the cluster center vector, is a hyperparameter, B is the batch size of training samples; b =1, 2…, B; k =1,2, representing good quality and bad quality respectively; n is the length of the vector.
2. The model training method according to claim 1, characterized in that The method of constructing a feature encoding network for extracting facial feature vectors from facial images, wherein the facial feature vectors as samples obey a first normal distribution, includes: Constructing the feature encoding model; The first generation module samples from the standard normal distribution to obtain a first sampling value vector, and constructs the first normal distribution using the following formula: in, is the facial feature vector; ) is the first sampling value vector, ) is the first mean vector, is the first standard deviation vector, b =1,2…,B; B is the batch size of training samples, n is the length of the vector.
3. The model training method according to claim 1, characterized in that The constructing of a cluster center network for generating two cluster center vectors describing a facial image as having good quality and bad quality, wherein the two cluster center vectors are respectively used as samples to obey a second normal distribution, includes: Constructing the cluster center model; The second generation module samples from the standard normal distribution to obtain a second sampling value vector, and constructs the second normal distribution using the following formula: in, is the cluster center vector; is the second sampling value vector, is the second mean vector, is the second standard deviation vector; k =1,2, representing good quality and bad quality respectively, n is the length of the vector.
4. The model training method according to any one of claims 1 to 3, characterized in that: Constructing the distance loss between the first normal distribution and the second normal distribution corresponding to the face image marked as good quality, comprising: Inputting B good-quality facial images into the feature encoding model to obtain B good-quality first mean vectors and B good-quality first standard deviation vectors, recording the mean of the B good-quality first mean vectors as the good-quality mean vector, and recording the mean of the B good-quality first standard deviation vectors as the good-quality standard deviation vector; Determine that the good-quality facial feature vector of the good-quality facial image as a sample obeys a good-quality first normal distribution with the good-quality first mean vector as the mean and the good-quality first standard deviation vector as the standard deviation; The distance loss between the first normal distribution and the second normal distribution corresponding to the good quality face image is calculated by the following formula: in, is the distance loss between the first normal distribution and the second normal distribution corresponding to the good quality face image, express and Kullback-Leibler divergence; p( ) express The probability distribution of As a sample, it obeys a normal distribution with a mean of the good quality mean vector and a standard deviation of the good quality standard deviation vector; p( ) Indicates good quality cluster center vector The probability distribution of As the sample obeys the second mean vector of good quality , the standard deviation is the second standard deviation vector of good quality The normal distribution of p( ) Cluster center vector representing bad quality The probability distribution of The second mean vector as the sample obeys the mean of bad quality , the standard deviation is the second standard deviation vector of bad quality The normal distribution of n is the length of the vector.
5. The model training method according to claim 1, characterized in that The loss of the joint training also includes facial feature loss, and constructing the facial feature loss includes: Construct an image restoration model whose input is the facial feature vector and output is a tensor of the facial image shape. Add the image restoration model to the joint training process and calculate the facial feature loss using the following formula: in, is the face feature loss, is the face image, is a tensor of the shape of the face image, is a hyperparameter, B is the batch size of training samples; b =1,2…,B.
6. The model training method according to claim 1, characterized in that The loss of the joint training also includes a classification probability value uniformity loss, and constructing the classification probability value uniformity loss includes: The classification probability value uniformity loss is calculated by the following formula: in, is the uniformity loss of the classification probability value, is the classification probability value of the face image belonging to good quality and bad quality, is a hyperparameter, B is the batch size of training samples; b =1,2…,B; k =1,2, representing good quality and bad quality respectively.
7. A facial image quality scoring method, characterized in that: include: Inputting the face image to be recognized into the feature coding model to obtain the face feature vector corresponding to the face image to be recognized as the third normal distribution obeyed by the sample; The quality of the face image to be identified is determined based on the distance between the facial feature vector corresponding to the face image to be identified as the third normal distribution obeyed by the sample and the two cluster center vectors output by the cluster center model as the fourth normal distribution obeyed by the samples; the feature encoding model and the cluster center model are trained by the model training method described in any one of claims 1-6.
8. The facial image quality scoring method according to claim 7, wherein: The determining the quality of the face image to be identified based on the distance between the third normal distribution obeyed by the facial feature vector corresponding to the face image to be identified as a sample and the fourth normal distribution obeyed by two cluster center vectors output by the cluster center model as samples, includes: The distance between the facial feature vector corresponding to the face image to be recognized as the third normal distribution to which the sample obeys and the two cluster center vectors output by the cluster center model as the fourth normal distribution to which the sample obeys is calculated by the following formula; in, is the distance between the third normal distribution and the cluster center vector describing the good quality of the face image as the fourth normal distribution obeyed by the sample, is the distance between the third normal distribution and the cluster center vector describing the bad quality of the face image as the fourth normal distribution obeyed by the sample, express and Kullback-Leibler divergence; p( ) express The probability distribution of is the facial feature vector corresponding to the face image to be recognized, which as a sample obeys the third normal distribution, p( ) Indicates good quality cluster center vector The probability distribution of As the sample obeys the second mean vector of good quality , the standard deviation is the second standard deviation vector of good quality The normal distribution of p( ) Cluster center vector representing bad quality The probability distribution of The second mean vector as the sample obeys the mean of bad quality , the standard deviation is the second standard deviation vector of bad quality The normal distribution of n is the vector length; The quality score socre of the face image to be recognized is calculated by the following formula: 。 9. An electronic device, characterized in that: include: at least one processor; a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the model training method described in any one of claims 1 to 6, or the facial image quality scoring method described in any one of claims 7 to 8.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the model training method described in any one of claims 1 to 6, or the facial image quality scoring method described in any one of the model training methods described in any one of claims 7 to 8.
Citation Information
Patent Citations
Electrocardiogram data quality evaluation method and device
CN108573227A
Living body detection method and device
CN112052759A