Method for training age detection model, age detection method and related device

By encoding and iteratively training facial images and age interference information in the training set, the neural network learns to distinguish effective features, solving the problem of age value fluctuations caused by changes in angle and expression in facial images, and achieving accuracy and stability in age detection.

CN114943999BActive Publication Date: 2025-11-21SHENZHEN SHULIAN TIANXIA INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210623051.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-01
Publication Date
2025-11-21
Estimated Expiration
2042-06-01

AI Technical Summary

Technical Problem

The angle and expression changes in facial images cause significant fluctuations in the age value identified for the same person, resulting in a lack of stability and accuracy.

Method used

By acquiring multiple face images and their corresponding age interference information from the training set, encoding them into information feature codes, and iteratively training the neural network, the network learns to distinguish age interference features and effective features that affect the accuracy of age prediction, filtering out interference features and reducing their impact on network learning.

Benefits of technology

The trained age detection model can accurately and stably detect age, reducing errors caused by interfering features and improving the stability and accuracy of age prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114943999B_ABST
    Figure CN114943999B_ABST
Patent Text Reader

Abstract

The embodiment of the application relates to the technical field of face image attribute prediction, and discloses a method for training an age detection model, an age detection method and related devices, a training set comprising a plurality of face images labeled with real ages, age interference information corresponding to each face image in the training set is first obtained. Then, the age interference information is encoded to obtain information feature encoding. Finally, the training set and the information feature encoding corresponding to each face image in the training set are used to iteratively train a neural network to obtain an age detection model. In this embodiment, the neural network can learn the features of the face images and the age interference features in the training process, that is, it can clearly distinguish the age interference features and the effective features that affect the accuracy of age prediction, so that the interference features can be filtered out when age prediction is performed, the influence of the interference features on network learning is reduced, and the age detection model obtained by training can accurately and stably detect age.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of facial image attribute prediction technology, and in particular to a method for training an age detection model, an age detection method, and related apparatus. Background Technology

[0002] Facial images contain a variety of facial feature information, such as face shape, skin condition, facial expression, facial features, and age. Among these, facial age, as a relatively important feature, has been widely used in the field of facial image detection. For example, some clients running on mobile devices have age detection functions. These clients acquire facial images and output the detected age based on the acquired facial images to provide feedback to the user.

[0003] However, facial images can vary in angle and facial expressions, which can cause significant fluctuations in the age value identified for the same person, resulting in a lack of stability. Summary of the Invention

[0004] The main technical problem addressed by the embodiments of this application is to provide a method for training an age detection model, an age detection method, and related apparatus, wherein the age detection model trained by this method can accurately and stably detect age.

[0005] To address the aforementioned technical problems, in a first aspect, embodiments of this application provide a method for training an age detection model, comprising:

[0006] Obtain a training set, which includes multiple face images, each face image labeled with its real age;

[0007] Obtain age interference information corresponding to each face image in the training set. The age interference information includes shooting information and / or expression information. The age interference information is an interference factor for the interference neural network to accurately detect age.

[0008] The age interference information is encoded to obtain information feature encoding;

[0009] The neural network is iteratively trained using the training set and the information feature encoding corresponding to each face image in the training set to obtain an age detection model.

[0010] In some embodiments, encoding the age interference information to obtain information feature encoding includes:

[0011] The text data in the age interference information is encoded to obtain the text encoding;

[0012] The text encoding is concatenated with the numerical data in the age interference information to obtain the information feature encoding.

[0013] In some embodiments, encoding the text data in the age interference information to obtain text encoding includes:

[0014] The text data in the age interference information is encoded using the bag-of-words model to obtain the text encoding.

[0015] In some embodiments, before iteratively training the neural network using the training set and information feature encodings corresponding to each face image in the training set to obtain the age detection model, the method further includes:

[0016] A multilayer perceptron module is used to extract features from the information feature encoding to obtain the target information vector.

[0017] The step of iteratively training the neural network using the training set and the information feature encoding corresponding to each face image in the training set to obtain the age detection model includes:

[0018] The neural network and the multilayer perceptron module are iteratively trained using the training set and the target information vector corresponding to the training set to obtain the age detection model.

[0019] In some embodiments, the neural network includes cascaded convolutional modules, fully connected layers, fusion layers, and classification layers, wherein the convolutional module includes multiple convolutional layers;

[0020] Using the training set and the target information vector corresponding to the training set, the neural network and the multilayer perceptron module are iteratively trained to obtain the age detection model, including:

[0021] The training set is input into the convolutional module of the neural network, and the last convolutional layer of the convolutional module outputs an age feature map.

[0022] The age feature map is input into the fully connected layer of the neural network to obtain the age feature vector;

[0023] The age feature vector and the target information vector are input into the fusion layer for fusion, and the fused vector is input into the classification layer for age classification to obtain the predicted age.

