Age and gender identification model training method, age and gender identification method and related device

By splicing the label age vector and the label gender vector into one vector as the target output of the neural network model, the problem of low age gender recognition accuracy in the prior art is solved, and higher recognition accuracy and reliability are achieved.

CN119445636APending Publication Date: 2025-02-14DALIAN ENTROPY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411593457.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the prior art, the accuracy of age and gender identification is low, and the failure to effectively combine age attributes and gender attributes leads to insufficient accuracy and reliability of the identification model.

Method used

By obtaining multiple training face images and their label information, the label age vector and label gender vector are generated, and they are spliced ​​into a vector as the target output of the model, and the neural network model is trained to improve the recognition of the age gender recognition model. accuracy.

Benefits of technology

By uniformly representing and combining age attributes and gender attributes in the same space, the model can fully learn the relationship and mutual influence between these two attributes, thereby improving the application scope and recognition accuracy of the age gender identification model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119445636A_ABST
    Figure CN119445636A_ABST
Patent Text Reader

Abstract

The invention provides a training method of an age and gender identification model, an age and gender identification method and a related device, which can splice a label age vector and a label gender vector into a vector and take the vector as a target output of the model for model training. Therefore, the age attribute and the gender attribute can be uniformly expressed in the same space, and the two attributes can be effectively combined. The label vector obtained by splicing is used as the target output of the model to carry out model training, and the model can fully learn the mutual relation and mutual influence between the age attribute and the gender attribute in the training process, so that the application range, the recognition accuracy and the recognition reliability of the age and gender recognition model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a training method for an age and gender recognition model, an age and gender recognition method, and related devices. Background Art

[0002] In the analysis of human attributes, age and gender are two important attribute features. In scenarios such as passenger flow statistics and market analysis, age and gender attributes play an important role. Therefore, how to identify and process age and gender attributes has become a core hotspot in personnel attribute analysis.

[0003] With the development and application of artificial intelligence technology, the prior art has proposed a solution for age recognition and gender recognition through artificial intelligence models. However, the inventors have found that the prior art has the problem of low recognition accuracy. Summary of the invention

[0004] The purpose of the present application is to solve at least one of the above-mentioned technical deficiencies, especially the technical defect of low recognition accuracy in the prior art.

[0005] In a first aspect, an embodiment of the present application provides a method for training an age and gender recognition model, comprising:

[0006] Acquire multiple training face images and label information corresponding to each of the training face images; wherein the label information includes a label age value and a label gender information;

[0007] Generate a label age vector according to the label age value corresponding to the target face image; wherein the target face image is any one of the multiple training face images;

[0008] Generate a label gender vector according to the label gender information corresponding to the target face image;

[0009] The label age vector and the label gender vector are concatenated into one vector, and a label vector corresponding to the target training face image is obtained;

[0010] The training face image is used as the input of the model, and the label vector corresponding to the training face image is used as the target output of the model to train the neural network model, and an age and gender recognition model is obtained when the training is completed.

[0011] In some embodiments, for every two of the training face images, if the label age values ​​corresponding to the two training face images are different, then the label age vectors corresponding to the two training face images are different.

[0012] In some embodiments, the tag age value is a decimal value, and the tag age vector includes a digital representation vector and a flag bit;

[0013] The step of generating a label age vector according to the label age value corresponding to the target face image includes:

[0014] Extract the tens digit M and the ones digit N of the tag age value respectively;

[0015] If M is less than or equal to N, the flag bit is set to the first value, otherwise, the flag bit is set to the second value;

[0016] If M is equal to N, the M+1th bit in the digital representation vector is set to a third value, and the remaining bits in the digital representation vector are set to a fourth value;

[0017] If M is not equal to N, the M+1th bit in the digital representation vector is set to the third value, the N+1th bit in the digital representation vector is set to the third value, and the remaining bits in the digital representation vector are set to the fourth value.

[0018] In some embodiments, the training of the neural network model using the training face image as the input of the model and the label vector corresponding to the training face image as the target output of the model includes:

[0019] In a current training round, the training face image is input into the neural network model, and a training vector output by the neural network model is obtained;

[0020] Calculate the loss value of the current training round using a binary cross entropy loss function according to the training vector and the label vector;

[0021] Based on the loss value of the current training round, the model parameters of the neural network model are adjusted, and the next training round is entered if the preset training end condition is not met.

[0022] In some embodiments, the neural network model is a ResNet model or a MobileFaceNet model.

[0023] In a second aspect, the present application embodiment provides an age and gender recognition method, comprising:

[0024] Obtaining a face image to be recognized;

[0025] Input the face image to be identified into an age and gender recognition model, and obtain a recognition vector output by the age and gender recognition model; wherein the age and gender recognition model is trained by the age and gender recognition model training method described in any of the above embodiments;

[0026] Based on the identification vector, an identification age value and identification gender information are obtained respectively.

[0027] In a third aspect, an embodiment of the present application provides a training device for an age and gender recognition model, comprising:

[0028] A training data acquisition module, used to acquire multiple training face images and label information corresponding to each of the training face images; wherein the label information includes a label age value and a label gender information;

[0029] An age vector generation module, used to generate a label age vector according to the label age value corresponding to the target face image; wherein the target face image is any one of the multiple training face images;

[0030] A gender vector generation module, used to generate a label gender vector according to the label gender information corresponding to the target face image;

[0031] A label vector generation module, used to concatenate the label age vector and the label gender vector into one vector, and obtain the label vector corresponding to the target training face image;

[0032] The training module is used to train the neural network model using the training face image as the input of the model and the label vector corresponding to the training face image as the target output of the model, and obtain the age and gender recognition model when the training is completed.

[0033] In a fourth aspect, an embodiment of the present application provides an age and gender recognition device, including:

[0034] An image acquisition module is used to acquire a face image to be recognized;

[0035] A recognition vector acquisition module, used for inputting the face image to be recognized into an age and gender recognition model, and obtaining a recognition vector output by the age and gender recognition model; wherein the age and gender recognition model is trained by the age and gender recognition model training method described in any of the above embodiments;

[0036] The age and gender information acquisition module is used to obtain the identification age value and the identification gender information based on the identification vector.

[0037] In a fifth aspect, an embodiment of the present application provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the training method for the age and gender recognition model described in any of the above embodiments, and / or execute the steps of the age and gender recognition method described in any of the above embodiments.

[0038] In a sixth aspect, an embodiment of the present application provides a computer device, the computer device comprising: one or more processors, and a memory;

[0039] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the training method of the age and gender recognition model described in any of the above embodiments and / or the steps of the age and gender recognition method described in any of the above embodiments are executed.

[0040] In the training method of the age and gender recognition model, the age and gender recognition method and related devices provided in some embodiments of the present application, the label age vector and the label gender vector can be spliced ​​into one vector, and this can be used as the target output of the model for model training. In this way, the age attribute and the gender attribute can be uniformly represented in the same space, and the two attributes can be effectively combined. The model training is carried out using the spliced ​​label vector as the target output of the model. The model can fully learn the relationship and mutual influence between the age attribute and the gender attribute during the training process, thereby improving the application scope of the age and gender recognition model as well as the recognition accuracy and recognition reliability. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0042] Figure 1 A flowchart of a method for training an age and gender recognition model in one embodiment;

[0043] Figure 2 A schematic diagram of a flow chart of an age and gender identification method in one embodiment;

[0044] Figure 3 1 is a schematic diagram of the structure of a training device for an age and gender recognition model in one embodiment;

[0045] Figure 4 is a schematic diagram of the structure of an age and gender identification device in one embodiment;

[0046] Figure 5 FIG. 1 is a diagram of the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0048] As mentioned in the background technology, the prior art has the technical problem of low recognition accuracy. The inventors have found that the reason for this problem is that the prior art does not take into account the relationship and mutual influence between the age attribute and the gender attribute when processing the two attribute characteristics, and cannot effectively combine the two attribute characteristics. In the process of model training, the prior art will use different network models / network branches to identify the age attribute and the gender attribute respectively, which reduces the accuracy and reliability of the recognition model obtained after training.

