Age recognition model training method and device, age recognition method and device, equipment and medium
By combining labeled data and unlabeled data, iterative training methods and self-supervised learning are used to solve the problem that the face age classification model performs poorly due to the lack of labeled data, and the generalization ability and accuracy of the model are significantly improved.
Patent Information
- Application Number
- CN202411845655.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-12
AI Technical Summary
In the prior art, the face age classification model lacks rich labeling data, resulting in poor performance on face images of different age groups and difficult to effectively generalize.
By combining labeled data and unlabeled data, iterative training methods are adopted to update the parameters of the age classification model using labeled images, and generate pseudo-labels through unlabeled images for self-supervised learning, gradually improving the age classification accuracy of the model.
The generalization ability and accuracy of the age classification model have been significantly improved. By effectively utilizing unlabeled data and labeled data, high-quality pseudo-labels are constructed, and the effect of self-supervised learning is achieved.
Smart Images

Figure CN119888808A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image recognition technology, and in particular to an age recognition model training method, recognition method, device, equipment and medium. Background Art
[0002] Currently, in the research of face age classification, the scarcity of labeled data has a significant negative impact on the generalization ability of the model. Although there are a large number of public face recognition datasets in related fields, these datasets cannot be directly used for age classification tasks due to the lack of age annotations. Since age classification models usually rely on rich and diverse training data to capture the characteristics of different age groups, the lack of data leads to poor performance of the model on face images of different age groups.
[0003] Therefore, how to combine labeled and unlabeled image data to train age classification in order to improve the accuracy of age classification has become an urgent problem to be solved. Summary of the invention
[0004] In view of this, the embodiments of the present application provide an age recognition model training method, recognition method, device, equipment and medium to solve the problem of how to combine labeled and unlabeled image data to train age classification to improve the accuracy of age classification.
[0005] In a first aspect, an embodiment of the present application provides an age recognition model training method, comprising: Acquire a labeled data set and an unlabeled data set, wherein the labeled data set includes at least one labeled image and a corresponding age label, and the unlabeled data set includes at least one unlabeled image; In N iterations, the annotated image is input into a first age classification model to obtain a first age classification result, and the parameters of the first age classification model are updated according to the first age classification result and the age label to obtain an updated first age classification model, where N is an integer greater than zero; In M iterations, the unlabeled image is input into the updated first age classification model to obtain a second age classification result, and the unlabeled image is input into the updated second age classification model to obtain a third age classification result, wherein the second age classification model has the same architecture as the first age classification model, and the parameters in the updated second classification age model are calculated based on the parameters of the updated first age classification model, and M is an integer greater than zero; According to the second age classification result and the third age classification result, the updated first age classification model is updated to obtain a re-updated first age classification model, the re-updated first age classification model is used as the first age classification model, and the step of inputting the annotated image into the first age classification model is returned to execute to obtain the first age classification result, until the training stop condition is reached to obtain the trained first age classification model.
[0006] In a second aspect, an embodiment of the present application provides a recognition method for face age recognition, comprising: Obtain an image to be recognized; The first age classification model trained by the age recognition model training method described in the first aspect is used to classify the image to be recognized, and an age classification result corresponding to the image to be recognized is obtained. In a third aspect, an embodiment of the present application provides an age recognition model training device, comprising: A data acquisition module, used to acquire a labeled data set and an unlabeled data set, wherein the labeled data set includes at least one labeled image and a corresponding age label, and the unlabeled data set includes at least one unlabeled image; a labeled image training module, configured to input the labeled image into a first age classification model in N iterations to obtain a first age classification result, and update the parameters of the first age classification model according to the first age classification result and the age label to obtain an updated first age classification model, where N is an integer greater than zero; an unlabeled image training module, for inputting the unlabeled image into the updated first age classification model in M iterations to obtain a second age classification result, and inputting the unlabeled image into the updated second age classification model to obtain a third age classification result, wherein the second age classification model has the same architecture as the first age classification model, and the parameters in the updated second classification age model are calculated based on the parameters of the updated first age classification model, and M is an integer greater than zero; A cyclic training module is used to update the updated first age classification model according to the second age classification result and the third age classification result to obtain a re-updated first age classification model, use the re-updated first age classification model as the first age classification model, return to execute the step of inputting the labeled image into the first age classification model to obtain the first age classification result, until the training stop condition is reached, and the trained first age classification model is obtained.
[0007] In a fourth aspect, an embodiment of the present application provides a recognition device for face age recognition, comprising: An image acquisition module, used for acquiring an image to be identified; The age classification recognition module is used to classify the image to be recognized using the first age classification model trained by the age recognition model training method described in the first aspect above, and obtain an age classification result corresponding to the image to be recognized. In a fifth aspect, an embodiment of the present application provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the age recognition model training method as described in the first aspect or the recognition method for face age recognition as described in the second aspect is implemented.
[0008] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the age recognition model training method as described in the first aspect, or the recognition method for face age recognition as described in the second aspect is implemented.
[0009] Compared with the prior art, the embodiments of the present invention have the following beneficial effects: The method of the present application includes inputting the labeled image into a first age classification model in N iterations to obtain a first age classification result, updating the parameters of the first age classification model according to the first age classification result and the age label to obtain an updated first age classification model, inputting the unlabeled image into the updated first age classification model in M iterations to obtain a second age classification result, inputting the unlabeled image into the updated second age classification model to obtain a third age classification result, updating the updated first age classification model according to the second age classification result and the third age classification result to obtain a further updated first age classification model, using the further updated first age classification model as the first age classification model for a loop until a training stop condition is reached to obtain a trained first age classification model, and the trained first age classification model is used to classify the image to be identified to obtain an age classification result corresponding to the image to be identified.
[0010] Among them, the age classification model is trained using unlabeled data and labeled data, and the model parameters are updated using age labels and pseudo labels of unlabeled data identified by the model, respectively. Self-supervised learning is effectively performed by accurately constructing pseudo labels, thereby significantly improving the age classification accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, 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.
[0012] Figure 1 This is a schematic diagram of an application environment of an age recognition model training method or a recognition method for face age recognition provided in Example 1 of the present application; Figure 2 It is a flowchart of an age recognition model training method provided in Example 2 of the present application; Figure 3 It is a flowchart of an age recognition model training method provided in Example 3 of the present application; Figure 4 It is a flowchart of an age recognition model training method provided in Example 4 of the present application; Figure 5 This is a flow chart of an age recognition model training method provided in Example 5 of the present application; Figure 6 This is a flowchart of a recognition method for face age recognition provided in Example 6 of the present application; Figure 7 It is a structural schematic diagram of an age recognition model training device provided in Example 7 of the present application; Figure 8 This is a schematic diagram of the structure of a recognition device for face age recognition provided in Embodiment 8 of the present application; Fig. 9 It is a structural diagram of a computer device provided in Example 9 of the present application. DETAILED DESCRIPTION
[0013] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0014] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0015] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0016] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0017] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0018] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0019] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0020] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0021] It should be understood that the size of the serial numbers of the steps in the following embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0022] In order to illustrate the technical solution of the present application, a specific embodiment is provided below for illustration.
[0023] The age recognition model training method or the recognition method for face age recognition provided in the first embodiment of the present application can be applied to Figure 1 In an application environment, a client communicates with a server, and the client can send an image to be classified to the server, so that classification and recognition are performed on the server.
[0024] The age recognition model training method and the recognition method for face age recognition can both be applied to the server, which is used to deploy models corresponding to the age recognition model training method and the recognition method for face age recognition. The model corresponding to the age recognition model training method is an untrained model, which is trained by obtaining image data from a client or a database, while the model corresponding to the recognition method for face age recognition is a model trained using the age recognition model training method, which is used to obtain client instructions for retrieval or to build an image database for retrieval.
[0025] The client includes, but is not limited to, PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud terminal devices, personal digital assistants (PDAs), and other computer devices. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0026] See also Figure 2 , is a flow chart of an age recognition model training method provided in Example 2 of the present application. The age recognition model training method can be applied to Figure 1 The server in the server, the computer device corresponding to the server connects to the client, database, etc. to obtain the corresponding data and process the data accordingly.
[0027] like Figure 2 As shown, the age recognition model training method may include the following steps: Step S201, obtaining a labeled data set and an unlabeled data set.
[0028] The labeled data set includes at least one labeled image and a corresponding age label, and the unlabeled data set includes at least one unlabeled image.
[0029] In this embodiment, the face recognition model is essentially an age classification model configured for identifying the age of a face. Of course, the age is obtained by analyzing the features of the face, and it can be used in some compliant scenarios later. The collected face images and age data are also obtained through compliant means.
[0030] In order to solve the problem that there are few data sets such as annotated images with age labels, unlabeled images without age labels are also used when training the model in this embodiment to achieve supervised training of the age classification model.
[0031] Among them, the age classification model can directly predict the age, which is a regression prediction. Of course, the age classification model can also predict the age group of the face instead of directly predicting the age of the face, and divide the age into 8 age groups: infants (0-2 years old), toddlers (3-5 years old), children (6-12 years old), teenagers (13-17 years old), young adults (18-24 years old), middle-aged (25-39 years old), middle-aged and elderly (40-59 years old), and elderly (60 years old and above), converting the regression prediction problem into a classification problem.
[0032] The above-mentioned labeled data set and unlabeled data set can be stored in a database for use in server training. The labeled data set and unlabeled data set can be used as a set of data sets in the database to train other models. For example, the images in both sets of data sets can be used to train a face recognition model, which is a model that predicts and outputs the position of a face in an image, face classification, confidence, etc. In addition, the face recognition model can also be used to calculate the saliency of the image, and can also be used to initialize the age classification model to improve the accuracy of the age classification model for face recognition, and then perform training based on this.
[0033] Step S202: In N iterations, the labeled image is input into the first age classification model to obtain a first age classification result, and the parameters of the first age classification model are updated according to the first age classification result and the age label to obtain an updated first age classification model.
[0034] Wherein, N is an integer greater than zero.
[0035] In this embodiment, for the first age classification model, the labeled images in the labeled data set are used to train it, and the training is iterated 1 time, 2 times, ..., N times, etc., and then it is trained again using the unlabeled images in the unlabeled data set. N can be set according to demand, for example, N=5.
[0036] The first age classification model is trained using the labeled data set, that is, supervised training methods such as contrast loss and cross entropy loss are used. That is, the age classification result of an image is compared with the age label of the image, and the loss is finally calculated. The parameters of the backbone network in the first age classification model are adjusted with the loss, so as to obtain an updated first age classification model. For example, the encoder, decoder, etc. are all backbone networks in the age classification model.
[0037] In one embodiment, when updating the parameters, Stochastic Gradient Descent (SGD) is used for parameter update optimization. SGD uses only the gradient information of one sample to update the model parameters in each iteration. In addition to SGD, there are other optimizers, such as Momentum and adaptive learning rate optimizers (such as Adagrad, RMSprop, Adam), which can improve the optimization effect.
[0038] Optionally, after updating the parameters of the first age classification model according to the first age classification result and the age label to obtain the updated first age classification model, the method further includes: Obtaining current parameters of the second age classification model and first updated parameters of the updated first age classification model; The current parameter and the first updated parameter are weightedly averaged to obtain a weighted average result as a second updated parameter. The second updated parameter is used to update the parameters of the second age classification model to obtain an updated second age classification model.
[0039] Among them, the second age classification model has the same architecture as the first age classification model, and the parameters in the updated second classification age model are calculated based on the parameters of the updated first age classification model. Therefore, in this embodiment, the current parameters of the second age classification model and the first updated parameters of the updated first age classification model are weighted averaged to obtain the second updated parameters, and the second updated parameters are used to update the second age classification model to obtain an updated second age classification model.
[0040] Among them, the parameter update formula of the second age classification model is as follows: In the formula, is the first update parameter, is the second update parameter, θ is the current parameter, δ is the decay rate, which belongs to [0,1]. For example, δ=0.99 or 0.9.
[0041] Initially, the parameters of the first age classification model and the second age classification model are the same, and they may be two copied models, or both may be updated using the parameters of the face recognition model.
[0042] Step S203, in M iterations, input the unlabeled image into the updated first age classification model to obtain a second age classification result, and input the unlabeled image into the updated second age classification model to obtain a third age classification result.
[0043] Among them, the second age classification model has the same architecture as the first age classification model, the parameters in the updated second age classification model are calculated based on the parameters of the updated first age classification model, and M is an integer greater than zero.
[0044] In this embodiment, after the first age classification model is trained using the labeled data set, the non-labeled images in the non-labeled data set are used to train it, and the training is iterated 1 time, 2 times, ..., M times, and then the labeled images in the labeled data set are used to train it again, forming a cycle. The value of M can be designed according to the requirements, for example, M=1.
[0045] To train the first age classification model, it is necessary to adopt a supervised training method such as contrast loss and cross entropy loss. The unlabeled image has no age label. In this embodiment, an updated second age classification model is used to predict the unlabeled image to obtain the corresponding age classification result (i.e., the third age classification result). In this way, the third age classification result is used as the corresponding age label, that is, the second age classification result of an image (i.e., the classification result of the first age classification model) is compared with the age label of the image (i.e., the third age classification result), and the loss is finally calculated, and the parameters of the backbone network in the first age classification model are adjusted again with the loss.
[0046] Step S204, based on the second age classification result and the third age classification result, the updated first age classification model is updated to obtain a re-updated first age classification model, the re-updated first age classification model is used as the first age classification model, and the execution returns to input the annotated image into the first age classification model to obtain the first age classification result, until the training stop condition is reached, and a trained first age classification model is obtained.
[0047] In this embodiment, the updated first age classification model is trained using unlabeled images to obtain a re-updated first age classification model, and the first age classification model is trained using labeled data sets and unlabeled data sets in a loop to obtain a trained first age classification model.
[0048] In the embodiment of the present application, in N iterations, the labeled image is input into the first age classification model to obtain the first age classification result, the parameters of the first age classification model are updated according to the first age classification result and the age label, and the updated first age classification model is obtained. In M iterations, the unlabeled image is input into the updated first age classification model to obtain the second age classification result, the unlabeled image is input into the updated second age classification model to obtain the third age classification result, the updated first age classification model is updated according to the second age classification result and the third age classification result, and the updated first age classification model is obtained again. The updated first age classification model is used as the first age classification model for looping until the training stop condition is reached to obtain the trained first age classification model, and the trained first age classification model is used to classify the image to be identified to obtain the age classification result corresponding to the image to be identified. Among them, the age classification model is trained using the unlabeled data and the labeled data, and the model parameters are updated respectively with the age label and the pseudo label of the unlabeled data identified by the model, and self-supervised learning is effectively performed by accurately constructing pseudo labels, thereby significantly improving the age classification accuracy of the model.
[0049] See also Figure 3 , is a flow chart of an age recognition model training method provided in Example 3 of the present application. Figure 3 As shown, in the above step S203, the unlabeled image is input into the updated first age classification model to obtain the second age classification result, and the unlabeled image is input into the updated second age classification model to obtain the third age classification result, which may include the following steps: Step S301, obtaining two unlabeled images from an unlabeled data set, and performing image fusion and augmentation on the two unlabeled images to obtain an augmented image.
[0050] Step S302: input the augmented image into the updated first age classification model to obtain a second age classification result.
[0051] Step S303: input the two unlabeled images into the updated second age classification model respectively to obtain the classification results of the corresponding unlabeled images, and fuse the classification results of the two unlabeled images to obtain the third age classification result.
[0052] In this embodiment, two unlabeled images are used to form an augmented image to train the first age classification model, and the age pseudo-label of the augmented image is formed in the same manner, so that the quality of the pseudo-label is higher.
[0053] The pseudo-label of the augmented image is obtained by fusing the classification results of the two unlabeled images corresponding to the augmented image, wherein the classification of the two unlabeled images adopts an updated second age classification model. The updated second age classification model is updated once after the first age classification model is updated, and no update is performed in the remaining calculations, so that it can obtain more accurate classification results based on the labeled image.
[0054] In the embodiment of the present application, two unlabeled image augmentation methods are used to form more accurate training data, so as to accurately obtain pseudo labels and achieve accurate classification of the first age classification model.
[0055] See also Figure 4 , is a flow chart of an age recognition model training method provided in Example 4 of the present application. Figure 4 As shown, the above step S301 of fusing and augmenting the two unlabeled images to obtain an augmented image may include the following steps: Step S401, obtaining the saliency ratios of two unlabeled images.
[0056] Step S402: According to the saliency ratios of the two unlabeled images, saliency enhancement is performed on the two unlabeled images to obtain augmented images.
[0057] The step S303 of fusing the classification results of the two unlabeled images to obtain a third age classification result may include the following steps: Step S403: According to the significance weights of the two unlabeled images, the classification results of the two unlabeled images are saliency enhanced to obtain a third age classification result.
[0058] In this embodiment, a significant augmentation method is adopted, wherein the Mixup augmentation method can improve the generalization ability and robustness of the model. By linearly mixing two images and their corresponding labels to generate new synthetic samples, this method not only increases the diversity of training data, but also helps the model learn smoother decision boundaries.
[0059] For face recognition and face age prediction models, when there are large angle differences between two face images, such as the front face and the side face, occlusion differences, or whether the person is wearing glasses, a hat, or a mask, simply using the Mixup augmentation formula will introduce large errors, making the generated image unable to truly reflect the face age information, which is inconsistent with the labels and may cause the model convergence to deteriorate, affecting the model's generalization ability on real samples.
[0060] This embodiment adopts Mixup augmentation based on saliency map, and the formula is as follows: In the formula, represents the augmented image, represents the i-th unlabeled image, represents the jth unlabeled image, express, represents the third age classification result, the classification result corresponding to the i-th unlabeled image, represents the classification result corresponding to the jth unlabeled image; where α and β are as follows: In the formula, For unlabeled images The significance ratio of For unlabeled images The significant proportion of .
[0061] Optionally, before obtaining the saliency ratios of the two unlabeled images, the following steps are further included: For any unlabeled image in the unlabeled dataset, construct an initial image with the same image size as the unlabeled image. In the current iteration, anchor points are selected from the unlabeled image, each anchor point is added to the initial image to obtain a composite image, and the unlabeled image and the composite image are recognized using the trained face recognition model to obtain a first recognition result corresponding to the unlabeled image and a second recognition result corresponding to the composite image; Calculate the similarity between the first recognition result and the second recognition result, use the synthesized image as the initial image, return to execute selecting anchor points from the unlabeled image, add each anchor point to the initial image, and obtain a synthesized image; If the similarity difference after two consecutive iterations is less than the preset difference, the iteration is stopped, and the synthetic image corresponding to the last iteration is determined to be the salient image; The saliency image is binarized to obtain a binary saliency image. The proportion of pixels with a pixel value of 1 in the binary saliency image in the unlabeled image is determined as the saliency ratio of the corresponding unlabeled image. All unlabeled images are traversed to obtain the saliency ratios of all unlabeled images.
[0062] The existing face recognition data set is used to train a face recognition model for extracting the saliency map of the face image. The face recognition data set may include the annotated data set and the unannotated data set.
[0063] Among them, the method of obtaining the saliency map is as follows: Initialize an image B with all zeros 0 As the initial image, the image size is consistent with the face image B. Anchor points are evenly taken on the face image. Each anchor point takes a circular area with a radius of R (for example, 5 by default) as the perception area. The perception areas can overlap.
[0064] Iterate through all anchor points, adding the circular area corresponding to an anchor point to B each time t-1 Then calculate the similarity between the composite image and the original face image, and take the composite image corresponding to the maximum similarity as the composite image B at the tth iteration t .
[0065] When the maximum number of iterations is reached or the matching similarity difference is less than the threshold, the iteration stops and outputs B t As a saliency map, the saliency Figure 2 The segmentation threshold is 0, that is, pixels greater than 0 are 1, and pixels less than or equal to 0 are 0.
[0066] The matching similarity difference is calculated as follows: In the formula, f (*) is the face recognition model.
[0067] The above operation is performed on all images in the face recognition dataset, especially those in the unlabeled dataset, to obtain the corresponding saliency map. The saliency weight S of the image is as follows: Among them, B t The proportion of the value of 1 in the binary image of the face image B is taken as the significance ratio of the face image.
[0068] For example, Figure 5 The figure is a flow chart of an age recognition model training method provided in Example 5 of the present application. The process is as follows: 1) Using the face recognition training set, train a face recognition model, and use the recognition model to obtain the significance ratio of the face recognition training set; 2) Use the above recognition model to initialize the face age classification model and maintain two models. A main model is updated through SGD, and the auxiliary model is updated through the main model parameter EMA method. The parameters of the two models are the same during initialization; 3) Training the face age classification model, the main model is trained alternately with labeled data and unlabeled data, the labeled data is iterated 5 times each time, and the unlabeled data is iterated once. The loss value of the labeled data is calculated using the cross entropy loss, and the SGD optimizer is used for parameter update optimization. The auxiliary model parameters are updated by EMA in each iteration; 4) When using unlabeled data, significant Mixup enhancement is performed between the two images. The enhanced images are sent to the main model (i.e., the first age classification model) to calculate the age prediction category; the two images before enhancement are sent to the auxiliary model (i.e., the second age classification model) to output the age prediction results. If the scores of a certain category predicted by the two images are both greater than the threshold (the default is 0.4), the category is used as the respective pseudo-label, and the augmented category label is calculated in the same way as the significant Mixup enhancement, and the cross entropy loss is used to calculate with the main model prediction; 5) When the loss value is lower than the set threshold or the number of iterations reaches the maximum value, the training is stopped and the main model is used for age prediction.
[0069] As the model is iteratively trained, EMA continuously updates the model and then continuously updates the pseudo-labels to improve the accuracy of the pseudo-labels and reduce the interference caused by error accumulation.
[0070] The embodiment of the present application proposes a face age classification method based on saliency enhancement by combining saliency analysis and self-supervised learning. The method effectively utilizes unlabeled data and labeled data to generate high-quality pseudo labels and enhanced samples, thereby significantly improving the age classification accuracy of the model.
[0071] See also Figure 6 , is a flow chart of a recognition method for face age recognition provided in Example 6 of the present application. The above-mentioned age recognition model training method can be applied to Figure 1 The server in the server, the computer device corresponding to the server connects to the client, database, etc. to obtain the corresponding data and process the data accordingly.
[0072] like Figure 6 As shown, the recognition method for face age recognition may include the following steps: Step S601, obtaining an image to be recognized.
[0073] Step S602: Use the first age classification model trained by the age recognition model training method to classify the image to be recognized, and obtain an age classification result corresponding to the image to be recognized.
[0074] In the embodiment of the present application, in N iterations, the labeled image is input into the first age classification model to obtain the first age classification result, the parameters of the first age classification model are updated according to the first age classification result and the age label, and the updated first age classification model is obtained. In M iterations, the unlabeled image is input into the updated first age classification model to obtain the second age classification result, the unlabeled image is input into the updated second age classification model to obtain the third age classification result, the updated first age classification model is updated according to the second age classification result and the third age classification result, and the updated first age classification model is obtained again. The updated first age classification model is used as the first age classification model for looping until the training stop condition is reached to obtain the trained first age classification model, and the trained first age classification model is used to classify the image to be identified to obtain the age classification result corresponding to the image to be identified. Among them, the age classification model is trained using the unlabeled data and the labeled data, and the model parameters are updated respectively with the age label and the pseudo label of the unlabeled data identified by the model, and self-supervised learning is effectively performed by accurately constructing pseudo labels, thereby significantly improving the age classification accuracy of the model.
[0075] Corresponding to the age recognition model training method in the above embodiment, Figure 7 The structural block diagram of the age recognition model training device provided in the seventh embodiment of the present application is shown. The age recognition model training device can be applied to Figure 1 The server in the embodiment of the present invention is connected to the client, database, etc., to obtain corresponding data and process the data accordingly. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0076] See also Figure 7 , the age recognition model training device comprises: A data acquisition module 71, configured to acquire a labeled data set and an unlabeled data set, wherein the labeled data set includes at least one labeled image and a corresponding age label, and the unlabeled data set includes at least one unlabeled image; The labeled image training module 72 is used to input the labeled image into the first age classification model in N iterations to obtain a first age classification result, and update the parameters of the first age classification model according to the first age classification result and the age label to obtain an updated first age classification model, where N is an integer greater than zero; The unlabeled image training module 73 is used to input the unlabeled image into the updated first age classification model in M iterations to obtain a second age classification result, and input the unlabeled image into the updated second age classification model to obtain a third age classification result, wherein the second age classification model has the same architecture as the first age classification model, and the parameters in the updated second classification age model are calculated based on the parameters of the updated first age classification model, and M is an integer greater than zero; The loop training module 74 is used to update the updated first age classification model according to the second age classification result and the third age classification result to obtain a re-updated first age classification model, use the re-updated first age classification model as the first age classification model, return to execute inputting the labeled image into the first age classification model to obtain the first age classification result, until the training stop condition is reached, and obtain the trained first age classification model.
[0077] Optionally, the unlabeled image training module 73 includes: An augmentation processing unit is used to obtain two unlabeled images from an unlabeled data set, and perform image fusion augmentation on the two unlabeled images to obtain an augmented image; an augmented image classification unit, used for inputting the augmented image into the updated first age classification model to obtain a second age classification result; The classification fusion unit is used to input the two unlabeled images into the updated second age classification model respectively to obtain the classification results of the corresponding unlabeled images, and fuse the classification results of the two unlabeled images to obtain the third age classification result.
[0078] Optionally, the augmentation processing unit includes: A weight acquisition subunit, used to acquire the saliency weights of two unlabeled images; An augmentation processing subunit, used for performing saliency enhancement on the two unlabeled images according to the saliency ratios of the two unlabeled images to obtain augmented images; Classification fusion unit, including: The classification fusion subunit is used to perform significance enhancement on the classification results of the two unlabeled images according to the significance ratios of the two unlabeled images to obtain a third age classification result.
[0079] Optionally, the age recognition model training device further includes: The initial image construction module is used to construct an initial image with the same image size as the unlabeled image for any unlabeled image in the unlabeled dataset before obtaining the saliency ratios of the two unlabeled images. A face recognition module is used to select anchor points from the unlabeled image in the current iteration, add each anchor point to the initial image to obtain a composite image, and use the trained face recognition model to recognize the unlabeled image and the composite image respectively to obtain a first recognition result corresponding to the unlabeled image and a second recognition result corresponding to the composite image; A loop processing module, used for calculating the similarity between the first recognition result and the second recognition result, taking the synthesized image as the initial image, returning to execute selecting anchor points from the unlabeled image, adding each anchor point to the initial image, and obtaining the synthesized image; A saliency determination module, used to stop iteration if the similarity difference after two consecutive iterations is less than a preset difference, and determine that the synthetic image corresponding to the last iteration is a salient image; The weight calculation module is used to perform binarization processing on the saliency image to obtain a binarized saliency image, determine the proportion of pixels with a pixel value of 1 in the binarized saliency image in the unlabeled image as the saliency weight of the corresponding unlabeled image, traverse all unlabeled images, and obtain the saliency weights of all unlabeled images.
[0080] Optionally, the age recognition model training device further includes: A parameter acquisition module, configured to update the parameters of the first age classification model according to the first age classification result and the age label, and after obtaining the updated first age classification model, obtain the current parameters of the second age classification model and the first updated parameters of the updated first age classification model; The second model updating module is used to perform weighted averaging of the current parameters and the first updated parameters to obtain the weighted average result as the second updated parameters, and use the second updated parameters to update the parameters of the second age classification model to obtain an updated second age classification model.
[0081] It should be noted that the information interaction, execution process, etc. between the above-mentioned modules, units, and sub-units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0082] Corresponding to the recognition method for face age recognition in the above embodiment, Figure 8 The structure block diagram of the recognition device for face age recognition provided in the eighth embodiment of the present application is shown. The recognition device for face age recognition can be applied to Figure 1 The server in the embodiment of the present invention is connected to the client, database, etc., to obtain corresponding data and process the data accordingly. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0083] See also Figure 8, the recognition device for face age recognition comprises: An image acquisition module 81 is used to acquire an image to be recognized; The age classification recognition module 82 is used to classify the image to be recognized by using the first age classification model trained by the age recognition model training method of the above embodiments to obtain an age classification result corresponding to the image to be recognized.
[0084] It should be noted that the information interaction, execution process, etc. between the above-mentioned modules, units, and sub-units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0085] Fig. 9 This is a schematic diagram of the structure of a computer device provided in Example 9 of the present application. Fig. 9 As shown, the computer device of this embodiment includes: at least one processor ( Fig. 9 Only one is shown), a memory, and a computer program stored in the memory and executable on at least one processor, wherein when the processor executes the computer program, the steps in any of the above-mentioned age recognition model training methods or recognition method embodiments for face age recognition are implemented.
[0086] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that Fig. 9 This is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, it may also include a network interface, a display screen, and an input device.
[0087] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0088] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory may be the memory of a computer device, and the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be a hard disk of a computer device, and in other embodiments, it may also be an external storage device of the computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Further, the memory may also include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of a computer program, etc. The memory may also be used to temporarily store data that has been output or is to be output.
[0089] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiment can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0090] The present application implements all or part of the processes in the above-mentioned embodiment method, and may also be completed through a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiment when executing the computer program product.
[0091] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0092] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0093] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0094] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0095] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for training an age recognition model, characterized in that: include: Acquire a labeled data set and an unlabeled data set, wherein the labeled data set includes at least one labeled image and a corresponding age label, and the unlabeled data set includes at least one unlabeled image; In N iterations, the annotated image is input into a first age classification model to obtain a first age classification result, and the parameters of the first age classification model are updated according to the first age classification result and the age label to obtain an updated first age classification model, where N is an integer greater than zero; In M iterations, the unlabeled image is input into the updated first age classification model to obtain a second age classification result, and the unlabeled image is input into the updated second age classification model to obtain a third age classification result, wherein the second age classification model has the same architecture as the first age classification model, and the parameters in the updated second classification age model are calculated based on the parameters of the updated first age classification model, and M is an integer greater than zero; According to the second age classification result and the third age classification result, the updated first age classification model is updated to obtain a re-updated first age classification model, the re-updated first age classification model is used as the first age classification model, and the step of inputting the annotated image into the first age classification model is returned to execute to obtain the first age classification result, until the training stop condition is reached to obtain the trained first age classification model.
2. The age recognition model training method according to claim 1, characterized in that: The step of inputting the unlabeled image into the updated first age classification model to obtain a second age classification result, and inputting the unlabeled image into the updated second age classification model to obtain a third age classification result includes: Acquire two unlabeled images from the unlabeled data set, and perform image fusion and augmentation on the two unlabeled images to obtain an augmented image; Inputting the augmented image into the updated first age classification model to obtain a second age classification result; The two unlabeled images are respectively input into the updated second age classification model to obtain classification results of the corresponding unlabeled images, and the classification results of the two unlabeled images are fused to obtain a third age classification result.
3. The age recognition model training method according to claim 2, characterized in that: The step of fusing and augmenting the two unlabeled images to obtain an augmented image includes: Obtaining the saliency ratios of the two unlabeled images; According to the saliency weights of the two unlabeled images, saliency enhancement is performed on the two unlabeled images to obtain augmented images; The step of fusing the classification results of the two unlabeled images to obtain a third age classification result includes: According to the significance proportions of the two unlabeled images, the classification results of the two unlabeled images are saliency enhanced to obtain a third age classification result.
4. The age recognition model training method according to claim 3, characterized in that: Before obtaining the saliency ratios of the two unlabeled images, the method further includes: For any unlabeled image in the unlabeled dataset, construct an initial image with the same image size as the unlabeled image, In the current iteration, anchor points are selected from the unlabeled image, each anchor point is added to the initial image to obtain a composite image, and the unlabeled image and the composite image are respectively recognized using the trained face recognition model to obtain a first recognition result corresponding to the unlabeled image and a second recognition result corresponding to the composite image; Calculating the similarity between the first recognition result and the second recognition result, taking the synthesized image as the initial image, returning to execute the step of selecting anchor points from the unlabeled image, and adding each anchor point to the initial image to obtain a synthesized image; If the similarity difference after two consecutive iterations is less than the preset difference, the iteration is stopped, and the synthetic image corresponding to the last iteration is determined to be the salient image; The saliency image is binarized to obtain a binarized saliency image, and the proportion of pixels with a pixel value of 1 in the binarized saliency image in the unlabeled image is determined as the saliency proportion of the corresponding unlabeled image, and all unlabeled images are traversed to obtain the saliency proportions of all unlabeled images.
5. The age recognition model training method according to any one of claims 1 to 4, characterized in that: After updating the parameters of the first age classification model according to the first age classification result and the age label to obtain an updated first age classification model, the method further includes: Obtaining current parameters of the second age classification model and first updated parameters of the updated first age classification model; A weighted average is performed on the current parameter and the first updated parameter to obtain a weighted average result as a second updated parameter. The second updated parameter is used to update the parameters of the second age classification model to obtain an updated second age classification model.
6. A method for face age recognition, characterized in that: include: Obtain an image to be recognized; The image to be identified is classified using the trained first age classification model obtained by executing the age recognition model training method as described in any one of claims 1 to 5 to obtain an age classification result corresponding to the image to be identified.
7. An age recognition model training device, characterized in that: include: A data acquisition module, used to acquire a labeled data set and an unlabeled data set, wherein the labeled data set includes at least one labeled image and a corresponding age label, and the unlabeled data set includes at least one unlabeled image; a labeled image training module, configured to input the labeled image into a first age classification model in N iterations to obtain a first age classification result, and update the parameters of the first age classification model according to the first age classification result and the age label to obtain an updated first age classification model, where N is an integer greater than zero; an unlabeled image training module, for inputting the unlabeled image into the updated first age classification model in M iterations to obtain a second age classification result, and inputting the unlabeled image into the updated second age classification model to obtain a third age classification result, wherein the second age classification model has the same architecture as the first age classification model, and the parameters in the updated second classification age model are calculated based on the parameters of the updated first age classification model, and M is an integer greater than zero; A cyclic training module is used to update the updated first age classification model according to the second age classification result and the third age classification result to obtain a re-updated first age classification model, use the re-updated first age classification model as the first age classification model, return to execute the step of inputting the labeled image into the first age classification model to obtain the first age classification result, until the training stop condition is reached, and the trained first age classification model is obtained.
8. A recognition device for face age recognition, characterized in that: include: An image acquisition module, used for acquiring an image to be recognized; An age classification recognition module is used to classify the image to be recognized using the first age classification model trained by the age recognition model training method as described in any one of claims 1 to 5 to obtain an age classification result corresponding to the image to be recognized.
9. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the age recognition model training method as described in any one of claims 1 to 5 or the recognition method for face age recognition as described in claim 6 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the age recognition model training method as described in any one of claims 1 to 5, or the recognition method for face age recognition as described in claim 6.
Citation Information
Patent Citations
Age recognition method and device and training method and device of age recognition model
CN112070060A
Target detection method and device, electronic equipment and storage medium
CN113298159A
Digital picture classification method and system based on collaborative semi-supervised convolutional neural network
CN113743474A
Image classification method and system based on meta-learning embedded semi-supervised learning
CN114821204A
Efficient intelligent pathological diagnosis system and method based on semi-supervised mean teacher model
CN117174297A