CN112101488B - Training method and device for machine learning model and storage medium - Google Patents

Training method and device for machine learning model and storage medium Download PDF

Info

Publication number
CN112101488B
CN112101488B CN202011291240.3A CN202011291240A CN112101488B CN 112101488 B CN112101488 B CN 112101488B CN 202011291240 A CN202011291240 A CN 202011291240A CN 112101488 B CN112101488 B CN 112101488B
Authority
CN
China
Prior art keywords
value
label
training image
training
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011291240.3A
Other languages
Chinese (zh)
Other versions
CN112101488A (en
Inventor
白亚龙
张炜
梅涛
周伯文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202011291240.3A priority Critical patent/CN112101488B/en
Publication of CN112101488A publication Critical patent/CN112101488A/en
Application granted granted Critical
Publication of CN112101488B publication Critical patent/CN112101488B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/217Validation; Performance evaluation; Active pattern learning techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Abstract

The disclosure provides a training method and a training device of a machine learning model and a computer readable storage medium, and relates to the technical field of artificial intelligence. The training method of the machine learning model comprises the following steps: inputting the training image into a machine learning model to obtain the prediction confidence of the training image; inputting the prediction confidence coefficient and the label true value of the training image into an evaluation index loss function to obtain a loss function value, wherein the evaluation index of the loss function value random learning model of the evaluation index loss function is monotonically decreased, and the evaluation index is represented by the prediction confidence coefficient and the label true value of the training image; and adjusting each parameter variable in the machine learning model according to the loss function value. The evaluation index of the machine learning model can be effectively improved.

Description

Training method and device for machine learning model and storage medium
Technical Field
The present disclosure relates to the field of artificial intelligence technologies, and in particular, to a training method and a training apparatus for a machine learning model, and a computer-readable storage medium.
Background
The loss function is a non-negative real-valued function that measures the degree of disparity between predicted and real values of the machine-learned model. The smaller the loss function value, the better the robustness of the machine learning model. Generally, the more appropriately the loss function is selected, the higher the performance of the machine learning model. Therefore, the loss function has strong relevance to the working performance of the machine learning model and the implementation effect of the machine learning task.
Disclosure of Invention
The technical problem solved by the present disclosure is how to effectively improve the evaluation index of the machine learning model.
According to one aspect of the present disclosure, there is provided a training method of a machine learning model, including: inputting the training image into a machine learning model to obtain the prediction confidence of the training image; inputting the prediction confidence coefficient and the label true value of the training image into an evaluation index loss function to obtain a loss function value, wherein the evaluation index of the loss function value random learning model of the evaluation index loss function is monotonically decreased, and the evaluation index is represented by the prediction confidence coefficient and the label true value of the training image; and adjusting each parameter variable in the machine learning model according to the loss function value.
In some embodiments, the training method further comprises: in some embodiments, the constructing a derivable evaluation index loss function includes, with the prediction confidence and the label of the training image as arguments: representing quantization values corresponding to different image marking conditions by using the prediction confidence coefficient and the label real value of the training image, wherein each image marking condition comprises different image marking combinations, and each image marking combination comprises the label real value and the prediction marking value of the training image; expressing evaluation indexes by using quantization values corresponding to different image marking conditions; and constructing a derivable evaluation index loss function by using the evaluation index.
In some embodiments, the different image tagging scenarios include: in a binary image labeling scenario, the true label value of the training image is positive and the predictive label value is positive, the true label value of the training image is negative and the predictive label value is positive, the true label value of the training image is positive and the predictive label value is negative, the true label value of the training image is negative and the predictive label value is negative.
In some embodiments, the representing the quantized values corresponding to different image labeling cases by using the prediction confidence and the true label values of the training images comprises:
Figure 925055DEST_PATH_IMAGE001
wherein the content of the first and second substances,
Figure 518060DEST_PATH_IMAGE002
representing that the true value of the label of the training image is positive and the predictive flag value is a positive corresponding quantization value; x represents each sample training image in a batch of training images;
Figure 179855DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 538679DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
In some embodiments, the representing the quantized values corresponding to different image labeling cases by using the prediction confidence and the true label values of the training images comprises:
Figure 31846DEST_PATH_IMAGE005
wherein the content of the first and second substances,
Figure 18257DEST_PATH_IMAGE006
representing a quantization value corresponding to the fact that the true value of the label of the training image is positive and the predicted tag value is negative; x represents each sample training image in a batch of training images;
Figure 226735DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 120741DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
In some embodiments, the representing the quantized values corresponding to different image labeling cases by using the prediction confidence and the true label values of the training images comprises:
Figure 471345DEST_PATH_IMAGE007
wherein the content of the first and second substances,
Figure 363077DEST_PATH_IMAGE008
a quantization value corresponding to the fact that the true value of the label representing the training image is negative and the predictive flag value is positive; x represents each sample training image in a batch of training images;
Figure 858518DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 677920DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
In some embodiments, the representing the quantized values corresponding to different image labeling cases by using the prediction confidence and the true label values of the training images comprises:
Figure 896412DEST_PATH_IMAGE009
wherein the content of the first and second substances,
Figure 349259DEST_PATH_IMAGE010
representing a quantization value corresponding to the fact that the true value of the label of the training image is negative and the prediction marking value is negative; x represents each sample training image in a batch of training images;
Figure 413554DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 164210DEST_PATH_IMAGE004
The true value of the label representing a single training image,the value is 0 or 1.
In some embodiments, adjusting the respective parameter variables in the machine learning model according to the loss function values comprises: training the machine learning model by adopting a cross entropy loss function so as to make the machine learning model converge; and training the converged machine learning model by adopting the evaluation index loss function so as to adjust each parameter variable in the machine learning model according to the loss function value of the evaluation index loss function.
In some embodiments, the evaluation metrics include accuracy, precision, recall, F-score.
According to another aspect of the present disclosure, there is provided a training apparatus of a machine learning model, including: the confidence coefficient acquisition module is configured to input the training image into the machine learning model and obtain the prediction confidence coefficient of the training image; the function value obtaining module is configured to input the prediction confidence coefficient and the label true value of the training image into an evaluation index loss function to obtain a loss function value, wherein the evaluation index of the loss function value random learning model of the evaluation index loss function is monotonically decreased, and the evaluation index is represented by the prediction confidence coefficient and the label true value of the training image; a variable adjustment module configured to adjust respective parameter variables in the machine learning model according to the loss function values.
In some embodiments, the training apparatus further comprises a function building module configured to: and constructing a derivable evaluation index loss function by taking the prediction confidence coefficient and the label true value of the training image as independent variables.
In some embodiments, the function building module is configured to: representing quantization values corresponding to different image marking conditions by using the prediction confidence coefficient and the label real value of the training image, wherein each image marking condition comprises different image marking combinations, and each image marking combination comprises the label real value and the prediction marking value of the training image; expressing evaluation indexes by using quantization values corresponding to different image marking conditions; and constructing a derivable evaluation index loss function by using the evaluation index.
In some embodiments, the different image tagging scenarios include: in a binary image labeling scenario, the true label value of the training image is positive and the predictive label value is positive, the true label value of the training image is negative and the predictive label value is positive, the true label value of the training image is positive and the predictive label value is negative, the true label value of the training image is negative and the predictive label value is negative.
In some embodiments, the function building module is configured to: the quantization value corresponding to the true label value and the positive predictive marker value of the training image is expressed in the following way
Figure 257716DEST_PATH_IMAGE011
Wherein the content of the first and second substances,
Figure 271678DEST_PATH_IMAGE002
representing that the true value of the label of the training image is positive and the predictive flag value is a positive corresponding quantization value; x represents each sample training image in a batch of training images;
Figure 430126DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 393928DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
In some embodiments, the function building module is configured to: a quantized value corresponding to a true value of the label of the training image being positive and a negative value of the predictive flag being negative is represented in the following manner
Figure 836279DEST_PATH_IMAGE005
Wherein the content of the first and second substances,
Figure 627999DEST_PATH_IMAGE006
representing a quantization value corresponding to the fact that the true value of the label of the training image is positive and the predicted tag value is negative; x represents a batch of training imagesEach sample training image in (1);
Figure 663957DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 975990DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
In some embodiments, the function building module is configured to: a quantization value corresponding to a negative true value of the label and a positive predictive flag value of the training image is expressed in the following manner
Figure 541357DEST_PATH_IMAGE012
Wherein the content of the first and second substances,
Figure 506908DEST_PATH_IMAGE008
a quantization value corresponding to the fact that the true value of the label representing the training image is negative and the predictive flag value is positive; x represents each sample training image in a batch of training images;
Figure 374369DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 205272DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
In some embodiments, the function building module is configured to: the quantization value corresponding to the fact that the true value of the label of the training image is negative and the predictive flag value is negative is expressed in the following way
Figure 372949DEST_PATH_IMAGE009
Wherein the content of the first and second substances,
Figure 509401DEST_PATH_IMAGE010
representing a quantization value corresponding to the fact that the true value of the label of the training image is negative and the prediction marking value is negative; x represents each sample training image in a batch of training images;
Figure 257301DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 691563DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
In some embodiments, the variable adjustment module is configured to: training the machine learning model by adopting a cross entropy loss function so as to make the machine learning model converge; and training the converged machine learning model by adopting the evaluation index loss function so as to adjust each parameter variable in the machine learning model according to the loss function value of the evaluation index loss function.
In some embodiments, the evaluation metrics include accuracy, precision, recall, F-score.
According to yet another aspect of the present disclosure, there is provided a training apparatus for a machine learning model, including: a memory; and a processor coupled to the memory, the processor configured to perform the aforementioned method of training a machine learning model based on instructions stored in the memory.
According to yet another aspect of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, which when executed by a processor, implement the aforementioned training method of a machine learning model.
The evaluation index of the machine learning model can be effectively improved.
Other features of the present disclosure and advantages thereof will become apparent from the following detailed description of exemplary embodiments thereof, which proceeds with reference to the accompanying drawings.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or technical solutions in the related art, the drawings required to be used in the description of the embodiments or the related art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and for those skilled in the art, other drawings may be obtained according to the drawings without inventive exercise.
Figure 1 shows the quantitative relationship between accuracy and the loss function values of the cross-entropy loss function.
Fig. 2 illustrates a flow diagram of a method of training a machine learning model of some embodiments of the present disclosure.
FIG. 3 illustrates some embodiments of constructing a derivable evaluation index loss function.
Figure 4 shows the magnitude relation between accuracy and the loss function values of the accuracy loss function.
Fig. 5 shows a schematic structural diagram of a training apparatus of a machine learning model according to some embodiments of the present disclosure.
Fig. 6 is a schematic structural diagram of a training apparatus for machine learning model according to further embodiments of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, and not all of the embodiments. The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
The evaluation index is an index used for measuring the performance of the machine learning model in machine learning and is also a final evaluation standard of the machine learning task. Common evaluation metrics include accuracy, precision, recall, and F-score (F-score).
The logarithmic, quadratic, and hinge loss functions are all conventional loss functions. The inventor researches and discovers that in the traditional loss functions, the value of the loss function is not monotonous with the evaluation index of the machine learning model. That is, the smaller the loss function value is, the higher the evaluation index is not necessarily. For example, a cross-entropy loss function is often chosen in the classification task. Assuming that p is the probability distribution of the desired output, q is the probability distribution of the actual output, H (p, q) represents the cross entropy, and x represents the input data, then there is formula (1):
Figure 38712DEST_PATH_IMAGE013
(1)
and the evaluation index of the classification task generally adopts the accuracy. Figure 1 shows the quantitative relationship between accuracy and the loss function values of the cross-entropy loss function. By enumerating a number of discretized instances, as shown in FIG. 1, there is no monotonically decreasing relationship between accuracy and the loss function value of the cross-entropy loss function. That is, when the machine learning model is optimized so that the loss function value is lower, the classification accuracy of the machine learning model is likely to be lower. In view of this, the present disclosure provides a training method for a machine learning model, which can effectively improve evaluation indexes of the machine learning model.
Some embodiments of the training method of the machine learning model of the present disclosure are first described in conjunction with fig. 2.
Fig. 2 illustrates a flow diagram of a method of training a machine learning model of some embodiments of the present disclosure. As shown in fig. 2, the method includes steps S201 to S205.
In step S201, a training image is input to the machine learning model, and a prediction confidence of the training image is obtained.
In step S203, the prediction confidence and the label true value of the training image are input to the evaluation index loss function, and a loss function value is obtained.
The evaluation index of the loss function value random learning model of the evaluation index loss function is monotonically decreased, and the evaluation index is represented by the prediction confidence coefficient and the label true value of the training image. The evaluation index may be, for example, accuracy, precision, recall, and F-score.
In step S205, each parameter variable in the machine learning model is adjusted according to the loss function value.
In some embodiments, in order to adjust each parameter variable in the machine learning model more quickly so as to make the machine learning model converge quickly, the machine learning model may be trained by using a loss function such as cross entropy, and each parameter variable in the machine learning model may be adjusted. And after the machine learning model is converged, training the machine learning model by adopting an evaluation index loss function, and finely adjusting each parameter variable in the machine learning model according to the loss function value of the evaluation index loss function.
In this embodiment, since the evaluation index of the evaluation index loss function is monotonically decreased with the evaluation index of the learning model of the random machine, the machine learning model is trained by using the evaluation index loss function, which can effectively improve the evaluation index of the machine learning model, that is, the performance of the trained machine learning model on the evaluation index.
In some embodiments, the training method further comprises step S202. In step S202, a derivable evaluation index loss function is constructed with the prediction confidence and the true label value of the training image as arguments.
The inventors also studied the conventional loss function. The inventor further researches and discovers that, assuming that the prediction confidence of the machine learning model for the training image is I, the traditional training method usually adopts a mode of comparing with a preset threshold value or logically regressing softmax to convert I into 0 or 1, and then compares with the true value of the label. Therefore, if the evaluation index is directly calculated by the traditional method, the calculation formula of the evaluation index is not conducive, and further the evaluation index loss function is not conducive. The machine learning model based on the back propagation algorithm usually needs to calculate the gradient of the loss function, so that the evaluation index loss function is required to be a derivative function, and the traditional evaluation index calculation mode needs to be adjusted. The detailed implementation of step S202 is described in detail below with reference to fig. 3.
FIG. 3 illustrates some embodiments of constructing a derivable evaluation index loss function. As shown in fig. 3, step S202 specifically includes steps S3021 to S3023.
In step S3021, the prediction confidence and the true label value of the training image are used to represent the quantization values corresponding to different image labeling situations.
Wherein each image marker case comprises a different image marker combination, and the image marker combination comprises a label real value and a prediction marker value of the training image. For example, different image tagging scenarios include: in a binary image labeling scenario, the training image's tagreal value is positive and the predictive flag value is positive (predictive correct), the training image's tagreal value is negative and the predictive flag value is positive (predictive incorrect), the training image's tagreal value is positive and the predictive flag value is negative (predictive incorrect), the training image's tagreal value is negative and the predictive flag value is negative (predictive correct).
In order to meet the requirement that the calculation formula of the evaluation index is derivable, and simultaneously not change the meaning of the evaluation index, the discretization processing mode in the calculation formula of the evaluation index needs to be converted into the continuous processing mode. That is, I is not directly converted to 0 or 1, but I is regarded as I1 and (1-I) 0, and thus the evaluation index is converted from discrete to continuous by means of probability decomposition. Suppose that
Figure 142803DEST_PATH_IMAGE002
The true value of the label representing the training image is positive and the predictive flag value is the positive corresponding quantized value,
Figure 615152DEST_PATH_IMAGE006
the quantized values corresponding to positive true values of the labels representing the training images and negative values of the predictive markers,
Figure 807099DEST_PATH_IMAGE008
the quantized values corresponding to negative true values of the labels representing the training images and positive predicted label values,
Figure 935985DEST_PATH_IMAGE010
the quantized values corresponding to the true values of the labels representing the training images being negative and the predictive flag values being negative. Then, the following formulas (2) to (5) are provided:
Figure 86344DEST_PATH_IMAGE014
(2)
Figure 930541DEST_PATH_IMAGE015
(3)
Figure 579041DEST_PATH_IMAGE016
(4)
Figure 638133DEST_PATH_IMAGE017
(5)
wherein x represents each sample training image in a batch of training images;
Figure 224972DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 762657DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
In step S3022, the evaluation index is expressed by using the quantization values corresponding to different types of image markers.
For example, the evaluation index is the accuracy
Figure 155461DEST_PATH_IMAGE018
When, there is formula (6):
Figure 210005DEST_PATH_IMAGE019
(6)
as yet another example of this type of device,the evaluation index is the accuracy
Figure 682925DEST_PATH_IMAGE020
When, there is formula (7):
Figure 314763DEST_PATH_IMAGE021
(7)
as another example, the evaluation index is recall
Figure 183362DEST_PATH_IMAGE022
When, there is formula (8):
Figure 610189DEST_PATH_IMAGE023
(8)
also, for example, the evaluation index is F-score
Figure 273251DEST_PATH_IMAGE024
When, there is formula (9):
Figure 779669DEST_PATH_IMAGE025
(9)
in step S3023, a derivable evaluation index loss function is constructed using the evaluation index.
For example, after obtaining the continuously derivable accuracy calculation by equation (6), the continuously derivable accuracy loss function can be obtained by subtracting the accuracy from 1
Figure 186380DEST_PATH_IMAGE026
I.e. equation (10):
Figure 340149DEST_PATH_IMAGE027
(10)
the formula (10) provides that under the common two-classification scene, the calculation of the accuracy is adjusted to be in a continuously-derivable form, so that the accuracy loss function is optimized as the target loss function. Based on similar principle, under multi-classification scene, continuously derivable accuracy loss function
Figure 301677DEST_PATH_IMAGE028
As shown in formula (11):
Figure 95058DEST_PATH_IMAGE029
(11)
wherein x represents each sample training image in a batch of training images; n represents the number of samples in a batch of training images;
Figure 633356DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 537506DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1. Those skilled in the art will understand that the calculation formula given in the above embodiments is only an example, and those skilled in the art can flexibly adjust the calculation formula according to actual needs.
Figure 4 shows the magnitude relation between accuracy and the loss function values of the accuracy loss function. As can be seen from fig. 4, after the derivable evaluation index function is represented by the prediction confidence and the true label value of the training image and the derivable evaluation index loss function is constructed by using the derivable evaluation index function, the evaluation index of the loss function value randomizer learning model of the evaluation index loss function monotonically decreases. The experimental results of evaluation on the object recognition data sets such as FGVC-iMET2020, AliProduct, ImageNet and the like show that after the training method provided by the disclosure is adopted to train the machine learning model, the evaluation indexes such as the accuracy rate of recognizing the image by using the machine learning model can be improved by at least 0.3% -0.5%.
Some embodiments of the training apparatus of the machine learning model of the present disclosure are described below in conjunction with fig. 5.
Fig. 5 shows a schematic structural diagram of a training apparatus of a machine learning model according to some embodiments of the present disclosure. As shown in fig. 5, the training device 50 for machine learning model includes: a confidence obtaining module 501 configured to input the training image into the machine learning model to obtain a prediction confidence of the training image; a function value obtaining module 503 configured to input the prediction confidence and the label true value of the training image into an evaluation index loss function to obtain a loss function value, where the evaluation index of the loss function value randomizer learning model of the evaluation index loss function monotonically decreases, and the evaluation index is represented by the prediction confidence and the label true value of the training image; a variable adjustment module 505 configured to adjust respective parameter variables in the machine learning model according to the loss function values.
In this embodiment, since the evaluation index of the evaluation index loss function is monotonically decreased with the evaluation index of the learning model of the random machine, the machine learning model is trained by using the evaluation index loss function, which can effectively improve the evaluation index of the machine learning model, that is, the performance of the trained machine learning model on the evaluation index.
In some embodiments, the training apparatus further comprises a function building module 502 configured to: and constructing a derivable evaluation index loss function by taking the prediction confidence coefficient and the label true value of the training image as independent variables.
In some embodiments, function building module 502 is configured to: representing quantization values corresponding to different image marking conditions by using the prediction confidence coefficient and the label real value of the training image, wherein each image marking condition comprises different image marking combinations, and each image marking combination comprises the label real value and the prediction marking value of the training image; expressing evaluation indexes by using quantization values corresponding to different image marking conditions; and constructing a derivable evaluation index loss function by using the evaluation index.
In some embodiments, the different image tagging scenarios include: in a binary image labeling scenario, the true label value of the training image is positive and the predictive label value is positive, the true label value of the training image is negative and the predictive label value is positive, the true label value of the training image is positive and the predictive label value is negative, the true label value of the training image is negative and the predictive label value is negative.
In some embodiments, function building module 502 is configured to: the quantization value corresponding to the true label value and the positive predictive marker value of the training image is expressed in the following way
Figure 57218DEST_PATH_IMAGE014
(2)
Wherein the content of the first and second substances,
Figure 823048DEST_PATH_IMAGE002
representing that the true value of the label of the training image is positive and the predictive flag value is a positive corresponding quantization value; x represents each sample training image in a batch of training images;
Figure 105650DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 624225DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
In some embodiments, function building module 502 is configured to: a quantized value corresponding to a true value of the label of the training image being positive and a negative value of the predictive flag being negative is represented in the following manner
Figure 127887DEST_PATH_IMAGE015
(3)
Wherein the content of the first and second substances,
Figure 581347DEST_PATH_IMAGE006
representing a quantization value corresponding to the fact that the true value of the label of the training image is positive and the predicted tag value is negative; x represents each sample training image in a batch of training images;
Figure 382818DEST_PATH_IMAGE003
representing a single training imageMeasuring confidence coefficient, and the value interval is [0, 1%];
Figure 241053DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
In some embodiments, function building module 502 is configured to: a quantization value corresponding to a negative true value of the label and a positive predictive flag value of the training image is expressed in the following manner
Figure 184126DEST_PATH_IMAGE016
(4)
Wherein the content of the first and second substances,
Figure 642658DEST_PATH_IMAGE008
a quantization value corresponding to the fact that the true value of the label representing the training image is negative and the predictive flag value is positive; x represents each sample training image in a batch of training images;
Figure 60869DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 770681DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
In some embodiments, function building module 502 is configured to: the quantization value corresponding to the fact that the true value of the label of the training image is negative and the predictive flag value is negative is expressed in the following way
Figure 803097DEST_PATH_IMAGE017
(5)
Wherein the content of the first and second substances,
Figure 234078DEST_PATH_IMAGE010
representing a quantization value corresponding to the fact that the true value of the label of the training image is negative and the prediction marking value is negative; x represents the training of each sample in a batch of training imagesImage training;
Figure 458910DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 541005DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
In some embodiments, the evaluation metrics include accuracy, precision, recall, F-score.
In the above embodiment, the derivable evaluation index function is represented by the prediction confidence and the true label value of the training image, and after the derivable evaluation index loss function is constructed by using the derivable evaluation index function, the evaluation index of the random learning model of the loss function value of the evaluation index loss function is monotonically decreased.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
Further embodiments of the training apparatus of the machine learning model of the present disclosure are described below in conjunction with FIG. 6.
Fig. 6 is a schematic structural diagram of a training apparatus for machine learning model according to further embodiments of the present disclosure. As shown in fig. 6, the training device 60 for machine learning model includes: a memory 610 and a processor 620 coupled to the memory 610, the processor 620 being configured to perform the method of training a machine learning model in any of the foregoing embodiments based on instructions stored in the memory 610.
Memory 610 may include, for example, system memory, fixed non-volatile storage media, and the like. The system memory stores, for example, an operating system, an application program, a Boot Loader (Boot Loader), and other programs.
The training apparatus 60 for machine learning model may further include an input/output interface 630, a network interface 640, a storage interface 650, and the like. These interfaces 630, 640, 650 and the connections between the memory 610 and the processor 620 may be through a bus 660, for example. The input/output interface 630 provides a connection interface for input/output devices such as a display, a mouse, a keyboard, and a touch screen. The network interface 640 provides a connection interface for various networking devices. The storage interface 650 provides a connection interface for external storage devices such as an SD card and a usb disk.
The present disclosure also includes a computer-readable storage medium having stored thereon computer instructions that, when executed by a processor, implement a method of training a machine learning model in any of the foregoing embodiments.
The aforementioned integrated units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The present disclosure is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the disclosure. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may 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, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
The above description is only exemplary of the present disclosure and is not intended to limit the present disclosure, so that any modification, equivalent replacement, or improvement made within the spirit and principle of the present disclosure should be included in the scope of the present disclosure.

Claims (14)

1. A method of training a machine learning model, comprising:
inputting the training image into a machine learning model to obtain the prediction confidence of the training image;
processing the prediction confidence coefficient and the label real value of the training image to obtain the quantization values corresponding to different image marking conditions, wherein each image marking condition comprises different image marking combinations, and each image marking combination comprises the label real value and the prediction marking value of the training image;
processing the quantitative values corresponding to different image marking conditions to obtain evaluation indexes of the machine learning model, wherein the evaluation indexes comprise accuracy, precision, recall rate and F score;
constructing a derivable evaluation index loss function by using the evaluation index;
inputting the prediction confidence coefficient and the label real value of the training image into the evaluation index loss function to obtain a loss function value, wherein the loss function value of the evaluation index loss function is monotonically decreased along with the evaluation index;
adjusting various parameter variables in the machine learning model according to the loss function values, including: training the machine learning model by adopting a cross entropy loss function so as to make the machine learning model converge; and training the converged machine learning model by adopting the evaluation index loss function so as to adjust each parameter variable in the machine learning model according to the loss function value of the evaluation index loss function.
2. The training method of claim 1, wherein the different image labeling scenarios comprise:
in a binary image labeling scenario, the true label value of the training image is positive and the predictive label value is positive, the true label value of the training image is negative and the predictive label value is positive, the true label value of the training image is positive and the predictive label value is negative, the true label value of the training image is negative and the predictive label value is negative.
3. The training method according to claim 2, wherein the processing the prediction confidence and the label true value of the training image to obtain the quantization values corresponding to different image labeling situations comprises:
Figure 42294DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE003
representing that the true value of the label of the training image is positive and the predictive flag value is a positive corresponding quantization value; x represents each sample training image in a batch of training images;
Figure 897117DEST_PATH_IMAGE004
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure DEST_PATH_IMAGE005
And the true value of the label of a single training image is represented, and the value is 0 or 1.
4. The training method according to claim 2, wherein the processing the prediction confidence and the label true value of the training image to obtain the quantization values corresponding to different image labeling situations comprises:
Figure DEST_PATH_IMAGE007
wherein the content of the first and second substances,
Figure 237706DEST_PATH_IMAGE008
representing a quantization value corresponding to the fact that the true value of the label of the training image is positive and the predicted tag value is negative; x represents each sample training image in a batch of training images;
Figure 242703DEST_PATH_IMAGE004
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 384971DEST_PATH_IMAGE005
And the true value of the label of a single training image is represented, and the value is 0 or 1.
5. The training method according to claim 2, wherein the processing the prediction confidence and the label true value of the training image to obtain the quantization values corresponding to different image labeling situations comprises:
Figure 817221DEST_PATH_IMAGE010
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE011
a quantization value corresponding to the fact that the true value of the label representing the training image is negative and the predictive flag value is positive; x represents each sample training image in a batch of training images;
Figure 52897DEST_PATH_IMAGE004
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 861584DEST_PATH_IMAGE005
And the true value of the label of a single training image is represented, and the value is 0 or 1.
6. The training method according to claim 2, wherein the processing the prediction confidence and the label true value of the training image to obtain the quantization values corresponding to different image labeling situations comprises:
Figure DEST_PATH_IMAGE013
wherein the content of the first and second substances,
Figure 468146DEST_PATH_IMAGE014
representing a quantization value corresponding to the fact that the true value of the label of the training image is negative and the prediction marking value is negative; x represents each sample training image in a batch of training images;
Figure 336876DEST_PATH_IMAGE004
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 901325DEST_PATH_IMAGE005
And the true value of the label of a single training image is represented, and the value is 0 or 1.
7. A training apparatus for a machine learning model, comprising:
the confidence coefficient acquisition module is configured to input the training image into the machine learning model and obtain the prediction confidence coefficient of the training image;
a function building module configured to: processing the prediction confidence coefficient and the label real value of the training image to obtain the quantization values corresponding to different image marking conditions, wherein each image marking condition comprises different image marking combinations, and each image marking combination comprises the label real value and the prediction marking value of the training image; processing the quantitative values corresponding to different image marking conditions to obtain evaluation indexes of the machine learning model, wherein the evaluation indexes comprise accuracy, precision, recall rate and F score; constructing a derivable evaluation index loss function by using the evaluation index;
a function value obtaining module configured to input the prediction confidence coefficient and the label real value of the training image into the evaluation index loss function to obtain a loss function value, wherein the loss function value of the evaluation index loss function is monotonically decreased with the evaluation index;
a variable adjustment module configured to adjust respective parameter variables in the machine learning model according to the loss function values, comprising: training the machine learning model by adopting a cross entropy loss function so as to make the machine learning model converge; and training the converged machine learning model by adopting the evaluation index loss function so as to adjust each parameter variable in the machine learning model according to the loss function value of the evaluation index loss function.
8. The training apparatus of claim 7, wherein the different image tagging conditions comprise:
in a binary image labeling scenario, the true label value of the training image is positive and the predictive label value is positive, the true label value of the training image is negative and the predictive label value is positive, the true label value of the training image is positive and the predictive label value is negative, the true label value of the training image is negative and the predictive label value is negative.
9. The training apparatus of claim 8, wherein the function building module is configured to:
obtaining the corresponding quantized value of the training image with the true label value being positive and the predictive label value being positive
Figure 513703DEST_PATH_IMAGE002
Wherein the content of the first and second substances,
Figure 99405DEST_PATH_IMAGE003
representing that the true value of the label of the training image is positive and the predictive flag value is a positive corresponding quantization value; x represents each sample training image in a batch of training images;
Figure 404616DEST_PATH_IMAGE004
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 459291DEST_PATH_IMAGE005
And the true value of the label of a single training image is represented, and the value is 0 or 1.
10. The training apparatus of claim 8, wherein the function building module is configured to:
obtaining the corresponding quantized value of the training image with the true label value being positive and the predicted label value being negative
Figure 612710DEST_PATH_IMAGE007
Wherein the content of the first and second substances,
Figure 131547DEST_PATH_IMAGE008
representing a quantization value corresponding to the fact that the true value of the label of the training image is positive and the predicted tag value is negative; x represents each sample training image in a batch of training images;
Figure 529030DEST_PATH_IMAGE004
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 133318DEST_PATH_IMAGE005
And the true value of the label of a single training image is represented, and the value is 0 or 1.
11. The training apparatus of claim 8, wherein the function building module is configured to:
obtaining the corresponding quantized value of the training image with the true label value being negative and the predicted label value being positive
Figure 25182DEST_PATH_IMAGE010
Wherein the content of the first and second substances,
Figure 395596DEST_PATH_IMAGE011
a quantization value corresponding to the fact that the true value of the label representing the training image is negative and the predictive flag value is positive; x represents each sample training image in a batch of training images;
Figure 229560DEST_PATH_IMAGE004
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 55564DEST_PATH_IMAGE005
To representAnd the true value of the label of the single training image is 0 or 1.
12. The training apparatus of claim 8, wherein the function building module is configured to:
obtaining the corresponding quantized value of the training image with the negative true label value and the negative predicted label value in the following way
Figure DEST_PATH_IMAGE015
Wherein the content of the first and second substances,
Figure 813436DEST_PATH_IMAGE014
representing a quantization value corresponding to the fact that the true value of the label of the training image is negative and the prediction marking value is negative; x represents each sample training image in a batch of training images;
Figure 41286DEST_PATH_IMAGE004
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 788095DEST_PATH_IMAGE005
And the true value of the label of a single training image is represented, and the value is 0 or 1.
13. A training apparatus for a machine learning model, comprising:
a memory; and
a processor coupled to the memory, the processor configured to perform the method of training of a machine learning model of any of claims 1-6 based on instructions stored in the memory.
14. A non-transitory computer readable storage medium, wherein the non-transitory computer readable storage medium stores computer instructions that, when executed by a processor, implement a method of training a machine learning model according to any of claims 1 to 6.
CN202011291240.3A 2020-11-18 2020-11-18 Training method and device for machine learning model and storage medium Active CN112101488B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011291240.3A CN112101488B (en) 2020-11-18 2020-11-18 Training method and device for machine learning model and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011291240.3A CN112101488B (en) 2020-11-18 2020-11-18 Training method and device for machine learning model and storage medium

Publications (2)

Publication Number Publication Date
CN112101488A CN112101488A (en) 2020-12-18
CN112101488B true CN112101488B (en) 2021-06-25

Family

ID=73785255

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011291240.3A Active CN112101488B (en) 2020-11-18 2020-11-18 Training method and device for machine learning model and storage medium

Country Status (1)

Country Link
CN (1) CN112101488B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113111729B (en) * 2021-03-23 2023-08-18 广州大学 Training method, recognition method, system, device and medium for personnel recognition model
CN113194320B (en) * 2021-04-30 2022-11-22 北京达佳互联信息技术有限公司 Parameter prediction model training method and device and parameter prediction method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108009526A (en) * 2017-12-25 2018-05-08 西北工业大学 A kind of vehicle identification and detection method based on convolutional neural networks
CN110378909A (en) * 2019-06-24 2019-10-25 南京林业大学 Single wooden dividing method towards laser point cloud based on Faster R-CNN
CN110837818A (en) * 2019-11-18 2020-02-25 汕头大学 Chinese white sea rag dorsal fin identification method based on convolutional neural network
WO2020063715A1 (en) * 2018-09-26 2020-04-02 Huawei Technologies Co., Ltd. Method and system for training binary quantized weight and activation function for deep neural networks
CN111611981A (en) * 2020-06-28 2020-09-01 腾讯科技(深圳)有限公司 Information identification method and device and information identification neural network training method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108009526A (en) * 2017-12-25 2018-05-08 西北工业大学 A kind of vehicle identification and detection method based on convolutional neural networks
WO2020063715A1 (en) * 2018-09-26 2020-04-02 Huawei Technologies Co., Ltd. Method and system for training binary quantized weight and activation function for deep neural networks
CN110378909A (en) * 2019-06-24 2019-10-25 南京林业大学 Single wooden dividing method towards laser point cloud based on Faster R-CNN
CN110837818A (en) * 2019-11-18 2020-02-25 汕头大学 Chinese white sea rag dorsal fin identification method based on convolutional neural network
CN111611981A (en) * 2020-06-28 2020-09-01 腾讯科技(深圳)有限公司 Information identification method and device and information identification neural network training method and device

Also Published As

Publication number Publication date
CN112101488A (en) 2020-12-18

Similar Documents

Publication Publication Date Title
CN110196908A (en) Data classification method, device, computer installation and storage medium
CN112101488B (en) Training method and device for machine learning model and storage medium
CN108304373B (en) Semantic dictionary construction method and device, storage medium and electronic device
CN109684476B (en) Text classification method, text classification device and terminal equipment
CN111985229A (en) Sequence labeling method and device and computer equipment
CN107451596B (en) Network node classification method and device
CN110378438A (en) Training method, device and the relevant device of Image Segmentation Model under label is fault-tolerant
CN111783767B (en) Character recognition method, character recognition device, electronic equipment and storage medium
CN111831826B (en) Training method, classification method and device of cross-domain text classification model
CN111881671A (en) Attribute word extraction method
CN111178537A (en) Feature extraction model training method and device
CN110929119A (en) Data annotation method, device, equipment and computer storage medium
CN115455300A (en) Data pushing method and system based on artificial intelligence and cloud platform
CN114187486A (en) Model training method and related equipment
Zhang et al. Bayesian classification
CN113408282B (en) Method, device, equipment and storage medium for topic model training and topic prediction
CN115204142A (en) Open relationship extraction method, device and storage medium
CN112801006A (en) Training method of expression representation model, and facial expression representation method and device
CN114238622A (en) Key information extraction method and device, storage medium and electronic device
WO2020215581A1 (en) Chinese coding method and apparatus based on bidirectional long short-term memory network model
CN112287215A (en) Intelligent employment recommendation method and device
CN110929033A (en) Long text classification method and device, computer equipment and storage medium
Lu et al. A novel method for Chinese named entity recognition based on character vector
CN105468657B (en) A kind of method and system of the important knowledge point in acquisition field
CN117573956B (en) Metadata management method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant