Model update method, apparatus, electronic device and readable storage medium

By using a self-distillation update method, the parameters of the target model are updated by adjusting the positive and negative label probabilities in the historical output results and combining them with the hard labels of the images. This solves the problems of time-consuming model distillation and small datasets, and improves the generalization ability and recognition accuracy of the model.

CN115810120BActive Publication Date: 2026-05-26LENOVO (BEIJING) LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
LENOVO (BEIJING) LTD
Filing Date
2022-09-30
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In existing technologies, the model distillation process is time-consuming and makes it difficult to improve the generalization ability of small models when the training dataset is small.

Method used

By using a self-distillation update method based on the target model, the positive and negative label probabilities in the historical output results are adjusted, and the hard labels of the images are combined to update the parameters of the target model, thereby improving the generalization ability of the model.

Benefits of technology

This improved the accuracy of the target model in recognizing other images and enhanced the model's generalization ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115810120B_ABST
    Figure CN115810120B_ABST
Patent Text Reader

Abstract

The model update method, apparatus, electronic device, and readable storage medium provided in this application determine a target historical output result from multiple historical output results, adjust the probability of a target negative label based on the probability of a positive label in the target historical output result, and guide the current result obtained by the target model in processing the image based on the adjusted probability of the target negative label and the probability of the positive label to update the target model and obtain the current output result. This results in a probability corresponding to a label in the current output result that is different from the probability corresponding to the corresponding processing classification in the current result. The update of the target model combines the dark knowledge contained in the historical output, improves the generalization ability of the target model, and improves the accuracy of the target model in recognizing other images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information technology, and more specifically, to a model updating method, apparatus, electronic device, and readable storage medium. Background Technology

[0002] Current model distillation typically involves using a large model (teacher model) to distill a small model (student model), drawing knowledge from the large model to improve the small model's capabilities. However, this usually requires a large model that has been carefully trained over a long period of time, which is a time-consuming process.

[0003] However, when the training dataset is small and large, high-performing models are difficult to train, it is necessary to improve the model's generalization ability through self-distillation updates. Summary of the Invention

[0004] In view of this, this application provides a model update method, as follows:

[0005] A model update method, comprising:

[0006] The image is identified based on the target model, and multiple historical output results are obtained.

[0007] Determine a target historical output result from the plurality of historical output results, wherein the target historical output result contains a positive label and at least one negative label;

[0008] The probability of the target negative label among the at least one negative label is adjusted based on the probability of the positive label;

[0009] The image is processed based on the target model to obtain the current result, which contains at least two probabilities of processing classification.

[0010] Based on the probabilities of the positive labels and the adjusted target negative labels, the current result of the target model is guided to update the parameters of the target model and obtain the current output result;

[0011] The current output result contains one positive label and at least one negative label, and the probability corresponding to the label in the current output result is different from the probability corresponding to the processing classification in the current result.

[0012] Optionally, in the above method, determining the target historical output result among the plurality of historical output results includes:

[0013] Among the plurality of historical output results, at least two specified historical output results are determined, wherein the probability of positive labels in the specified historical output results is greater than a threshold, and the specified historical output results contain at least two negative labels;

[0014] Based on the fusion probability of the positive labels in the at least two specified historical output results and the fusion probability of each of the negative labels, at least one target negative label is determined;

[0015] The probability of the positive label and the at least one target negative label being determined from at least two specified historical output results, and the historical output results that satisfy the conditions are used as the target historical output results.

[0016] Optionally, in the above method, adjusting the probability of the target negative label among the at least one negative label based on the probability of the positive label includes:

[0017] Increase the probability of the target negative label and decrease the probability of other negative labels besides the target negative label, so that the sum of the probabilities of the target negative label and the positive label is a first target value.

[0018] Optionally, in the above method, increasing the probability of the target negative label and decreasing the probability of other negative labels besides the target negative label includes:

[0019] Determine the first probability sum of the target negative label, and the second probability sum of other negative labels besides the target negative label;

[0020] Based on the first probability sum and the second probability sum, the probability sum of the target negative label and the probability sum of other negative labels besides the target negative label are adjusted so that the probability sum of the target negative label approaches the third probability sum of the negative labels, and the probability sum of other negative labels besides the target negative label approaches the second target value.

[0021] Optionally, the above method further includes at least one of the following:

[0022] The current results of the target model are used to guide the updating of the parameters of the target model based on the historical output results of the target model.

[0023] The current results of the target model are guided based on the image and the hard labels of the image to update the parameters of the target model. The hard labels include positive hard labels and negative hard labels.

[0024] Optionally, in the above method, the step of guiding the current result of the target model to update the parameters of the target model includes:

[0025] Based on the probabilities of the positive labels and the adjusted target negative labels, the current result of the target model is guided to obtain a first loss value;

[0026] Based on the historical output results, the current result of the target model is guided to obtain the second loss value;

[0027] Based on the image and its hard label, the current result of the target model is guided to obtain a third loss value;

[0028] The parameters of the target model are updated by controlling the sum of the first loss value, the second loss value, and the third loss value to satisfy the target loss condition.

[0029] Optionally, the above method, after obtaining the current output result, further includes:

[0030] Determine whether the number of historical output results stored in the target storage space has reached the target number;

[0031] If the number of outputs does not reach the target number, the current output results are stored in the target storage space according to the order of their generation time.

