Age recognition model training method, face age recognition method and related device

Through the combined training method of age classification model, uncertainty model and age regression model, the problem of low accuracy in face age recognition technology is solved, and higher accuracy and generalization ability are achieved.

CN114170654BActive Publication Date: 2025-08-19SHENZHEN SHULIAN TIANXIA INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111421021.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-26
Publication Date
2025-08-19
Estimated Expiration
2041-11-26

AI Technical Summary

Technical Problem

In the existing face age recognition technology, the accuracy is relatively low, mainly due to the noise interference in the training data, which makes it difficult for the model to adapt to the unique characteristics of the newly input face image.

Method used

The combined training method of age classification model, uncertainty model and age regression model is adopted to improve the generalization ability of the model by converting noise interference into uncertainty probability and introducing it into a loss function.

Benefits of technology

It improves the accuracy of face age recognition, reduces the impact of noise interference, and enhances the generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114170654B_ABST
    Figure CN114170654B_ABST
Patent Text Reader

Abstract

The embodiments of the present application relate to the technical field of face image recognition, and disclose a training method for an age recognition model, a face age recognition method, and related devices. The trained age recognition model includes an age classification model, an uncertainty model, and an age regression model. In the first stage, the uncertainty model is used to convert the influence of noise interference on the first predicted age value output by the trained age classification model into an uncertainty probability. In the second stage, the training set is used to train the recurrent neural network, and the uncertainty probability corresponding to each face image is introduced into the loss function to obtain an age regression model. The introduction of uncertainty probability is equivalent to telling the age regression model that the features extracted from each face image have a certain probability of uncertainty. Therefore, during the training process, image features with higher uncertainty probabilities need to be studied in depth, which can reduce the impact of the above-mentioned noise and improve the generalization ability and accuracy of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of facial image recognition, and in particular to a training method for an age recognition model, a facial age recognition method, and related devices. Background Art

[0002] Facial images contain a variety of facial features, such as face shape, skin condition, facial expression, facial features, and age. Age, as a key feature, is widely used in facial image recognition. For example, some clients running on mobile devices have facial age recognition capabilities. These clients capture facial images and output the recognized age based on the captured images, which is then fed back to the user.

[0003] For clients equipped with facial age recognition capabilities, the accuracy of age recognition—that is, the difference between the recognized age and the user's actual age—is a crucial factor. Currently, technologies for facial age recognition typically treat a person's actual age as a separate label, labeling the facial image. A one-to-one correspondence is established between the facial image and the actual age, and then the facial age recognition model is trained. Due to the uniqueness of user identities, different faces of the same age have different facial features. During the training process of the facial age recognition model, each input training face image represents a new class of image for the model. The model can only learn the facial features of the training data and is susceptible to noise in the training data. When the facial age recognition model is used to recognize facial age, the newly input face image represents a new class of image. Since the model has not learned the facial features of this class of image, it struggles to adapt to the unique characteristics of the newly input face image, resulting in low accuracy in practical applications. Summary of the Invention

[0004] The main technical problem solved by the embodiments of the present application is to provide a training method for an age recognition model, a face age recognition method and related devices, which can solve the technical problem of low accuracy in existing face age recognition technologies.

[0005] To solve the above technical problems, in a first aspect, embodiments of the present application provide a method for training an age recognition model, wherein the age recognition model includes an age classification model, an uncertainty model, and an age regression model. The method includes:

[0006] Obtaining a training set, wherein the training set includes a plurality of face images;

[0007] Using the training set, training a classification neural network until the classification neural network converges to obtain the age classification model, wherein the age classification model outputs an age probability vector for each face image in the training set;

[0008] determining a first predicted age value of the target face image according to an age probability vector of the target face image, wherein the target face is any face image in the training set;

[0009] Establishing the uncertainty model to obtain the uncertainty probability corresponding to the first predicted age value of the target facial image;

[0010] The recurrent neural network is trained using the training set and the loss function until the recurrent neural network converges to obtain the age regression model, wherein the loss function includes the loss of the uncertainty probability corresponding to each of the facial images.

[0011] In some embodiments, the classification neural network includes a plurality of feature extraction convolutional layers, a fully connected layer, and a softmax layer connected in sequence. The feature map output by the last feature extraction convolutional layer in the plurality of feature extraction convolutional layers is an age feature map, and the age feature map includes an age feature vector for each age. The fully connected layer is used to perform convolution processing on the age feature map and output a one-dimensional vector. The softmax layer is used to classify the one-dimensional vector to obtain the age probability vector. The age recognition model also includes a metric learning model.

[0012] The step of determining a first predicted age value of the target facial image based on the age probability vector of the target facial image includes:

[0013] Using the metric learning model, calculating first similarities between the one-dimensional vector corresponding to the target facial image and each age feature vector in the age feature map corresponding to the target facial image;

[0014] A first predicted age value of the target facial image is determined according to each of the first similarities.