[0049] To solve the above problems, the present application provides a training method for an age and gender recognition model, an age and gender recognition method and related devices. The present application uniformly represents the age attribute and the gender attribute in the same space, and effectively combines the two attributes, and uses the label vector that uniformly represents the two attributes as the target output of the model for model training. The model can fully learn the relationship and mutual influence between the age attribute and the gender attribute during the training process, thereby improving the application scope, recognition accuracy and recognition reliability of the age and gender recognition model.

[0050] It should be noted that the facial image collection, storage, use, processing, transmission, provision and disclosure involved in this application are in compliance with relevant laws and regulations and do not violate public order and good morals.

[0051] The following describes the training method of the age and gender recognition model and the age and gender recognition method provided by this application.

[0052] In some embodiments, the present application provides a training method for an age and gender recognition model. The following description is explained by taking the method applied to a computer device as an example. It can be understood that the computer device described herein can be a device with data acquisition and data processing functions, which can be but is not limited to a notebook computer, a desktop computer, a laptop, a server, a controller, an edge node, an Internet of Things device, a wearable device, etc.

[0053] like Figure 1 As shown, the training method of the age and gender recognition model provided in the embodiment of the present application may include the following steps:

[0054] S102: Acquire multiple training face images and label information corresponding to each training face image.

[0055] Among them, the training face image refers to the face image used for model training, which can be collected and / or processed in advance. The label information corresponding to the training face image refers to the age and gender information corresponding to the face recorded by the training face image. The label information may include a label age value and a label gender information. The label age value refers to the specific age value corresponding to the training face image, and the label gender information refers to the physiological gender corresponding to the training face image. In one example, the label information can be manually preset.

[0056] It should be noted that the computer device can obtain data in any manner, and this document does not impose any specific restrictions on this. For example, the computer device can pull multiple training face images and label information corresponding to each training face image from a server according to a preset server address.

[0057] S104: Generate a label age vector according to the label age value corresponding to the target face image.

[0058] The target face image is any one of the multiple training face images, and the label age vector is a vector used to reflect the label age value. In one example, the label age vector can be a binary vector.

[0059] In this step, for each of the multiple training face images, the computer device can generate a label age vector corresponding to the training face image according to the label age value corresponding to the training face image, so as to convert the label age value into data that can be easily recognized and processed by the computer device and the neural network model. It can be understood that the computer device can use any encoding method to obtain the label age vector. In one example, the computer device can use the binary label age value as the label age vector.

[0060] S106: Generate a label gender vector according to the label gender information corresponding to the target face image.

[0061] The label gender vector is a vector used to reflect label gender information. In one example, the label gender vector may be a binary vector.

[0062] In this step, for each training face image in the multiple training face images, the computer device can generate a label gender vector corresponding to the training face image based on the label gender information corresponding to the training face image, so as to convert the label gender information into data that can be easily recognized and processed by the computer device and the neural network model.

[0063] S108: Concatenate the label age vector and the label gender vector into one vector, and obtain the label vector corresponding to the target training face image.

[0064] In this step, the computer device can concatenate the label age vector and label gender vector corresponding to the same training face image, and use the concatenated vector as the label vector corresponding to the training face image. In this way, the age information and the label information can be effectively combined to obtain the label vector.

[0065] For example, when the label age value corresponding to the target training facial image is 41, and the label gender information corresponding to the target training facial image is male, the computer device can generate a label age vector [0,1,0,0,1,0,0,0,0,0,1] corresponding to the target training facial image according to the label age value 41, and generate a label gender vector [0,1] corresponding to the target training facial image according to the label gender information, and concatenate the label age vector and the label gender vector into a vector [0,1,0,0,1,0,0,0,0,0,1,0,1], which is the label vector corresponding to the target training facial image.