[0032] If the number reaches the target number, after deleting the first historical output result in the target storage space, the current output result is stored in the target storage space according to the order of the generation time of the output result. The first historical output result is the historical output result in the target storage space whose generation time meets the target time condition.

[0033] A model update apparatus, comprising:

[0034] The recognition module is used to recognize images based on the target model and obtain multiple historical output results;

[0035] A determination module is used to determine a target historical output result among the plurality of historical output results, wherein the target historical output result contains a positive label and at least one negative label;

[0036] An adjustment module is used to adjust the probability of a target negative label among the at least one negative label based on the probability of the positive label;

[0037] A processing module is used to process the image based on the target model to obtain a current result, wherein the current result contains probabilities of at least two processing categories;

[0038] The guidance module is used to guide the current result of the target model based on the probability of the positive label and the adjusted target negative label, so as to update the parameters of the target model and obtain the current output result;

[0039] The current output result contains one positive label and at least one negative label, and the probability corresponding to the label in the current output result is different from the probability corresponding to the processing classification in the current result.

[0040] An electronic device includes: a memory and a processor;

[0041] The memory stores the processing program;

[0042] The processor is used to load and execute the processing program stored in the memory to implement the steps of the model update method as described in any of the preceding claims.

[0043] A readable storage medium having a computer program stored thereon, the computer program being invoked and executed by a processor to implement the steps of the model update method as described in any of the preceding claims.

[0044] As can be seen from the above technical solution, this application provides a model update method, including: recognizing an image based on a target model to obtain multiple historical output results; determining a target historical output result among the multiple historical output results, wherein the target historical output result contains a positive label and at least one negative label; adjusting the probability of a target negative label among the at least one negative label based on the probability of the positive label; processing the image based on the target model to obtain a current result, wherein the current result contains probabilities of at least two processing categories; guiding the current result of the target model based on the positive label and the adjusted probability of the target negative label to update the parameters of the target model and obtain a current output result; wherein the current output result contains one positive label and at least one negative label, and the probability corresponding to the label in the current output result is different from the probability corresponding to the corresponding processing category in the current result. In this scheme, a target historical output result is determined from multiple historical output results. The probability of the target negative label is adjusted based on the probability of the positive label in the target historical output result. The current result obtained by the target model in processing the image is then guided by the adjusted probability of the target negative label and the probability of the positive label to update the target model and obtain the current output result. This results in a situation where the probability of the label in the current output result is different from the probability of the corresponding processing classification in the current result. The update of the target model incorporates the dark knowledge contained in the historical output, which improves the generalization ability of the target model and enhances the accuracy of the target model in recognizing other images. Attached Figure Description

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

[0046] Figure 1 This is a flowchart of an embodiment 1 of a model update method provided in this application;

[0047] Figure 2 This is a flowchart of Embodiment 2 of a model update method provided in this application;

[0048] Figure 3 This is a flowchart of embodiment 3 of the model update method provided in this application;

[0049] Figure 4 This is a flowchart of embodiment 4 of the model update method provided in this application;

[0050] Figure 5 This is a flowchart of embodiment 5 of the model update method provided in this application;

[0051] Figure 6 This is a schematic diagram of an embodiment of a model update device provided in this application. Detailed Implementation

[0052] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0053] It should be noted that the model update method provided in this application involves the student model learning dark knowledge. When the teacher model trains the student model, the soft labels it provides contain information about negative examples. Specifically, the soft labels output by the teacher model contain a large amount of knowledge, where the probability of certain negative labels (labels not selected in the final recognition result) is much higher than that of other negative labels. This significantly higher probability of a negative label indicates the presence of dark knowledge. To enable the student model to learn this dark knowledge within the negative labels, this application updates the model based on the dark knowledge contained in the student model's historical output results obtained from image recognition.

[0054] like Figure 1 The diagram shown is a flowchart of an embodiment 1 of a model update method provided in this application. The method is applied to an electronic device and includes the following steps:

[0055] Step S101: Recognize the image based on the target model to obtain multiple historical output results;

[0056] The target model is the student model trained by the teacher model. After training with the teacher model, the target model has a certain recognition accuracy, but its generalization ability needs to be further improved.

[0057] In this application, the generalization ability is improved by self-distillation and updating of the target model.

[0058] The system includes pre-set training samples for updating the target model; in this application, images are used.

[0059] Specifically, the target model performs multiple recognitions on the image, and each recognition yields an output result. The output results obtained from previous recognitions are used as historical output results relative to the current recognition.

[0060] In practice, an image set can be set up, and the target model can identify multiple frames of images in the input image set to obtain historical output results.

[0061] Step S102: Determine the target historical output result from the plurality of historical output results, wherein the target historical output result contains a positive label and at least one negative label;

[0062] Among these, a target historical output result is determined from multiple historical output results. This target historical output result is the one with better hidden knowledge among the multiple historical output results.

[0063] The historical output of this target contains one positive label and at least one negative label.

[0064] Specifically, a positive label is one where the recognition result matches the content of the image; if the recognition result does not match the content of the image, the recognition result corresponds to a negative label.

[0065] For example, if the image contains a car, the recognition results include car, cat, and tiger. The car in the recognition results is a positive label, while the cat and tiger are negative labels.

[0066] This refers to the image classification in the historical output results for this target. For example, if the input image is an image of a car, the historical output results for this target will show the highest probability of identifying the car, while other identification results will have lower probabilities.