[0015] In some embodiments, the using the metric learning model to calculate the first similarity between each age probability in the age probability vector corresponding to the target facial image and the corresponding age feature vector includes:

[0016] The first similarity is calculated using the following formula:

[0017] (=1,2,…,100)

[0018] in, represents the one-dimensional vector corresponding to the target face image, i represents the age label, represents the age feature vector corresponding to the i-th age, cosθ i Represents the first similarity between the one-dimensional vector corresponding to the target face image and the age feature vector corresponding to the i-th age.

[0019] In some embodiments, determining the first predicted age value of the target facial image based on each of the first similarities includes:

[0020] The first predicted age value of the target facial image is determined to be the age corresponding to the maximum value of the first similarities.

[0021] In some embodiments, establishing the uncertainty model to obtain the uncertainty probability corresponding to the first predicted age value of the target facial image includes:

[0022] Performing facial feature discarding processing on the target facial image to obtain multiple target changed facial images;

[0023] Inputting the plurality of target changed face images into the age classification model respectively to obtain age probability vectors corresponding to the plurality of target changed face images respectively;

[0024] determining a second predicted age value for each of the target changed facial images according to the age probability vectors respectively corresponding to the plurality of target changed facial images;

[0025] An uncertainty probability corresponding to the first predicted age value of the target facial image is determined according to the first predicted age value and each of the second predicted age values.

[0026] In some embodiments, the step of performing facial feature discarding processing on the target facial image to obtain multiple target changed facial images includes:

[0027] The target facial image is cropped according to different aspect ratios to obtain the multiple target changed facial images.

[0028] In some embodiments, determining the uncertainty probability corresponding to the first predicted age value of the target facial image based on the first predicted age value and each of the second predicted age values includes:

[0029] Obtaining an average of the first predicted age value and each of the second predicted age values, and obtaining a variance of the first predicted age value and each of the second predicted age values;

[0030] Gaussian distribution is used to calculate the uncertainty probability corresponding to the first predicted age value of the target facial image according to the mean value and the variance.

[0031] In some embodiments, the loss function comprises the following formula:

[0032]

[0033] Where Loss is the loss, N is the number of face images in the training set, i is the label of the face image, xi is the i-th face image in the training set, Yi is the real age of the i-th face image, p(xi) is the uncertainty probability of the i-th face image, f(x i ) is the predicted age value output by the recurrent neural network.

[0034] To solve the above technical problems, in a second aspect, the embodiments of the present application provide a face age recognition method, comprising:

[0035] Obtain the face image to be recognized;

[0036] Inputting the face image to be recognized into an age recognition model to obtain a predicted age value of the face image to be recognized and an uncertainty probability of the face image to be recognized, wherein the age recognition model is trained using the method described in the first aspect above;

[0037] The final age of the face image to be recognized is determined according to the uncertainty probability of the face image to be recognized and the predicted age value of the face image to be recognized.

[0038] In some embodiments, determining the final age of the facial image to be recognized based on the uncertainty probability corresponding to the facial image to be recognized and the predicted age value corresponding to the facial image to be recognized includes:

[0039] The final age of the face image to be identified is calculated using the following formula:

[0040] Age=(1-p(z))*f(z);

[0041] Among them, Age is the final age, z is the face image to be recognized, p(z) is the uncertainty probability corresponding to the face image to be recognized, and f(z) is the predicted age of the face image to be recognized.

[0042] To solve the above technical problems, in a third aspect, an embodiment of the present application provides an electronic device, including:

[0043] at least one processor, and

[0044] a memory communicatively coupled to the at least one processor, wherein:

[0045] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect or the second aspect above.

[0046] To solve the above technical problems, in the fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable an electronic device to execute the method described in the first or second aspect above.

[0047] Beneficial effects of the embodiments of the present application: Different from the prior art, the training method of the age recognition model provided by the embodiments of the present application, the age recognition model obtained by training includes an age classification model, an uncertainty model and an age regression model. In the first stage, the classification neural network is trained using a training set to obtain an age classification model. After the training is completed, the age classification model outputs the age probability vector of each face image in the training set; for any face image (target face image) in the training set, the first predicted age value of the target face image is determined based on its age probability vector. Due to the interference of noise such as the uniqueness of facial features, facial expressions, skin conditions and the errors of the age classification model itself, the first predicted age value is less accurate due to noise interference. In order to overcome the noise interference, an uncertainty model is used to convert the influence of this noise interference on the first predicted age value into uncertainty probability, that is, the uncertainty probability reflects the deviation between the first predicted age value and the actual age value.

[0048] In the second stage, the recurrent neural network is trained using this training set, and the uncertainty probability corresponding to each facial image is introduced into the loss function to obtain an age regression model. The introduction of uncertainty probability is equivalent to telling the age regression model that the features extracted from each facial image have a certain probability of uncertainty. Therefore, during the training process, image features with high uncertainty probabilities, such as those in which the first predicted age value of individual facial images deviates significantly from the actual age, are specifically targeted for learning. This mitigates the impact of this noise, improves the generalization ability of the age recognition model, and enhances the accuracy of age prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] 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.

