Method, device and storage medium for training a multi-attribute prediction model
By adaptively adjusting the weights of the loss function, the problem of low accuracy in facial attribute analysis of multi-attribute prediction models is solved, achieving more efficient training and more accurate prediction results.
Patent Information
- Application Number
- CN201910439133.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-05-24
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2039-05-24
AI Technical Summary
Existing technologies have low accuracy in predicting multiple attributes in images, especially when dealing with changes in facial perspective, lighting, and expression, where the model performance is poor.
By adaptively adjusting the weights of the loss function, the weights of the loss function of the multi-attribute prediction model are dynamically adjusted based on the difference between the labeled value and the predicted value of each attribute and the number of categories, thus preventing difficult tasks from dominating the training process.
It improves the prediction accuracy of the multi-attribute prediction model, enhances the efficiency of the training process, reduces the dependence on the amount of data, and reduces the risk of overfitting.
Smart Images

Figure CN111985279B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image recognition, and in particular to a multi-attribute prediction model training method and device and storage medium. BACKGROUND
[0002] The goal of face attribute analysis is to predict the face attributes contained in a given face image, including age, gender, race, expression and other information. However, due to changes in face appearance such as face angle, lighting, expression and occlusion, face attribute analysis remains a great challenge. In recent years, with the development of deep learning and convolutional neural networks (CNN), face attribute analysis technology has been widely applied. SUMMARY
[0003] The inventors have found that the related art uses a deep learning method to train a model. However, the model in the related art has poor performance and low prediction accuracy for multi-attribute in an image.
[0004] One technical problem to be solved by embodiments of the present application is how to improve the prediction accuracy of multi-attribute in an image.
[0005] According to a first aspect of some embodiments of the present application, a multi-attribute prediction model training method is provided, including: inputting a training image into a multi-attribute prediction model to obtain a prediction value corresponding to each attribute of an object in the training image, wherein the label value of the training image includes a label value corresponding to each attribute; determining a loss function weight corresponding to each attribute according to the difference between the label value and the prediction value of each attribute, wherein the difference between the label value and the prediction value of each attribute and the corresponding loss function weight are in a negative correlation relationship; determining a total loss function value of the multi-attribute prediction model according to the loss function weight corresponding to each attribute and the difference between the label value and the prediction value of each attribute; and adjusting the parameters of the multi-attribute prediction model according to the total loss function value.
[0006] In some embodiments, the loss function weight corresponding to each attribute is determined according to the difference between the label value and the prediction value of each attribute and the number of categories of each attribute, wherein the number of categories of each attribute and the corresponding loss function weight are in a positive correlation relationship.
[0007] In some embodiments, each attribute has a training image with a labeled value as a valid training image; and the loss function weight corresponding to each attribute is determined according to the difference between the labeled value and the predicted value of each attribute, which comprises: for each attribute of the plurality of attributes, determining a training image with a labeled value of the attribute as a valid image corresponding to the attribute; and determining the loss function weight corresponding to each attribute according to the difference between the labeled value and the predicted value of the valid image corresponding to each attribute.
[0008] In some embodiments, the loss function weight corresponding to each attribute is determined according to the difference between the labeled value and the predicted value of the valid image corresponding to each attribute, which comprises: for each attribute of the plurality of attributes, determining a valid average loss corresponding to the attribute according to the average value of the square of the difference between the labeled value and the predicted value of the corresponding valid image; and determining the loss function weight corresponding to the attribute according to the ratio of the number of categories of the attribute to the valid average loss.
[0009] In some embodiments, the multi-attribute prediction model comprises a feature extraction layer and a plurality of parallel full connection layers, each full connection layer corresponding to one of the plurality of attributes, and each full connection layer being configured to output a predicted value of the attribute corresponding to the full connection layer according to the extraction result of the feature extraction layer.
[0010] In some embodiments, the training method further comprises: inputting the face image into the trained multi-attribute prediction model to obtain the predicted values of the plurality of attributes of the face in the face image.
[0011] In some embodiments, the plurality of attributes comprises at least two of age, gender, race, and expression.
[0012] According to a second aspect of some embodiments of the present application, a training device of a multi-attribute prediction model is provided, which comprises: an input module configured to input a training image into a multi-attribute prediction model to obtain a predicted value corresponding to each attribute of a plurality of attributes of an object in the training image, wherein the labeled value of the training image comprises a labeled value corresponding to each attribute; a weight determination module configured to determine a loss function weight corresponding to each attribute according to the difference between the labeled value and the predicted value of each attribute, wherein the difference between the labeled value and the predicted value of each attribute is negatively correlated with the corresponding loss function weight; a total loss determination module configured to determine a total loss function value of the multi-attribute prediction model according to the loss function weight corresponding to each attribute and the difference between the labeled value and the predicted value of each attribute; and a parameter adjustment module configured to adjust the parameters of the multi-attribute prediction model according to the total loss function value.
[0013] According to a third aspect of some embodiments of the present application, there is provided a device for training a multi-attribute prediction model, comprising: a memory; and a processor coupled to the memory, the processor configured to perform any of the above-mentioned methods for training a multi-attribute prediction model based on instructions stored in the memory.
[0014] According to a fourth aspect of some embodiments of the present application, there is provided a computer-readable storage medium having stored thereon a computer program, wherein the program, when executed by a processor, implements any of the above-mentioned methods for training a multi-attribute prediction model.
[0015] Some embodiments of the above-mentioned application have the following advantages or beneficial effects: the embodiments of the present application can calculate the gap between the predicted value of each attribute and the labeled value according to the predicted value result of the training image used in this iteration in each iteration of the training process, and dynamically adjust the weight of the loss of each attribute in the total loss function value according to the gap. The embodiments of the present application can increase the contribution degree of simple tasks in learning and prevent the network from being dominated by more difficult tasks. Thus, the prediction accuracy of the multi-attribute prediction model is improved.
[0016] Other features and advantages of the present application will become apparent from the following detailed description of illustrative embodiments thereof, which description should be taken in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0018] Figure 1 Flowchart of a method for training a multi-attribute prediction model according to some embodiments of the present application.
[0019] Figure 2 Structure diagram of a multi-attribute prediction model according to some embodiments of the present application.
[0020] Figure 3 Flowchart of a method for determining loss function weights according to some embodiments of the present application.
[0021] Figure 4 Flowchart of a face attribute prediction method according to some embodiments of the present application.
[0022] Figure 5 Structure diagram of a device for training a multi-attribute prediction model according to some embodiments of the present application.
[0023] Figure 6 A structural schematic diagram of a training device for a multi-attribute prediction model according to another embodiment of the present application.
[0024] Figure 7 A structural schematic diagram of a training device for a multi-attribute prediction model according to another embodiment of the present application. DETAILED DESCRIPTION
[0025] The technical solutions in the embodiments of the present application will be clearly and completely described with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way limiting on the application or its applications or uses. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of the present application.
[0026] The relative arrangement, numerical expressions, and numerical values of the components and steps set forth in the embodiments are not limiting on the scope of the present application, unless otherwise specifically stated.
[0027] Meanwhile, it should be understood that the sizes of the various portions shown in the drawings are not drawn in proportion to the actual proportions.
[0028] The techniques, methods, and devices known to those of ordinary skill in the relevant art can not be discussed in detail, but should be considered as part of the authorized description, if appropriate.
[0029] In all examples shown and discussed herein, any specific values should be interpreted as merely illustrative, and not as limiting. Thus, other examples of the example embodiments can have different values.
[0030] It should be noted that similar reference numbers and letters represent similar items in the following drawings, and thus, once an item is defined in one drawing, it need not be discussed further in subsequent drawings.
[0031] The inventors have found through analysis that face attribute analysis based on deep learning needs to simultaneously perform multi-attribute prediction, such as age, gender, and expression, etc. Due to uneven sample distribution in the data set used for training, large differences between multi-attribute categories, and different task difficulties, the learning convergence rates of different attributes in the multi-task learning process are inconsistent, the difficulty levels between tasks are ignored, and the final model performance is relatively poor and difficult to apply in actual scenarios.
[0032] For example, a conventional loss function keeps the loss function weight of each kind of attribute prediction task unchanged during the training process. However, the difficulty and convergence speed of each task are different. For example, age prediction is much more difficult than gender prediction. Therefore, the inventors believe that the loss function weight of different tasks should be automatically adjusted during the training process to adapt to the convergence of each task. In view of this, the inventors propose a multi-attribute learning method with adaptive weight. During the training process, the weight between each task can be adaptively coordinated according to the convergence of different tasks.
[0033] Reference will now be made to the drawings Figure 1 An embodiment of the training method of the multi-attribute prediction model is described.
[0034] Figure 1 A flowchart of the training method of the multi-attribute prediction model according to some embodiments of the present application is shown. As Figure 1 shown, the training method of this embodiment includes steps S102-S108.
[0035] In step S102, the training image is input into the multi-attribute prediction model to obtain the prediction value corresponding to each of the multiple attributes of the object in the training image, wherein the label value of the training image includes a label value corresponding to each of the multiple attributes.
[0036] The multi-attribute prediction model is a neural network model for predicting multiple attributes. For example, it can output the classification results of multiple attributes of an object in an image. For example, it can predict at least two of the age, gender, race, and expression corresponding to a face in a face image.
[0037] In some embodiments, the multi-attribute prediction model includes a feature extraction layer and multiple parallel fully connected layers, each fully connected layer corresponding to one of the multiple attributes, and each fully connected layer being configured to output a prediction value of the attribute corresponding to the fully connected layer based on the extraction result of the feature extraction layer. The structure diagram of the multi-attribute prediction model can be as Figure 2 shown.
[0038] The feature extraction layer can be, for example, a convolutional layer of a convolutional neural network, such as the convolutional neural network VGG (Visual Geometry Group) -16.
[0039] Each fully connected layer can calculate a classification probability score for each attribute. For example, the gender attribute can be considered as a binary classification task, the age attribute can be set as a 101-class classification task (from 0 to 100 years old), and so on. Based on the classification probability score of each attribute, the prediction result of each attribute can be determined.
[0040] In step S104, a loss function weight corresponding to each attribute is determined according to a gap between the labeled value and the predicted value of each attribute, where the gap between the labeled value and the predicted value of each attribute is negatively correlated with the corresponding loss function weight.
[0041] The determined loss function weight is used for the current iteration. In the next iteration, a loss function weight corresponding to each attribute in the next iteration can be determined according to a gap between the labeled value and the predicted value of the attribute of the training image in the next iteration.
[0042] The gap between the labeled value and the predicted value of the attribute reflects the current training difficulty. The greater the current training difficulty of the task, the more it needs to be dynamically suppressed to prevent the model from being dominated by difficult tasks in the training process. Therefore, by making the gap between the labeled value and the predicted value negatively correlated with the corresponding loss function weight, the loss function weight of the attribute can be suppressed when the predicted value of the attribute is greatly different from the labeled value.
[0043] In addition to the gap between the labeled value and the predicted value, the influence of the number of categories of the attribute on the loss function weight can also be considered. In some embodiments, a loss function weight corresponding to each attribute is determined according to a gap between the labeled value and the predicted value of each attribute, and the number of categories of each attribute, where the number of categories of each attribute is positively correlated with the corresponding loss function weight.
[0044] During the training process, the number of categories of the attribute does not change. Therefore, the number of categories can be used as a basis for determining the loss function weight. When the number of categories of the attribute is large, it means that the training task corresponding to the attribute is more difficult than the training tasks corresponding to other attributes under the condition that other conditions remain unchanged, and therefore a larger weight should be assigned to it, which is a weight allocation between attributes. At the same time, the change in the gap between the labeled value and the predicted value generated during the training process dynamically adjusts the loss function weight of the attribute itself, which is a weight adjustment within the attribute. Through the weight allocation between attributes and the weight adjustment within the attribute, the importance of difficult tasks can be reflected in the training process, and the model can be prevented from being completely dominated by difficult tasks.
[0045] In some embodiments, a suppression factor can be used to determine the loss function weight. Formula (1) exemplarily introduces a calculation method of a suppression factor.
[0046]
[0047] In formula (1), j is the identification of the attribute category; σ j is the suppression factor of the jth attribute; κ is a preset parameter for indicating the degree of suppression, κ has a value range of [5, 10], and κ = 7 can achieve a relatively good effect; m is the number of samples; i is the identification of the sample; denotes the label value of the jth attribute of the ith sample; denotes the predicted value of the jth attribute of the ith sample; K j denotes the number of classes of the jth attribute.
[0048] After the inhibition factor is determined, the loss function weight can be calculated by using formula (2).
[0049]
[0050] In formula (2), λ j denotes the loss function weight of the jth attribute; γ is a preset parameter representing the weight change amplitude, and the value range of γ is [0.3, 0.7], and a relatively good effect can be obtained when γ = 0.5. For meanings of other parameters, refer to formula (1).
[0051] In some embodiments, the may also be a vector. It is assumed that the numerical form of the jth attribute of the ith sample is represented as and the kth element in the vector is equal to k , the value of is 1. At this time, the predicted value may also be represented in the form of a vector, so that the loss can be calculated by the distance between vectors.
[0052] In step S106, according to the loss function weight corresponding to each attribute and the difference between the label value and the predicted value of each attribute, the total loss function value of the multivariate attribute prediction model is determined.
[0053] In some embodiments, the loss function value corresponding to each attribute can be calculated according to the difference between the label value and the predicted value of each attribute, then the weighted result can be calculated according to the loss function value corresponding to each attribute and the loss function value corresponding to each attribute, and the weighted result is determined as the total loss function value. For example, the total loss function can be represented by formula (3).
[0054] J(θ) = ∑ j λ j J(θ j ) (3)
[0055] In formula (3), J(θ) denotes the total loss function, j denotes the identification of each attribute, λ j denotes the loss function weight of the jth attribute, θ j denotes the parameter of the softmax function used when calculating the loss function J(θ j ) of the jth attribute.
[0056] In some embodiments, it can be determined according to the total loss function value whether the convergence condition is reached. If not, step S108 can be performed and the process returns to step S102 to continue training; if yes, the training can be ended.
[0057] In step S108, the parameters of the multi-attribute prediction model are adjusted according to the total loss function value. For example, the gradient descent method can be used to adjust the parameters of the model.
[0058] By the method of the above embodiments, in each iteration of the training process, the difference between the prediction value of each attribute and the label value can be calculated according to the prediction value result of the training image used in this iteration, and the weight of the loss of each attribute in the total loss function value can be dynamically adjusted according to the difference. The embodiments of the present application can increase the contribution of simple tasks in learning and prevent the network from being dominated by more difficult tasks. Thus, the prediction accuracy of the multi-attribute prediction model is improved.
[0059] Moreover, the embodiments of the present application do not rely on other images other than the current iteration, but dynamically adjust the weight according to the training image of the current iteration. Therefore, the amount of data required for the training process is reduced, and the training efficiency is improved.
[0060] In some cases, some samples have the problem of lacking label values for some or all attributes, and the problem of attribute class imbalance. Thus, the model may have problems such as overfitting for some attributes. The present application can selectively determine the loss function weight according to the effective training image when determining the loss function weight. The following describes Figure 3 Embodiments of the training method of the multi-attribute prediction model of the present application.
[0061] Figure 3 The flowchart of the loss function weight determination method according to some embodiments of the present application is shown in FIG. 3. As shown in FIG. 3, the loss function weight determination method of this embodiment includes steps S302-S304. Figure 3
[0062] In step S302, for each attribute of the multiple attributes, the training image having the label value of the attribute is determined as the effective image corresponding to the attribute. Table 1 is a schematic table of the label values of the training images. " / " in the table indicates that the label value of the corresponding attribute of the training image is missing. In Table 1, training images 2 and 3 are effective images for the attribute age, training image 1 is an effective image for the attribute race, and training images 1, 2 and 3 are effective images for the attributes gender and expression.
[0063] Table 1
[0064] Figure 4 Figure 4 Figure 4 Figure 5 Figure 5 1 Figure 5 / Figure 6 Figure 6 2 Figure 7 35 / Figure 7 3 Figure 1 19 / Figure 1 …… …… …… …… ……
[0065] In step S304, a loss function weight corresponding to each attribute is determined according to a difference between a label value and a predicted value of the effective image corresponding to each attribute.
[0066] Formula (4) exemplarily introduces another calculation method of the suppression factor.
[0067]
[0068] In formula (4), j is an identifier of an attribute type; σ j is the suppression factor of the jth attribute; κ is a preset parameter for representing a suppression degree, κ has a value range of [5, 10], and a relatively good effect can be obtained when κ = 7; m * is the number of effective samples; m is the number of samples; i is an identifier of a sample; indicates whether the jth attribute of the ith sample is missing, and the value of is -1 in the case of missing, and the value of is 1 in the case of non-missing; has a value of 1 in the case of equaling 1, and 0 otherwise; indicates a label value of the jth attribute of the ith sample; indicates a predicted value of the jth attribute of the ith sample; K j indicates the number of categories of the jth attribute.
[0069] After the suppression factor is determined, the loss function weight can be calculated by formula (5).
[0070]
[0071] In formula (5), λ j indicates the loss function weight of the jth attribute; γ is a preset parameter for representing a weight variation amplitude, γ has a value range of [0.3, 0.7], and a relatively good effect can be obtained when γ = 0.5. The meanings of other parameters are described in formula (4).
[0072] In some embodiments, σ and in formulas (4) and (5) can also be vectors.
[0073] By the method of the above embodiments, the influence caused by the missing of the label value of the training image can be reduced, the training effect is improved, and thus the model completed by training has a higher prediction accuracy.
[0074] The multivariate attribute prediction model completed by training can be applied to various application scenarios. Next, an example is exemplarily introduced. Figure 1
[0075] Figure 1 FIG. 1 is a flowchart of a face attribute prediction method according to some embodiments of the present application. As shown in FIG. 1, the face attribute prediction method according to the embodiments includes steps S102-S108. Figure 1
[0076] In step S102, a face image of a user is collected.
[0077] In step S104, the face image is input into a trained multi-attribute prediction model to obtain predicted values of multiple attributes of the face in the face image.
[0078] In step S106, according to the predicted values of the multiple attributes of the face, entries such as commodities, articles, personal homepages, etc. that match the predicted values are searched.
[0079] In step S108, the matched entries are pushed to the user. For example, the matched entries can be displayed through a terminal device of the user.
[0080] Through the method of the above embodiments, the trained multi-attribute prediction model can output more accurate prediction results, so that more accurate pushing can be performed for the user. Of course, the trained multi-attribute prediction model can also be applied to image search, face verification, etc. by those skilled in the art, which will not be described here.
[0081] The following describes an embodiment of a training device of a multi-attribute prediction model according to some embodiments of the present application. Figure 1
[0082] FIG. 2 is a structural diagram of a training device of a multi-attribute prediction model according to some embodiments of the present application. As shown in FIG. 2, the training device 50 according to the embodiments includes: an input module 510 configured to input a training image into a multi-attribute prediction model to obtain predicted values corresponding to multiple attributes of an object in the training image respectively, wherein a label value of the training image includes a label value corresponding to each attribute; a weight determination module 520 configured to determine a loss function weight corresponding to each attribute according to a difference between the label value and the predicted value of each attribute, wherein the difference between the label value and the predicted value of each attribute and the corresponding loss function weight are in a negative correlation relationship; a total loss determination module 530 configured to determine a total loss function value of the multi-attribute prediction model according to the loss function weight corresponding to each attribute and the difference between the label value and the predicted value of each attribute; and a parameter adjustment module 540 configured to adjust parameters of the multi-attribute prediction model according to the total loss function value.
[0083] In some embodiments, the weight determination module 520 is further configured to determine, according to the difference between the label value and the predicted value of each attribute and the number of categories of each attribute, the loss function weight corresponding to each attribute, wherein the number of categories of each attribute is in a positive correlation with the corresponding loss function weight.
[0084] In some embodiments, the training image with the label value of each attribute is a valid training image; the weight determination module 520 is further configured to, for each attribute of the plurality of attributes, determine the training image with the label value of the attribute as the valid image corresponding to the attribute; and determine, according to the difference between the label value and the predicted value of the valid image corresponding to each attribute, the loss function weight corresponding to each attribute.
[0085] In some embodiments, the weight determination module 520 is further configured to, for each attribute of the plurality of attributes, determine, according to the average value of the square of the difference between the label value and the predicted value of the corresponding valid image, the valid average loss corresponding to the attribute; and determine, according to the ratio of the number of categories of the attribute to the valid average loss, the loss function weight corresponding to the attribute.
[0086] In some embodiments, the multi-attribute prediction model comprises a feature extraction layer and a plurality of parallel full connection layers, the full connection layers correspond one-to-one to the plurality of attributes, and each full connection layer is configured to output, according to the extraction result of the feature extraction layer, the predicted value of the attribute corresponding to the full connection layer.
[0087] In some embodiments, the training apparatus 50 further comprises a prediction module 550 configured to input the face image into the trained multi-attribute prediction model to obtain the predicted values of the plurality of attributes of the face in the face image.
[0088] In some embodiments, the plurality of attributes comprises at least two of age, gender, race, and expression.
[0089] A structural schematic diagram of a training apparatus of a multi-attribute prediction model according to some other embodiments of the present application. As shown in the figure, the training apparatus 60 of the multi-attribute prediction model of this embodiment comprises a memory 610 and a processor 620 coupled to the memory 610, and the processor 620 is configured to execute the training method of the multi-attribute prediction model in any one of the preceding embodiments based on the instructions stored in the memory 610.
[0090] The memory 610 may, for example, include a system memory, a fixed non-volatile storage medium, etc. The system memory may, for example, store an operating system, an application program, a boot loader, and other programs, etc.
[0091] This is a schematic diagram of the structure of a training device for a multi-attribute prediction model according to some embodiments of the present invention. As shown, the training device 70 for the multi-attribute prediction model in this embodiment includes a memory 710 and a processor 720, and may also include an input / output interface 730, a network interface 740, and a storage interface 750. These interfaces 730, 740, 750, and the memory 710 and processor 720 can be connected, for example, via a bus 760. The input / output interface 730 provides a connection interface for input / output devices such as a display, mouse, keyboard, and touchscreen. The network interface 740 provides a connection interface for various networked devices. The storage interface 750 provides a connection interface for external storage devices such as SD cards and USB flash drives.
[0092] Embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, characterized in that the program, when executed by a processor, implements a training method for any of the aforementioned multi-attribute prediction models.
[0093] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable non-transitory storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0094] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. One or more processes and / or boxes A device that provides the functions specified in one or more boxes.
[0095] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process One or more processes and / or boxes The function specified in one or more boxes.
[0096] These computer program instructions can also be loaded into computer or other programmable data processing devices, so that a series of operational steps are performed on the computer or other programmable data processing devices to generate computer-implemented processes, thus the instructions executed on the computer or other programmable data processing devices provide processes for implementing the functions specified in the flowcharts one flow or multiple flows and / or one block or multiple blocks. the steps of the functions specified in the flowcharts
[0097] The above description is merely preferred embodiments of the present application, and not intended to limit the present application. Any modification, equivalent replacement and improvement made without departing from the spirit and principle of the present application shall fall within the protection scope of the present application.
Claims
1. A training method for a multi-attribute prediction model, comprising: The training image is input into the multi-attribute prediction model to obtain the predicted values corresponding to the various attributes of the object in the training image, wherein the labeled value of the training image includes the labeled value corresponding to each attribute. Based on the difference between the labeled value and the predicted value of each attribute, the weight of the loss function corresponding to each attribute is determined. The difference between the labeled value and the predicted value of each attribute is negatively correlated with the corresponding weight of the loss function. The determined weight of the loss function is used in this iteration. The total loss function value of the multi-attribute prediction model is determined based on the loss function weight corresponding to each attribute and the difference between the labeled value and the predicted value of each attribute. The parameters of the multi-attribute prediction model are adjusted based on the total loss function value.
2. The training method according to claim 1, wherein, The weight of the loss function for each attribute is determined based on the difference between the labeled value and the predicted value of each attribute, as well as the number of categories for each attribute. The number of categories for each attribute is positively correlated with the corresponding weight of the loss function.
3. The training method according to claim 1 or 2, wherein, Training images with labeled values for each attribute are valid training images; The step of determining the weight of the loss function for each attribute based on the difference between the labeled value and the predicted value of each attribute includes: For each of the multiple attributes, the training image with the labeled value of the attribute is determined as the valid image corresponding to that attribute; The weights of the loss function for each attribute are determined based on the difference between the labeled value and the predicted value of the valid image corresponding to each attribute.
4. The training method according to claim 3, wherein, The step of determining the weight of the loss function for each attribute based on the difference between the labeled value and the predicted value of the valid image corresponding to each attribute includes: For each of the multiple attributes, the effective average loss corresponding to that attribute is determined based on the average of the squared differences between the labeled value and the predicted value of the corresponding effective image. The weight of the loss function corresponding to an attribute is determined based on the ratio of the number of categories of the attribute to the effective average loss.
5. The training method according to claim 1, wherein, The multi-attribute prediction model includes a feature extraction layer and multiple parallel fully connected layers. Each fully connected layer corresponds one-to-one with the various attributes, and each fully connected layer is used to output the predicted value of the attribute corresponding to that fully connected layer based on the extraction result of the feature extraction layer.
6. The training method according to claim 1, further comprising: The face image is input into the trained multi-attribute prediction model to obtain the predicted values of multiple attributes of the face in the face image.
7. The training method according to claim 1, wherein, The multiple attributes include at least two of age, gender, race, and facial expression.
8. A training device for a multi-attribute prediction model, comprising: The input module is configured to input a training image into a multi-attribute prediction model to obtain prediction values corresponding to multiple attributes of the object in the training image, wherein the labeled value of the training image includes the labeled value corresponding to each attribute. The weight determination module is configured to determine the weight of the loss function corresponding to each attribute based on the difference between the labeled value and the predicted value of each attribute. The difference between the labeled value and the predicted value of each attribute is negatively correlated with the corresponding weight of the loss function. The determined weight of the loss function is used in this iteration. The total loss determination module is configured to determine the total loss function value of the multi-attribute prediction model based on the loss function weight corresponding to each attribute and the difference between the labeled value and the predicted value of each attribute. The parameter adjustment module is configured to adjust the parameters of the multi-attribute prediction model based on the total loss function value.
9. A training device for a multi-attribute prediction model, comprising: Memory; as well as A processor coupled to the memory, the processor being configured to execute a training method for a multi-attribute prediction model as described in any one of claims 1 to 7, based on instructions stored in the memory.
10. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a training method for the multi-attribute prediction model according to any one of claims 1 to 7.