Optimization of training methods, image processing methods, devices, equipment and media

By iteratively training and merging parameters in the face recognition and attribute classification sub-models, the problem of model performance degradation in multi-task learning is solved, the overall recognition accuracy and classification precision are improved, and better overall performance is achieved.

CN119810883BActive Publication Date: 2025-10-28SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411814859.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-10-28
Estimated Expiration
2044-12-09

AI Technical Summary

Technical Problem

Existing multi-task learning methods suffer from task conflicts, overfitting, and issues with loss function weight settings in face recognition and face attribute classification, leading to a decline in overall model performance.

Method used

The face recognition sub-model and attribute classification sub-model in the preset model are trained iteratively. The parameters are updated using triplet loss and cross-entropy loss. After N iterations, the parameters are merged to form global parameters, which replace the sub-model parameters until the preset conditions are met.

Benefits of technology

It improves the accuracy and robustness of face recognition and attribute classification, enhances the overall performance and generalization ability of the model, and achieves mutual promotion between face recognition and attribute classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810883B_ABST
    Figure CN119810883B_ABST
Patent Text Reader

Abstract

This application relates to the field of image processing technology, and particularly to an optimized training method, image processing method, apparatus, device, and medium. The method uses a pre-defined face recognition sub-model and an attribute classification sub-model to process each first image accordingly. In N iterations, the corresponding model is trained based on the processing results. A global parameter is calculated using the parameters of each sub-model after N iterations of training, replacing the parameters of all sub-models. Through iterative training, a trained face recognition sub-model and a trained attribute classification sub-model are obtained. During the iteration process, the two sub-models simultaneously process the same image and are trained independently. Finally, through a global parameter update, the final model retains both face recognition and attribute classification performance. The final model can learn features from other tasks, thus improving overall performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to an optimization training method, image processing method, apparatus, device and medium. Background Technology

[0002] With the rapid development of artificial intelligence technology, facial recognition and facial attribute classification (such as gender, age, race, and emotion) have been widely applied in various fields, including security monitoring, social media, personalized advertising, and smart homes. Traditional facial recognition methods typically rely on specially designed feature extractors and classifiers. While these methods perform well on specific tasks, they often fail to fully utilize rich contextual information. Furthermore, attribute classification tasks are usually treated as independent problems, lacking support for facial recognition tasks, leading to overall performance degradation.

[0003] Research shows that multi-task learning (MTL) can improve performance across different tasks by learning shared features. By processing face recognition and attribute classification in parallel, models can learn richer and more discriminative feature representations, thereby enhancing their adaptability to different tasks. However, existing MTL methods have limitations in parameter updates and model integration, failing to fully realize the synergistic effect between tasks.

[0004] Traditional multi-task training methods typically employ the simple approach of adding task heads to train different tasks, especially in scenarios involving face recognition and facial attribute classification. While this method can introduce additional functionality to face recognition models to some extent, such as attribute classification (e.g., gender, age, ethnicity), it often leads to a decrease in classification accuracy in practical applications. This phenomenon can be attributed to several factors, including task conflict, overfitting, and issues with the weighting of the loss function.

[0005] Therefore, optimizing the model architecture and training process to avoid performance degradation of individual tasks in multi-task training affecting the overall performance of the model when it is used has become an urgent problem to be solved. Summary of the Invention

[0006] In view of this, embodiments of this application provide an optimized training method, image processing method, apparatus, device, and medium to address the problem of how to optimize model architecture and training process to avoid the performance degradation of individual tasks in a multi-task trained model affecting the overall performance of the model when it is used.

[0007] In a first aspect, embodiments of this application provide an optimized training method, including:

[0008] Obtain a training set consisting of first images for training, wherein the training set also includes classification labels for the attribute classification corresponding to each of the first images;

[0009] In one iteration, face recognition is performed on each first image using the face recognition sub-model in the preset model to obtain the corresponding target recognition result. Then, attribute classification is performed on each first image using the attribute classification sub-model in the preset model to obtain the corresponding target classification result.

[0010] Based on the target recognition result corresponding to each first image, the parameters of the face recognition sub-model are updated; based on the target classification result and corresponding classification label corresponding to each first image, the parameters of the attribute classification sub-model are updated.

[0011] After N iterations, the first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model are obtained. Based on the first parameter and the second parameter, the current global parameters are updated to obtain the updated global parameters, where N is an integer greater than zero.

[0012] The first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model are replaced with the updated global parameters. Then, the process of performing face recognition on each first image in one iteration using the face recognition sub-model in the preset model is returned to obtain the corresponding target recognition result until the preset conditions are met, thus obtaining the trained face recognition sub-model and the trained attribute classification sub-model.

[0013] Secondly, embodiments of this application provide an image processing method, including:

[0014] Obtain the image to be processed;

[0015] When performing face recognition on the image to be processed, the image to be processed is input into the trained face recognition sub-model obtained after executing the optimization training method described in the first aspect, and the first processing result is output; or

[0016] When classifying the attributes of the image to be processed, the image to be processed is input into the trained attribute classification sub-model obtained after the optimization training method described in the first aspect is executed, and the second processing result is output.

[0017] Thirdly, an optimized training device according to an embodiment of this application includes:

[0018] The first acquisition module is used to acquire a training set consisting of first images for training, wherein the training set also includes classification labels for the attribute classification corresponding to each first image;

[0019] The image processing module is used to perform face recognition on each first image in one iteration using the face recognition sub-model in the preset model to obtain the corresponding target recognition result, and to perform attribute classification on each first image using the attribute classification sub-model in the preset model to obtain the corresponding target classification result.

[0020] The sub-module parameter update module is used to update the parameters of the face recognition sub-model according to the target recognition result corresponding to each first image, and to update the parameters of the attribute classification sub-model according to the target classification result and the corresponding classification label corresponding to each first image.

[0021] The global parameter calculation module is used to obtain the first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model after N iterations, and update the current global parameters according to the first parameter and the second parameter to obtain the updated global parameters, where N is an integer greater than zero;

[0022] The iterative training module is used to replace the first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model with the updated global parameters, and then return to execute the process of performing face recognition on each of the first images in one iteration using the face recognition sub-model in the preset model to obtain the corresponding target recognition result, until the preset conditions are met, and then obtaining the trained face recognition sub-model and the trained attribute classification sub-model.

[0023] Fourthly, embodiments of this application provide an image processing apparatus, comprising:

[0024] The second acquisition module is used to acquire the image to be processed;

[0025] The face recognition processing module is used to, when performing face recognition on the image to be processed, input the image to be processed into a trained face recognition sub-model obtained after executing the optimization training method described in the first aspect, and output a first processing result; or

[0026] The attribute classification processing module is used to input the image to be processed into the trained attribute classification sub-model obtained after the optimization training method described in the first aspect when performing attribute classification on the image to be processed, and output the second processing result.

[0027] Fifthly, embodiments of this application provide a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the optimization training method as described in the first aspect, or the image processing method as described in the second aspect.

[0028] In a sixth aspect, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the optimization training method as described in the first aspect, or the image processing method as described in the second aspect.

[0029] The beneficial effects of this application embodiment compared with the prior art are as follows: This application obtains a training set composed of first images for training, the training set also includes classification labels for attribute classification corresponding to each first image. In one iteration, face recognition is performed on each first image through the face recognition sub-model in the preset model to obtain the corresponding target recognition result. Attribute classification is performed on each first image through the attribute classification sub-model in the preset model to obtain the corresponding target classification result. The parameters of the face recognition sub-model are updated according to the target recognition result corresponding to each first image. The parameters of the face recognition sub-model are updated according to the target classification result and the corresponding classification label for each first image. The parameters of the attribute classification sub-model are updated. After N iterations, the first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model are obtained. Based on the first parameter and the second parameter, the current global parameters are updated to obtain the updated global parameters. N is an integer greater than zero. The updated global parameters are used to replace the first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model. The process returns to the beginning. In one iteration, the face recognition sub-model in the preset model is used to perform face recognition on each of the first images to obtain the corresponding target recognition result. This process continues until the preset conditions are met, resulting in the trained face recognition sub-model and the trained attribute classification sub-model.

[0030] Each first image is processed according to the face recognition sub-model and attribute classification sub-model in the preset model. In N iterations, the corresponding model is trained according to the corresponding processing results. A global parameter is calculated based on the parameters of each sub-model after N iterations of training, and the parameters of all sub-models are replaced. The trained face recognition sub-model and the trained attribute classification sub-model are obtained through iterative training. The two sub-models process the same image simultaneously and are trained independently during the iteration process. Finally, the global parameter is updated so that the final model can retain the performance of both face recognition and attribute classification. The final model can learn the features of other tasks, thus improving the overall performance. Attached Figure Description

[0031] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0032] Figure 1 This is a schematic diagram of an application environment for an optimization training method or image processing method provided in Embodiment 1 of this application;

[0033] Figure 2 This is a flowchart illustrating an optimized training method provided in Embodiment 2 of this application;

[0034] Figure 3 This is a schematic diagram of the structure of an optimized training model provided in Embodiment 2 of this application;

[0035] Figure 4 This is a flowchart illustrating an optimized training method provided in Embodiment 3 of this application;

[0036] Figure 5 This is a schematic flowchart of an image processing method provided in Embodiment 4 of this application;

[0037] Figure 6 This is a schematic diagram of the structure of an optimized training device provided in Embodiment 5 of this application;

[0038] Figure 7 This is a schematic diagram of the structure of an image processing device provided in Embodiment Six of this application;

[0039] Figure 8 This is a schematic diagram of the structure of a computer device provided in Embodiment 7 of this application. Detailed Implementation

[0040] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0041] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0042] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0043] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0044] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0045] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0046] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence 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 that knowledge to obtain optimal results.

[0047] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0048] It should be understood that the sequence number of each step in the following embodiments does not imply 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 this application.

[0049] To illustrate the technical solution of this application, specific embodiments are described below.

[0050] The optimization training method and image processing method provided in Embodiment 1 of this application can be applied to, for example, Figure 1 In the application environment, both the optimization training method and the image processing method can be applied to the server. The server is used to deploy the models corresponding to the optimization training method and the image processing method. The model corresponding to the optimization training method is an untrained model, which is trained by acquiring image data from the client or the database. The model corresponding to the image processing method is a model trained using the optimization training method, which is used to acquire image data from the client or the database to perform face recognition or attribute classification.

[0051] The client devices include, but are not limited to, handheld computers, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, server-side computer equipment, and personal digital assistants (PDAs). The server can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0052] See Figure 2 This is a flowchart illustrating an optimized training method provided in Embodiment 2 of this application. The optimized training method is applied to... Figure 1 The server-side in [the context]. For example... Figure 2 As shown, the optimized training method may include the following steps:

[0053] Step S201: Obtain the training set consisting of the first image used for training.

[0054] The training set also includes classification labels for the attribute classification corresponding to each first image. The first image includes, but is not limited to, images containing faces; that is, the first image may contain images without faces, which can be used as negative or invalid samples during training. Each first image in the training set corresponds to an attribute classification result, i.e., a classification label, used for supervision during subsequent training on attribute classification.

[0055] In one embodiment, the first image described above can also be used for supervised training when training for face recognition. In this case, it is necessary to set annotations for face recognition in the training set. Of course, this embodiment mainly uses unsupervised training, therefore, the training set is not limited to include annotations corresponding to face recognition results.

[0056] In step S202, during one iteration, face recognition is performed on each first image using the face recognition sub-model in the preset model to obtain the corresponding target recognition result. Then, attribute classification is performed on each first image using the attribute classification sub-model in the preset model to obtain the corresponding target classification result.

[0057] The preset model includes a face recognition sub-model and an attribute classification sub-model. The face recognition sub-model is used to recognize faces in images. For example, it locates the face in the image and then obtains the face features. The attribute classification sub-model is used to classify the attributes of the image. For example, the image attributes are defined as 0 and 1, where 0 indicates that the image does not contain a human body and 1 indicates that the image contains a human body. The final classification result of the image is 1 or 0.

[0058] In this application, two identical deep learning network structures are used for face recognition and attribute classification tasks, respectively. For example, the face recognition model and the attribute classification model use convolutional neural networks (CNNs).

[0059] Step S203: Update the parameters of the face recognition sub-model according to the target recognition result corresponding to each first image, and update the parameters of the attribute classification sub-model according to the target classification result and corresponding classification label corresponding to each first image.

[0060] Specifically, after obtaining the target recognition result, the parameters of the face recognition sub-model are updated and adjusted in reverse by calculating the loss, thus completing one iteration of the face recognition sub-model. Similarly, after obtaining the target classification result, the loss is calculated for all target classification results and the corresponding target classification results, thereby updating and adjusting the parameters of the attribute classification sub-model, thus completing one iteration of the attribute classification sub-model.