[0050] Figure 1 This is a flowchart of a method for training an age recognition model in some embodiments of the present application;

[0051] Figure 2 This is a schematic diagram of the structure and processing process of the classification neural network in some embodiments of the present application;

[0052] Figure 3 for Figure 1 A schematic diagram of a sub-process of step S30 in the method shown;

[0053] Figure 4 This is a schematic diagram of the structure of the age recognition model in some embodiments of the present application;

[0054] Figure 5 for Figure 1 A schematic diagram of a sub-process of step S40 in the method shown;

[0055] Figure 6 for Figure 5 A schematic diagram of a sub-flow chart of step S44 in the method shown;

[0056] Figure 7 This is a flowchart of an age recognition method in some embodiments of the present application;

[0057] Figure 8 This is a schematic diagram of the structure of an electronic device in some embodiments of the present application. DETAILED DESCRIPTION

[0058] The present application is described in detail below with reference to specific embodiments. The following embodiments will help those skilled in the art to further understand the present application, but are not intended to limit the present application in any form. It should be noted that those skilled in the art may make several variations and improvements without departing from the scope of the present application. These all fall within the scope of protection of the present application.

[0059] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0060] It should be noted that, if there is no conflict, the various features in the embodiments of the present application can be combined with each other and are all within the scope of protection of the present application. In addition, although the functional modules are divided in the device schematic and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order than the module division in the device or the order in the flow chart. In addition, the words "first", "second", "third", etc. used herein do not limit the data and execution order, but only distinguish between the same items or similar items with basically the same functions and effects.

[0061] Unless otherwise defined, all technical and scientific terms used in this specification have the same meanings as those commonly understood by those skilled in the art to which this application belongs. The terms used in this specification and in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" as used in this specification includes any and all combinations of one or more of the relevant listed items.

[0062] In addition, the technical features involved in the various embodiments of the present application described below can be combined with each other as long as they do not conflict with each other.

[0063] The technical solution of this application is applicable to various face recognition scenarios. Specifically, the technical solution of this application can be used to identify the facial age corresponding to a facial image in face recognition scenarios. In face recognition scenarios, in some implementations, an age recognition model with age recognition function is used to recognize the facial image in the scene to determine the facial age corresponding to the facial image, wherein the age recognition model is pre-trained.

[0064] In the process of training the age recognition model, a large number of facial images are obtained, and a corresponding age label is added to each facial image. Then, each facial image and the age label corresponding to each facial image are input into an untrained neural network for training. The trained age recognition model can output age recognition results based on each facial image that are infinitely close to the age label corresponding to each age image, so that the age recognition model learns the facial features of these facial images and has the ability to distinguish facial images of different ages. The age recognition model with the ability to distinguish facial images of different ages can be used to identify the facial age corresponding to the facial image.

[0065] To facilitate understanding of the technical solution of this application, the training process of an age recognition model known to the inventors will be specifically described using an example. For example, the age range to be recognized is between 1 and 100, and a classification neural network is trained using N facial images as a training set. It is understood that a classification neural network is a neural network used to solve classification problems, which is equivalent to classifying age into 100 categories. Predicting age is equivalent to predicting category. A training process is as follows:

[0066] 1) Label each facial image with an age. Specifically, one-hot encoding can be used to identify age labels. Since the age range to be identified is between 1 and 100, a 100-dimensional vector is used as the age label corresponding to each facial image. One 100-dimensional vector is used to indicate the age corresponding to each facial image. It is understood that using one-hot encoding for labeling is a common method used by those skilled in the art and will not be described in detail here.

[0067] 2) Each facial image is fed into a classification neural network. For each facial image, the classification neural network (here, the classification neural network can be understood as the age recognition model during training) outputs an age detection result. Each age detection result includes the probability of the facial image corresponding to each age. Specifically, after N facial images are fed into the age recognition model, each detection result output by the classification neural network is a 100-dimensional vector. Each 100-dimensional vector contains 100 probability values, each ranging from 0 to 1, indicating the probability of the facial image corresponding to the 100-dimensional vector being between 1 and 100.

[0068] 3) Calculating the difference between the output of the classification neural network and the age label to determine the loss of the classification neural network. The loss of the classification neural network represents the accuracy of age recognition. The smaller the loss, the higher the accuracy of the classification neural network and the closer it is to the true situation. Specifically, a loss function can be used to calculate the loss between the output of the classification neural network and the age label. It will be understood that the use of a loss function for backpropagation to train a model is well known to those skilled in the art, and the principle will not be explained in detail here.

[0069] 4) Adjust the network parameters of the classification neural network according to the loss.

[0070] The above is the first parameter adjustment process for a classification neural network known to the inventors. During actual training, a large number of facial images are acquired, and the real ages corresponding to the facial images are used as age labels. Multiple iterations of parameter adjustment training are performed until the classification neural network converges, resulting in an age recognition model. Convergence of the classification neural network can include achieving a minimum loss, loss fluctuation within a range, or a certain number of training cycles.

