CN112101488A - 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
CN112101488A
CN112101488A CN202011291240.3A CN202011291240A CN112101488A CN 112101488 A CN112101488 A CN 112101488A CN 202011291240 A CN202011291240 A CN 202011291240A CN 112101488 A CN112101488 A CN 112101488A
Authority
CN
China
Prior art keywords
value
training
label
training image
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.)
Granted
Application number
CN202011291240.3A
Other languages
Chinese (zh)
Other versions
CN112101488B (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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Software Systems (AREA)
  • Medical Informatics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Image Analysis (AREA)

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
And the true value of the label of a single training image is represented, and 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 each sample training image in a batch of training images;
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, instead of directly converting I to 0 or 1, I is regarded as I1 and (1-I) 0, and the evaluation index is summarizedThe rate decomposition mode is changed from discrete to continuous. 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 another example, the evaluation index is an 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 a common two-class scenario, the calculation of the accuracy is adjusted to a continuously derivable form, thereby optimizing the accuracy loss function 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 the prediction confidence of a single training image, 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
Represents a singleAnd the real label value of the training image 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 each sample training image in a batch of training images;
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 (22)

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;
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 of the evaluation index loss function learning model is monotonically decreased by the evaluation index randomizer, 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.
2. The training method of claim 1, further comprising:
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.
3. The training method according to claim 2, wherein the constructing a derivable evaluation index loss function with the prediction confidence and the tag true value of the training image as arguments comprises:
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 the evaluation index by using the quantization values corresponding to different image marking conditions;
and constructing a derivable evaluation index loss function by using the evaluation index.
4. The training method of claim 3, 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.
5. The training method according to claim 4, wherein the representing the quantized values corresponding to different image labeling situations by using the predicted confidence and the true label values of the training images comprises:
Figure 103848DEST_PATH_IMAGE001
wherein the content of the first and second substances,
Figure 801414DEST_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 377889DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 81753DEST_PATH_IMAGE004
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 4, wherein the representing the quantized values corresponding to different image labeling situations by using the predicted confidence and the true label values of the training images comprises:
Figure 224021DEST_PATH_IMAGE005
wherein the content of the first and second substances,
Figure 702276DEST_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 424769DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 200833DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
7. The training method according to claim 4, wherein the representing the quantized values corresponding to different image labeling situations by using the predicted confidence and the true label values of the training images comprises:
Figure 522574DEST_PATH_IMAGE007
wherein the content of the first and second substances,
Figure 968468DEST_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 378589DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 915269DEST_PATH_IMAGE004
Representing a single training diagramAnd the true value of the image label is 0 or 1.
8. The training method according to claim 4, wherein the representing the quantized values corresponding to different image labeling situations by using the predicted confidence and the true label values of the training images comprises:
Figure 94446DEST_PATH_IMAGE009
wherein the content of the first and second substances,
Figure 304716DEST_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 871308DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 926858DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
9. The training method of claim 1, wherein said adjusting 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.
10. Training method according to any of claims 1 to 9, wherein the evaluation metrics comprise accuracy, precision, recall, F-score.
11. 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;
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.
12. The training apparatus of claim 11, further comprising 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.
13. The training apparatus of claim 12, wherein 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 the evaluation index by using the quantization values corresponding to different image marking conditions;
and constructing a derivable evaluation index loss function by using the evaluation index.
14. The training apparatus of claim 13, wherein the different image tagging instances 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.
15. The training apparatus of claim 14, wherein 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 898225DEST_PATH_IMAGE011
Wherein the content of the first and second substances,
Figure 813485DEST_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 401461DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 277013DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
16. The training apparatus of claim 14, wherein 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 107083DEST_PATH_IMAGE012
Wherein the content of the first and second substances,
Figure 800101DEST_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 281898DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 744497DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
17. The training apparatus of claim 14, wherein 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 628139DEST_PATH_IMAGE013
Wherein the content of the first and second substances,
Figure 144921DEST_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 238648DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 190424DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
18. The training apparatus of claim 14, wherein 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 318786DEST_PATH_IMAGE014
Wherein the content of the first and second substances,
Figure 481170DEST_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 937559DEST_PATH_IMAGE003
representing the prediction confidence of a single training image, and the value interval is [0,1 ]];
Figure 736101DEST_PATH_IMAGE004
And the true value of the label of a single training image is represented, and the value is 0 or 1.
19. The training apparatus of claim 11, wherein 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.
20. Training apparatus according to any of claims 11 to 19 wherein the assessment indicators comprise accuracy, precision, recall, F-score.
21. An apparatus to train 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-10 based on instructions stored in the memory.
22. 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 10.
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 true CN112101488A (en) 2020-12-18
CN112101488B 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)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113111729A (en) * 2021-03-23 2021-07-13 广州大学 Training method, recognition method, system, device and medium of personnel recognition model
CN113194320A (en) * 2021-04-30 2021-07-30 北京达佳互联信息技术有限公司 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

Cited By (4)

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

Also Published As

Publication number Publication date
CN112101488B (en) 2021-06-25

Similar Documents

Publication Publication Date Title
CN110196908A (en) Data classification method, device, computer installation and storage medium
CN110598191B (en) Complex PDF structure analysis method and device based on neural network
CN112101488B (en) Training method and device for machine learning model and storage medium
CN111985229A (en) Sequence labeling method and device and computer equipment
CN109684476B (en) Text classification method, text classification device and terminal equipment
CN107451596B (en) Network node classification method and device
CN114780727A (en) Text classification method and device based on reinforcement learning, computer equipment and medium
CN111831826B (en) Training method, classification method and device of cross-domain text classification model
CN110929524A (en) Data screening method, device, equipment and computer readable storage medium
WO2022174496A1 (en) Data annotation method and apparatus based on generative model, and device and storage medium
CN111881671A (en) Attribute word extraction method
CN114528845A (en) Abnormal log analysis method and device and electronic equipment
CN111402579A (en) Road congestion degree prediction method, electronic device and readable storage medium
CN110929119A (en) Data annotation method, device, equipment and computer storage medium
Zhang et al. Bayesian classification
CN111259623A (en) PDF document paragraph automatic extraction system and device based on deep learning
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
WO2020215581A1 (en) Chinese coding method and apparatus based on bidirectional long short-term memory network model
CN111767710A (en) Indonesia emotion classification method, device, equipment and medium
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
CN117573956B (en) Metadata management method, device, equipment and storage medium
CN117115564B (en) Cross-modal concept discovery and reasoning-based image classification method and intelligent terminal
CN113204660B (en) Multimedia data processing method, tag identification device and electronic equipment

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