[0024] The loss function is used to calculate the loss between each of the true ages and the corresponding predicted ages, and the model parameters of the neural network and the multilayer perceptron module are adjusted according to the loss until convergence is obtained to obtain the age detection model.

[0025] In some embodiments, the step of inputting the age feature vector and the target information vector into the fusion layer for fusion includes:

[0026] The age feature vector and the target information vector are multiplied and fused to obtain the fused vector.

[0027] In some embodiments, the loss function includes:

[0028]

[0029]

[0030] in, The probability corresponding to the i-th age in the predicted age. Let n be the probability corresponding to the i-th age in the true age range, and n be the maximum age.

[0031] To address the aforementioned technical problems, in a second aspect, this application provides an age detection method, comprising:

[0032] Acquire the image of the face to be detected;

[0033] Obtain age interference information corresponding to the face image to be detected. The age interference information includes shooting information and / or expression information. The age interference information is an interference factor for the interference neural network to accurately detect age.

[0034] The age interference information corresponding to the face image to be detected is encoded to obtain the information feature code corresponding to the face image to be detected;

[0035] The face image to be detected and the information feature encoding corresponding to the face image to be detected are input into the age detection model to detect age, and the age corresponding to the face image to be detected is obtained.

[0036] To address the aforementioned technical problems, in a third aspect, this application provides an electronic device, comprising:

[0037] At least one processor, and

[0038] A memory that is communicatively connected to at least one processor, wherein,

[0039] The memory stores instructions that can be executed by at least one processor, such that the instructions are executed by at least one processor to enable the at least one processor to perform the method of the first aspect.

[0040] To address the aforementioned technical problems, in a fourth aspect, this application provides a computer-readable storage medium storing computer-executable instructions for causing a computer device to perform the method of the first aspect.

[0041] The beneficial effects of this application's embodiments are as follows: Unlike existing technologies, the method for training an age detection model provided in this application includes a training set comprising multiple face images labeled with real ages. First, age interference information corresponding to each face image in the training set is obtained, such as shooting information and / or facial expression information. Then, the age interference information is encoded to obtain information feature encoding. Finally, the neural network is iteratively trained using the training set and the information feature encoding corresponding to each face image in the training set to obtain the age detection model. In this embodiment, the neural network can learn the features of face images and age interference features during training, clearly distinguishing between age interference features and effective features that affect the accuracy of age prediction. This makes the effective features highly discriminative, thereby filtering out interference features during age prediction, reducing the impact of interference features on network learning, and enabling the trained age detection model to accurately and stably detect age. Attached Figure Description

[0042] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0043] Figure 1 This is a schematic diagram illustrating the application scenarios of the age detection system in some embodiments of this application;

[0044] Figure 2 This is a schematic diagram of the structure of an electronic device in some embodiments of this application;

[0045] Figure 3 This is a flowchart illustrating the method for training an age detection model in some embodiments of this application;

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

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

[0048] Figure 6 This is a schematic diagram of the structure of the neural network used for training in some embodiments of this application;

[0049] Figure 7 This is a flowchart illustrating the age detection method in some embodiments of this application. Detailed Implementation

[0050] The present application will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present application, but do not limit the present application in any way. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application. These all fall within the protection scope of the present application.

[0051] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0052] It should be noted that, unless there is a conflict, the various features in the embodiments of this application can be combined with each other, all of which are within the protection scope of this application. Furthermore, although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than the module division in the device or the order in the flowchart. In addition, the terms "first," "second," and "third" used herein do not limit the data or execution order, but only distinguish identical or similar items with essentially the same function and effect.

[0053] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items.

[0054] Furthermore, the technical features involved in the various embodiments of this application described below can be combined with each other as long as they do not conflict with each other.

[0055] To facilitate understanding of the methods provided in the embodiments of this application, the terms used in the embodiments of this application will first be introduced:

[0056] (1) Neural Network

[0057] A neural network can be composed of neural units, specifically understood as a neural network with input layers, hidden layers, and output layers. Generally, the first layer is the input layer, the last layer is the output layer, and the layers in between are hidden layers. Neural networks with many hidden layers are called deep neural networks (DNNs). The work of each layer in a neural network can be described by the mathematical expression y=a(W·x+b). From a physical perspective, the work of each layer in a neural network can be understood as transforming the input space (the set of input vectors) to the output space (i.e., from the row space to the column space of a matrix) through five operations on the input space: 1. Dimensionality increase / decrease; 2. Magnification / scaling; 3. Rotation; 4. Translation; 5. "Bending". Operations 2 and 3 are performed by "W·x", operation 4 by "+b", and operation 5 by "a()". The term "space" is used here because the objects being classified are not individual things, but a class of things; space refers to the set of all individuals within that class. W is the weight matrix of each layer in the neural network, where each value represents the weight of a neuron in that layer. This matrix W determines the spatial transformation from the input space to the output space, as described above; that is, the W of each layer of the neural network controls how the space is transformed. The purpose of training the neural network is to ultimately obtain the weight matrices of all layers of the trained neural network. Therefore, the training process of a neural network is essentially learning how to control spatial transformation, more specifically, learning the weight matrix.