[0061] like Figure 3 The diagram shown is a structural schematic of an optimized training model provided in Embodiment 2 of this application. The first image is input into the modules corresponding to face feature extraction and attribute feature extraction for feature extraction. The results of feature extraction are then fed to the corresponding fully connected layers and the corresponding losses are output. The parameters of the feature extraction part are adjusted in reverse according to the loss, thereby forming an iteration.

[0062] For example, for face recognition models, triplet loss (TL) is used to optimize the similarity of feature representations; while for attribute classification models, cross-entropy loss (CEL) is used to optimize classification accuracy. The two models can use different optimizers (such as Adam or SGD) to meet the needs of their respective tasks.

[0063] Optionally, the parameters of the face recognition sub-model are updated based on the target recognition result corresponding to each first image, including:

[0064] For any first image, based on the triplet loss and combined with the target recognition result of the first image, determine the triplet loss value corresponding to the first image;

[0065] Traverse all first images to obtain the triplet loss value corresponding to each first image, and sum the triplet loss values ​​corresponding to all first images to obtain the face recognition loss.

[0066] The parameters of the face recognition sub-model are updated based on the face recognition loss.

[0067] Among them, training using triplet loss is unsupervised training. When processing images, it can obtain anchor samples: representing samples to be classified, positive samples: samples similar to anchor samples, and negative samples: samples dissimilar to anchor samples.

[0068] The triplet loss is as follows:

[0069] L=max{d(a,p)-d(a,n)+ margin,0}

[0070] Where d(a,p) represents the distance metric between the anchor sample and the positive sample, d(a,n) represents the distance metric between the anchor sample and the negative sample, and margin represents the margin parameter used to control the distance difference between positive and negative samples. Using this triplet loss eliminates the need for supervised training, reducing the difficulty of constructing training samples during model training.

[0071] Optionally, the parameters of the attribute classification sub-model are updated based on the target classification result and corresponding classification label for each first image, including:

[0072] For any first image, calculate the cross-entropy loss between the target classification result and the corresponding classification label of the first image to obtain the cross-entropy loss value of the first image;

[0073] Traverse all first images to obtain the cross-entropy loss value corresponding to each first image, and sum the cross-entropy loss values ​​corresponding to all first images to obtain the attribute classification loss.

[0074] The parameters of the attribute classification sub-model are updated based on the attribute classification loss.

[0075] The cross-entropy loss is calculated by combining the target classification result with the corresponding classification label. The cross-entropy loss values ​​of all images are then summed to determine the attribute classification loss. This loss is then used to update the parameters of the attribute classification sub-model. Supervised training using cross-entropy loss yields good training results.

[0076] Step S204: After N iterations, obtain the first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model. Based on the first and second parameters, update the current global parameters to obtain the updated global parameters.

[0077] Where N is an integer greater than zero.

[0078] In each training iteration, the parameters of the two sub-models are updated independently. After every N iterations, the parameters of the backbone networks of the two sub-models are merged to obtain the updated global parameters.

[0079] After the global model is updated, the parameters of the two trained sub-models are replaced with the global model parameters.

[0080] Step S205: Replace the first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model with the updated global parameters, and return to the execution. In one iteration, face recognition is performed on each first image through the face recognition sub-model in the preset model to obtain the corresponding target recognition result until the preset conditions are met, and then the trained face recognition sub-model and the trained attribute classification sub-model are obtained.

[0081] In this process, when the parameters of the global model are updated, the two base models continue training using the updated parameters. Finally, through iterative training, a trained face recognition sub-model and a trained attribute classification sub-model are obtained. The trained face recognition sub-model can perform face recognition on images, and the trained attribute classification sub-model can perform attribute classification on images.

[0082] Through this parameter substitution mechanism, a tighter coupling is achieved between the two tasks. In this process, the face recognition model not only focuses on identifying different face categories but also learns features related to face attributes using shared parameters, thereby improving classification accuracy and robustness. Simultaneously, the attribute classification model can obtain richer feature representations from the face recognition model, making it more accurate in recognizing and distinguishing different attributes. In this way, the models can mutually promote and complement each other in face recognition and attribute classification, ultimately achieving superior overall performance.

[0083] This coupling mechanism effectively leverages the advantages of multi-task learning, not only enabling the model to perform better on its individual tasks but also enhancing its overall generalization ability. As training continues, this parameter substitution and coupled learning strategy will help the model gradually achieve higher recognition accuracy and attribute classification precision through continuous optimization, thereby realizing a more comprehensive face recognition solution.