[0067] In this context, the positive and negative labels in the historical output of the target are soft labels, with probabilities ranging from 0 to 1. Compared to hard labels (values ​​of 1 or 0), the negative labels in the historical output also carry a significant amount of information. When the probability of some negative labels is much higher than that of others, this indicates the presence of hidden knowledge, allowing the target model to learn more information. Updating the target model based on this hidden knowledge within the negative labels improves its generalization ability.

[0068] For example, the probabilities of identifying this target in the historical output results are (0.70, 0.15, 0.1, 0.015, 0.025, 0.002, 0.003, 0.004, 0.00025, 0.00075), corresponding to 10 possible outcomes including car, cat, tiger, etc. Among them, the probability corresponding to car is the highest, and the historical identification results include a positive label (car) and 9 negative labels (cat, tiger, etc.).

[0069] Step S103: Adjust the probability of the target negative label among the at least one negative label based on the probability of the positive label;

[0070] The probability of positive labels in the historical output results of the target is fixed, which represents the accuracy of the image recognition.

[0071] Among them, the historical output results of this target also contain negative labels. The probability of the negative label represents its ability to identify from multiple perspectives, that is, the ability to generalize the recognition of the object corresponding to the negative label.

[0072] Specifically, the target negative label is identified within this negative label; this target negative label is the one that contains a significant amount of implicit knowledge.

[0073] Specifically, the target negative label is a label that contains a lot of implicit knowledge.

[0074] Specifically, the probability of the target negative label is adjusted based on the probability of the positive label, so that the dark knowledge contained in the target negative label can be better utilized, thereby improving the generalization ability of the target model and achieving higher accuracy when recognizing the content corresponding to other labels.

[0075] Step S104: Process the image based on the target model to obtain the current result, wherein the current result contains at least two probabilities of processing classification;

[0076] The target model processes the image to obtain the current result of the processing, which includes the probabilities of multiple processing categories.

[0077] The number of these multiple processing categories is consistent with the sum of the number of positive and negative labels mentioned above.

[0078] For example, in the historical output results, 1 positive label and 9 negative labels were identified. Correspondingly, the current result obtained in this step contains 10 processing categories.

[0079] Moreover, the probability of this classification process ranges from (0, 1).

[0080] Step S105: Based on the probability of the positive label and the adjusted target negative label, guide the current result of the target model to update the parameters of the target model and obtain the current output result.

[0081] The current output result contains one positive label and at least one negative label, and the probability corresponding to the label in the current output result is different from the probability corresponding to the processing classification in the current result.

[0082] Specifically, the probability of the positive label and the adjusted probability of the target negative label are used to guide the current results of the target model in order to update the parameters of the target model.

[0083] Specifically, the current results of the target model are guided by adjusting the probabilities of at least two processing classifications in the current results. The parameters of the target model are adjusted so that the probability of the processing classification obtained by the target model in recognizing the image is closer to the probability of the positive label and the adjusted probability of the target negative label.

[0084] It should be noted that positive and negative labels each correspond to a recognition perspective. The negative label is based on the image's perspective, where the content of the image has a high similarity to the content corresponding to the negative label. This negative label is a perspective containing hidden knowledge, which leads to the image being identified as a negative label. Since the probability of the positive label and the adjusted probability of the target negative label guide the current result of the target model, the target model can learn the hidden knowledge contained in the target negative label. This allows the target model to learn more hidden knowledge corresponding to the perspective in the target negative label. The hidden knowledge learned by the target model can ensure that its accuracy in recognizing the correct image corresponding to the target negative label is improved, thereby enhancing the generalization ability of the target model.

[0085] For example, if the positive label is "car" and the target negative labels include "cat" and "tiger", then by adjusting the probability of the target negative label and the probability of the positive label, the current result of the target model is guided, which increases the probability of processing the corresponding classification of "cat" and "tiger". Moreover, after updating the parameters of the target model, when the updated target model processes images of cats and tigers in the future, it can use the learned dark knowledge to more accurately identify cats and tigers in the images, thus improving the generalization ability of the target model.

[0086] In summary, the model update method provided in this embodiment determines a target historical output result from multiple historical output results, adjusts the probability of the target negative label based on the probability of the positive label in the target historical output result, and guides the current result obtained by the target model in processing the image based on the adjusted probability of the target negative label and the probability of the positive label, so as to update the target model and obtain the current output result. This results in a situation where the probability corresponding to the label in the current output result is different from the probability corresponding to the corresponding processing classification in the current result. The update of the target model combines the dark knowledge contained in the historical output, improves the generalization ability of the target model, and improves the accuracy of the target model in recognizing other images.

[0087] like Figure 2 The diagram shown is a flowchart of an embodiment 2 of a model update method provided in this application. The method includes the following steps:

[0088] Step S201: Recognize the image based on the target model to obtain multiple historical output results;

[0089] Step S201 is the same as step S101 in Embodiment 1, and will not be repeated in this embodiment.

[0090] Step S202: Determine at least two specified historical output results from the plurality of historical output results;

[0091] Wherein, the probability of positive labels in the specified historical output results is greater than a threshold, and the specified historical output results contain at least two negative labels.

[0092] Among these multiple historical output results, some were correctly identified, while others were incorrect.

[0093] Among these multiple historical output results, the one that is correctly identified is determined.

[0094] Among these, the specified historical output results are those with a probability of identifying a positive label that is greater than a threshold.