[0058] It should be noted that, in the embodiments of this application, the models used for machine learning tasks are essentially neural networks. Common components in neural networks include convolutional layers, pooling layers, normalization layers, and deconvolutional layers. By assembling these common components in neural networks, a model is designed. When the model parameters (weight matrices of each layer) are determined such that the model error meets a preset condition or the number of model parameters is adjusted to reach a preset threshold, the model converges.

[0059] The convolutional layer is configured with multiple convolutional kernels, each with a corresponding stride, to perform convolution operations on the image. The purpose of convolution is to extract different features from the input image. The first convolutional layer may only extract some low-level features such as edges, lines, and corners, while deeper convolutional layers can iteratively extract more complex features from low-level features.

[0060] A deconvolutional layer is used to map a low-dimensional space to a high-dimensional space while preserving the connections / patterns between them (the connections during convolution). A deconvolutional layer is configured with multiple convolutional kernels, each with a corresponding stride, to perform deconvolution operations on the image. Generally, framework libraries used for designing neural networks (such as the PyTorch library) have a built-in `upsumple()` function, which allows for low-dimensional to high-dimensional spatial mapping.

[0061] Pooling layers mimic the human visual system's ability to reduce the dimensionality of data or represent images with higher-level features. Common pooling operations include max pooling, mean pooling, random pooling, median pooling, and combined pooling. Typically, pooling layers are periodically inserted between convolutional layers in neural networks to achieve dimensionality reduction.

[0062] The normalization layer is used to normalize all neurons in the intermediate layer to prevent gradient explosion and gradient vanishing.

[0063] (2) Loss function

[0064] During neural network training, to ensure the output closely approximates the desired predicted value, we compare the network's current prediction with the target value. Based on the difference, we update the weight matrix of each layer (usually an initialization process before the first update, pre-configuring parameters for each layer). For example, if the network's prediction is too high, the weight matrix is ​​adjusted to predict a lower value, and this adjustment continues until the neural network accurately predicts the target value. Therefore, we need to predefine "how to compare the difference between the predicted and target values," which is the loss function or objective function. These are important equations used to measure the difference between the predicted and target values. Taking the loss function as an example, a higher output value (loss) indicates a greater difference, and training the neural network becomes a process of minimizing this loss.

[0065] Before introducing the embodiments of this application, a brief introduction will be given to age detection methods known to the inventors of this application, so as to facilitate the understanding of the embodiments of this application later.

[0066] In some age detection methods, training samples are obtained, each sample being a face image labeled with a corresponding age tag; the age tag distribution corresponding to the age tag of each sample is determined; based on the samples and the age tag distribution, the age estimation model is trained until the total loss function of the age estimation model converges.

[0067] The above method is a statistical classification method. When applied to practical applications, the age prediction results for the same person will fluctuate greatly due to differences in facial expressions and shooting angles, resulting in a lack of stability and accuracy.

[0068] To address the aforementioned issues, this application provides a method for training an age detection model, an age detection technique, an electronic device, and a storage medium. The training method uses multiple face images and corresponding age interference information to train a neural network. Thus, during training, the neural network can learn the features of the face images and age interference features, clearly distinguishing between age interference features that interfere with age prediction and effective features that affect the accuracy of age prediction. This makes the effective features highly discriminative, allowing interference features to be filtered out during age prediction, reducing their impact on network learning, and enabling the trained age detection model to accurately and stably detect age.

[0069] The following describes exemplary applications of the electronic devices provided in this application for training age detection models or for age detection. It is understood that the electronic devices can both train age detection models and use the age detection models to detect the age of facial images.

[0070] The electronic device provided in this application embodiment can be a server, such as a server deployed in the cloud. When the server is used to train an age detection model, it iteratively trains the neural network using the training set provided by other devices or those skilled in the art, determines the final model parameters, and then configures the neural network with these final model parameters to obtain the age detection model. When the server is used for age detection, it calls the built-in age detection model to perform corresponding calculations on the face image to be detected provided by other devices or the user to obtain the corresponding age.

[0071] The electronic devices provided in some embodiments of this application can be various types of terminals such as laptops, desktop computers, or mobile devices. When the terminal is used to train an age detection model, those skilled in the art input a prepared training set into the terminal and design a neural network on the terminal. The terminal uses the training set to iteratively train the neural network, determine the final model parameters, and then configure the neural network with these final model parameters to obtain the age detection model. When the terminal is used for age detection, it calls the built-in age detection model to perform corresponding calculations on the user-input face image to be detected, and obtains the age corresponding to the face image to be detected.