[0071] When using the age recognition model, a face image is input into the age recognition model, and the age recognition model outputs a 100-dimensional age probability vector. Usually, the age with the highest probability is fed back to the user as the detection result.

[0072] Because facial features in facial images include not only those that represent age, but also those that represent user identity, facial expression, and skin condition, the trained age recognition model will recognize that the newly input facial image is a new type of image in terms of facial features, label features, and skin condition. The age recognition model has not learned features related to the identity, expression, and skin condition of the newly input facial image, which interferes with the model's recognition and results in poor age recognition accuracy.

[0073] In view of this, the technical solution of the present application proposes a new training method for an age recognition model. The age recognition model obtained through training is a composite model, including an age classification model, an uncertainty model, and an age regression model. In the first stage, a classification neural network is trained using a training set to obtain an age classification model. After the training, the age classification model outputs an age probability vector for each face image in the training set. For any face image (target face image) in the training set, the first predicted age value of the target face image is determined based on its age probability vector. Due to the interference of noise such as the uniqueness of facial features, facial expressions, skin conditions, and the errors of the age classification model itself, the first predicted age value is less accurate due to noise interference. In order to overcome the noise interference, an uncertainty model is used to convert the influence of this noise interference on the first predicted age value into an uncertainty probability, that is, the uncertainty probability reflects the deviation between the first predicted age value and the actual age value.

[0074] In the second stage, the recurrent neural network is trained using this training set, and the uncertainty probability corresponding to each facial image is introduced into the loss function to obtain an age regression model. The introduction of uncertainty probability is equivalent to telling the age regression model that the features extracted from each facial image have a certain probability of uncertainty. Therefore, during the training process, image features with high uncertainty probabilities, such as those in which the first predicted age value of individual facial images deviates significantly from the actual age, are specifically targeted for learning. This mitigates the impact of this noise, improves the generalization ability of the age recognition model, and enhances the accuracy of age prediction.

[0075] The technical solution of this application is described in detail below.

[0076] See first Figure 1 , Figure 1 A flowchart of a training method for an age recognition model provided in an embodiment of the present application is provided. The age recognition model includes an age classification model, an uncertainty model, and an age regression model.

[0077] This method can be applied to various face recognition devices, such as Figure 1 As shown, the method includes the following steps:

[0078] S10: Obtain a training set, where the training set includes multiple face images.

[0079] The training set includes a large number of face images, wherein each face image includes a face. It is understandable that in the training set, each face image is annotated with an age label (i.e., real age), and each age label covers an age range of 1-100 years old.

[0080] Among them, the age label of each facial image can be labeled using the hot encoding labeling method described in 1) above. For example, if the age range to be identified is between 1 and 100, a 100-dimensional vector is used as the age label corresponding to a facial image, and a 100-dimensional vector is used to indicate the age corresponding to a facial image.

[0081] In some embodiments, the facial images in the training set can be preprocessed and normalized to a size of 320*320*3. Because actual image collection often involves an imbalance in the number of facial images of different ages, in some embodiments, operations such as illumination transformation and rotation can be performed on the facial images for data augmentation, helping to improve the robustness of the model.

[0082] S20: Using the training set, the classification neural network is trained until the classification neural network converges, thereby obtaining an age classification model. The age classification model outputs an age probability vector for each face image in the training set.

[0083] The training process of the classification neural network can be consistent with the training process described in 1)-4) above, and will not be repeated here. When the classification neural network converges, the corresponding network parameters at the time of convergence are used as the final model parameters to obtain the age classification model.

[0084] In some embodiments, the classification neural network can be an existing neural network such as MobileNet or YOLOV3. In some embodiments, the classification neural network includes multiple sequentially connected feature extraction convolutional layers, fully connected layers, and softmax layers, each of which is followed by an activation function layer and a normalization layer.

[0085] The mathematical expression of the classification neural network can be expressed as follows:

[0086]

[0087] in, represents the mth feature map of the lth layer, represents the nth feature map of the l+lth layer, W represents the convolution kernel, B represents the bias term, σ(·) represents the ReLU activation function, and IN represents instance normalization.

[0088] In some embodiments, the convolution kernel size in the feature extraction convolution layer is set to 3×3 to help reduce aliasing effects after feature map fusion. Because downsampling and upsampling can cause information loss, uniform stride convolution can be used, that is, the stride size of the convolution kernel in each feature extraction convolution layer is consistent. The number of feature extraction convolution layers can be 5, and the number of convolution kernels included in each layer can be set to 16, 32, 64, 128, and 100, respectively.