[0095] Specifically, determine multiple labels in the historical output results, and whether the probability of the positive label is greater than a threshold. If it is greater than the threshold, the positive label is used as the final result in the historical output results, indicating that the classification of the image in the historical output results is correct, and the historical output results are determined as the specified historical output results.

[0096] The threshold can be a specific set value, or it can be determined based on the probability of the label with the highest probability in the historical output results.

[0097] For example, the historical output results include: car (0.75), cat (0.10), tiger (0.10), flower (0.01), eagle (0.02), gecko (0.02). Among them, car is a positive label with a relatively high probability, so this historical output result is the specified historical output result.

[0098] For example, the historical output results include: tiger (0.55), car (0.35), cat (0.06), flower (0.01), eagle (0.02), gecko (0.01). Among them, car is a positive label with a low probability, so this historical output result is not the specified historical output result.

[0099] Step S203: Based on the fusion probability of the positive labels in the at least two specified historical output results and the fusion probability of each of the negative labels, determine at least one target negative label;

[0100] Among them, based on the specified historical output results that correctly classify the image, negative labels containing more dark knowledge are identified.

[0101] Specifically, the target negative label is identified among multiple negative labels, and this target negative label is a perspective that contains more tacit knowledge.

[0102] First, the fusion probability of each label in multiple specified historical output results is calculated, including the fusion probability of positive labels and the fusion probability of each negative label. The fusion probabilities of each label are sorted from largest to smallest, and the top few negative labels with the highest fusion probabilities are determined as target negative labels.

[0103] As an example, let's set the target negative labels to 2, obtain 100 historical output results, output 10 labels, select 80 specified historical output results from these 100 historical output results, calculate the average probability of the 10 labels in these 80 specified historical output results and sort them from largest to smallest, select the 2 negative labels with the highest average probability. For example, if the positive label is "car" and the 2 negative labels with the highest average probability are "cat" and "tiger", then the target negative labels are determined to be "cat" and "tiger".

[0104] The number of negative labels for the target can be determined based on the dataset (images) identified by the target model. The more complex the dataset, the larger the number of negative labels can be.

[0105] For example, an image of a car can be classified as a car based on its headlights, wheels, or windows. An image of a cat can be classified as a cat based on its ears, legs, or eyes; observing all of these features, using just one of them is sufficient for classification.

[0106] Step S204: Determine the probability of the positive label and the at least one target negative label from at least two specified historical output results and the historical output results that satisfy the conditions as target historical output results;

[0107] Among them, after determining multiple specified historical output results, it is necessary to select the historical output result that contains the most hidden knowledge.

[0108] Specifically, the probability sum of the target negative label and positive label in the multiple specified historical output results is calculated respectively, and the historical output results whose probability sum meets the condition are determined as the target historical output results.

[0109] Among them, the probability of positive labels and target negative labels and the conditions for satisfying them indicate that the historical output contains the most hidden knowledge.

[0110] The condition to be met can be the maximum sum of probabilities, or the sum of probabilities being greater than a set threshold, etc.

[0111] Step S205: Adjust the probability of the target negative label among the at least one negative label based on the probability of the positive label;

[0112] Step S206: Process the image based on the target model to obtain the current result, wherein the current result contains at least two probabilities of processing classification;

[0113] Step S207: Based on the probability of the positive label and the adjusted target negative label, guide the current result of the target model to update the parameters of the target model and obtain the current output result.

[0114] Steps S205-207 are the same as steps S103-105 in Example 1, and will not be repeated in this example.

[0115] In summary, the model update method provided in this embodiment determines a specified historical output result with accurate classification from multiple historical output results, identifies a target negative label from the specified historical output result, determines which negative labels contain more dark knowledge, and determines a target historical output result based on the sum of the probabilities of the target negative label and positive label in each specified historical output result. The dark knowledge contained in the target historical output result is suitable, providing a basis for the subsequent process of adjusting the probability of the target negative label based on the probability of the target negative label and positive label in the target historical output result, and ensuring that the current result can be guided based on appropriate dark knowledge.

[0116] like Figure 3 The diagram shown is a flowchart of an embodiment 3 of a model update method provided in this application. The method includes the following steps:

[0117] Step S301: Recognize the image based on the target model to obtain multiple historical output results;

[0118] Step S302: Determine the target historical output result from the plurality of historical output results, wherein the target historical output result contains a positive label and at least one negative label;

[0119] Steps S301-302 are the same as steps S101-102 in Example 1, and will not be repeated in this example.

[0120] Step S303: Increase the probability of the target negative label and decrease the probability of other negative labels besides the target negative label, so that the sum of the probabilities of the target negative label and the positive label is a first target value;

[0121] Specifically, the process of adjusting the probability of the target negative label involves increasing the probability of the target negative label and decreasing the probability of other negative labels.

[0122] The first target value is 1.

[0123] Specifically, the sum of the probability of the target being a negative label and the probability of being a positive label reaches 1.

[0124] Specifically, by increasing the probability of the target negative label and decreasing the probability of other negative labels besides the target negative label, the basis for guiding the current result is concentrated on the negative labels corresponding to the perspective containing dark knowledge, so as to improve the target model's ability to learn the dark knowledge of the target negative label more effectively.

[0125] Step S303 includes:

[0126] Step S031: Determine the first probability sum of the target negative label and the second probability sum of other negative labels besides the target negative label;

[0127] The probability of each target's negative label is summed to obtain the first probability sum.