[0072] As an example, see Figure 1 , Figure 1This is a schematic diagram of an application scenario for the age detection system provided in this application embodiment. The terminal 10 is connected to the server 20 via a network, which can be a wide area network or a local area network, or a combination of both.

[0073] Terminal 10 can be used to acquire training sets and build neural networks. For example, those skilled in the art can download prepared training sets on the terminal and build the network structure of the neural network. It is understood that terminal 10 can also be used to acquire facial images. For example, a user inputs a facial image through an input interface, and after the input is completed, the terminal automatically acquires the facial image; for example, terminal 10 is equipped with a camera to capture facial images.

[0074] In some embodiments, terminal 10 locally executes the method for training an age detection model provided in this application to train a designed neural network using a training set, determine the final model parameters, and then configure the neural network with the final model parameters to obtain the age detection model. In some embodiments, terminal 10 may also send a training set and a constructed neural network stored on the terminal by a person skilled in the art to server 20 via a network. Server 20 receives the training set and the neural network, trains the designed neural network using the training set, determines the final model parameters, and then sends the final model parameters to terminal 10. Terminal 10 saves the final model parameters so that the neural network can be configured with the final model parameters to obtain the age detection model.

[0075] In some embodiments, terminal 10 locally executes the age detection method provided in this application embodiment to provide age detection services to the user. It calls the built-in age detection model to perform corresponding calculations on the face image to be detected and age interference information to obtain the age corresponding to the face image to be detected. In some embodiments, terminal 10 can also send the face image to be detected and age interference information input by the user on the terminal to server 20 via the network. Upon receiving the face image to be detected and age interference information, server 20 calls the built-in age detection model to perform corresponding calculations on the face image to be detected and age interference information to obtain the age corresponding to the face image to be detected, and then sends the age to terminal 10. After receiving the age, terminal 10 displays the age on its own display interface to inform the user.

[0076] The structure of the electronic device in the embodiments of this application is described below. Figure 2This is a schematic diagram of the structure of an electronic device 500 in an embodiment of this application. The electronic device 500 includes at least one processor 510, a memory 550, at least one network interface 520, and a user interface 530. The various components in the electronic device 500 are coupled together through a bus system 540. It is understood that the bus system 540 is used to realize the connection and communication between these components. In addition to a data bus, the bus system 540 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 2 The general labeled all buses as Bus System 540.

[0077] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor.

[0078] User interface 530 includes one or more output devices 531 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0079] Memory 550 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 550 described in this application embodiment is intended to include any suitable type of memory. Memory 550 may optionally include one or more storage devices physically located away from processor 510.

[0080] In some embodiments, memory 550 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.

[0081] Operating system 551 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks.

[0082] The network communication module 552 is used to reach other computing devices via one or more (wired or wireless) network interfaces 520, such as Bluetooth, WiFi, and Universal Serial Bus (USB).

[0083] Display module 553 is configured to enable the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 531 (e.g., a display screen, a speaker, etc.) associated with user interface 530;

[0084] The input processing module 554 is used to detect and translate one or more user inputs or interactions from one or more input devices 532.

[0085] As can be understood from the above, the method for training the age detection model and the age detection method provided in the embodiments of this application can be implemented by various types of electronic devices with computing capabilities, such as smart terminals and servers.

[0086] The following describes the method for training an age detection model provided in this application, using exemplary applications and implementations of the server provided in the embodiments of this application. See also Figure 3 , Figure 3 This is a flowchart illustrating the method for training an age detection model provided in an embodiment of this application.

[0087] Please refer to it again. Figure 3 The method S100 may specifically include the following steps:

[0088] S10: Obtain the training set, which includes multiple face images, each labeled with the real age.

[0089] The training set includes a large number of face images, where each face image contains a face. Understandably, each face image in the training set is labeled with its real age, which can cover an age range of 1-100 years old.

[0090] The true age of each face image can be labeled using a hot-coding method. For example, if the age range to be detected is between 1 and 100, a 100-dimensional vector can be used as the true age corresponding to a face image. It is understood that hot-coding is a common technique used by those skilled in the art, and will not be described in detail here.

[0091] In some embodiments, the terminal or server can normalize the face images in the training set, which is beneficial to improving the convergence speed and model accuracy of subsequent model training. Specifically, in some embodiments, the size of the face image can be set to 256*256, and the pixel value range of the face image can be transformed from 0-255 to 0-1.

[0092] In some embodiments, the number of face images in the training set is in the tens of thousands, for example, 20,000, which is beneficial for training an accurate general model. Those skilled in the art can determine the number of face images according to the actual situation.

[0093] S20: Obtain age interference information corresponding to each face image in the training set.

[0094] It is understandable that facial skin condition and eye expression in a facial image are valid information for age determination. In addition to the aforementioned valid information, facial images also include age interference information. This age interference information is a factor that interferes with the accurate age detection of neural networks. It is understandable that the same person's face will appear different due to different shooting angles, thus affecting the neural network's learning and judgment; similarly, the same person's face will appear different due to different facial expressions, thus affecting the neural network's learning and judgment. In some embodiments, age interference information includes shooting information and / or facial expression information.