[0089] like Figure 2 As shown in the figure, the size of the face image input to the classification neural network is 320*320*3. After being processed by 5 feature extraction convolution layers and activation function layers, a 10*10*100 feature map is obtained. Then, after being processed by the normalization layer (IN), a 100*100 age feature map is obtained. That is, the feature map output by the last feature extraction convolution layer in multiple feature extraction convolution layers is the age feature map. Subsequently, the age feature map enters the fully connected layer (FC), and after convolution processing by the fully connected layer (FC), a one-dimensional vector 1*100 is output. Finally, this one-dimensional vector is input to the softmax layer for classification, and an age probability vector P of size 100*1 is output. i The age probability vector includes the probability that the age corresponding to the face image may be 1-100 years old.

[0090] It can be understood that the age feature map includes the age feature vectors of each age. For example, in the 100*1 age probability vector, the age feature vector of the first age is the first column of the 100*100 age feature map, the age feature vector of the second age is the second column of the age feature map,..., the age feature vector of the 100th age is the 100th column of the age feature map.

[0091] In the process of classification neural network training, a multi-category cross entropy loss function can be used for model training. The multi-category cross entropy loss function is shown in the following formula:

[0092]

[0093] Among them, Y i Indicates the real age label, P i represents the predicted age probability vector, and n represents the predicted age value.

[0094] In addition, the Adam algorithm is used to optimize the model parameters, the number of iterations is set to 500, the initial learning rate is set to 0.001, the weight decay is set to 0.0005, and the learning rate is decayed to 1 / 10 of the original every 50 iterations. The classification neural network training is performed until convergence, and the age classification model is saved.

[0095] It can be understood that the age classification model outputs the age probability vector P of each face image in the training set i .

[0096] S30: Determine a first predicted age value of the target face image according to the age probability vector of the target face image, wherein the target face is any face image in the training set.

[0097] Here, any face image (target face image) in the training set is taken as an example for schematic explanation. In some embodiments, the age value corresponding to the maximum probability in the age probability vector can be used as the first predicted age value of the target face image.

[0098] In some embodiments, the age recognition model also includes a metric learning model. In this embodiment, see Figure 3 , the above step S30 specifically includes:

[0099] S31: Using a metric learning model, calculate first similarities between the one-dimensional vector corresponding to the target facial image and each age feature vector in the age feature map corresponding to the target facial image.

[0100] Based on the age feature map of the target face image, each column corresponds to an age feature vector of an age value, so that Figure 4 As shown, a pre-set metric learning model can be used to calculate the first similarity between the one-dimensional vector corresponding to the target facial image and each age feature vector in the age feature map corresponding to the target facial image. It can be understood that the greater the first similarity, the closer the age value corresponding to the age probability is to the actual age value.

[0101] In some embodiments, the above step S31 specifically includes:

[0102] The first similarity is calculated using the following formula:

[0103] (=1,2,…,100)

[0104] in, Represents the one-dimensional vector corresponding to the target face image, i represents the age label, represents the age feature vector corresponding to the i-th age, cosθ i Represents the first similarity between the one-dimensional vector corresponding to the target face image and the age feature vector corresponding to the i-th age.

[0105] S32: Determine a first predicted age value of the target facial image according to each of the first similarities.

[0106] For example, in some embodiments, the average of the ages corresponding to the top three first similarities in size can be used as the first predicted age of the target face image. For example, if the ages corresponding to the top three first similarities in size are 21, 24, and 25, respectively, the first predicted age is (21+24+25) / 3=23.3, which is rounded to 24.

[0107] Based on the fact that the larger the first similarity, the closer the age corresponding to the age feature vector is to the actual age value, in some embodiments, the above-mentioned step S32 specifically includes: determining that the first predicted age value of the target face image is the age corresponding to the maximum value of each of the first similarities.

[0108] For example, among the ages 1-100, the first similarity between the age feature vector of 25 and the one-dimensional vector output by the fully connected layer is the largest, so 25 is used as the first predicted age value of the target face image.

[0109] In this embodiment, a metric learning model is used to calculate the first similarity between the one-dimensional vector output by the fully connected layer and each age feature vector to determine a first predicted age value. This first predicted age value is then used to train a recurrent neural network using uncertainty probabilities. During backpropagation, this helps to minimize the similarity between age feature vectors for the same age and maximize the distance between age feature vectors for different ages, thereby enhancing the model's generalization capabilities.

[0110] S40: Establishing an uncertainty model to obtain the uncertainty probability corresponding to the first predicted age value of the target facial image.

[0111] Due to the uniqueness of facial features, facial expressions, skin conditions, and the inherent errors of the age classification model, the first predicted age value is less accurate due to noise interference. To overcome noise interference, please refer to Figure 4 ,The uncertainty model is used to convert the impact of this noise interference on the ,first predicted age value into uncertainty probability, that is, the uncertainty probability reflects the deviation ,between the first predicted age value and the actual age value.

[0112] In some embodiments, see Figure 5 , step S40 specifically includes:

[0113] S41: performing facial feature discarding processing on the target facial image to obtain multiple target changed facial images.

[0114] For example, after subjecting target face image A to (T-1) facial feature discarding processes, (T-1) target modified face images are obtained. Facial feature discarding processes include erasing some facial features, such as removing some facial features (e.g., 1 / 3 of the forehead features) by pixel overlaying.

[0115] In some embodiments, step S41 specifically includes: cropping the target facial image according to different aspect ratios to obtain multiple target changed facial images.

[0116] In this embodiment, facial features are discarded by cropping the image. For example, different cropping ratios such as 1:0.95, 1:0.9, and 0.95:1 are set. Then, the target face image A is cropped (T-1) times at different ratios to obtain (T-1) target modified face images.

[0117] S42: Inputting the plurality of target changed face images into the age classification model respectively to obtain age probability vectors corresponding to the plurality of target changed face images respectively.

[0118] In this process, the trained age classification model is used to detect the age of (T-1) target face images, and the age probability vectors corresponding to the (T-1) target face images are output.

[0119] S43: Determine a second predicted age value for each target changed facial image based on the age probability vectors corresponding to the plurality of target changed facial images.

[0120] For any target face image, its second predicted age value can be determined based on its age probability vector. For example, the aforementioned metric learning model (i.e., referring to steps S31 and S32) can be used to calculate the second similarities between the one-dimensional vector corresponding to the target face image and each age feature vector in the age feature map corresponding to the target face image. The second predicted age value of the target face image is determined to be the age corresponding to the maximum value among the second similarities.

[0121] S44: Determine the uncertainty probability corresponding to the first predicted age value of the target facial image based on the first predicted age value and each second predicted age value.

[0122] For example, the first predicted age value is y0, and the second predicted age values are y1, y2, .....y(T-1). Therefore, a probability distribution (such as Bayesian distribution) is introduced, and y0, y1, y2, .....y(T-1) are calculated using the probability distribution formula to obtain the uncertainty probability corresponding to the first predicted age value.

[0123] In some embodiments, see Figure 6 , step S44 specifically includes:

[0124] S441: Obtain an average value of the first predicted age value and each second predicted age value, and obtain a variance of the first predicted age value and each second predicted age value.

[0125] S442: Calculate the uncertainty probability corresponding to the first predicted age value of the target facial image using Gaussian distribution based on the mean value and variance.

[0126] For example, the following formula is used to obtain the mean μ and variance σ 2 And the uncertainty probability p(x) corresponding to the first predicted age value of the target face image.

[0127]

[0128]

[0129]

[0130] Among them, y0 is the first predicted age value, y1, y2, .....y (T-1) is each second predicted age value, and p(x) represents the uncertainty probability obtained after Gaussian distribution of the target face image x.

[0131] In this embodiment, Gaussian distribution is used to calculate the uncertainty probability corresponding to the first predicted age value of the target facial image, which is simple and accurate.

[0132] S50: Using the training set and the loss function, the recurrent neural network is trained until the recurrent neural network converges to obtain an age regression model, wherein the loss function includes the loss of the uncertainty probability corresponding to each facial image.

[0133] Here, please refer again Figure 4 The feature extraction convolutional layer of the regression neural network can have the same structure as the feature extraction convolutional layer of the classification neural network, and is finally connected to a 1*1 fully connected layer to output the final predicted age value. In this embodiment, the regression neural network can be an existing neural network for regression prediction, and there is no restriction on the structure of the regression neural network.

[0134] The training set is used to train the recurrent neural network. During the training process, since the loss function includes the loss of the uncertainty probability corresponding to each face image, the uncertainty probability corresponding to each face image is introduced into the loss function to obtain an age regression model.

[0135] In some embodiments, the Adam algorithm can be used to optimize model parameters, with the number of iterations set to 500, the initial learning rate set to 0.001, and the weight decay set to 0.0005. Every 50 iterations, the learning rate is decayed to 1 / 10 of the original value. Recurrent neural network training is performed until convergence to obtain an age regression model.

[0136] Therefore, the above-mentioned age classification model, uncertainty model and year regression model can constitute an age recognition model.

[0137] In this embodiment, the introduction of uncertainty probability is equivalent to informing the age regression model that the features extracted from each facial image have a certain probability of uncertainty. Therefore, during training, the first predicted age value for individual facial images deviates significantly from the actual age, i.e., image features with a high probability of uncertainty, are prioritized for learning. This mitigates the impact of the aforementioned noise (such as the uniqueness of facial features, facial expression, skin condition, and inherent errors in the age classification model), improves the generalization ability of the age recognition model, and enhances the accuracy of age prediction.

[0138] In some embodiments, the loss function comprises the following formula:

[0139]

[0140] Among them, Loss is the loss, N is the number of face images in the training set, i is the label of the face image, x i is the i-th face image in the training set, Y i is the real age of the i-th face image, p(x i ) is the uncertainty probability of the i-th face image, f(x i ) represents the predicted age value output by the regression neural network.