[0084] In this embodiment, a face recognition sub-model and an attribute classification sub-model in a preset model are used to process each first image accordingly. In N iterations, the corresponding model is trained based on the processing results. A global parameter is calculated using the parameters of each sub-model after N iterations of training to replace the parameters of all sub-models. Through iterative training, a trained face recognition sub-model and a trained attribute classification sub-model are obtained. The two sub-models process the same image simultaneously during the iteration process and are trained independently. Finally, through the global parameter update, the final model can retain both the performance of face recognition and the performance of attribute classification. The final model can learn the features of other tasks, thereby improving the overall performance.

[0085] See Figure 4 This is a flowchart illustrating an optimized training method provided in Embodiment 3 of this application. Figure 3 As shown, step S204 above, which updates the current global parameters based on the first and second parameters to obtain the updated global parameters, may include the following steps:

[0086] Step S401: Calculate the weighted average of the first parameter and the second parameter to obtain the weighted average parameter.

[0087] Step S402: Calculate the weighted average parameter and the current global parameter by performing a weighted average to obtain the updated global parameter.

[0088] Specifically, the adoption numbers in the backbone networks of the two sub-models are weighted and merged. The merged parameters are updated with global network parameters using an exponential moving average (EMA), as follows:

[0089]

[0090] In the formula, express and The weighted summation result, i.e., the weighted average parameter, These represent the parameters of the face feature extraction backbone of the face recognition sub-model. This represents the parameters of the attribute feature extraction backbone in the attribute classification sub-model. α represents the weighting coefficient, which can be an empirical value of 0.5 or based on... and Make adaptive adjustments. This indicates an update to global parameters. This indicates the current global parameter (i.e., the updated global parameter after the last iteration), which is updated using the EMA method. β is the EMA weighting value; for example, β can be set to 0.9-0.999.

[0091] Optionally, a weighted average is calculated by taking the first parameter and the second parameter to obtain a weighted average parameter, including:

[0092] Obtain the first loss value of the face recognition sub-model when the first parameter is obtained, and the second loss value of the attribute classification sub-model when the second parameter is obtained;

[0093] Based on the first loss value and the second loss value, determine the first weight corresponding to the first parameter and the second weight corresponding to the second parameter;

[0094] Multiply the first weight by the first parameter to obtain the first multiplication result, and multiply the second weight by the second parameter to obtain the second multiplication result;

[0095] The weighted average parameter is obtained by averaging the results of the first and second multiplications.

[0096] The integration of parameters from the two sub-models can be achieved using a simple weighted average method. In this embodiment, the parameters are weighted according to the performance of each model on the current task, thereby improving the performance of the global model.

[0097] In this embodiment, the combination of multi-task learning and EMA strategy can achieve mutual performance improvement in two tasks. Studies have shown that when performing face recognition, the model can utilize the features learned from attribute classification to improve recognition accuracy. In addition, the EMA strategy helps reduce training fluctuations and makes the model more robust to different tasks and environments. In particular, when the dataset is noisy or imbalanced, the stability of the model will be further enhanced.

[0098] See Figure 5This is a flowchart illustrating an image processing method provided in Embodiment 4 of this application. The image processing method is applied to... Figure 1 The server-side in [the context]. For example... Figure 5 As shown, the image processing method may include the following steps:

[0099] Step S501: Obtain the image to be processed.

[0100] Step S502: When performing face recognition on the image to be processed, the image to be processed is input into the trained face recognition sub-model obtained after the above-mentioned optimization training method is executed, and the first processing result is output.

[0101] Step S503: When classifying the attributes of the image to be processed, input the image to be processed into the trained attribute classification sub-model obtained after the above-mentioned optimization training method is executed, and output the second processing result.

[0102] The image processing method uses a model trained using the aforementioned optimization training method. In actual use, the preset model includes a face recognition sub-model and an attribute classification sub-model. The two sub-models are trained by mutual learning. However, in practice, the two sub-models are used independently. That is, the trained face recognition sub-model is used to perform face recognition processing on the image, and the trained attribute classification sub-model is used to perform attribute classification processing on the image.