[0095] In some embodiments, age interference information may also include hairstyle information. It is understood that different hairstyles can obscure a person's face to varying degrees, altering their facial features or gender. Therefore, when the same person has different hairstyles, the neural network may provide different age predictions.

[0096] Considering the impact of age interference information on the neural network, we obtain the age interference information corresponding to each face image in the training set. In some embodiments, the age interference information includes shooting information and expression information. Shooting information includes pitch angle, yaw angle, roll angle, etc. Expression information includes laughing, smiling, or sad, etc. For example, the age interference information for a 32-year-old's face image is: pitch angle 45°, yaw angle 10°, roll angle 10°, laughing (expression).

[0097] S30: Encode the age interference information to obtain the information feature code.

[0098] It is understandable that age-related interference information includes both textual and numerical data. To transform this interference information into numerical data that the neural network can learn, it is encoded into information feature codes before training. These information feature codes are numerical data, such as vectors. Thus, the neural network can learn the age-related interference information reflected in the information feature codes.

[0099] In some embodiments, please refer to Figure 4 The aforementioned step S30 specifically includes:

[0100] S31: Encode the text data in the age interference information to obtain the text encoding.

[0101] S32: Concatenate the text encoding with the numerical data in the age interference information to obtain the information feature encoding.

[0102] Understandably, text data can include expressions, angle names, etc., such as the text mentioned above like "pitch angle, yaw angle, roll angle, and laugh". In some embodiments, text data can be encoded using methods such as hot coding to obtain the corresponding text encoding.

[0103] In some embodiments, the aforementioned step S31 specifically includes: encoding the text data in the age interference information using a bag-of-words model to obtain text encoding.

[0104] The bag-of-words model involves selecting words from the text data, placing them into a bag, counting the frequency of each word in the text data, and representing them as vectors. In this embodiment, the text data from the age interference information of all face images in the training set is first integrated to construct a dictionary. This dictionary includes the words contained in the text data from the age interference information of all face images in the training set. The dictionary includes word location information and the corresponding word. For example, the constructed dictionary could be {1: pitch angle, 2: yaw angle, 3: roll angle, 4: laughing, 5: sad, 6: smiling}, where the number preceding the word is the word location information.

[0105] In this embodiment, for example, for the text data "pitch angle, yaw angle, roll angle, laugh", after using the dictionary encoding in the example above, the resulting text encoding can be "111100". From this text encoding "111100", it can be seen that "pitch angle, yaw angle, roll angle, laugh" each appear once in the text data, while "sad" and "smile" appear zero times in the text data.

[0106] After obtaining the text encoding corresponding to the text data in the age interference information, the text encoding is concatenated with the numerical data in the age interference information to obtain the information feature encoding. The concatenation method between the text encoding and the numerical data can be horizontal concatenation.

[0107] It is understandable that the numerical data in the age interference information may include various angle values. For example, 45° for pitch angle, 10° for yaw angle, and 10° for roll angle. In some embodiments, 45° is 000101101 and 10° is 000001010. Thus, the information feature code obtained by concatenating the text code "111100" with the numerical data "000101101, 000001010, 000001010" can be "111100 000101101 000001010 000001010".

[0108] In this embodiment, by encoding the text data and then concatenating the encoded text with the numerical data, the age interference information is quantified, which facilitates subsequent learning by the neural network.

[0109] S40: The neural network is iteratively trained using the training set and the information feature encoding corresponding to each face image in the training set to obtain the age detection model.

[0110] Understandably, during training, the neural network learns the image features of multiple face images in the training set and the interference features reflected by the corresponding information feature encodings, makes age predictions, and adjusts the model parameters in reverse based on the predicted age and the actual age, that is, adjusts the feature extraction parameters of the face images, so that the neural network can extract and learn effective features that affect the accuracy of age prediction, such as skin features.

[0111] Furthermore, the interference features reflected in the information feature encoding inform the neural network that there are interfering features in the face image. Therefore, when making age predictions, these interfering features can be ignored, preventing them from affecting the prediction. For example, when the information feature encoding reflects shooting information and facial expression information, it can tell the neural network that there are facial expressions and shooting angles in the face image. When learning features from the face image, interfering features such as facial expressions and shooting angles should be filtered out, focusing attention on the effective features that affect the accuracy of age prediction.

[0112] After multiple iterations of training and parameter tuning, the neural network converges, yielding the age detection model. Based on the aforementioned information feature encoding, the neural network can focus its attention on the effective features affecting the accuracy of age prediction. Therefore, the converged age detection model can accurately and stably detect age.

[0113] It is understandable that convergence here can refer to the fact that, under a certain model parameter, the sum of the differences between the real age and the predicted age in the training set is less than a preset threshold or fluctuates within a certain range.