[0128] The second probability sum is obtained by summing the probabilities of all negative labels other than the target negative label.

[0129] For example, if the target negative labels are cat and tiger, with probabilities of 0.10 and 0.10 respectively, the sum of the first probabilities of the target negative labels is 0.20; if the other negative labels are flower, eagle and gecko, with probabilities of 0.01, 0.02 and 0.02 respectively, then the sum of the second probabilities is 0.05.

[0130] Step S032: Based on the first probability sum and the second probability sum, adjust the probability sum of the target negative label and the probability sum of other negative labels besides the target negative label, so that the probability sum of the target negative label approaches the third probability sum of the negative labels, and the probability sum of other negative labels besides the target negative label approaches the second target value.

[0131] Specifically, based on the sum of the first probability and the sum of the second probability, the probability of the target negative label and the probability of other negative labels are adjusted, which means controlling the entropy of the sum of the first probability and the sum of the second probability to be minimized.

[0132] The value of the second target is 0.

[0133] Among them, by adjusting, the probability of achieving the target negative label approaches the sum of the overall probabilities of the negative label, that is, the difference between the probability of 1 and the probability of the positive label; by adjusting, the sum of the probabilities of achieving other negative labels besides the target negative label approaches 0.

[0134] As an example, the probability of a positive label is 'a', the probability of the target negative label is 'b', and the sum of the probabilities of other negative labels is 'c', where a + b + c = 1. The goal is to increase the probability of the target negative label so that the adjusted probability b' approaches 1 - a (or b + c), and the probabilities of other negative labels approach 0.

[0135] Step S304: Process the image based on the target model to obtain the current result, wherein the current result contains at least two probabilities of processing classification;

[0136] Step S305: Based on the probability of the positive label and the adjusted target negative label, guide the current result of the target model to update the parameters of the target model and obtain the current output result.

[0137] Steps S304-305 are the same as steps S104-105 in Example 1, and will not be repeated in this example.

[0138] In summary, the model update method provided in this embodiment calculates a first probability sum of the target negative label and a second probability sum of other negative labels besides the target negative label. Based on the first and second probability sums, the probability of the target negative label is increased, and the probability of other negative labels besides the target negative label is decreased. Since the amount of dark knowledge contained in the target negative label is greater than that contained in other negative labels, by increasing the probability of the target negative label and decreasing the probability of other negative labels besides the target negative label, the basis for guiding the current result is concentrated in the negative labels corresponding to the perspective containing dark knowledge, so that the target model can learn the dark knowledge of the target negative label more effectively.

[0139] like Figure 4 The diagram shown is a flowchart of an embodiment 4 of a model update method provided in this application. The method includes the following steps:

[0140] Step S401: Recognize the image based on the target model to obtain multiple historical output results;

[0141] Step S402: Determine at least two specified historical output results from the plurality of historical output results, wherein the probability of positive labels in the specified historical output results is greater than a threshold, and the specified historical output results contain at least two negative labels;

[0142] Step S403: Based on the fusion probability of the positive labels in the at least two specified historical output results and the fusion probability of each of the negative labels, determine at least one target negative label;

[0143] Step S404: Determine the probability of the positive label and the at least one target negative label from at least two specified historical output results and the historical output results that satisfy the conditions as target historical output results;

[0144] Step S405: Adjust the probability of the target negative label among the at least one negative label based on the probability of the positive label;

[0145] Step S406: Process the image based on the target model to obtain the current result, wherein the current result contains at least two probabilities of processing classification;

[0146] Step S407: Based on the probability of the positive label and the adjusted target negative label, guide the current result of the target model to update the parameters of the target model;

[0147] Steps S401-407 are the same as steps S201-207 in Example 2, and will not be repeated in this example.

[0148] Step S408: Based on the historical output results of the target model, guide the current results of the target model to update the parameters of the target model;

[0149] Furthermore, the current result is guided by the historical output of the target.

[0150] Specifically, cross-entropy is used to guide the current result so that the probabilities of each label in the historical output results and the probabilities of the corresponding processing classification in the current result are constrained to within a first agreed threshold.

[0151] In practice, the softmax function can be used for constraints.

[0152] Step S409: Based on the image and the hard label of the image, guide the current result of the target model to update the parameters of the target model and obtain the current output result.

[0153] The hard labels include positive hard labels and negative hard labels.

[0154] Furthermore, the hard label of the image provides guidance for the current result.

[0155] The hard label of the image is the correct classification of the image. The probability of a positive hard label is 1, and the probability of a negative hard label is 0.

[0156] Specifically, cross-entropy is used to guide the current result so that the probability corresponding to the hard label of the image and the probability of the corresponding processing classification in the current result are constrained to within a second agreed threshold.

[0157] The second agreed threshold can be the same as or different from the first agreed threshold, and the specific value can be set according to the actual situation.

[0158] In practice, the softmax function can be used for constraints.

[0159] It should be noted that in specific implementation, one or both of the above-mentioned guidance bases, namely, target-based historical output results and image-based hard labels, can be selected and implemented.

[0160] In this embodiment, the parameters of the target model are updated based on three types of information to guide the current result. These three types of information include: the probability of the positive label and the adjusted target negative label, historical output results, the image, and the hard label of the image.

[0161] Regardless of the type of information used to guide the current outcome, losses will result.

[0162] Specifically, the step of guiding the current results of the target model to update the parameters of the target model includes:

[0163] Based on the probabilities of the positive labels and the adjusted target negative labels, the current result of the target model is guided to obtain a first loss value;

[0164] Based on the historical output results, the current result of the target model is guided to obtain the second loss value;

[0165] Based on the image and its hard label, the current result of the target model is guided to obtain a third loss value;

[0166] The parameters of the target model are updated by controlling the sum of the first loss value, the second loss value, and the third loss value to satisfy the target loss condition.

[0167] Using any type of information to guide the current result will result in some loss. In order to ensure that the update loss of the final target model is small, it is necessary to determine that the overall loss satisfies the target loss condition.

[0168] Specifically, the first loss value, the second loss value, and the third loss value are summed to obtain the sum of the loss values. Based on the fact that the sum of the loss values ​​satisfies the target loss condition, the loss of the current output result of the target model is minimized.

[0169] In order to improve the update speed of the target model, weights are assigned to each loss value.

[0170] Specifically, the first loss value L1, the second loss value L2, and the third loss value L3 are each assigned a weight of α, β, and γ, respectively, where β + γ < 1 and α < β. The corresponding loss function value L guiding the current result is as follows:

[0171] L=αL1+βL2+γL3

[0172] Specifically, the value L of the loss function is controlled to satisfy the target loss condition.

[0173] In practice, the loss function is calculated for each current result until the value of the loss function L meets the stopping condition, at which point the model is stopped from being updated.

[0174] The stopping condition is that the value of the loss function no longer decreases.

[0175] In summary, the model update method provided in this embodiment further includes at least one of the following: guiding the current result of the target model based on the historical output results of the target model to update the parameters of the target model; guiding the current result of the target model based on the image and the hard labels of the image to update the parameters of the target model, wherein the hard labels include positive hard labels and negative hard labels. This embodiment also provides two methods for guiding the current result of the target model, and guides the current result of the target model based on the adjusted probability of the negative target label, thereby improving training efficiency.

[0176] like Figure 5 The diagram shown is a flowchart of embodiment 5 of a model update method provided in this application. The method includes the following steps:

[0177] Step S501: Recognize the image based on the target model to obtain multiple historical output results;

[0178] Step S502: Determine the target historical output result from the plurality of historical output results, wherein the target historical output result contains a positive label and at least one negative label;

[0179] Step S503: Adjust the probability of the target negative label among the at least one negative label based on the probability of the positive label;

[0180] Step S504: Process the image based on the target model to obtain the current result, wherein the current result contains at least two probabilities of processing classification;

[0181] Step S505: Based on the probability of the positive label and the adjusted target negative label, guide the current result of the target model to update the parameters of the target model and obtain the current output result;

[0182] Steps S501-505 are the same as steps S101-105 in Example 1, and will not be repeated in this example.

[0183] Step S506: Determine whether the number of historical output results stored in the target storage space has reached the target number;

[0184] In this process, after the target model obtains the output result, the input result is stored so that it can be processed as a historical output result later.

[0185] If the target storage space of an electronic device can only store a limited number of output results, it is necessary to first determine whether the target storage space is already full.

[0186] Specifically, the target number of output results that can be stored in the target storage space is fixed. The number of historical output results that have been stored in the target storage space is determined, and it is determined whether the number of historical output results that have been stored has reached the target number.

[0187] In practice, the number of historical output results that can be stored in the target storage space can be preset, such as determining the number of historical output results that can be stored based on the size of the storage area of ​​the target storage space.

[0188] In practice, since subsequent recognition and previous historical recognition are based on the same dataset (the same set of images), the parameters of the target model that outputs the historical output results each time can be stored. When the historical output results are needed, the stored parameters of the target model can be imported into the target model and the input image can be obtained.

[0189] For example, if you need to store N historical output results, you need to store the parameters of the target model corresponding to each of the N historical output results.

[0190] Step S507: If the number of outputs does not reach the target number, store the current output results in the target storage space according to the order of their generation time.

[0191] If the number of historical output results stored in the target storage space is small and has not yet reached the target number, then the current output result is stored in the target storage space.

[0192] Specifically, when outputting the current result, the results are stored sequentially according to their generation time, with the first generated results listed first and the last generated results listed last.

[0193] Step S508: If the number reaches the target number, after deleting the first historical output result in the target storage space, store the current output result in the target storage space according to the order of the generation time of the output result.

[0194] The first historical output result is the historical output result generated in the target storage space whose time meets the target time condition.

[0195] If the target storage space already contains historical output results for the target number of items, delete the historical output results whose generation time meets the target time condition, and store the current output result for this time in the target storage space.

[0196] The target time condition is that the generation time is the earliest among the target storage spaces.

[0197] If the target storage space is full, the oldest historical output result stored in the target storage space is deleted, and the current output result is placed after the historical input result with the most recent generation time.

[0198] The order in which historical output results are stored in the target storage space is based on the order of their generation time; the earlier the generation time, the higher the ranking.

[0199] In this embodiment, by deleting the earliest generated historical output results to make room for the current output results, it is ensured that the historical output results stored in the target storage space are all generated in a relatively recent time. After multiple model updates, the historical output results generated with each update are updated sequentially compared to the previous ones. Since the target model has stronger generalization ability and higher accuracy after model updates, its corresponding historical output results are more accurate than before. Therefore, in this embodiment, when the target storage space is limited, the output results of the target number generated in a relatively recent time are retained first, so as to realize the historical output results that update the parameters of the target model based on the historical updates, and iteratively update the parameters of the target model, so that the generalization ability of the target model is further enhanced and the accuracy is higher.