[0103] Specifically, the face recognition sub-model is deployed on the server. When performing a face recognition task, the first processing result, i.e., the face recognition result, is obtained by performing face recognition processing on the acquired image to be processed. The attribute classification sub-model is deployed on the server. When performing an attribute classification task, the second processing result, i.e., the attribute classification result, is obtained by performing attribute classification processing on the acquired image to be processed.

[0104] In this embodiment, a face recognition sub-model and an attribute classification sub-model in a preset model are used to process each first image accordingly. In N iterations, the corresponding model is trained based on the processing results. A global parameter is calculated using the parameters of each sub-model after N iterations of training to replace the parameters of all sub-models. Through iterative training, a trained face recognition sub-model and a trained attribute classification sub-model are obtained. The two sub-models process the same image simultaneously during the iteration process and are trained independently. Finally, through the global parameter update, the final model can retain both the performance of face recognition and the performance of attribute classification. The final model can learn the features of other tasks, thereby improving the overall performance.

[0105] Corresponding to the optimized training method in the above embodiments, Figure 6The diagram shows a structural block diagram of the optimized training device provided in Embodiment 5 of this application. The optimized training device can be used for the above-mentioned... Figure 1 The server-side component is shown. For ease of explanation, only the parts relevant to the embodiments of this application are shown.

[0106] See Figure 6 The optimized training device includes:

[0107] The first acquisition module 61 is used to acquire a training set consisting of the first images used for training. The training set also includes classification labels for the attribute classification of each first image.

[0108] The image processing module 62 is used to perform face recognition on each first image in one iteration using the face recognition sub-model in the preset model to obtain the corresponding target recognition result, and to perform attribute classification on each first image using the attribute classification sub-model in the preset model to obtain the corresponding target classification result.

[0109] The sub-module parameter update module 63 is used to update the parameters of the face recognition sub-model according to the target recognition result corresponding to each first image, and to update the parameters of the attribute classification sub-model according to the target classification result and the corresponding classification label corresponding to each first image.

[0110] The global parameter calculation module 64 is used to obtain the first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model after N iterations, and update the current global parameters based on the first and second parameters to obtain the updated global parameters, where N is an integer greater than zero.

[0111] The iterative training module 65 is used to replace the first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model with updated global parameters. It returns to the execution in one iteration. Through the face recognition sub-model in the preset model, face recognition is performed on each first image to obtain the corresponding target recognition result until the preset conditions are met, and then the trained face recognition sub-model and the trained attribute classification sub-model are obtained.

[0112] Optionally, submodule parameter update module 63 includes:

[0113] The triplet loss calculation unit is used to determine the triplet loss value of any first image based on the triplet loss and the target recognition result of the first image.

[0114] The face recognition loss unit is used to traverse all first images, obtain the triplet loss value corresponding to all first images, and sum the triplet loss values ​​corresponding to all first images to obtain the face recognition loss.

[0115] The face recognition parameter update unit is used to update the parameters of the face recognition sub-model based on the face recognition loss.

[0116] Optionally, submodule parameter update module 63 includes:

[0117] The cross-entropy loss calculation unit is used to calculate the cross-entropy loss between the target classification result and the corresponding classification label for any first image, and obtain the cross-entropy loss value of the first image.

[0118] The attribute classification loss unit is used to traverse all first images, obtain the cross-entropy loss value corresponding to all first images, and sum the cross-entropy loss values ​​corresponding to all first images to obtain the attribute classification loss.

[0119] The attribute classification parameter update unit is used to update the parameters of the attribute classification sub-model based on the attribute classification loss.

[0120] Optionally, the global parameter calculation module 64 includes:

[0121] The parameter weighted average unit is used to calculate the weighted average of the first parameter and the second parameter to obtain the weighted average parameter.

[0122] The global parameter update unit is used to calculate the weighted average of the weighted average parameter and the current global parameter to obtain the updated global parameter.

[0123] Optionally, the parameter-weighted average unit includes:

[0124] The loss acquisition subunit is used to acquire the first loss value of the face recognition submodel when the first parameter is obtained, and the second loss value of the attribute classification submodel when the second parameter is obtained.

[0125] The weight calculation subunit is used to determine the first weight corresponding to the first parameter and the second weight corresponding to the second parameter based on the first loss value and the second loss value.

[0126] The product operation subunit is used to multiply the first weight by the first parameter to obtain the first multiplication result, and to multiply the second weight by the second parameter to obtain the second multiplication result;

[0127] The parameter weighted average sub-unit is used to average the first multiplication result and the second multiplication result to obtain the weighted average parameter.