[0114] In some embodiments, the Adam algorithm is used to optimize model parameters. For example, the number of iterations is set to 100,000, the initial learning rate is set to 0.001, and the learning rate weight decay is set to 0.0005. Every 1,000 iterations, the learning rate decays to 1 / 10 of its original value. The learning rate and the differences between the actual ages and their corresponding predicted ages in the training set can be input into the Adam algorithm to obtain the adjusted model parameters output by the Adam algorithm. These adjusted model parameters are used for the next training iteration until training is complete, at which point the converged neural network model parameters are output. Thus, the converged neural network serves as the age detection model.

[0115] In this embodiment, the neural network can learn the features of the face image and the age interference features during the training process. That is, it can clearly distinguish the age interference features and the effective features that affect the accuracy of age prediction, so that the effective features have high discriminability. Thus, when making age prediction, the interference features can be filtered out, reducing the impact of interference features on the network learning, so that the trained age detection model can accurately and stably detect age.

[0116] In some embodiments, prior to the aforementioned step S40, the method further includes:

[0117] S50: The multilayer perceptron module is used to extract features from the information feature encoding to obtain the target information vector.

[0118] As can be understood, a multilayer perceptron module includes an input layer, multiple hidden layers, and an output layer. The input layer contains N neurons, the hidden layers contain Q neurons, and the output layer contains K neurons. The operation of each layer can be described by a function expression, and it is understood that the function expression for each layer is different.

[0119] Understandably, if the input information feature encoding is represented by x, then the input layer is fed to the hidden layer x, and the output of the hidden layer can be... ,in, It's weight. It is a partial variable, a function This can be either the commonly used sigmoid function or the tanh function. The process from the hidden layer to the output layer is essentially a multi-class logistic regression, i.e., softmax regression. Therefore, the output of the output layer is... ,in, Output for hidden layer .

[0120] Therefore, the multilayer perceptron module can be represented by the following formula:

[0121]

[0122] Where G represents The activation function, where h represents the number of hidden layers. and This represents the weights and biases of the i-th hidden layer. This represents the encoding of the input information features. and This represents the weights and biases of the input layer, and S represents the activation function. This represents the target information vector.

[0123] In some embodiments, K can be 1024, so that the output layer outputs a one-dimensional vector of length 1024, that is, a target information vector of length 1024.

[0124] The multilayer perceptron module uses activation functions in each layer, introducing nonlinear factors into neurons. This allows the module to approximate any nonlinear function, thus enabling its application in a wider range of nonlinear models. The multilayer perceptron module also exhibits excellent feature extraction capabilities for discrete information. Consequently, the extracted target information vector fully reflects the characteristics of the information feature encoding, specifically the characteristics of age-related interference information.

[0125] In this embodiment, the aforementioned step S40 specifically includes:

[0126] S41: Using the training set and the target information vector corresponding to the training set, the neural network and multilayer perceptron module are iteratively trained to obtain the age detection model.

[0127] In this embodiment, the target information vector is extracted by a multilayer perceptron module, which has the advantages of low dimensionality and small feature granularity. Therefore, it can facilitate neural network learning and help improve the accuracy and training speed of the model.

[0128] In some embodiments, please refer to Figure 6 This neural network comprises cascaded convolutional modules, fully connected layers, fusion layers, and classification layers. The convolutional modules, consisting of multiple convolutional layers, are used to extract downsampled features from the input face image. The fully connected layers integrate and classify the input feature maps, outputting a one-dimensional vector. The fusion layers fuse at least two features. The classification layers transform the input vector into a probability vector with values ​​between 0 and 1, thereby achieving classification. It is worth noting that convolutional layers, fully connected layers, and classification layers are common components in neural networks and are well-known to those skilled in the art; therefore, they will not be described in detail here.

[0129] In this embodiment, please refer to Figure 5 The aforementioned step S41 specifically includes:

[0130] S411: Input the training set into the convolutional module of the neural network. The last convolutional layer of the convolutional module outputs an age feature map.

[0131] In some embodiments, please refer to Figure 6 The convolutional module consists of multiple convolutional layers, each followed by a pooling layer for dimensionality reduction. The convolutional layers primarily use 3x3 kernels with a stride of 2. Some convolutional layers have 32, 64, 128, 256, and 512 kernels, resulting in output feature map sizes of 256*256*32, 128*128*64, 64*64*128, 32*32*256, and 16*16*512, respectively. It can be understood that the feature map output by the last convolutional layer in the module is the age feature map.

[0132] S412: Input the age feature map into the fully connected layer of the neural network to obtain the age feature vector.

[0133] The fully connected layer is used to integrate and classify the input features and output a one-dimensional vector. Thus, after the age feature map is processed by the fully connected layer, a one-dimensional vector is obtained, namely the age feature vector.