[0200] Another storage method is to directly store the current output result in the target storage space, without considering whether the target storage space already contains the target number of historical output results.

[0201] In practice, the storage method is selected based on the size of the image dataset and the size of the target model. If there are too many image datasets, there will be many output results. To ensure effective storage, the parameters of the target model corresponding to the historical output results are stored. If the target model is large and the image dataset is small, storing the parameters of the target model would require more storage space than storing the output results. Therefore, the method of directly storing the output results can be selected.

[0202] In summary, in the model update method provided in this embodiment, if the number of historical output results stored in the target storage space does not reach the target number, the current output results are stored in the target storage space in the order of their generation time. If the number of historical output results stored in the target storage space reaches the target number, the first historical output result generated is deleted, and the current output results are stored in the target storage space in the order of their generation time. In this embodiment, when the target storage space is limited, output results generated more recently are prioritized to achieve the target model parameters iteratively updated based on historical output results, thereby further enhancing the generalization ability and accuracy of the target model.

[0203] Corresponding to the above-described embodiment of the model update method provided in this application, this application also provides an embodiment of an apparatus for applying the model update method.

[0204] like Figure 6 The diagram shown is a structural schematic of an embodiment of a model update device provided in this application. The device includes the following components: an identification module 601, a determination module 602, an adjustment module 603, a processing module 604, and a guidance module 605.

[0205] The recognition module 601 is used to recognize images based on the target model and obtain multiple historical output results.

[0206] The determining module 602 is used to determine a target historical output result among the plurality of historical output results, wherein the target historical output result contains a positive label and at least one negative label;

[0207] The adjustment module 603 is used to adjust the probability of the target negative label among the at least one negative label based on the probability of the positive label;

[0208] The processing module 604 is used to process the image based on the target model to obtain a current result, wherein the current result contains at least two probabilities of processing classification.

[0209] The guidance module 605 is used to guide the current result of the target model based on the probability of the positive label and the adjusted target negative label, so as to update the parameters of the target model and obtain the current output result.

[0210] The current output result contains one positive label and at least one negative label, and the probability corresponding to the label in the current output result is different from the probability corresponding to the processing classification in the current result.

[0211] Optionally, the determining module includes:

[0212] The first determining unit is configured to determine at least two specified historical output results among the plurality of historical output results, wherein the probability of positive labels in the specified historical output results is greater than a threshold, and the specified historical output results contain at least two negative labels;

[0213] The second determining unit is used to determine at least one target negative label based on the fusion probability of the positive labels in the at least two specified historical output results and the fusion probability of each negative label.

[0214] The third determining unit is used to determine the probability of the positive label and the at least one target negative label and the historical output result that satisfies the condition from at least two specified historical output results as the target historical output result.

[0215] Optionally, the adjustment module is used for:

[0216] Increase the probability of the target negative label and decrease the probability of other negative labels besides the target negative label, so that the sum of the probabilities of the target negative label and the positive label is a first target value.

[0217] Optionally, the adjustment module includes:

[0218] A probability unit is used to determine a first probability sum of the target negative label and a second probability sum of other negative labels besides the target negative label;

[0219] An adjustment unit is configured to adjust the probability sum of the target negative label and the probability sum of other negative labels besides the target negative label based on the first probability sum and the second probability sum, so that the probability sum of the target negative label approaches the third probability sum of the negative labels, and the probability sum of other negative labels besides the target negative label approaches the second target value.

[0220] Optionally, it may also include at least one of the following:

[0221] The historical guidance module is used to guide the current results of the target model based on the historical output results of the target, so as to update the parameters of the target model;

[0222] The label guidance module is used to guide the current result of the target model based on the image and the hard labels of the image, so as to update the parameters of the target model. The hard labels include positive hard labels and negative hard labels.

[0223] Optional,

[0224] The guidance module provides guidance to the current result of the target model based on the probability of the positive label and the adjusted target negative label, and obtains a first loss value;

[0225] The historical guidance module guides the current result of the target model based on the historical output results to obtain a second loss value;

[0226] The label guidance module guides the current result of the target model based on the image and the hard labels of the image to obtain a third loss value;

[0227] The guidance module is also used to control the sum of the first loss value, the second loss value, and the third loss value to meet the target loss condition, and to update the parameters of the target model.

[0228] Optional, also includes:

[0229] The judgment module is used to determine whether the number of historical output results stored in the target storage space has reached the target number;

[0230] The first storage module is used to store the current output results into the target storage space in the order of their generation time if the number of output results does not reach the target number.

[0231] The second storage module is used to, if the number reaches the target number, delete the first historical output result in the target storage space, and then store the current output result in the target storage space according to the order of the generation time of the output result. The first historical output result is a historical output result in the target storage space whose generation time meets the target time condition.

[0232] It should be noted that the explanation of the functions of each structure in the model update device provided in this embodiment is provided in the method embodiment, and will not be repeated in this embodiment.

[0233] In summary, the model update device provided in this embodiment determines a target historical output result from multiple historical output results, adjusts the probability of the target negative label based on the probability of the positive label in the target historical output result, and guides the current result obtained by the target model in processing the image based on the adjusted probability of the target negative label and the probability of the positive label, so as to update the target model and obtain the current output result. This results in a situation where the probability corresponding to the label in the current output result is different from the probability corresponding to the corresponding processing classification in the current result. The update of the target model combines the dark knowledge contained in the historical output, improves the generalization ability of the target model, and improves the accuracy of the target model in recognizing other images.