[0128] It should be noted that the information interaction and execution process between the above modules are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.

[0129] Corresponding to the image processing method in the above embodiments, Figure 7 This diagram illustrates a structural block diagram of an image processing apparatus provided in Embodiment Six of this application. The image processing apparatus can be used for the above-described... Figure 1 The server-side component is shown. For ease of explanation, only the parts relevant to the embodiments of this application are shown.

[0130] See Figure 7 The image processing includes:

[0131] The second acquisition module 71 is used to acquire the image to be processed;

[0132] The face recognition processing module 72 is used to input the image to be processed into the trained face recognition sub-model obtained after executing the above-mentioned optimized training method, and output the first processing result when performing face recognition on the image to be processed; or

[0133] The attribute classification processing module 73 is used to input the image to be processed into the trained attribute classification sub-model obtained after the above-mentioned optimization training method is executed when classifying the attributes of the image to be processed, and output the second processing result.

[0134] It should be noted that the information interaction and execution process between the above modules are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.

[0135] Figure 8 This is a schematic diagram of the structure of a computer device provided in Embodiment Seven of this application. Figure 8 As shown, the computer device of this embodiment includes: at least one processor ( Figure 8 (Only one is shown in the image), a memory, and a computer program stored in the memory and executable on a processor, wherein at least one processor executes the computer program to implement the steps in any of the above-described optimization training methods or image processing method embodiments.

[0136] This computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 8 The examples of computer devices are merely examples and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown in the illustration, or combinations of certain components, or different components, such as network interfaces, displays, and input devices.

[0137] The processor referred to can be a CPU, but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0138] Memory includes readable storage media, internal memory, etc., wherein internal memory can be the RAM of a computer device, providing an environment for the operation of the operating system and computer-readable instructions stored in the readable storage media. The readable storage media can be the hard drive of a computer device, or in other embodiments, it can be an external storage device of the computer device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, memory can include both internal storage units and external storage devices of the computer device. Memory is used to store the operating system, applications, bootloader, data, and other programs, such as program code for computer programs. Memory can also be used to temporarily store data that has been output or will be output.

[0139] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. If the integrated unit is implemented as 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, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0140] The implementation of all or part of the processes in the methods of the above embodiments can also be accomplished by a computer program product. When the computer program product is run on a computer device, it enables the computer device to execute the steps in the above method embodiments.

[0141] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0142] Those skilled in the art will recognize that the units and algorithm steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0143] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0144] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0145] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. An optimization training method, characterized in that, include: Obtain a training set consisting of first images for training, wherein the training set also includes classification labels for the attribute classification corresponding to each of the first images; In one iteration, face recognition is performed on each first image using the face recognition sub-model in the preset model to obtain the corresponding target recognition result. Then, attribute classification is performed on each first image using the attribute classification sub-model in the preset model to obtain the corresponding target classification result. Based on the target recognition result corresponding to each first image, the parameters of the face recognition sub-model are updated; based on the target classification result and corresponding classification label corresponding to each first image, the parameters of the attribute classification sub-model are updated. After N iterations, the first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model are obtained. Based on the first parameter and the second parameter, the current global parameters are updated to obtain the updated global parameters, where N is an integer greater than zero. The first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model are replaced with the updated global parameters. Then, the process of performing face recognition on each first image in one iteration using the face recognition sub-model in the preset model is returned to obtain the corresponding target recognition result until the preset conditions are met, and the trained face recognition sub-model and the trained attribute classification sub-model are obtained. The step of updating the current global parameters based on the first parameter and the second parameter to obtain updated global parameters includes: The first parameter and the second parameter are weighted and averaged to obtain the weighted average parameter. The weighted average parameter and the current global parameter are averaged to obtain the updated global parameter; The step of taking a weighted average of the first parameter and the second parameter to obtain a weighted average parameter includes: Obtain the first loss value of the face recognition sub-model when the first parameter is obtained, and the second loss value of the attribute classification sub-model when the second parameter is obtained; Based on the first loss value and the second loss value, determine the first weight corresponding to the first parameter and the second weight corresponding to the second parameter; Multiply the first weight by the first parameter to obtain the first multiplication result, and multiply the second weight by the second parameter to obtain the second multiplication result; The weighted average parameter is obtained by averaging the first multiplication result and the second multiplication result.