[0134] S413: Input the age feature vector and the target information vector into the fusion layer for fusion, and input the fused vector into the classification layer for age classification to obtain the predicted age.

[0135] The fusion layer is used to fuse at least two features. Thus, after the age feature vector and the target information vector are input into the fusion layer, the resulting fusion vector contains the image features reflected by the age feature vector and the interference features reflected by the target information vector.

[0136] Please refer to it again. Figure 6 The fused vector, after being processed by the classification layer, is transformed into a probability vector with values ​​between 0 and 1. This probability vector represents the predicted age, where each element indicates the probability of a face in the image representing a particular age. The age with the highest probability is the predicted age.

[0137] Since the predicted age is obtained by classifying the fused vector, the neural network can learn the features of the face image as well as the age interference features. That is, it can clearly distinguish the age interference features from the effective features that affect the accuracy of age prediction, so that the effective features have high discriminability. Thus, when making age prediction, the interference features can be filtered out, reducing the impact of interference features on the network learning.

[0138] In some embodiments, the aforementioned "inputting the age feature vector and the target information vector into the fusion layer for fusion" includes: multiplying and fusing the age feature vector and the target information vector to obtain a fusion vector.

[0139] It is understandable that multiplication fusion is the multiplication of the corresponding positions of the age feature vector and the target information vector, which increases the weight of the target information in the age feature vector. In other words, the target information has a greater weight in the resulting fused vector, making it easier to distinguish and identify. This is beneficial for the neural network to clearly distinguish age interference features and effective features that affect the accuracy of age prediction.

[0140] S414: The loss function is used to calculate the loss between each true age and the corresponding predicted age, and the model parameters of the neural network and multilayer perceptron module are adjusted according to the loss until convergence is achieved, thus obtaining the age detection model.

[0141] Here, the loss function can be configured by those skilled in the art in the terminal. The configured loss function is sent to the server along with the neural network and the multilayer perceptron module. After the server processes and obtains the predicted age corresponding to each face image in the training set, it uses the loss function to calculate the loss between each real age and the predicted age in the training set. Based on the loss, the neural network and the multilayer perceptron module are iteratively trained until convergence, and the age detection model is obtained.

[0142] In this embodiment, a loss function is used to calculate the difference between the real age and the predicted age of each face image in the training set. The loss function has been described in detail in the aforementioned "Glossary (2)" section and will not be repeated here. It is understood that, based on different network structures and training methods, the structure of the loss function can be set according to the actual situation.

[0143] In some embodiments, the loss function includes:

[0144]

[0145]

[0146] in, To predict the probability corresponding to the i-th age, Let n be the probability corresponding to the i-th age in the real age, and n be the maximum age.

[0147] The loss function described above has a strong ability to distinguish between categories, thus effectively avoiding gradient vanishing.

[0148] In summary, the method for training an age detection model provided in this application includes a training set comprising multiple face images labeled with real ages. First, age interference information corresponding to each face image in the training set is obtained, such as shooting information and / or facial expression information. Then, each age interference information is encoded to obtain information feature encoding. Finally, the neural network is iteratively trained using the training set and the information feature encoding corresponding to each face image in the training set to obtain the age detection model. In this embodiment, the neural network can learn the features of face images and age interference features during training, clearly distinguishing between age interference features and effective features that affect the accuracy of age prediction. This makes the effective features highly discriminative, thereby filtering out interference features during age prediction, reducing the impact of interference features on network learning, and enabling the trained age detection model to accurately and stably detect age.

[0149] After training an age detection model using the method provided in this application, the model can be applied to age detection. The age detection method provided in this application can be implemented by various types of electronic devices with computing capabilities, such as smart terminals and servers.

[0150] The age detection method provided in this application is described below with reference to exemplary applications and implementations of the terminals provided in the embodiments of this application. (See also...) Figure 7 , Figure 7 This is a schematic flowchart of the age detection method provided in an embodiment of this application. Method S30 may include the following steps:

[0151] S31: Obtain the image of the face to be detected.

[0152] Here, the face image to be detected refers to the face image of the person whose age is to be detected. It is understood that this face image includes a human face.

[0153] In practice, the clothing classification assistant (application software) built into the terminal (such as a smartphone) acquires the image of the face to be detected. This image can be captured by the terminal itself or input by the user.

[0154] S32: Obtain age interference information corresponding to the face image to be detected.

[0155] Understandably, the skin condition and eye expression in the face image to be detected are effective information for determining age. In addition to the aforementioned effective information, the face image to be detected also includes age interference information. This age interference information is image information that interferes with the age detection model's ability to identify effective information.

[0156] S33: Encode the age interference information corresponding to the face image to be detected to obtain the information feature encoding corresponding to the face image to be detected.

[0157] It is understood that age interference information includes both textual and numerical data. To convert this age interference information into numerical data that the age detection module can calculate, it is encoded into information feature codes before detection. The specific implementation of step S33 can be found in the encoding method of step S30 in the training embodiment, and will not be repeated here.