[0066] S110: Using the training face image as the input of the model and the label vector corresponding to the training face image as the target output of the model, the neural network model is trained, and an age and gender recognition model is obtained after the training is completed.

[0067] It can be understood that a training face image and a label vector corresponding to the training face image may constitute a set of training data, and multiple training face images and a label vector corresponding to each training face image may constitute multiple sets of training data.

[0068] In this step, the computer device can obtain multiple sets of training data, and use the multiple sets of training data to train the neural network model, and obtain an age and gender recognition model that can be used to identify age values ​​and gender information after the training is completed. In this way, the problem that the age attribute and the gender attribute cannot be trained together in the model in the prior art can be solved. By using a label vector to simultaneously represent the age value and the gender information, the age feature and the gender feature can be trained together for multi-classification, thereby realizing the mutual fusion of the age feature and the gender feature, and further improving the application range of the model performance.

[0069] It should be noted that by uniformly representing age information and gender information, learning and training can be performed using an existing neural network model without designing a specific neural network model structure, thereby improving the breadth of application. For example, the neural network model used in this application may be a ResNet model or a MobileFaceNet model, and this article does not make specific restrictions on this.

[0070] This application can concatenate the label age vector and the label gender vector into one vector, and use this as the target output of the model for model training. In this way, the age attribute and the gender attribute can be uniformly represented in the same space, and the two attributes can be effectively combined. By using the concatenated label vector as the target output of the model for model training, the model can fully learn the relationship and mutual influence between the age attribute and the gender attribute during the training process, thereby improving the application scope, recognition accuracy, and recognition reliability of the age and gender recognition model.

[0071] When generating training data for the age and gender recognition model, the prior art pre-sets multiple age segment intervals, and determines the label age vector by determining the age segment interval into which the label age value falls. In this implementation, each label age value that falls into the same age segment interval corresponds to the same label age vector. For example, when the age segment interval is divided into 0~50 years old and 51~99 years old, 1 year old, 2 years old, 15 years old, 30 years old, and 49 years old all correspond to the same label age vector. After determining the label age vector, the prior art uses the classification method for learning.

[0072] However, the inventors have found that the above-mentioned prior art will break the continuity characteristics of age. If there are too many segments, it is not easy to get a good training effect; if there are too few segments, the age and gender recognition model obtained by training can only be used to determine a general age range, but cannot accurately identify the specific age value.

[0073] To solve this problem and avoid the impact of the continuity feature of segmented age on model performance, in some embodiments, the label age vector of the present application can represent a specific age value rather than an age range. By using the label age vector that can represent a specific age value to train the model, the trained age and gender recognition model can accurately identify the specific age value corresponding to the face image rather than the age range, thereby improving the accuracy of age recognition.

[0074] Specifically, for every two training face images, if the label age values ​​corresponding to the two training face images are different, then the label age vectors corresponding to the two training face images are different.

[0075] That is, if the first training face image and the second training face image are every two training face images in the plurality of training face images, then when the label age value corresponding to the first training face image is different from the label age value corresponding to the second training face image, the label age vector corresponding to the first training face image is also different from the label age vector corresponding to the second training face image. Conversely, when the label age value corresponding to the first training face image is the same as the label age value corresponding to the second training face image, the label age vector corresponding to the first training face image is the same as the label age vector corresponding to the second training face image.

[0076] In some embodiments, the tag age value is a decimal value, and the tag age vector includes a digital representation vector and a flag bit. The digital representation vector is used to represent the numbers appearing in the decimal tag age value, and the flag bit can be used to reflect the size relationship between the tens digit and the ones digit in the tag age value.

[0077] It is understandable that the digital representation vector and the flag bit can be spliced ​​in any way to obtain the label age vector. In addition, in addition to the digital representation vector and the flag bit, the label age vector can also include more sub-vectors or flag bits.

[0078] For ease of description, some embodiments of the present application are described by taking the label age vector including only a digital representation vector and a flag bit as an example, with the digital representation vector in front and the flag bit in the back.

