Face age recognition model training method and related device
By using a data set marked with age difference labels in the face age recognition model training, the age labels are weakened and a multi-level loss function is constructed, which solves the problem of low accuracy of face age recognition in the prior art, and achieves more accurate face age recognition.
Patent Information
- Application Number
- CN202011033875.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-27
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2040-09-27
AI Technical Summary
In practical applications, the existing face age recognition algorithm has low accuracy in recognition of face age, especially when processing face feature information with similar age values.
By obtaining the sample face image data set marked with age value tags and age difference tags, the network model is trained, and the age difference value is used to weaken the age tags, and a multi-level loss function is constructed to enhance the model's learning ability of face feature information of similar age values.
The accuracy of face age recognition is improved, making the range of age recognition results closer to the real age value, and reducing the recognition error between similar ages.
Smart Images

Figure CN112183326B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a face age recognition model training method and related devices. Background Art
[0002] Face images often contain a lot of facial feature information, among which age, as a very important feature information, has been widely used in the field of face recognition.
[0003] Generally, in the problem of age recognition in facial images, age is often used as a label information, and a corresponding relationship between a facial image and its age is established during the model training process. However, different people at the same age have some similar features, and the usual facial age recognition algorithm has a low recognition accuracy in actual applications. Summary of the invention
[0004] The present application provides a face age recognition model training method and related devices.
[0005] In a first aspect, a method for training a face age recognition model is provided, comprising:
[0006] Acquire a sample data set, the sample data set comprising a plurality of sample face images, each of the sample face images being annotated with a corresponding age value label and an age difference label, the age value label indicating the actual age value of the face in the sample face image, and the age difference label being used to indicate a deviation range from the actual age value;
[0007] Based on the sample face image, the age value label and the age difference label of the sample face image, the network model is trained to obtain an age recognition model.
[0008] In a second aspect, a face age recognition model training device is provided, comprising:
[0009] An acquisition module is used to acquire a sample data set, wherein the sample data set includes a plurality of sample face images, each of which is annotated with a corresponding age value label and an age difference label, wherein the age value label indicates the actual age value of the face in the sample face image, and the age difference label is used to indicate the deviation range from the actual age value;
[0010] The training module is used to train the network model based on the sample face image, the age value label and the age difference label of the sample face image to obtain an age recognition model.
[0011] According to a third aspect, a computer storage medium is provided, wherein the computer storage medium stores one or more instructions, wherein the one or more instructions are suitable for being loaded by a processor and executing the steps of the first aspect and any possible implementation thereof.
[0012] The embodiment of the present application obtains a sample data set, the sample data set includes a plurality of sample face images, each of the sample face images is annotated with a corresponding age value label and an age difference label, the age value label indicates the actual age value of the face in the sample face image, and the age difference label is used to indicate the deviation range from the actual age value, and then trains the network model based on the sample face image, the age value label of the sample face image and the age difference label to obtain an age recognition model, and the age difference can be used to weaken the age label, and the network model can better learn the facial feature information of similar age values through the mutual constraints between the age value label and the age difference label, and a multi-level loss function is constructed to perform model training. In addition, the age recognition result can be comprehensively judged according to the predicted age value and the acceptable age difference in the application, so that the range of the age recognition result is closer to the real age value, thereby improving the accuracy of age recognition of face images. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background technology, the drawings required for use in the embodiments of the present application or the background technology will be described below.
[0014] Figure 1 A flowchart of a face age recognition model training method provided in an embodiment of the present application;
[0015] Figure 2 A flowchart of a face age recognition model training method provided in an embodiment of the present application;
[0016] Figure 3 A schematic diagram of the structure of a network model provided in an embodiment of the present application;
[0017] Figure 4 A structural schematic diagram of a face age recognition model training device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0018] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0019] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0020] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0021] The neural network (NN) involved in the embodiments of the present application is a complex network system formed by a large number of simple processing units (called neurons) widely connected to each other. It reflects many basic characteristics of human brain functions and is a highly complex nonlinear dynamic learning system. Neural networks have large-scale parallel, distributed storage and processing, self-organization, self-adaptation and self-learning capabilities, and are particularly suitable for processing imprecise and fuzzy information processing problems that require simultaneous consideration of many factors and conditions.
[0022] Convolutional Neural Networks (CNN) are a type of feedforward neural network that includes convolution calculations and has a deep structure. It is one of the representative algorithms of deep learning.
[0023] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application.
[0024] See also Figure 1 , Figure 1 : is a flow chart of a method for training a face age recognition model provided by an embodiment of the present application. The method may include:
[0025] 101. Obtain a sample data set, the sample data set comprising a plurality of sample face images, each of the sample face images being annotated with a corresponding age value label and an age difference label, the age value label indicating the actual age value of the face in the sample face image, and the age difference label being used to indicate a deviation range from the actual age value.
[0026] The execution subject of the embodiment of the present application may be a face age recognition model training device, or an electronic device. In a specific implementation, the electronic device may be a terminal, which may also be referred to as a terminal device, including but not limited to other portable devices such as mobile phones, laptop computers, or tablet computers with touch-sensitive surfaces (e.g., touch screen displays and / or touch pads). It should also be understood that in some embodiments, the device is not a portable communication device, but a desktop computer with a touch-sensitive surface (e.g., touch screen displays and / or touch pads).
[0027] Specifically, a sample data set can be constructed first. The above-mentioned sample data set may include sample face images of different ages, and specifically, a preset age range of the selected sample face images may be set, that is, the age distribution of the sample face images is within the preset age range, such as 1-100 years old, and the sample data set may be made to contain sample face images of various ages within the preset age range as much as possible. In the embodiment of the present application, the actual age of the face is used as a label for model training, and the age difference of each sample face image is also marked, that is, the acceptable age deviation range value for age prediction. For example, when the age value label of a sample face image is 36, and the age difference label is within plus or minus 2 years old, the age label range of the sample face image is between [34, 38]. Among them, the age difference corresponding to different age values may be different, and the range of the age difference corresponding to each age value can be adjusted according to the actual situation. In the embodiment of the present application, the setting rule of the age difference can set different age differences for different age stages. For example, for the age stage of 10-19, the age difference label corresponding to each age is 1, and for the age stage of 30-39, the age difference label corresponding to each age is 2. The age difference is set based on the criterion of the degree of change of the face in different age stages, because the degree of change of facial features is different in different periods of a person. In adolescence, due to rapid development, the change of facial features is relatively greater than that in middle age, so a relatively smaller age difference can be set. Setting the same age difference may lead to a larger or smaller prediction result. Setting different age differences for different age stages takes into account the size of the face changes at different age stages, so that the face age can be predicted more accurately after training with these labels, and the age prediction of faces at different age stages is targeted. The maximum age difference can be set as needed not to exceed a preset threshold, such as plus or minus 4 years old, to prevent the age difference from being too large, and covering too many features of other ages for one age, resulting in inaccuracy in model learning.
[0028] 102. Based on the sample face images, the age value labels of the sample face images, and the age difference labels, a network model is trained to obtain an age recognition model.
[0029] In order to enable the model to better learn similar feature information between similar age values, during the model training stage, the above-mentioned age value labels and the above-mentioned age difference labels are used to weaken the labels of single age values, and a multi-level loss function is constructed to train the network model.
[0030] In an optional implementation, the above network model may be a pre-built deep network model.
[0031] In the embodiment of the present application, the sample face image can be preprocessed so that the sample face image has a preset image size. Further optionally, a deep network model can be constructed, for example, for an input image size of 224*224*3, which represents the image size in RGB color mode, where 224*224 represents the pixel size (length*width) of the image.
[0032] The network model mainly uses a convolution kernel of 3*3 size, a step size of 2, and an activation function set to Relu. After multiple layers of convolution operations, a 7*7 feature image is obtained, and then it passes through a multi-layer output structure composed of a fully connected layer to form a deep network model for age recognition.
[0033] The network structure for feature extraction in the network model of the embodiment of the present application is not restricted and can be replaced according to actual needs, such as using a Mobilenet structure, an Inception structure, etc.
[0034] In an optional implementation, the above step 103 may include:
[0035] 21. Generate an age label vector corresponding to each sample face image according to the age value label and the age difference label of each sample face image;
[0036] 22. According to the age value label, the age difference label and the age label vector of each sample face image, the network model is trained to obtain the age recognition model.
[0037] In an embodiment of the present application, the age value label of each sample facial image and the above-mentioned age difference label can be integrated to represent the label information in a corresponding vector form, namely, the above-mentioned age label vector, and used in model training.
[0038] Specifically, the age label vector corresponding to each sample face image is generated according to the age value label and the age difference label of each sample face image, including:
[0039] Determine a plurality of target age values corresponding to each of the sample face images according to the age value label and the age difference label of each of the sample face images;
[0040] Then, an age label vector corresponding to each of the sample facial images is generated based on the above-mentioned multiple target age values, and the above-mentioned age label vector includes a vector value of each age value within a preset age range, wherein the vector values corresponding to the above-mentioned multiple target age values within the above-mentioned preset age range are greater than the vector values corresponding to other age values.
[0041] Optionally, the age label vector can be constructed using one-hot encoding. One-hot encoding, also known as one-bit effective encoding, uses an N-bit state register to encode N states, each state has its own independent register bit, and at any time, only one of them is valid.
[0042] According to the age value label and age difference label of each sample face image, multiple target age values corresponding to each sample face image can be determined. For example, when the age value label of a sample face image is 36 and the age difference label is within plus or minus 2 years, the age label range of the sample face image is between [34, 38], that is, the corresponding target age values include 34, 35, 36, 37, and 38. The target age value can be represented in the form of a vector. When generating the age label vector, the position corresponding to the target age value is distinguished from the vector values at other positions to reflect the valid age value. For example, the target age values include 34, 35, 36, 37, and 38, and the corresponding age label vector can be represented as [0,…, 0, 1, 1, 1, 1, 1, 0,…, 0]. Assuming that the preset age range is set to 1-100, the vector values of the 34th, 35th, 36th, 37th, and 38th positions in the age label vector are recorded as 1, and the vector values of other positions are recorded as 0.
[0043] Other methods may also be set to generate corresponding age label vector representations based on age value labels and age difference labels, and the embodiments of the present application do not limit this.
[0044] Furthermore, the above step 22 may specifically include:
[0045] Input the sample face image into the network model, and output the predicted classification result of the sample face image;
[0046] A loss function is used to calculate the total loss value between the predicted classification results of each of the above-mentioned sample face images and the label data; the network parameters of the above-mentioned network model are adjusted according to the above-mentioned total loss value until the above-mentioned network model converges, and the above-mentioned age recognition model is obtained. The above-mentioned label data includes the above-mentioned age value label of the above-mentioned sample face image, the above-mentioned age difference label and the above-mentioned age label vector.
[0047] After generating the age label vector of the sample face image, the sample face image can be used to train the network model. During the training process, a loss function is used to calculate the total loss value between the predicted classification results of each sample face image and the label data, and the network parameters of the network model are adjusted according to the total loss value until the network model converges. The loss function can calculate the loss values of three levels including the age value label, the age difference label and the age label vector.
[0048] Optionally, the method further includes:
[0049] 23. Obtain the face image to be recognized;
[0050] 24. Use the age recognition model to process the face image to be recognized to obtain an age prediction result of the face image to be recognized.
[0051] The above steps can be performed after step 102. Through the above steps 101 and 102, a trained age recognition model can be obtained and then applied to the above processing steps. That is, the model obtained after training can also be used in other devices to perform the above processing steps, which is not limited here.
[0052] The above-mentioned face image to be identified can be a photographed image containing a face. The acquired image can be pre-processed by cropping to obtain a standardized face image to be identified so as to identify the age of the face therein. In practical applications, the age recognition result of the face image to be identified can be comprehensively judged based on the predicted age value and the acceptable age difference.
[0053] The embodiment of the present application obtains a sample data set, the sample data set includes a plurality of sample face images, each of the sample face images is annotated with a corresponding age value label and an age difference label, the age value label indicates the actual age value of the face in the sample face image, and the age difference label is used to indicate the deviation range from the actual age value, and then based on the sample face image, the age value label of the sample face image and the age difference label, the network model is trained to obtain an age recognition model, the age difference can be used to weaken the age label, and the mutual constraint between the age value label and the age difference label can be used to make the network model better learn the facial feature information of similar age values, and a multi-level loss function is constructed to perform model training. In addition, the age recognition result can be comprehensively judged according to the predicted age value and the acceptable age difference in the application, so that the range of the age recognition result is closer to the real age value, thereby improving the accuracy of age recognition of face images.
[0054] See also Figure 2 , Figure 2 FIG. 1 is a flow chart of another method for training a face age recognition model provided in an embodiment of the present application. Figure 2 As shown, the method may specifically include:
[0055] 201. Obtain a sample data set, the sample data set comprising a plurality of sample face images, each of the sample face images being annotated with a corresponding age value label and an age difference label, the age value label indicating the actual age value of the face in the sample face image, and the age difference label being used to indicate a deviation range from the actual age value.
[0056] 202. Generate an age label vector corresponding to each of the sample facial images according to the age value label and the age difference label of each of the sample facial images.
[0057] The above steps 201 and 202 can refer to Figure 1 The specific description of step 101 and step 21 in step 202 in the illustrated embodiment will not be repeated here. The above step 202 can be performed by the network model during the training phase, or can be performed before the model training phase.
[0058] 203. Input the sample face image into the network model, and output the predicted classification result of the sample face image, wherein the predicted classification result of the sample face image includes the predicted age value, predicted age vector and predicted age difference of the sample face image.
[0059] During the training phase, the network model can process sample face images and predict the age value, age vector and age difference corresponding to each sample face image. The predicted age vector includes the probability value corresponding to each age value predicted by the model, and the predicted age value can be understood as the age value with the largest probability value.
[0060] 204. Calculate the first loss value of the predicted age vector of each sample image and the age label vector, calculate the second loss value of the predicted age value of each sample image and the age value label, calculate the third loss value of the predicted age difference of each sample image and the age difference label, and add the first loss value, the second loss value and the third loss value to obtain the total loss value.
[0061] Specifically, in order to enable the model to better learn similar feature information between similar age values, in the model training stage, the above-mentioned age label vector can be used to weaken the label of a single age value, and a multi-level loss function is constructed. The loss function of the network model in the embodiment of the present application can be composed of three parts. The first loss value of the first part is the age label vector loss value L1, and this part adopts the KL distance function. The second loss value of the second part is the age regression loss value L2, and the third loss value of the third part is the age difference loss value L3.
[0062] In an optional implementation, the loss function is calculated as follows:
[0063]
[0064] Wherein, the above n represents the maximum value within the above preset age range, and the above P i The vector value representing the i-th age in the above age label vector, Q irepresents the predicted age vector, that is, the probability value corresponding to each age value predicted by the model; y represents the actual age value indicated by the age value label, f represents the predicted age value output by the model, and y cha represents the age difference indicated by the age difference label, f cha Represents the predicted age difference output by the model.
[0065] 205. Adjust the network parameters of the network model according to the total loss value until the network model converges to obtain an age recognition model, wherein the label data includes the age value label of the sample face image, the age difference label and the age label vector.
[0066] The above steps 203 and 204 may be repeatedly performed until the network model converges and the training is completed, and a trained age recognition model may be obtained.
[0067] In the embodiment of the present application, different algorithms can be selected as needed to optimize model parameters, including setting training parameters such as the number of iterations and the learning rate, which is not limited in the embodiment of the present application.
[0068] In an optional implementation, in order to minimize the loss value of the entire model training, the Adam algorithm can be used to optimize the model parameters. For example, the number of iterations can be set to 500, the initialization learning rate is set to 0.001, and the weight decay is set to 0.0005. Every 100 iterations, the learning rate decays to 1 / 10 of the original to train the network model. The above is only an example, and the actual training parameters can have other settings, which are not limited in the embodiments of the present application.
[0069] In an alternative embodiment, see Figure 3 , Figure 3 is a schematic diagram of a network model provided in an embodiment of the present application, such as Figure 3 As shown, a deep network structure for age prediction is constructed. This structure mainly uses convolution kernels, activation functions, and fully connected layers. The circles represent the nodes of the fully connected layer, which is only for illustration.
[0070] In the embodiment of the present application, a sample face image of a preset image size can be obtained; the sample face image is input into a deep network structure, and feature extraction is performed in the convolution layer of the deep network structure to obtain a feature map corresponding to the sample face image. The convolution kernel of the convolution layer has a size of 3*3, a step size of 2, and an activation function set to Relu.
[0071] For example, the size of the input image is first set to 224*224*3. By using a convolution kernel of 3*3, a step size of 2, and an activation function of Relu, feature maps of different scales are continuously extracted, thereby extracting semantic features from shallow features to deep features, and finally obtaining a feature map of 7*7 size. There is no restriction on the feature extraction part, and the existing structure can be extracted for replacement.
[0072] After obtaining the feature map corresponding to the sample face image, the feature map corresponding to the sample face image is input into the fully connected layer for processing to obtain the feature structure corresponding to the feature map; then, according to the feature structure corresponding to the feature map, the predicted classification result of the sample face image is calculated and output. The predicted classification result may include three parts: predicted age value, predicted age difference and predicted age vector. The predicted age vector includes the probability values corresponding to each predicted age value.
[0073] Specifically, after obtaining the final 7*7 feature map, a fully connected layer is used to convert the 7*7 feature map into a 1*1*1024 feature structure; and then through a fully connected layer, it is converted into a 1*1*n feature structure. At this time, in order to satisfy the construction of a multi-level loss function, the model will be divided into three parts for output. The upper layer outputs the predicted age value, which has only a single value, such as 33 years old; the middle layer outputs the predicted age difference, which is also a single value, such as -1 years old or 1 year old, indicating that the age of the face in the image is between 32-34, which is acceptable. Within this range, the prediction is accurate. Therefore, the lower layer outputs the predicted age vector, including the probability values corresponding to each predicted age value. The vector size is n, which is specifically
[0074] [0,0,0,…,0.3,0.4,0.3,…,0]. Figure 3 Middle Q i represents the predicted age vector, that is, the probability value corresponding to each age value predicted by the model; f represents the predicted age value output by the model, f cha Represents the predicted age difference output by the model.
[0075] The above structural setting is only an example. In practice, different network model structures can be constructed as needed, and different network parameters can be adjusted. The embodiments of the present application are not limited to this.
[0076] Optionally, after obtaining the above age recognition model, the age recognition model can be used to perform age recognition on the face image, such as Figure 1 The description of step 23 and step 24 in the illustrated embodiment will not be repeated here.
[0077] Further optionally, the above step 24 includes:
[0078] The age recognition model is used to process the face image to be recognized, so as to obtain the predicted age value and the predicted age difference of the face image to be recognized;
[0079] Determine whether the absolute value of the predicted age difference is greater than the difference threshold;
[0080] If it is not greater than, the age prediction result is the predicted age value; if it is greater than, the age prediction result is the sum of the predicted age value and the predicted age difference.
[0081] In the age recognition application scenario, the above difference threshold can be pre-set, such as 4 (years old), and the above age recognition model can be used to process the face image to be recognized to obtain the age prediction result of the face image to be recognized. Specifically, the face image to be recognized is input into the trained age recognition model, and feature extraction is performed in the convolution layer to obtain a feature map, and then processed by the fully connected layer to obtain the predicted age vector of the face image to be recognized, including the probability that the face image to be recognized corresponds to each age value, and the age value with the highest probability can be determined as the above predicted age value output, and finally the above predicted age value and the predicted age difference can be output. When the predicted age difference is within the difference threshold, the predicted age value is output, and when the predicted age difference is greater than the difference threshold, the predicted age value plus the predicted age difference is used as the final output age value, that is, the age prediction result.
[0082] In an embodiment of the present application, when annotating the age of a sample facial image, acceptable age difference labels are added to weaken the single age value label, thereby reducing the impact of clear boundaries between similar ages. During the model training process, the constraint relationship between the predicted age value and the predicted age difference is limited, so that the range of age recognition results is closer to the true value. Compared with general solutions with large fluctuations in facial age recognition results and low accuracy, the present application can improve the accuracy of facial age recognition.
[0083] Based on the description of the above-mentioned face age recognition model training method embodiment, the present application embodiment also discloses a face age recognition model training device. Figure 4 , the face age recognition model training device 400 includes:
[0084] The acquisition module 410 is used to acquire a sample data set, wherein the sample data set includes a plurality of sample face images, each of which is annotated with a corresponding age value label and an age difference label, wherein the age value label indicates the actual age value of the face in the sample face image, and the age difference label indicates the deviation range from the actual age value;
[0085] The training module 420 is used to train the network model based on the sample face image, the age value label of the sample face image and the age difference label to obtain an age recognition model.
[0086] Optionally, the acquisition module 410 is further used to acquire a face image to be recognized;
[0087] The training module 420 is further configured to process the face image to be identified using the age recognition model to obtain an age prediction result of the face image to be identified.
[0088] According to one embodiment of the present application, Figure 1 and Figure 2 Each step involved in the method shown can be performed by Figure 4 The operations performed by various modules in the face age recognition model training device 400 are shown and will not be described in detail here.
[0089] The face age recognition model training device 400 in the embodiment of the present application can obtain a sample data set, the sample data set includes a plurality of sample face images, each of the sample face images is annotated with a corresponding age value label and an age difference label, the age value label indicates the actual age value of the face in the sample face image, and the age difference label is used to indicate the deviation range from the actual age value, and then based on the sample face image, the age value label of the sample face image and the age difference label, the network model is trained to obtain an age recognition model, the age difference can be used to weaken the age label, and the mutual constraint between the age value label and the age difference label can be used to make the network model better learn the facial feature information of similar age values, and a multi-level loss function is constructed to perform model training. In addition, the age recognition result can be comprehensively judged according to the predicted age value and the acceptable age difference in the application, so that the range of the age recognition result is closer to the real age value, thereby improving the accuracy of age recognition.
[0090] The embodiment of the present application also provides a computer storage medium (Memory), which is a memory device in an electronic device for storing programs and data. It is understandable that the computer storage medium here can include both built-in storage media in electronic devices and, of course, extended storage media supported by electronic devices. The computer storage medium provides a storage space that stores the operating system of the electronic device. In addition, one or more instructions suitable for being loaded and executed by a processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed RAM memory, or a non-volatile memory, such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.
[0091] In one embodiment, one or more instructions stored in a computer storage medium may be loaded and executed by a processor to implement the corresponding steps in the above embodiment; in a specific implementation, one or more instructions in a computer storage medium may be loaded and executed by a processor. Figure 1 and / or Figure 2 Any steps in the method will not be repeated here.
[0092] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0093] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the division of the module is only a logical function division, and there may be other division methods in actual implementation, for example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. The mutual coupling, direct coupling, or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0094] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0095] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media integrations. The available medium may be a read-only memory (ROM), or a random access memory (RAM), or a magnetic medium, such as a floppy disk, a hard disk, a tape, a magnetic disk, or an optical medium, such as a digital versatile disc (DVD), or a semiconductor medium, such as a solid state disk (SSD), etc.
Claims
1. A face age recognition model training method, characterized in that: include: Acquire a sample data set, the sample data set comprising a plurality of sample face images, each of the sample face images being annotated with a corresponding age value label and an age difference label, the age value label indicating the actual age value of the face in the sample face image, the age difference label being used to indicate a deviation range from the actual age value, and the age difference label being determined based on the age stage to which the corresponding age value label belongs; Based on the sample face images, the age value labels and the age difference labels of the sample face images, training a network model to obtain an age recognition model specifically includes: generating an age label vector corresponding to each sample face image according to the age value label and the age difference label of each sample face image; training a network model according to the age value label, the age difference label and the age label vector of each sample face image to obtain the age recognition model; Obtain a face image to be recognized; The age recognition model is used to process the face image to be recognized to obtain an age prediction result of the face image to be recognized, specifically including: The age recognition model is used to process the face image to be recognized to obtain a predicted age value and a predicted age difference of the face image to be recognized; whether the absolute value of the predicted age difference is greater than a difference threshold is determined; if not, the age prediction result is the predicted age value; if greater, the age prediction result is the sum of the predicted age value and the predicted age difference.
2. The face age recognition model training method according to claim 1, characterized in that: The step of generating an age label vector corresponding to each sample face image according to the age value label and the age difference label of each sample face image comprises: Determining a plurality of target age values corresponding to each sample face image according to the age value label and the age difference label of each sample face image; An age label vector corresponding to each sample facial image is generated according to the multiple target age values, the age label vector including a vector value for each age value within a preset age range, wherein the vector values corresponding to the multiple target age values within the preset age range are greater than the vector values corresponding to other age values.
3. The face age recognition model training method according to claim 2, characterized in that: The step of training a network model according to the age value label, the age difference label and the age label vector of each sample face image to obtain the age recognition model comprises: Inputting the sample face image into the network model, and outputting the predicted classification result of the sample face image; A loss function is used to calculate the total loss value between the predicted classification results of each sample face image and the label data; the network parameters of the network model are adjusted according to the total loss value until the network model converges to obtain the age recognition model, and the label data includes the age value label, the age difference label and the age label vector of the sample face image.
4. The face age recognition model training method according to claim 3, characterized in that: The predicted classification result of the sample face image includes the predicted age value, predicted age vector and predicted age difference of the sample face image; The using of a loss function to calculate the total loss value between the predicted classification results of each sample face image and the label data includes: Calculating a first loss value of the predicted age vector of each sample image and the age label vector; calculating a second loss value of the predicted age value of each sample image and the age value label; calculating a third loss value of the predicted age difference of each sample image and the age difference label; The first loss value, the second loss value, and the third loss value are added together to obtain the total loss value.
5. A face age recognition model training device, characterized in that: include: An acquisition module is used to acquire a sample data set, wherein the sample data set includes a plurality of sample face images, each of which is annotated with a corresponding age value label and an age difference label, wherein the age value label indicates the actual age value of the face in the sample face image, and the age difference label is used to indicate a deviation range from the actual age value, and the age difference label is determined based on the age stage to which the corresponding age value label belongs; A training module, used for training a network model based on the sample face image, the age value label and the age difference label of the sample face image to obtain an age recognition model; The training module is specifically used to generate an age label vector corresponding to each sample face image according to the age value label and the age difference label of each sample face image; train a network model according to the age value label, the age difference label and the age label vector of each sample face image to obtain the age recognition model; The acquisition module is also used to acquire the face image to be recognized; The training module is further used to process the face image to be identified by using the age recognition model to obtain an age prediction result of the face image to be identified; The training module is specifically used to: process the face image to be identified using the age recognition model to obtain a predicted age value and a predicted age difference of the face image to be identified; and determine whether the absolute value of the predicted age difference is greater than a difference threshold; If not, the age prediction result is the predicted age value; If it is greater, the age prediction result is the sum of the predicted age value and the predicted age difference.
6. A computer-readable storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a processor, the processor executes the steps of the face age recognition model training method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Image-based age prediction method and device
CN108108668A
A multi-label age estimation method based on convolution neural network
CN109101938A
Face image simulation method and device, computer equipment and storage medium
CN110738112A