[0141] In the embodiment of the present application, the age recognition model obtained through training includes an age classification model, an uncertainty model, and an age regression model. In the first stage, a training set is used to train the classification neural network to obtain an age classification model. After the training is completed, the age classification model outputs an age probability vector for each face image in the training set. For any face image in the training set (target face image), the first predicted age value of the target face image is determined based on its age probability vector. Due to the interference of noise such as the uniqueness of facial features, facial expressions, skin conditions, and the inherent errors of the age classification model, the first predicted age value is less accurate due to noise interference. In order to overcome the noise interference, an uncertainty model is first used to convert the effect of this noise interference on the first predicted age value into an uncertainty probability, that is, the uncertainty probability reflects the deviation between the first predicted age value and the actual age value.

[0142] In the second stage, the recurrent neural network is trained using this training set, and the uncertainty probability corresponding to each facial image is introduced into the loss function to obtain an age regression model. The introduction of uncertainty probability is equivalent to telling the age regression model that the features extracted from each facial image have a certain probability of uncertainty. Therefore, during the training process, image features with high uncertainty probabilities, such as those in which the first predicted age value of individual facial images deviates significantly from the actual age, are specifically targeted for learning. This mitigates the impact of this noise, improves the generalization ability of the age recognition model, and enhances the accuracy of age prediction.

[0143] After the age recognition model training method provided in this application is used, the age recognition model can be used to perform face age recognition. Figure 7 , Figure 7 A flow chart of the face age recognition method provided in the embodiment of the present application is shown as follows: Figure 7 As shown, the method includes the following steps:

[0144] S60: Obtaining a face image to be recognized.

[0145] Here, the face image to be recognized refers to a face image of the face age to be recognized.

[0146] In a specific implementation, the face image to be identified can be obtained by local acquisition, direct shooting, etc.

[0147] S70: Inputting the face image to be recognized into the age recognition model to obtain the predicted age value of the face image to be recognized and the uncertainty probability of the face image to be recognized.

[0148] Here, the age recognition model refers to the Figures 1-6 The age recognition model obtained by training according to the embodiment of the method. As mentioned above, the age recognition model includes an age classification model, an uncertainty model, and an age regression model. Therefore, the face image to be recognized is first input into the age classification model to obtain a preliminary predicted age probability vector. Then, the age classification model obtains a preliminary predicted age based on the preliminary predicted age probability vector. Then, the preliminary predicted age and the face image to be recognized are input into the uncertainty model to obtain the uncertainty probability of the preliminary predicted age. Finally, the face image to be recognized and the uncertainty probability are input into the age regression model to obtain the predicted age value of the face image to be recognized.

[0149] S80: Determine the final age of the face image to be recognized based on the uncertainty probability of the face image to be recognized and the predicted age value of the face image to be recognized.

[0150] Here, the final age is the result after taking into account the uncertain new probability and the predicted age value, making the final age closer to the real age.

[0151] In some embodiments, step S80 specifically includes:

[0152] The following formula is used to calculate the final age of the face image to be recognized;

[0153] Age=(1-p(z))*f(z);

[0154] Among them, Age is the final age, z is the face image to be recognized, p(z) is the uncertainty probability corresponding to the face image to be recognized, and f(z) is the predicted age of the face image to be recognized.

[0155] For example, if a person's real age is 36, the age regression model predicts an age of 38, but its uncertainty is 0.05. Then the final age value is 38*(1-0.05)=36.1, which is approximately equal to 36 years old.

[0156] In this embodiment, the predicted age value predicted by the age regression model is fused with the uncertainty probability, so that the final age is closer to the actual age value.

[0157] The age recognition model is obtained by training the above-mentioned composite neural network (including the classification neural network, the uncertainty model and the recurrent neural network), and has the same structure and function as the above-mentioned composite neural network. The specific processing method of the age recognition model for identifying facial images is the same as the processing method of the composite neural network for identifying facial images in the above-mentioned embodiment, and will not be repeated here.

[0158] The above describes the methods of the present application. In order to better implement the methods of the present application, the following describes the equipment of the present application.

[0159] See also Figure 8 , is a hardware structure diagram of an electronic device 60 provided in an embodiment of the present application, specifically, Figure 8 As shown, the electronic device 60 includes at least one processor 61 and a memory 62 ( Figure 8 (a bus connection and a processor are used as an example).

[0160] The processor 61 is used to provide computing and control capabilities to control the electronic device 60 to perform corresponding tasks, and to control the electronic device 60 to perform any one of the age recognition model training methods or face age recognition methods provided in the above embodiments.

[0161] It is understandable that the processor 61 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0162] The memory 62, as a non-transient computer-readable storage medium, can be used to store non-transient software programs, non-transient computer executable programs and modules, such as the program instructions / modules corresponding to the training method of the age recognition model in the embodiment of the present invention, or the program instructions / modules corresponding to the face age recognition method. The processor 61 can implement any of the age recognition model training methods or face age recognition methods provided in the above embodiments by running the non-transient software programs, instructions and modules stored in the memory 62. Specifically, the memory 62 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 62 may also include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0163] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the training method of the age recognition model and the face age recognition method as described above.