[0079] Generate a label age vector based on the label age value corresponding to the target face image, including:

[0080] Step A1: extract the tens digit M and the ones digit N of the tag age value respectively;

[0081] Step A2: If M is less than or equal to N, the flag bit is set to the first value, otherwise, the flag bit is set to the second value;

[0082] Step A3: if M is equal to N, then setting the M+1th bit in the digital representation vector to the third value, and setting the remaining bits in the digital representation vector to the fourth value;

[0083] Step A4: If M is not equal to N, set the M+1th bit in the digital representation vector to the third value, set the N+1th bit in the digital representation vector to the third value, and set the remaining bits in the digital representation vector to the fourth value.

[0084] Specifically, in the process of generating the label age vector, the computer device can extract the numerical value M of the tens digit and the numerical value N of the ones digit of the decimal label age value respectively. If M is less than or equal to N, that is, the tens digit is less than or equal to the ones digit, the flag bit can be set to the first numerical value. If M is greater than N, that is, the tens digit is greater than the ones digit, the flag bit can be set to the second numerical value. In this way, the size relationship between the ones digit and the tens digit of the label age value can be reflected by the flag bit.

[0085] It is understood that the first value and the second value may be two different values, which is not specifically limited herein. In one example, the first value may be 1, and the second value may be 0. In another example, the first value may be 0, and the second value may be 1.

[0086] In order to enable the digital representation vector to represent the numbers appearing in the decimal label age value, when M=N, the computer device may set the M+1th bit in the digital representation vector to the third value, and set the 1st to Mth bits and the M+2th to the last bit to the fourth value.

[0087] It is understood that the third value and the fourth value may be two different values, which is not specifically limited herein. In one example, the third value may be 1, and the fourth value may be 0. In another example, the third value may be 0, and the fourth value may be 1.

[0088] For example, when the label age value is 33 years old, M=N=3, the digital representation vector can be [0,0,0,1,0,0,0,0,0,0], the flag bit can be 0, and the label age vector can be [0,0,0,1,0,0,0,0,0,0,0].

[0089] When M≠N, the computer device may set the M+1th bit and the N+1th bit in the digital representation vector to a third value, and set all bits except the M+1th bit and the N+1th bit in the digital representation vector to a fourth value.

[0090] For example, when the label age value is 5 years old, M=0, N=5, M<N, then the digital representation vector can be [1,0,0,0,0,1,0,0,0,0], the flag is 0, and the label age vector is [1,0,0,0,0,1,0,0,0,0,0]. For another example, when the label age value is 14 years old, M=1, N=4, M<N, then the digital representation vector can be [0,1,0,0,1,0,0,0,0,0], the flag is 0, and the label age vector is [0,1,0,0,1,0,0,0,0,0,0]. For example, when the label age value is 41 years old, M=4, N=1, M>N, then the digital representation vector can be [0,1,0,0,1,0,0,0,0,0], the flag bit is 1, and the label age vector is [0,1,0,0,1,0,0,0,0,0,1].

[0091] In this way, the specific age value can be represented by a smaller vector space, thereby improving the training efficiency of the model while ensuring recognition accuracy.

[0092] In some embodiments, the label gender vector may be a two-digit binary vector. For example, when the label gender information is female, the label gender vector may be [1,0]; when the label gender information is male, the label gender vector may be [0,1]. After concatenating the label age vector and the label gender vector, the first 11 bits of the label vector may be the label age vector, and the 12th to 13th bits may be the label gender vector. In this way, the age and gender attributes may be mapped to a 1×13 dimensional vector, thereby improving the training efficiency of the model while ensuring recognition accuracy.

[0093] For example, when the label gender information is female and the label age value is 25 years old, the corresponding label vector is [0,0,1,0,0,1,0,0,0,0,0,1,0].

[0094] In some embodiments, the neural network model is trained using the training face image as the input of the model and the label vector corresponding to the training face image as the target output of the model, including:

[0095] Step B1: In the current training round, the training face image is input into the neural network model, and the training vector output by the neural network model is obtained;

[0096] Step B2: According to the training vector and the label vector, the binary cross entropy loss function is used to calculate the loss value of the current training round;

[0097] Step B3: Based on the loss value of the current training round, adjust the model parameters of the neural network model, and enter the next training round if the preset training end condition is not met.

[0098] Specifically, since the label vector is a binary vector, during the model training process, the binary cross entropy loss function can be used to calculate the loss value, and the model training is performed accordingly until the preset training end condition is met and the age recognition model is obtained. In this way, better stability can be achieved.

[0099] Since the present application has the above advantages, the solution provided by the present application can be widely used in application fields such as data processing systems, machine learning, and monitoring passenger flow statistics and analysis. For example, in the field of data processing systems, the present application achieves a unified label representation with gender by mapping the continuous value of age to a 1×11 vector space. For another example, in the field of machine learning, the present application can improve the performance and application scope of the model. Since the present technical solution can effectively integrate age and gender attribute features, it can be applied to more machine learning tasks, thereby improving the efficiency and effect of model training and saving the number of models and the cost of deployment. For another example, in the field of monitoring passenger flow statistics and analysis, the present application can improve the accuracy and reliability of passenger flow statistics by integrating and identifying age and gender, thereby improving the determination of personnel attributes. In scenarios such as supermarket passenger flow statistics and workshop station passenger flow statistics and analysis, age and gender are important user attribute features that are extracted together, saving deployment inference costs and providing higher-precision user attribute feature portraits, thereby improving the accuracy and reliability of passenger flow statistics and analysis.

[0100] In some embodiments, the present application provides a method for identifying age and gender. The following embodiments are described by taking the method applied to a computer device as an example. For the relevant description of the computer device, please refer to other embodiments of this article, which will not be repeated here.

[0101] like Figure 2 As shown, the age and gender identification method provided by this application specifically includes the following steps:

[0102] S202: Acquire a face image to be recognized;

[0103] S204: inputting the face image to be recognized into the age and gender recognition model, and obtaining a recognition vector output by the age and gender recognition model; wherein the age and gender recognition model is trained based on the training method of the age and gender recognition model described in any of the above embodiments;

[0104] S206: Based on the recognition vector, obtain the recognition age value and the recognition gender information respectively.

[0105] In this embodiment, when age and gender recognition is required, the computer device may first obtain a face image to be recognized, and input the face image to be recognized into a pre-trained age and gender recognition model to obtain a recognition vector. After obtaining the recognition vector, the computer device may split the recognition vector and obtain a target age vector and a target gender vector respectively, and obtain the recognition age value corresponding to the face image to be recognized based on the target age vector, and obtain the recognition gender information corresponding to the face image to be recognized based on the target gender vector. In this way, age and gender recognition can be achieved.

[0106] Since the age and gender recognition model involved in this embodiment is obtained by adopting the training method of the age and gender recognition model provided by any of the above embodiments, it has the advantages of high recognition accuracy and high recognition reliability.

[0107] The following is a description of the training device for the age and gender recognition model provided in an embodiment of the present application. The training device for the age and gender recognition model described below and the training method for the age and gender recognition model described above can be referenced to each other.

[0108] In some embodiments, Figure 3 As shown, the present application provides a training device 300 for an age and gender recognition model, comprising:

[0109] The training data acquisition module 302 is used to acquire a plurality of training face images and label information corresponding to each of the training face images; wherein the label information includes a label age value and a label gender information;

[0110] The age vector generating module 304 is used to generate a label age vector according to the label age value corresponding to the target face image; wherein the target face image is any one of the plurality of training face images;

[0111] A gender vector generating module 306, configured to generate a label gender vector according to the label gender information corresponding to the target face image;

[0112] A label vector generation module 308 is used to concatenate the label age vector and the label gender vector into one vector, and obtain a label vector corresponding to the target training face image;