[0234] Corresponding to the above-described embodiment of the model update method provided in this application, this application also provides an electronic device and a readable storage medium corresponding to the model update method.

[0235] The electronic device includes: a memory and a processor;

[0236] The memory stores the processing program;

[0237] The processor is used to load and execute the processing program stored in the memory to implement the steps of the model update method embodiments as described above.

[0238] For details on the specific implementation model update method of this electronic device, please refer to the aforementioned model update method embodiment.

[0239] The readable storage medium stores a computer program that is invoked and executed by a processor to implement the steps of the model update method embodiments described above.

[0240] For details on the specific implementation of the model update method by executing the computer program stored in the readable storage medium, please refer to the aforementioned model update method embodiments.

[0241] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. The apparatus provided in the embodiments is described simply because it corresponds to the method provided in the embodiments; relevant parts can be referred to in the method section.

[0242] The above description of the provided embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features provided herein.

Claims

1. A model update method, comprising: The image is identified based on the target model, and multiple historical output results are obtained. Determine a target historical output result from the plurality of historical output results, wherein the target historical output result contains a positive label and at least one negative label; Adjusting the probability of a target negative label among the at least one negative labels based on the probability of the positive label includes: increasing the probability of the target negative label and decreasing the probability of other negative labels besides the target negative label, so that the sum of the probabilities of the target negative label and the positive label is a first target value; The image is processed based on the target model to obtain the current result, which contains at least two probabilities of processing classification. Based on the probabilities of the positive labels and the adjusted target negative labels, the current result of the target model is guided to update the parameters of the target model and obtain the current output result; The current output result contains one positive label and at least one negative label, and the probability corresponding to the label in the current output result is different from the probability corresponding to the processing classification in the current result.

2. The method according to claim 1, wherein determining the target historical output result among the plurality of historical output results includes: Among the plurality of historical output results, at least two specified historical output results are determined, wherein the probability of positive labels in the specified historical output results is greater than a threshold, and the specified historical output results contain at least two negative labels; Based on the fusion probability of the positive labels in the at least two specified historical output results and the fusion probability of each of the negative labels, at least one target negative label is determined; The probability of the positive label and the at least one target negative label being determined from at least two specified historical output results, and the historical output results that satisfy the conditions are used as the target historical output results.

3. The method according to claim 1, wherein increasing the probability of the target negative label and decreasing the probability of other negative labels besides the target negative label comprises: Determine the first probability sum of the target negative label, and the second probability sum of other negative labels besides the target negative label; Based on the first probability sum and the second probability sum, the probability sum of the target negative label and the probability sum of other negative labels besides the target negative label are adjusted so that the probability sum of the target negative label approaches the third probability sum of the negative labels, and the probability sum of other negative labels besides the target negative label approaches the second target value.

4. The method of claim 2, further comprising at least one of the following: The current results of the target model are used to guide the updating of the parameters of the target model based on the historical output results of the target model. The current results of the target model are guided based on the image and the hard labels of the image to update the parameters of the target model. The hard labels include positive hard labels and negative hard labels.

5. The method according to claim 4, wherein guiding the current result of the target model to update the parameters of the target model includes: Based on the probabilities of the positive labels and the adjusted target negative labels, the current result of the target model is guided to obtain a first loss value; Based on the historical output results, the current result of the target model is guided to obtain the second loss value; Based on the image and its hard label, the current result of the target model is guided to obtain a third loss value; The parameters of the target model are updated by controlling the sum of the first loss value, the second loss value, and the third loss value to satisfy the target loss condition.

6. The method according to claim 1, further comprising, after obtaining the current output result: Determine whether the number of historical output results stored in the target storage space has reached the target number; If the number of outputs does not reach the target number, the current output results are stored in the target storage space according to the order of their generation time. If the number reaches the target number, after deleting the first historical output result in the target storage space, the current output result is stored in the target storage space according to the order of the generation time of the output result. The first historical output result is the historical output result in the target storage space whose generation time meets the target time condition.

7. A model update apparatus, comprising: The recognition module is used to recognize images based on the target model and obtain multiple historical output results; A determination module is used to determine a target historical output result among the plurality of historical output results, wherein the target historical output result contains a positive label and at least one negative label; An adjustment module is used to adjust the probability of a target negative label among the at least one negative label based on the probability of the positive label; A processing module is used to process the image based on the target model to obtain a current result, wherein the current result contains probabilities of at least two processing categories; The guidance module is used to guide the current result of the target model based on the probability of the positive label and the adjusted target negative label, so as to update the parameters of the target model and obtain the current output result; The current output result contains one positive label and at least one negative label, and the probability corresponding to the label in the current output result is different from the probability corresponding to the corresponding processing category in the current result; The adjustment module is specifically used to: increase the probability of the target negative label and decrease the probability of other negative labels besides the target negative label, so that the sum of the probabilities of the target negative label and the positive label is a first target value.

8. An electronic device, comprising: Memory, processor; The memory stores the processing program; The processor is used to load and execute the processing program stored in the memory to implement the steps of the model update method as described in any one of claims 1-6.

9. A readable storage medium having a computer program stored thereon, the computer program being invoked and executed by a processor to implement the steps of the model update method as described in any one of claims 1-6.