2. The optimized training method according to claim 1, characterized in that, The step of updating the parameters of the face recognition sub-model based on the target recognition result corresponding to each of the first images includes: For any first image, based on the triplet loss and combined with the target recognition result of the first image, the triplet loss value corresponding to the first image is determined; Traverse all first images to obtain the triplet loss value corresponding to each first image, and sum the triplet loss values ​​corresponding to all first images to obtain the face recognition loss. The parameters of the face recognition sub-model are updated based on the face recognition loss.

3. The optimized training method according to claim 1, characterized in that, The step of updating the parameters of the attribute classification sub-model based on the target classification result and corresponding classification label for each of the first images includes: For any first image, calculate the cross-entropy loss between the target classification result and the corresponding classification label of the first image to obtain the cross-entropy loss value of the first image; Traverse all first images to obtain the cross-entropy loss value corresponding to each first image, and sum the cross-entropy loss values ​​corresponding to all first images to obtain the attribute classification loss. The parameters of the attribute classification sub-model are updated based on the attribute classification loss.

4. An image processing method, characterized in that, include: Obtain the image to be processed; When performing face recognition on the image to be processed, the image to be processed is input into the trained face recognition sub-model obtained after executing the optimization training method as described in any one of claims 1 to 3, and the first processing result is output; or When performing attribute classification on the image to be processed, the image to be processed is input into the trained attribute classification sub-model obtained after the optimization training method described in any one of claims 1 to 3, and the second processing result is output.

5. An optimized training device, characterized in that, include: The first acquisition module is used to acquire a training set consisting of first images for training, wherein the training set also includes classification labels for the attribute classification corresponding to each first image; The image processing module is used to perform face recognition on each first image in one iteration using the face recognition sub-model in the preset model to obtain the corresponding target recognition result, and to perform attribute classification on each first image using the attribute classification sub-model in the preset model to obtain the corresponding target classification result. The sub-module parameter update module is used to update the parameters of the face recognition sub-model according to the target recognition result corresponding to each first image, and to update the parameters of the attribute classification sub-model according to the target classification result and the corresponding classification label corresponding to each first image. The global parameter calculation module is used to obtain the first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model after N iterations, and update the current global parameters according to the first parameter and the second parameter to obtain the updated global parameters, where N is an integer greater than zero; The loop training module is used to replace the first parameter of the face recognition sub-model and the second parameter of the attribute classification sub-model with the updated global parameters, and return to execute the process of performing face recognition on each first image in one iteration through the face recognition sub-model in the preset model to obtain the corresponding target recognition result until the preset conditions are met, and then the trained face recognition sub-model and the trained attribute classification sub-model are obtained. The global parameter calculation module includes: The parameter weighted average unit is used to calculate the weighted average of the first parameter and the second parameter to obtain the weighted average parameter. The global parameter update unit is used to calculate the weighted average of the weighted average parameter and the current global parameter to obtain the updated global parameter. The parameter-weighted average unit includes: The loss acquisition subunit is used to acquire the first loss value of the face recognition submodel when the first parameter is obtained, and the second loss value of the attribute classification submodel when the second parameter is obtained; The weight calculation subunit is used to determine the first weight corresponding to the first parameter and the second weight corresponding to the second parameter based on the first loss value and the second loss value. The product operation subunit is used to multiply the first weight by the first parameter to obtain a first multiplication result, and to multiply the second weight by the second parameter to obtain a second multiplication result; The parameter weighted average subunit is used to average the first multiplication result and the second multiplication result to obtain the weighted average parameter.

6. An image processing apparatus, characterized in that, include: The second acquisition module is used to acquire the image to be processed; The face recognition processing module is configured to, when performing face recognition on the image to be processed, input the image to be processed into a trained face recognition sub-model obtained after executing the optimization training method as described in any one of claims 1 to 3, and output a first processing result; or The attribute classification processing module is used to input the image to be processed into the trained attribute classification sub-model obtained after the optimization training method described in any one of claims 1 to 3 when classifying the attributes of the image to be processed, and output the second processing result.

7. 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, it implements the optimization training method as described in any one of claims 1 to 3, or the image processing method as described in claim 4.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the optimization training method as described in any one of claims 1 to 3, or the image processing method as described in claim 4.

Citation Information

Patent Citations

  • Face recognition and attribute classification method based on multi-task convolutional neural network

    CN111814706A

  • Face recognition model training method and device

    CN115631522A