[0113] The training module 310 is used to train the neural network model using the training face image as the input of the model and the label vector corresponding to the training face image as the target output of the model, and obtain the age and gender recognition model when the training is completed.

[0114] In some embodiments, for every two of the training face images, if the label age values ​​corresponding to the two training face images are different, then the label age vectors corresponding to the two training face images are different.

[0115] In some embodiments, the tag age value is a decimal value, and the tag age vector includes a digital representation vector and a flag bit.

[0116] The age vector generation module 304 of the present application includes:

[0117] A numerical extraction unit, used to extract the tens digit M and the units digit N of the tag age value respectively;

[0118] a flag setting unit, configured to set the flag to a first value if M is less than or equal to N, and to set the flag to a second value otherwise;

[0119] a first digital representation vector setting unit, configured to set the M+1th bit in the digital representation vector to a third value and set the remaining bits in the digital representation vector to a fourth value if M is equal to N;

[0120] The second digital representation vector setting unit is used to set the M+1th bit in the digital representation vector to a third value, set the N+1th bit in the digital representation vector to the third value, and set the remaining bits in the digital representation vector to a fourth value if M is not equal to N.

[0121] In some embodiments, the training module 310 of the present application includes:

[0122] A training vector acquisition unit, used to input the training face image into the neural network model in a current training round, and obtain a training vector output by the neural network model;

[0123] A loss calculation unit, used to calculate the loss value of the current training round using a binary cross entropy loss function according to the training vector and the label vector;

[0124] An adjustment unit is used to adjust the model parameters of the neural network model based on the loss value of the current training round, and enter the next training round when a preset training end condition is not met.

[0125] In some embodiments, the neural network model is a ResNet model or a MobileFaceNet model.

[0126] The age and gender identification device provided in the embodiment of the present application is described below. The age and gender identification device described below and the age and gender identification method described above can be referenced to each other.

[0127] In some embodiments, Figure 4 As shown, the present application provides an age and gender identification device 400, comprising:

[0128] The image acquisition module 402 is used to acquire the face image to be recognized;

[0129] The recognition vector acquisition module 404 is used to input the face image to be recognized into the age and gender recognition model and obtain the recognition vector output by the age and gender recognition model; wherein the age and gender recognition model is trained based on the training method of the age and gender recognition model described in any of the above embodiments;

[0130] The age and gender information acquisition module 406 is used to obtain the identification age value and the identification gender information based on the identification vector.

[0131] In one embodiment, the present application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the training method of the age and gender recognition model as described in any embodiment, and / or execute the steps of the age and gender recognition method as described in any embodiment.

[0132] In one embodiment, the present application also provides a computer device having computer-readable instructions stored therein. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the training method of the age and gender recognition model as described in any embodiment, and / or execute the steps of the age and gender recognition method as described in any embodiment.

[0133] Indicatively, Figure 5 The internal structure diagram of a computer device provided in an embodiment of the present application is shown in FIG. 1 . In one example, the computer device may be a server. Figure 5 , the computer device 900 includes a processing component 902, which further includes one or more processors, and a memory resource represented by a memory 901, for storing instructions that can be executed by the processing component 902, such as an application. The application stored in the memory 901 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 902 is configured to execute instructions to perform the steps of the method described in any of the above embodiments.

[0134] The computer device 900 may further include a power supply component 903 configured to perform power management of the computer device 900, a wired or wireless network interface 904 configured to connect the computer device 900 to a network, and an input / output (I / O) interface 905. The computer device 900 may operate based on an operating system stored in the memory 901, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.

[0135] Those skilled in the art will understand that the internal structure of the computer device shown in the present application is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0136] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements not only includes those elements, but also includes other elements not clearly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements. Herein, "one", "one", "said", "the" and "it" may also include plural forms, unless the context clearly indicates another way. A plurality refers to at least two cases, such as 2, 3, 5 or 8, etc. "And / or" includes any and all combinations of the relevant listed items.

[0137] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.