[0158] S33: Input the face image to be detected and the age interference information corresponding to the face image to be detected into the age detection model to detect the age and obtain the age corresponding to the face image to be detected.

[0159] Here, the age detection model refers to the model described above. Figures 3-6 The age detection model trained by the method embodiment has the same structure and function as the age detection model in the above embodiment, and will not be described in detail here.

[0160] This application also provides a computer-readable storage medium storing computer-executable instructions for causing an electronic device to execute the method for training an age detection model provided in this application, for example... Figure 3-6 The method for training the age detection model shown, or the age detection method provided in the embodiments of this application.

[0161] In some embodiments, the storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.

[0162] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0163] As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborative files (e.g., a file that stores one or more modules, subroutines, or code sections).

[0164] As an example, executable instructions can be deployed to execute on a single computing device (including devices such as smart terminals and servers), or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.

[0165] This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a computer, cause the computer to perform the method for training an age detection model or the age detection method as described in the foregoing embodiments.

[0166] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of this application as described above, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A method for training an age detection model, characterized in that, include: Obtain a training set, which includes multiple face images and corresponding age interference information, wherein each face image is labeled with its real age; Obtain the age interference information corresponding to each face image in the training set. The age interference information includes shooting information and / or expression information. The age interference information is an interference factor for the interference neural network to accurately detect age. The age interference information is encoded to obtain information feature encoding; The neural network is iteratively trained using the training set and the information feature encoding corresponding to each face image in the training set to obtain an age detection model. The encoding of the age interference information to obtain information feature encoding includes: The text data in the age interference information is encoded to obtain the text encoding; The text encoding is concatenated with the numerical data in the age interference information to obtain the information feature encoding.

2. The method according to claim 1, characterized in that, The process of encoding the text data in the age interference information to obtain text encoding includes: The text data in the age interference information is encoded using the bag-of-words model to obtain the text encoding.

3. The method according to any one of claims 1 or 2, characterized in that, Before iteratively training the neural network using the training set and the information feature encoding corresponding to each face image in the training set to obtain the age detection model, the method further includes: A multilayer perceptron module is used to extract features from the information feature encoding to obtain the target information vector. The step of iteratively training the neural network using the training set and the information feature encoding corresponding to each face image in the training set to obtain the age detection model includes: The neural network and the multilayer perceptron module are iteratively trained using the training set and the target information vector corresponding to the training set to obtain the age detection model.

4. The method according to claim 3, characterized in that, The neural network includes cascaded convolutional modules, fully connected layers, fusion layers, and classification layers, wherein the convolutional module includes multiple convolutional layers; Using the training set and the target information vector corresponding to the training set, the neural network and the multilayer perceptron module are iteratively trained to obtain the age detection model, including: The training set is input into the convolutional module of the neural network, and the last convolutional layer of the convolutional module outputs an age feature map. The age feature map is input into the fully connected layer of the neural network to obtain the age feature vector; The age feature vector and the target information vector are input into the fusion layer for fusion, and the fused vector is input into the classification layer for age classification to obtain the predicted age. The loss function is used to calculate the loss between each of the true ages and the corresponding predicted ages, and the model parameters of the neural network and the multilayer perceptron module are adjusted according to the loss until convergence is obtained to obtain the age detection model.

5. The method according to claim 4, characterized in that, The step of inputting the age feature vector and the target information vector into the fusion layer for fusion includes: The age feature vector and the target information vector are multiplied and fused to obtain the fused vector.

6. The method according to claim 4, characterized in that, The loss function includes: in, The probability corresponding to the i-th age in the predicted age. Let n be the probability corresponding to the i-th age in the true age range, and n be the maximum age.

7. An age detection method, characterized in that, include: Acquire the image of the face to be detected; Obtain age interference information corresponding to the face image to be detected. The age interference information includes shooting information and / or expression information. The age interference information is an interference factor for the interference neural network to accurately detect age. The age interference information corresponding to the face image to be detected is encoded to obtain the information feature code corresponding to the face image to be detected; The face image to be detected and the information feature encoding corresponding to the face image to be detected are input into the age detection model to perform age detection, thereby obtaining the age corresponding to the face image to be detected. The age detection model is trained using the training method of the age detection model as described in any one of claims 1-6. Encoding the age interference information corresponding to the face image to be detected to obtain the information feature encoding corresponding to the face image to be detected includes: The text data in the age interference information corresponding to the face image to be detected is encoded to obtain the text encoding; The text encoding is concatenated with the numerical data in the age interference information corresponding to the face image to be detected to obtain the information feature encoding corresponding to the face image to be detected.

8. An electronic device, characterized in that, include: At least one processor, and The memory communicatively connected to the at least one processor, wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1-7.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer device to perform the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Face detection method, and training method and device of face detection model

    CN111461089A