[0164] It should be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.

[0165] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, or of course by hardware. Those skilled in the art can understand that all or part of the processes in the above embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0166] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Based on the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations in different aspects of the present application as described above. For the sake of simplicity, they are not provided in detail. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A training method for an age recognition model, characterized in that: The age recognition model includes an age classification model, an uncertainty model and an age regression model, and the method includes: Obtaining a training set, wherein the training set includes a plurality of face images; Using the training set, training a classification neural network until the classification neural network converges to obtain the age classification model, wherein the age classification model outputs an age probability vector for each face image in the training set; determining a first predicted age value of the target face image according to an age probability vector of the target face image, wherein the target face is any face image in the training set; Establishing the uncertainty model to obtain an uncertainty probability corresponding to a first predicted age value of the target facial image, wherein the uncertainty probability reflects a deviation between the first predicted age value and the actual age value; Using the training set and the loss function, training a recurrent neural network until the recurrent neural network converges to obtain the age regression model, wherein the loss function includes the loss of uncertainty probability corresponding to each of the facial images; The step of establishing the uncertainty model to obtain the uncertainty probability corresponding to the first predicted age value of the target facial image includes: Performing facial feature discarding processing on the target facial image to obtain multiple target changed facial images; Inputting the plurality of target changed face images into the age classification model respectively to obtain age probability vectors corresponding to the plurality of target changed face images respectively; determining a second predicted age value for each of the target changed facial images according to the age probability vectors respectively corresponding to the plurality of target changed facial images; Obtaining an average of the first predicted age value and each of the second predicted age values, and obtaining a variance of the first predicted age value and each of the second predicted age values; Calculating an uncertainty probability corresponding to a first predicted age value of the target facial image using a Gaussian distribution according to the mean value and the variance; The loss function includes the following formula: Wherein, Loss is the loss, N is the number of face images in the training set, i is the label of the face image, xi is the i-th face image in the training set, Yi is the real age of the i-th face image, p(xi) is the uncertainty probability of the i-th face image, is the predicted age value output by the recurrent neural network.

2. The method according to claim 1, characterized in that The classification neural network includes a plurality of feature extraction convolutional layers, a fully connected layer, and a softmax layer connected in sequence. The feature map output by the last feature extraction convolutional layer among the plurality of feature extraction convolutional layers is an age feature map, and the age feature map includes an age feature vector for each age. The fully connected layer is used to perform convolution processing on the age feature map and output a one-dimensional vector. The softmax layer is used to classify the one-dimensional vector to obtain the age probability vector. The age recognition model also includes a metric learning model; The step of determining a first predicted age value of the target facial image based on the age probability vector of the target facial image includes: Using the metric learning model, calculating first similarities between the one-dimensional vector corresponding to the target facial image and each age feature vector in the age feature map corresponding to the target facial image; A first predicted age value of the target facial image is determined according to each of the first similarities.

3. The method according to claim 2, characterized in that The step of using the metric learning model to calculate a first similarity between each age probability in the age probability vector corresponding to the target facial image and the corresponding age feature vector includes: The first similarity is calculated using the following formula: in, represents the one-dimensional vector corresponding to the target face image, i represents the age label, represents the age feature vector corresponding to the i-th age, Represents the first similarity between the one-dimensional vector corresponding to the target face image and the age feature vector corresponding to the i-th age.

4. The method according to claim 3, characterized in that Determining a first predicted age value of the target facial image according to each of the first similarities includes: The first predicted age value of the target facial image is determined to be the age corresponding to the maximum value of the first similarities.

5. The method according to claim 1, wherein The step of performing facial feature discarding processing on the target facial image to obtain a plurality of target changed facial images includes: The target facial image is cropped according to different aspect ratios to obtain the multiple target changed facial images.

6. A method for facial age recognition, characterized in that: include: Obtain the face image to be recognized; Inputting the facial image to be recognized into an age recognition model to obtain a predicted age value of the facial image to be recognized and an uncertainty probability of the facial image to be recognized, wherein the age recognition model is trained using the method according to any one of claims 1 to 5; The final age of the face image to be recognized is determined according to the uncertainty probability of the face image to be recognized and the predicted age value of the face image to be recognized.

7. The method according to claim 6, characterized in that The determining the final age of the face image to be recognized according to the uncertainty probability corresponding to the face image to be recognized and the predicted age value corresponding to the face image to be recognized includes: The final age of the face image to be identified is calculated using the following formula: ; in, is the final age, z is the face image to be recognized, is the uncertainty probability corresponding to the face image to be recognized, is the predicted age of the face image to be recognized.

8. An electronic device, characterized in that: include: at least one processor, and a memory communicatively coupled to the at least one processor, wherein: 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 to enable the at least one processor to perform the method according to any one of claims 1 to 7.

9. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable an electronic device to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Age prediction method, device and image processing equipment

    CN110378306A