[0138] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A training method for an age and gender recognition model, characterized in that: include: Acquire multiple training face images and label information corresponding to each of the training face images; wherein the label information includes a label age value and a label gender information; Generate a label age vector according to the label age value corresponding to the target face image; wherein the target face image is any one of the multiple training face images; Generate a label gender vector according to the label gender information corresponding to the target face image; The label age vector and the label gender vector are concatenated into one vector, and the label vector corresponding to the target training face image is obtained; The training face image is used as the input of the model, and the label vector corresponding to the training face image is used as the target output of the model to train the neural network model, and an age and gender recognition model is obtained when the training is completed.

2. The method according to claim 1, characterized in that For every two training face images, if the label age values ​​corresponding to the two training face images are different, then the label age vectors corresponding to the two training face images are different.

3. The method according to claim 2, characterized in that The tag age value is a decimal value, and the tag age vector includes a digital representation vector and a flag bit; The step of generating a label age vector according to the label age value corresponding to the target face image includes: Extract the tens digit M and the ones digit N of the tag age value respectively; If M is less than or equal to N, the flag bit is set to the first value, otherwise, the flag bit is set to the second value; If M is equal to N, the M+1th bit in the digital representation vector is set to a third value, and the remaining bits in the digital representation vector are set to a fourth value; If M is not equal to N, the M+1th bit in the digital representation vector is set to the third value, the N+1th bit in the digital representation vector is set to the third value, and the remaining bits in the digital representation vector are set to the fourth value.

4. The method according to any one of claims 1 to 3, characterized in that: The training face image is used as the input of the model, and the label vector corresponding to the training face image is used as the target output of the model to train the neural network model, including: In a current training round, the training face image is input into the neural network model, and a training vector output by the neural network model is obtained; Calculate the loss value of the current training round using a binary cross entropy loss function according to the training vector and the label vector; Based on the loss value of the current training round, the model parameters of the neural network model are adjusted, and the next training round is entered if the preset training end condition is not met.

5. The method according to any one of claims 1 to 3, characterized in that: The neural network model is a ResNet model or a MobileFaceNet model.

6. A method for identifying age and gender, characterized in that: include: Obtain a face image to be recognized; Inputting the face image to be identified into an age and gender recognition model, and obtaining a recognition vector output by the age and gender recognition model; wherein the age and gender recognition model is trained based on the training method of the age and gender recognition model according to any one of claims 1 to 5; Based on the identification vector, an identification age value and identification gender information are obtained respectively.

7. A training device for an age and gender recognition model, characterized in that: include: A training data acquisition module, used to acquire multiple training face images and label information corresponding to each of the training face images; wherein the label information includes a label age value and a label gender information; An age vector generation module, used to generate a label age vector according to the label age value corresponding to the target face image; wherein the target face image is any one of the multiple training face images; A gender vector generation module, used to generate a label gender vector according to the label gender information corresponding to the target face image; A label vector generation module, used to concatenate the label age vector and the label gender vector into one vector, and obtain the label vector corresponding to the target training face image; The training module is used to train the neural network model using the training face image as the input of the model and the label vector corresponding to the training face image as the target output of the model, and obtain the age and gender recognition model when the training is completed.

8. An age and gender identification device, characterized in that: include: An image acquisition module is used to acquire a face image to be recognized; A recognition vector acquisition module, used for inputting the face image to be recognized into an age and gender recognition model, and obtaining a recognition vector output by the age and gender recognition model; wherein the age and gender recognition model is trained based on the training method of the age and gender recognition model according to any one of claims 1 to 5; The age and gender information acquisition module is used to obtain the identification age value and the identification gender information based on the identification vector.

9. A storage medium, characterized in that: The storage medium stores computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to execute the steps of the training method for the age and gender recognition model as described in any one of claims 1 to 5, and / or execute the steps of the age and gender recognition method as described in claim 6.

10. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, which, when executed by the one or more processors, execute the steps of the training method for the age and gender recognition model as described in any one of claims 1 to 5, and / or execute the steps of the age and gender recognition method as described in claim 6.