A model training method and device, and a target detection method and device
By using the first model to predict unlabeled data and determine candidate labels based on the confidence threshold, and combining it with labeled data to train the second model, the problem of training deep learning models consuming a lot of human resources is solved, and efficient model training is achieved and generalization capabilities are improved.
Patent Information
- Application Number
- CN202210507932.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-10
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-05-10
AI Technical Summary
Training deep learning models requires large amounts of labeled data, which results in a huge amount of human resources required for labeling.
The first model is used to predict the unlabeled data, and the candidate labels are determined in combination with the confidence threshold. The second model is trained using the labeled data and the candidate labels, and the model training is performed in a semi-supervised manner.
It reduces the human resources required for model training, improves the generalization ability of the model, and avoids the occurrence of false positive labels and false negative labels.
Smart Images

Figure CN114881149B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of deep learning technology, and in particular to a model training method and device, and a target detection method and device. Background Art
[0002] With the rapid development of deep learning technology, it has achieved remarkable results in many fields, including object detection and face recognition. However, training deep learning models to achieve good performance relies on large amounts of labeled data and computing resources. However, labeling large amounts of data requires significant human resources. Summary of the Invention
[0003] The purpose of the embodiments of the present application is to provide a model training method and device, and a target detection method and device to reduce the human resources required for model training. The specific technical solutions are as follows:
[0004] In a first aspect, an embodiment of the present application provides a model training method, the method comprising:
[0005] Using the first model, predicting at least one first unlabeled data, obtaining a plurality of first predicted labels for each first unlabeled data and a confidence level of each first predicted label;
[0006] Determine a confidence threshold for the label category based on the distribution of each label category in the label set of labeled data and the confidence of all first predicted labels belonging to the label category;
[0007] Using the first model, predict at least one second unlabeled data to obtain multiple second predicted labels for each second unlabeled data and a confidence level for each second predicted label;
[0008] Determine, from among the multiple second predicted labels of each second unlabeled data, a second predicted label whose confidence is greater than a confidence threshold of the label category to which it belongs, as a candidate label for the second unlabeled data;
[0009] The second model is trained using the labeled data, the at least one second unlabeled data, and the candidate label of each second unlabeled data.
[0010] Optionally, the confidence threshold includes a first confidence threshold; and the step of determining the confidence threshold of the label category based on the distribution of each label category in the label set with labeled data and the confidence of all first predicted labels belonging to the label category includes:
[0011] Determine a multiple relationship between the total number of the at least one first unlabeled data and the total number of labeled data;
[0012] Determining, based on a first number of labels in each label category in the label set having label data, a second number of labels in the label category, wherein the second number of labels in the label category satisfies the multiple relationship with the first number of labels in the label category;
[0013] Determine the product of the second number of tags of each tag category and a preset reliability coefficient to obtain a third number of tags of the tag category;
[0014] In descending order, the confidences of all first predicted labels belonging to each label category are determined at corresponding third number of positions as the first confidence threshold of the label category.
[0015] Optionally, the step of training the second model using the labeled data, the at least one second unlabeled data, and the candidate label of each second unlabeled data includes:
[0016] Inputting the labeled data and the at least one second unlabeled data into the second model respectively, and obtaining confidences that the labels of a plurality of first candidate boxes are corresponding candidate labels, wherein the first candidate boxes are detection boxes whose intersection-over-union ratio with the detection boxes marked with the candidate labels is greater than a first preset intersection-over-union ratio;
[0017] Determining a first loss using confidence levels corresponding to the multiple first candidate boxes;
[0018] Using the first loss, the parameters of the second model are updated.
[0019] Optionally, the confidence threshold includes a second confidence threshold; and the step of determining the confidence threshold of the label category based on the distribution of each label category in the label set with labeled data and the confidence of all first predicted labels belonging to the label category includes:
[0020] Determine a multiple relationship between the total number of the at least one first unlabeled data and the total number of labeled data;
[0021] Determining, based on a first number of labels in each label category in the label set having label data, a second number of labels in the label category, wherein the second number of labels in the label category satisfies the multiple relationship with the first number of labels in the label category;
[0022] In descending order, the confidences of all first predicted labels belonging to each label category are determined at corresponding second number of positions as the second confidence threshold of the label category.
[0023] Optionally, the step of training the second model using the labeled data, the at least one second unlabeled data, and the candidate label of each second unlabeled data includes:
[0024] Inputting the at least one second unlabeled data into the first model and the second model, obtaining a plurality of second candidate boxes having labels with first confidence levels and second confidence levels corresponding to the candidate labels, wherein the second candidate boxes are detection boxes having an intersection-over-union ratio (IOR) with the detection boxes marked with the candidate labels that is greater than a second preset IOR;
[0025] Determine a second loss using the first confidence level and the second confidence level corresponding to each second candidate box;
[0026] Utilizing the second loss, parameters of the second model are updated.
[0027] Optionally, the confidence threshold includes a first confidence threshold and a second confidence threshold; and the step of determining the confidence threshold of the label category based on the distribution of each label category in the label set with labeled data and the confidence of all first predicted labels belonging to the label category includes:
[0028] Determine a multiple relationship between the total number of the at least one first unlabeled data and the total number of labeled data;
[0029] Determining, based on a first number of labels in each label category in the label set having label data, a second number of labels in the label category, wherein the second number of labels in the label category satisfies the multiple relationship with the first number of labels in the label category;
[0030] Determine the product of the second number of tags of each tag category and a preset reliability coefficient to obtain a third number of tags of the tag category;
[0031] In order from large to small, from the confidences of all the first predicted labels belonging to each label category, determine the confidence at the corresponding third number of positions as the first confidence threshold of the label category, and determine the confidence at the corresponding second number of positions as the second confidence threshold of the label category.
[0032] Optionally, the step of determining, from the plurality of second predicted labels for each second unlabeled data, a second predicted label having a confidence greater than a confidence threshold of the label category to which it belongs as a candidate label for the second unlabeled data includes:
[0033] Determine, from among the multiple second predicted labels of each second unlabeled data, a second predicted label having a confidence level greater than a first confidence threshold of the label category to which it belongs, as a reliable label for the second unlabeled data;
[0034] Among the multiple second predicted labels of each second unlabeled data except the reliable label, a second predicted label with a confidence greater than a second confidence threshold of the label category to which it belongs is determined as the uncertain label of the second unlabeled data.
[0035] Optionally, the step of training the second model using the labeled data, the at least one second unlabeled data, and the candidate label of each second unlabeled data includes:
[0036] Inputting the labeled data and the at least one second unlabeled data into the second model respectively, obtaining confidences that the labels of a plurality of first candidate boxes are corresponding reliable labels, wherein the first candidate boxes are detection boxes whose intersection-over-union ratios with the detection boxes marked with the reliable labels are greater than a first preset intersection-over-union ratio;
[0037] Determining a first loss using confidence levels corresponding to the multiple first candidate boxes;
[0038] Inputting the at least one second unlabeled data into the first model and the second model, obtaining a plurality of second candidate boxes whose labels are first confidence levels and second confidence levels of the corresponding uncertain labels, wherein the second candidate boxes are detection boxes whose intersection-over-union ratios with the detection boxes marked with the uncertain labels are greater than a second preset intersection-over-union ratio;
[0039] Determine a second loss using the first confidence level and the second confidence level corresponding to each second candidate box;
[0040] Utilizing the first loss and the second loss, parameters of the second model are updated.
[0041] Optionally, during the process of training the second model, the method further includes:
[0042] After each update of the parameters of the second model, weighting the updated parameters of the second model and the parameters of the first model to obtain weighted parameters;
[0043] The parameters of the first model are updated using the weighted parameters.
[0044] Optionally, the method further includes:
[0045] If it is detected that the number of parameter updates of the second model reaches a preset number threshold, the number of parameter updates is cleared, and the step of using the first model to predict at least one first unlabeled data to obtain multiple first predicted labels for each first unlabeled data and the confidence level of each first predicted label is re-executed;
[0046] If it is detected that the number of parameter updates of the second model does not reach the preset threshold, the step of using the first model to predict at least one second unlabeled data to obtain multiple second prediction labels for each second unlabeled data and the confidence of each second prediction label is re-executed.
[0047] Optionally, before using the first model to predict at least one first unlabeled data, the method further includes:
[0048] Performing supervised training on the third model using the labeled data;
[0049] The parameters of the trained third model are assigned to the first model and the second model.
[0050] In a second aspect, an embodiment of the present application provides a target detection method, the method comprising:
[0051] Obtain the data to be tested;
[0052] The data to be detected is input into the second model trained by any of the above-mentioned model training methods to obtain the target detection result of the data to be detected.
[0053] Optionally, the data to be detected includes at least one of images, videos, audio, and text.
[0054] In a third aspect, an embodiment of the present application provides a model training device, the device comprising:
[0055] A first prediction module is configured to use a first model to predict at least one first unlabeled data, and obtain a plurality of first predicted labels for each first unlabeled data and a confidence level of each first predicted label;
[0056] A first determination module is configured to determine a confidence threshold for a label category based on the distribution of each label category in the label set of labeled data and the confidences of all first predicted labels belonging to the label category;
[0057] A second prediction module is configured to use the first model to predict at least one second unlabeled data, and obtain a plurality of second predicted labels for each second unlabeled data and a confidence level of each second predicted label;
[0058] A second determination module is configured to determine, from among the multiple second predicted labels of each second unlabeled data, a second predicted label whose confidence is greater than a confidence threshold of the label category to which it belongs, as a candidate label for the second unlabeled data;
[0059] The first training module is used to train the second model using the labeled data, the at least one second unlabeled data, and the candidate label of each second unlabeled data.
[0060] Optionally, the confidence threshold includes a first confidence threshold; and the first determination module is specifically configured to:
[0061] Determine a multiple relationship between the total number of the at least one first unlabeled data and the total number of labeled data;
[0062] Determining, based on a first number of labels in each label category in the label set having label data, a second number of labels in the label category, wherein the second number of labels in the label category satisfies the multiple relationship with the first number of labels in the label category;
[0063] Determine the product of the second number of tags of each tag category and a preset reliability coefficient to obtain a third number of tags of the tag category;
[0064] In descending order, the confidences of all first predicted labels belonging to each label category are determined at corresponding third number of positions as the first confidence threshold of the label category.
[0065] Optionally, the first training module is specifically used to:
[0066] Inputting the labeled data and the at least one second unlabeled data into the second model respectively, and obtaining confidences that the labels of a plurality of first candidate boxes are corresponding candidate labels, wherein the first candidate boxes are detection boxes whose intersection-over-union ratio with the detection boxes marked with the candidate labels is greater than a first preset intersection-over-union ratio;
[0067] Determining a first loss using confidence levels corresponding to the multiple first candidate boxes;
[0068] Using the first loss, the parameters of the second model are updated.
[0069] Optionally, the confidence threshold includes a second confidence threshold; and the first determining module is specifically configured to:
[0070] Determine a multiple relationship between the total number of the at least one first unlabeled data and the total number of labeled data;
[0071] Determining, based on a first number of labels in each label category in the label set having label data, a second number of labels in the label category, wherein the second number of labels in the label category satisfies the multiple relationship with the first number of labels in the label category;
[0072] In descending order, the confidences of all first predicted labels belonging to each label category are determined at corresponding second number of positions as the second confidence threshold of the label category.
[0073] Optionally, the first training module is specifically used to:
[0074] Inputting the at least one second unlabeled data into the first model and the second model, obtaining a plurality of second candidate boxes having labels with first confidence levels and second confidence levels corresponding to the candidate labels, wherein the second candidate boxes are detection boxes having an intersection-over-union ratio (IOR) with the detection boxes marked with the candidate labels that is greater than a second preset IOR;
[0075] Determine a second loss using the first confidence level and the second confidence level corresponding to each second candidate box;
[0076] Utilizing the second loss, parameters of the second model are updated.
[0077] Optionally, the confidence threshold includes a first confidence threshold and a second confidence threshold; and the first determining module is specifically configured to:
[0078] Determine a multiple relationship between the total number of the at least one first unlabeled data and the total number of labeled data;
[0079] Determining, based on a first number of labels in each label category in the label set having label data, a second number of labels in the label category, wherein the second number of labels in the label category satisfies the multiple relationship with the first number of labels in the label category;
[0080] Determine the product of the second number of tags of each tag category and a preset reliability coefficient to obtain a third number of tags of the tag category;
[0081] In order from large to small, from the confidences of all the first predicted labels belonging to each label category, determine the confidence at the corresponding third number of positions as the first confidence threshold of the label category, and determine the confidence at the corresponding second number of positions as the second confidence threshold of the label category.
[0082] Optionally, the second determining module is specifically configured to:
[0083] Determine, from among the multiple second predicted labels of each second unlabeled data, a second predicted label having a confidence level greater than a first confidence threshold of the label category to which it belongs, as a reliable label for the second unlabeled data;
[0084] Among the multiple second predicted labels of each second unlabeled data except the reliable label, a second predicted label with a confidence greater than a second confidence threshold of the label category to which it belongs is determined as the uncertain label of the second unlabeled data.
[0085] Optionally, the first training module is specifically used to:
[0086] Inputting the labeled data and the at least one second unlabeled data into the second model respectively, obtaining confidences that the labels of a plurality of first candidate boxes are corresponding reliable labels, wherein the first candidate boxes are detection boxes whose intersection-over-union ratios with the detection boxes marked with the reliable labels are greater than a first preset intersection-over-union ratio;
[0087] Determining a first loss using confidence levels corresponding to the multiple first candidate boxes;
[0088] Inputting the at least one second unlabeled data into the first model and the second model, obtaining a plurality of second candidate boxes whose labels are first confidence levels and second confidence levels of the corresponding uncertain labels, wherein the second candidate boxes are detection boxes whose intersection-over-union ratios with the detection boxes marked with the uncertain labels are greater than a second preset intersection-over-union ratio;
[0089] Determine a second loss using the first confidence level and the second confidence level corresponding to each second candidate box;
[0090] Utilizing the first loss and the second loss, parameters of the second model are updated.
[0091] Optionally, the device further includes:
[0092] The second training module is used to, during the training of the second model, perform weighted processing on the updated parameters of the second model and the parameters of the first model after each update of the parameters of the second model to obtain weighted parameters; and use the weighted parameters to update the parameters of the first model.
[0093] Optionally, the device further includes a processing module, configured to:
[0094] If it is detected that the number of parameter updates of the second model reaches a preset number threshold, the number of parameter updates is cleared, and the step of using the first model to predict at least one first unlabeled data to obtain multiple first predicted labels for each first unlabeled data and the confidence level of each first predicted label is re-executed;
[0095] If it is detected that the number of parameter updates of the second model does not reach the preset threshold, the step of using the first model to predict at least one second unlabeled data to obtain multiple second prediction labels for each second unlabeled data and the confidence of each second prediction label is re-executed.
[0096] Optionally, the device further includes a third training module, configured to:
[0097] Before using the first model to predict at least one first unlabeled data, the third model is supervised trained using the labeled data; and the parameters of the trained third model are assigned to the first model and the second model.
[0098] In a fourth aspect, an embodiment of the present application provides a target detection device, comprising:
[0099] An acquisition module is used to obtain the data to be detected;
[0100] The third prediction module is used to input the data to be detected into the second model trained by any one of the model training methods to obtain the target detection result of the data to be detected.
[0101] Optionally, the data to be detected includes at least one of images, videos, audio, and text.
[0102] In a fifth aspect, an embodiment of the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0103] Memory for storing computer programs;
[0104] The processor is used to implement any of the steps of the model training method or the steps of the target detection method when executing the program stored in the memory.
[0105] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, it implements any of the steps of the model training method or the steps of the target detection method.
[0106] In the seventh aspect, an embodiment of the present application also provides a computer program product comprising instructions, which, when run on a computer, enables the computer to execute any of the above-mentioned model training method steps, or enables the computer to execute the above-mentioned target detection method steps.
[0107] Beneficial effects of the embodiments of the present application:
[0108] In the technical solution provided in the embodiment of the present application, the first model is used to predict the second unlabeled data, and the candidate labels of the second unlabeled data are determined in combination with the confidence threshold. Then, the second model is trained using the labeled data and the second unlabeled data with the candidate labels. It can be seen that in the technical solution provided in the embodiment of the present application, a semi-supervised approach is adopted to complete the training of the second model, that is, the first model is used to add candidate labels to the unlabeled data to complete the training of the second model. There is no need to manually label the unlabeled data, which reduces the human resources required for model training.
[0109] Of course, it is not necessary to achieve all the advantages described above at the same time when implementing any product or method of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0110] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0111] Figure 1 A schematic diagram of the first flow chart of the model training method provided in an embodiment of the present application;
[0112] Figure 2 A second flow chart of the model training method provided in an embodiment of the present application;
[0113] Figure 3 A third flow chart of the model training method provided in an embodiment of the present application;
[0114] Figure 4 A fourth flow chart of the model training method provided in an embodiment of the present application;
[0115] Figure 5 A fifth flow chart of the model training method provided in an embodiment of the present application;
[0116] Figure 6 A sixth flow chart of the model training method provided in an embodiment of the present application;
[0117] Figure 7 A seventh flow chart of the model training method provided in an embodiment of the present application;
[0118] Figure 8 for Figure 7 A schematic diagram of an implementation of step S79 in the model training method shown;
[0119] Figure 9This is a schematic diagram of an eighth flow chart of the model training method provided in an embodiment of the present application;
[0120] Figure 10 A ninth flow chart of the model training method provided in an embodiment of the present application;
[0121] Figure 11 A tenth flow chart of the model training method provided in an embodiment of the present application;
[0122] Figure 12 A schematic diagram of a flow chart of a target detection method provided in an embodiment of the present application;
[0123] Figure 13 A schematic diagram of a flow chart of a model training device provided in an embodiment of the present application;
[0124] Figure 14 A schematic diagram of a flow chart of a target detection device provided in an embodiment of the present application;
[0125] Figure 15 A structural diagram of an electronic device used to implement the model training method or target detection method provided in the embodiments of the present application. DETAILED DESCRIPTION
[0126] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field based on this application are within the scope of protection of this application.
[0127] Training deep learning models to achieve good performance relies on large amounts of labeled data and computing resources. However, labeling large amounts of data requires a significant amount of human resources.
[0128] To solve the above problems, the embodiments of the present application provide a model training method, which can be applied to servers, cloud platforms, server clusters, etc. For ease of description, the following description is based on electronic devices as the execution subject, which is not limiting.
[0129] In this model training method, the electronic device uses the first model to predict the second unlabeled data, combines the confidence threshold, and determines the candidate labels for the second unlabeled data. Then, the second model is trained using the labeled data and the second unlabeled data with the candidate labels. It can be seen that in the technical solution provided by the embodiment of the present application, the electronic device uses a semi-supervised approach to complete the training of the second model, that is, using the first model to add candidate labels to the unlabeled data to complete the training of the second model. This eliminates the need for manual labeling of the unlabeled data, reducing the human resources required for model training.
[0130] In addition, in the model training method, the electronic device determines the confidence threshold of each label category based on the distribution of each label category in the label set of the labeled data, and then estimates the potential objects of the unlabeled data in various label categories. This makes the distribution of candidate labels for the unlabeled data determined by the electronic device consistent with the distribution of labels in the label set of the labeled data, avoiding the occurrence of too many false positive labels and false negative labels, and improving the generalization ability of the model.
[0131] The model training method provided in the embodiments of the present application is described in detail below through specific examples.
[0132] like Figure 1 As shown, a model training method is provided, including the following steps.
[0133] Step S11: Use the first model to predict at least one first unlabeled data to obtain multiple first predicted labels for each first unlabeled data and the confidence of each first predicted label.
[0134] In the embodiment of the present application, the first model is a deep learning model, such as a convolutional neural network model, a deep neural network model, etc. The first unlabeled data is data without a label, and the first unlabeled data can be at least one of an image, video, audio, and text.
[0135] The electronic device obtains at least one first unlabeled data, and for each first unlabeled data, inputs the first unlabeled data into a first model to obtain multiple first predicted labels for the first unlabeled data and a confidence level of each first predicted label.
[0136] In the embodiment of the present application, a first unlabeled data may include one or more detection boxes. Accordingly, a first predicted label of a first unlabeled data includes the first predicted labels of one or more detection boxes, wherein one detection box corresponds to one or more first predicted labels. For example, the first unlabeled data is X i Represents the first unlabeled data i, Y irepresents the first predicted label set of the first unlabeled data i, Y i Represents the first predicted label set of all detection boxes included in the first unlabeled data i.
[0137] Step S12: determining a confidence threshold of the label category according to the distribution of each label category in the label set with labeled data and the confidence of all first predicted labels belonging to the label category.
[0138] In the embodiment of the present application, the labeled data is data with labels, and the labeled data can be images, text, etc. The labeled data and the first unlabeled data are of the same type, for example, both the labeled data and the first unlabeled data are images. The labeled data can be represented as Among them, X' i Indicates labeled data i, Y' i It represents the tag set of the labeled data i. The tag category is the type of tag, for example, the tag category includes three categories, such as vehicle, human and animal.
[0139] For each tag category, the electronic device determines a confidence threshold for that tag category based on the distribution of that tag category in the tag set with labeled data and the confidence levels of all first predicted tags belonging to that tag category. The confidence threshold may include a first confidence threshold and / or a second confidence threshold. The first confidence threshold and the second confidence threshold will be described in detail later and are not further explained here.
[0140] The distribution of the tag category can be expressed by the first number of tags in the tag category, or by the proportion of tags in the tag set. For example, the distribution of the tag category can be expressed as r i It represents the proportion of tags of tag category i in the tag set, which can also be understood as the frequency of tags of tag category i appearing in the tag set.
[0141]
[0142] Among them, N represents the number of labeled data, sum(Y j ==i) represents the number of detection boxes of label category i contained in label data j, len(Y j ) represents the number of detection boxes contained in the labeled data j.
[0143] Step S13: Use the first model to predict at least one second unlabeled data to obtain multiple second predicted labels for each second unlabeled data and the confidence of each second predicted label.
[0144] In the embodiment of the present application, the second unlabeled data may be the same as or different from the first unlabeled data. In one example, the at least one second unlabeled data is part or all of the at least one first unlabeled data.
[0145] For each second unlabeled data, the electronic device inputs the second unlabeled data into the first model to obtain multiple second predicted labels of the second unlabeled data and the confidence level of each second predicted label. X i Represents the second unlabeled data i, Y i Represents the second predicted label set for the second unlabeled data i.
[0146] In some optional embodiments, the electronic device may perform a random transformation on each second unlabeled data to obtain first transformed data, input the first transformed data into the first model, and obtain multiple second predicted labels for the second unlabeled data and a confidence level for each second predicted label. Here, the random transformation includes rotating the angle, adjusting the brightness, adjusting the resolution, etc.
[0147] Step S14: Determine, from among the multiple second predicted labels of each second unlabeled data, a second predicted label whose confidence is greater than the confidence threshold of the label category to which it belongs, as a candidate label for the second unlabeled data.
[0148] The candidate labels are pseudo labels, which may include reliable labels and / or uncertain labels. Reliable labels and uncertain labels will be described in detail later and will not be elaborated here.
[0149] After obtaining multiple second predicted labels for each second unlabeled data and the confidence of each second predicted label, for each second unlabeled data, among the multiple second predicted labels of the second unlabeled data, determine the second predicted label whose confidence is greater than the confidence threshold of the label category to which it belongs as the candidate label for the second unlabeled data.
[0150] For example, the confidence threshold of label a is 0.9, the confidence threshold of label b is 0.6, and the confidence threshold of label c is 0.7. The electronic device uses the first model to predict the second unlabeled data 1, and obtains the following in the second unlabeled data 1: the confidence that the label of detection frame 1 is label a is 0.98; the confidence that the label of detection frame 1 is label b is 0.01; the confidence that the label of detection frame 1 is label c is 0.01; the confidence that the label of detection frame 2 is label a is 0.5; the confidence that the label of detection frame 2 is label b is 0.5, and the confidence that the label of detection frame 2 is label c is 0; the confidence that the label of detection frame 3 is label a is 0.03; the confidence that the label of detection frame 3 is label b is 0.85, and the confidence that the label of detection frame 3 is label c is 0.12.
[0151] For label a, 0.98>0.9, so the label a of detection frame 1 corresponding to 0.98 is a candidate label, that is, the candidate labels of the second unlabeled data 1 include the label a of detection frame 1; for label b, 0.85>0.6, so the label b of detection frame 3 corresponding to 0.85 is a candidate label, that is, the candidate labels of the second unlabeled data 1 include the label b of detection frame 3; for label c, the confidence that all the above detection frames are labeled with label c is less than 0.7, so the label c of any detection frame does not belong to the candidate labels, that is, the candidate labels of the second unlabeled data 1 do not include the label c of any detection frame. In summary, the candidate labels of the second unlabeled data 1 include the label a of detection frame 1 and the label b of detection frame 3.
[0152] Step S15: training the second model using the labeled data, at least one second unlabeled data, and the candidate labels of each second unlabeled data.
[0153] After determining the candidate label of the second unlabeled data, the candidate label can be added as the label of the second unlabeled data to obtain pseudo-labeled data. The electronic device trains the second model using the labeled data and the pseudo-labeled data.
[0154] After the second model is trained, the electronic device can use the trained second model to perform deep learning processing such as target detection or face recognition.
[0155] In an embodiment of the present application, the above-mentioned first model guides the training of the second model, and the first model and the second model satisfy the Teacher-Student mechanism, that is, the first model is equivalent to the teacher model, and the second model is equivalent to the student model.
[0156] In the technical solution provided by the embodiment of the present application, the electronic device uses the first model to predict the second unlabeled data, combines the confidence threshold, determines the candidate labels for the second unlabeled data, and then uses the labeled data and the second unlabeled data with the candidate labels to train the second model. It can be seen that in the technical solution provided by the embodiment of the present application, the electronic device uses a semi-supervised approach to complete the training of the second model, that is, using the first model to add candidate labels to the unlabeled data to complete the training of the second model, without the need for manual labeling of the unlabeled data, thereby reducing the human resources required for model training.
[0157] In addition, in the technical solution provided in the embodiment of the present application, the electronic device determines the confidence threshold of each label category based on the distribution of each label category in the label set of the labeled data, and then estimates the potential objects of the unlabeled data in various label categories. This makes the distribution of candidate labels of the unlabeled data determined by the electronic device consistent with the distribution of labels in the label set of the labeled data, avoiding the occurrence of too many false positive labels and false negative labels, and improving the generalization ability of the model.
[0158] In some embodiments, as Figure 2 As shown, a model training method is also provided, in which the confidence threshold includes a first confidence threshold. In this case, the model training method may include steps S21-S28. Steps S21 and S26-S28 are the same as steps S11 and S13-S15 above and are not repeated here. Steps S22-S25 are an implementation of step S12.
[0159] Step S22: determining a multiple relationship between the total number of at least one first unlabeled data and the total number of labeled data.
[0160] For example, the first unlabeled data is That is, the total number of at least one first unlabeled data is U; the labeled data can be expressed as That is, the total number of labeled data is N. Therefore, the electronic device may determine that the multiple relationship between the total number of at least one first unlabeled data and the total number of labeled data is U / N.
[0161] Step S23 , determining a second number of tags of each tag category according to the first number of tags of the tag category in the tag set with tag data, wherein the second number of tags of the tag category satisfies a multiple relationship with the first number of tags of the tag category.
[0162] In this embodiment of the present application, the first number of tags in a tag category is the number of detection frames containing tags belonging to that tag category. For each tag category, the electronic device determines the second number of tags in that tag category based on the first number of tags in the tag set with tag data, where the second number of tags in that tag category satisfies the aforementioned multiple relationship with the first number.
[0163] For example, the total number of at least one first unlabeled data is U, the total number of labeled data is N, the multiple relationship between the two is U / N, and the first number of labels of label category c is n c , the electronic device may determine the second number n' of tags of tag category c c n c *U / N.
[0164] For another example, the total number of at least one first unlabeled data is 1000, the total number of labeled data is 100, the multiple relationship between the two is 1000 / 100=10, and the first number of tags of tag category c is 60, then the electronic device can determine that the second number of tags of tag category c is 60*10=600.
[0165] In practical applications, there are a certain number of labels of a certain label category in the labeled data. When the labeled data increases exponentially, the labels of the label category also increase exponentially accordingly. For example, there are 60 labels of label category c in 100 labeled data. When the labeled data increases 10 times, that is, there are 1000 labeled data. In theory, these 1000 labeled data should have 60*10=600 labels of label category c.
[0166] In an embodiment of the present application, the electronic device determines the second number of labels for each label category according to the multiple relationship between the total number of the first unlabeled data and the total number of labeled data, so that the labels of the labeled data and the labels of the unlabeled data can be consistent at the instance level.
[0167] Step S24 : determining the product of the second number of tags of each tag category and the preset reliability coefficient to obtain the third number of tags of the tag category.
[0168] The preset reliability coefficient is a positive value less than 1. For example, the preset reliability coefficient is α, and the second number n' of tags of tag category c is c n c *U / N, the electronic device can determine the third number n of tags of tag category c" c for n' c *α=n c *U / N*α.
[0169] For another example, the preset reliability coefficient α is 0.6, and the second number n' of tags of tag category c is c is 600, then the third number n" of labels of label category c c It is 600*0.6=360.
[0170] Step S25 , determining the confidence at the corresponding third number of positions from the confidences of all first predicted labels belonging to each label category in descending order as the first confidence threshold of the label category.
[0171] In an embodiment of the present application, for each tag category, the electronic device can sort the confidences of all first predicted tags belonging to the tag category in descending order of confidence, and determine the confidence at the third position as the first confidence threshold of the tag category. Based on this, the first confidence threshold can be expressed as:
[0172] h tc =sort(Ac)[n” c ]=sort(Ac)[n' c *α]
[0173] Among them, h tc Represents the first confidence threshold of label category c, sort(Ac) represents the sorting result obtained by sorting the confidence of all first predicted labels of label category c in descending order, n" c The third number of labels for label category c, n' c represents the second number of tags of tag category c, and α represents a preset reliability coefficient.
[0174] For example, the electronic device uses the first model to predict the first unlabeled data and obtains the first predicted labels of 1000 detection boxes as predicted labels of label category c, as well as the corresponding confidence levels of the predicted labels of 1000 label category c. If the electronic device determines the third number n of labels of label category c, c If it is 360, then in descending order, from the confidences of the 1000 first predicted labels belonging to label category c, select the 360th confidence, such as confidence 1, and set confidence 1 as the first confidence threshold of label category c.
[0175] In the technical solution provided by the embodiment of the present application, when determining the first confidence threshold of the label category, the electronic device not only considers the distribution of each label category, but also considers the order of magnitude relationship between the labeled data and the unlabeled data, which can make the labels of the labeled data and the labels of the unlabeled data consistent at the distribution level and the instance level. The electronic device determines the first confidence threshold in this way to determine the candidate labels of the unlabeled data, and uses the detection frames of these candidate labels as the foreground content to be detected, and the detection frames of other labels as the background content, so that the unlabeled data of the candidate labels and the labeled data meet the same label category distribution and foreground and background distribution. The second model is trained based on the unlabeled data and labeled data of the candidate labels, which can improve the detection accuracy of the second model.
[0176] In some embodiments, the confidence threshold includes a first confidence threshold. The electronic device may pre-set a number of prediction labels, i.e., a preset number. The preset number may be set based on actual needs. The preset number may be 1,000, 2,000, or 10,000, etc.
[0177] In this case, the above-mentioned step S12 can be: determining the proportion of labels of the label category in the label set according to the first number of labels of each label category in the label set with labeled data; determining the fourth number of labels of the label category according to the proportion of labels of each label category in the label set and the preset number, and the ratio of the fourth number of labels of the label category to the preset number is equal to the proportion of labels of the label category in the label set; determining the product of the fourth number of labels of each label category and the preset reliability coefficient to obtain the fifth number of labels of the label category; and determining the confidence at the corresponding fifth number position from the confidences of all first predicted labels belonging to each label category in order from largest to smallest, as the first confidence threshold of the label category.
[0178] For example, the electronic device determines that the proportion of tags of tag category c in the tag set is r c , the preset number is N', the preset reliability coefficient is α, then the fourth number n"' of the label of label category c c For r c *N', the fifth number n" of labels for label category c c for n'' c *α=r c *N'*α. In descending order, the electronic device selects the nth "" from the confidence scores of all first predicted tags belonging to tag category c. c The confidence level of the position, such as confidence 2, will be the first confidence threshold of confidence 2 label category c.
[0179] In the embodiment of the present application, the electronic device may also use other methods to determine the first confidence threshold of each tag category, which is not limited to this.
[0180] In some embodiments, a model training method is also provided, such as Figure 3 As shown, the method may include steps S31-S310. Steps S31-S37 are the same as steps S21-S27 above and are not described in detail here. Steps S38-S310 are an implementation of step S28.
[0181] In step S38, the labeled data and at least one second unlabeled data are respectively input into the second model to obtain the confidence that the labels of multiple first candidate boxes are corresponding candidate labels. The first candidate box is a detection box whose intersection-over-union ratio with the detection box marked with the candidate label is greater than a first preset intersection-over-union ratio.
[0182] In the embodiment of the present application, the intersection-and-union ratio can be expressed as the ratio of the overlapping area of the two detection frames to the area occupied by the two detection frames. The first preset intersection-and-union ratio can be set according to actual needs. For example, the first preset intersection-and-union ratio is 0.5, 0.6, or 0.8. In step S38, the candidate label can also be called a reliable label, and the detection frame whose intersection-and-union ratio with the detection frame marked by the reliable label is greater than the first preset intersection-and-union ratio is called the first candidate frame.
[0183] The electronic device uses the labeled data and at least one second unlabeled data as input data of the second model respectively, inputs the input data into the second model, and the second model predicts the input data and outputs the confidence that the label of each first candidate box is the corresponding reliable label.
[0184] For example, in the input data 1, the label a of the detection frame 1 is a reliable label. In addition to the detection frame 1, the detection frames whose intersection-over-union ratio with the detection frame 1 is greater than the first preset intersection-over-union ratio are detection frames 2-5. Then the detection frames 1-5 are respectively used as the first candidate frames. The second model predicts the input data 1 and obtains that the label of the detection frame 1 is the confidence of label a, the label of the detection frame 2 is the confidence of label a, the label of the detection frame 3 is the confidence of label a, the label of the detection frame 4 is the confidence of label a, and the label of the detection frame 5 is the confidence of label a.
[0185] In an embodiment of the present application, the electronic device can perform a random transformation on each piece of input data to obtain second transformed data. The second transformed data is then input into the second model to determine the confidence level that the labels of multiple first candidate boxes in the input data are corresponding reliable labels. Here, the random transformation includes rotating the angle, adjusting the brightness, adjusting the resolution, etc. This can effectively improve the generalization capability of the second model.
[0186] Step S39: Determine the first loss using the confidence levels corresponding to the multiple first candidate boxes.
[0187] After obtaining the confidence levels that the labels of the multiple first candidate boxes are corresponding reliable labels, the electronic device determines the first loss using the confidence levels corresponding to the multiple first candidate boxes.
[0188] In the embodiment of the present application, the loss function used by the electronic device to calculate the first loss may differ depending on the specific second model (model used for detection) used. In one example, the loss function used to calculate the first loss may be expressed as:
[0189] L1=L loc +L cle
[0190] Among them, L1 represents the first loss, L loc Represents the loss of the coordinate frame, L cle Represents the loss of label categories.
[0191] Step S310: Update the parameters of the second model using the first loss.
[0192] Parameters include learning rates and weights. The electronic device determines whether the second model has converged based on the first loss. If so, training of the second model ends. If not, backpropagation and gradient descent are used to update the parameters of the second model using the first loss until convergence. Once a parameter update is completed, training of the second model is complete.
[0193] In the technical solution provided in the embodiment of the present application, the electronic device combines the labeled data and the second unlabeled data to perform supervised training on the second model, such as steps S38-S310 above. This allows the second model to fully learn the changing patterns of the data and improves the accuracy of subsequent detection by the second model.
[0194] In some embodiments, a model training method is also provided, such as Figure 4 As shown, in this method, the confidence threshold includes a second confidence threshold. In this case, the model training method may include steps S41-S47. Steps S41 and S45-S47 are the same as steps S11 and S13-S15 above and are not repeated here. Steps S42-S44 are an implementation of step S12.
[0195] Step S42: Determine the multiple relationship between the total number of at least one first unlabeled data and the total number of labeled data. For details, please refer to the relevant description of step S22.
[0196] In step S43, based on the first number of tags in each tag category in the tag set with tagged data, a second number of tags in the tag category is determined, where the second number of tags in the tag category satisfies a multiple relationship with the first number of tags in the tag category. For details, see the relevant description of step S23.
[0197] In step S44, the confidence scores at the corresponding second number of positions are determined from the confidence scores of all first predicted labels for each label category, in descending order, as the second confidence threshold for that label category. For details, please refer to the description of step S25 and will not be repeated here.
[0198] In an embodiment of the present application, for each tag category, the electronic device can sort the confidences of all first predicted tags belonging to the tag category in descending order of confidence, and determine the confidence of the second-numbered bits as the second confidence threshold for the tag category. Based on this, the second confidence threshold can be expressed as:
[0199] tc=sort(Ac)[n' c ]
[0200] Where tc represents the second confidence threshold of label category c, sort(Ac) represents the sorting result obtained by sorting the confidence of all first predicted labels of label category c in descending order, and n' c The second number of labels representing the label category c.
[0201] In the technical solution provided by the embodiment of the present application, when determining the second confidence threshold of the label category, the electronic device not only considers the distribution of each label category, but also considers the order of magnitude relationship between the labeled data and the unlabeled data, which can make the labels of the labeled data and the labels of the unlabeled data consistent at the distribution level and the instance level. The electronic device determines the second confidence threshold in this way to determine the candidate labels of the unlabeled data, and uses the detection frames of these candidate labels as the foreground content to be detected, and the detection frames of other labels as the background content, so that the unlabeled data of the candidate labels and the labeled data meet the same label category distribution and foreground and background distribution. The second model is trained based on the unlabeled data and labeled data of the candidate labels, which can improve the detection accuracy of the second model.
[0202] In some embodiments, the confidence threshold includes a second confidence threshold. Step S12 may also include: determining the proportion of labels of each label category in the label set based on the first number of labels of each label category in the label set with labeled data; determining the fourth number of labels of each label category based on the proportion of labels of each label category in the label set and a preset number, wherein the ratio of the fourth number of labels of the label category to the preset number is equal to the proportion of labels of the label category in the label set; and determining the confidence at the corresponding fourth number from the confidences of all first predicted labels belonging to each label category in descending order as the second confidence threshold of the label category.
[0203] In the embodiment of the present application, the electronic device may also use other methods to determine the second confidence threshold of each tag category, which is not limited to this.
[0204] In some embodiments, a model training method is also provided, such as Figure 5 As shown, the method may include steps S51-S59. Steps S51-S56 are the same as steps S41-S46 above and are not described here in detail. Steps S57-S59 are an implementation of step S47.
[0205] Step S57: input at least one second unlabeled data into the first model and the second model to obtain the labels of multiple second candidate boxes with the first confidence and the second confidence of the corresponding candidate labels, and the second candidate box is a detection box whose intersection-over-union ratio with the detection box marked with the candidate label is greater than the second preset intersection-over-union ratio.
[0206] In the embodiment of the present application, the second preset IoU ratio can be the same as or different from the first preset IoU ratio and can be set according to actual needs. For example, the second preset IoU ratio is 0.5, 0.6, or 0.8. In step S57, the candidate label can also be called an uncertain label, and the detection box whose IoU ratio with the detection box marked with the uncertain label is greater than the second preset IoU ratio is called the second candidate box.
[0207] The electronic device uses at least one second unlabeled data as input data for the first model and the second model respectively, inputs the input data into the first model, the first model predicts the input data, and outputs the label of each second candidate box as the first confidence of the corresponding uncertain label; inputs the input data into the second model, the second model predicts the input data, and outputs the label of each second candidate box as the second confidence of the corresponding uncertain label.
[0208] For example, in the input data 1, the label a of the detection frame 1 is an uncertain label. In addition to the detection frame 1, the detection frames 2-3 have an intersection-over-union ratio with the detection frame 1 that is greater than the second preset intersection-over-union ratio. Then the detection frames 1-3 are respectively used as the second candidate frames. The first model predicts the input data 1 and obtains that the label of the detection frame 1 is the first confidence of label a, the label of the detection frame 2 is the first confidence of label a, and the label of the detection frame 3 is the first confidence of label a; the second model predicts the input data 1 and obtains that the label of the detection frame 1 is the second confidence of label a, the label of the detection frame 2 is the second confidence of label a, and the label of the detection frame 3 is the second confidence of label a.
[0209] In an embodiment of the present application, for each input data, the electronic device can perform a random transformation on the input data to obtain third transformed data and fourth transformed data. The third transformed data is input into the first model to obtain a first confidence level that the label of each second candidate box in the input data is the corresponding uncertain label; the fourth transformed data is input into the second model to obtain a second confidence level that the label of each second candidate box in the input data is the corresponding uncertain label. Here, the random transformation includes rotating the angle, adjusting the brightness, adjusting the resolution, etc. This can effectively improve the generalization ability of the second model.
[0210] In the embodiment of the present application, there is no limitation on the random transformation for obtaining the third transformed data and the fourth transformed data, as long as the random transformation methods used for the third transformed data and the fourth transformed data are different. For example, the electronic device obtains the third transformed data by rotating the input data 90 degrees, obtains the fourth transformed data by rotating the input data 180 degrees, and so on.
[0211] Step S58: Determine the second loss using the first confidence level and the second confidence level corresponding to each second candidate box.
[0212] After obtaining the first confidence and the second confidence that the labels of the multiple second candidate boxes are the corresponding uncertain labels, the electronic device determines the second loss using the first confidence and the second confidence corresponding to the multiple second candidate boxes.
[0213] In the embodiment of the present application, the loss function used by the electronic device to calculate the second loss may differ according to the specific second model (model used for detection) adopted. In one example, the loss function for calculating the second loss may be expressed as:
[0214]
[0215] Among them, L2 represents the second loss, C represents the number of uncertain labels, Indicates that the label of the second candidate box predicted by the second model is the second confidence of the uncertain label i, The first confidence level indicates that the label of the second candidate box predicted by the first model is the uncertain label i. The second candidate box is the detection box whose intersection-over-union ratio with the detection box marked with the uncertain label i is greater than a second preset intersection-over-union ratio.
[0216] Step S59: Update the parameters of the second model using the second loss.
[0217] The electronic device determines whether the second model has converged based on the second loss. If so, training of the second model ends. If not, backpropagation and gradient descent are used to update parameters of the second model using the second loss until the second model converges. Completing one parameter update completes one training run of the second model.
[0218] In the technical solution provided in the embodiment of the present application, for unreliable pseudo-labels, that is, uncertain labels, the electronic device uses the uncertain labels as soft labels for unlabeled data, and adopts a self-training method at the detection frame level to perform comparative training on the second model, thereby improving the learning accuracy of the second model and the rationality of label allocation, so that the second model learns high-quality regression frames and high-quality labels, thereby reducing the false detection rate of subsequent detections by the second model.
[0219] In some embodiments, a model training method is also provided, such as Figure 6 As shown, in this method, the confidence threshold includes a first confidence threshold and a second confidence threshold. In this case, the above model training method may include steps S61-S68. Among them, steps S61, S66-S68 are the same as steps S11, S13-S15 above, and are not repeated here. Steps S62-S65 are an implementation of step S12.
[0220] Step S62: Determine the multiple relationship between the total number of at least one first unlabeled data and the total number of labeled data. For details, please refer to the description of step S22.
[0221] In step S63, based on the first number of tags in each tag category in the tag set with tagged data, a second number of tags in the tag category is determined, where the second number of tags in the tag category satisfies a multiple relationship with the first number of tags in the tag category. For details, see the relevant description of step S23.
[0222] Step S64: Determine the product of the second number of tags of each tag category and the preset reliability coefficient to obtain the third number of tags of the tag category. For details, please refer to the relevant description of step S24.
[0223] In step S65, the confidences of all first predicted labels belonging to each label category are determined, in descending order, at the corresponding third number of positions as the first confidence threshold for that label category, and the confidences of the corresponding second number of positions are determined as the second confidence threshold for that label category. For details, see the description of steps S25 and S44.
[0224] In the technical solution provided by the embodiment of the present application, when the electronic device determines the first confidence threshold and the second confidence threshold of the label category, it not only considers the distribution of each label category, but also considers the order of magnitude relationship between the labeled data and the unlabeled data, which can make the labels of the labeled data and the labels of the unlabeled data consistent at the distribution level and the instance level. The electronic device determines the first confidence threshold and the second confidence threshold in this way to determine the candidate labels of the unlabeled data, and uses the detection frames of these candidate labels as the foreground content to be detected, and the detection frames of other labels as the background content, so that the unlabeled data of the candidate labels and the labeled data meet the same label category distribution and foreground and background distribution. The second model is trained based on the unlabeled data and labeled data of the candidate labels, which can improve the detection accuracy of the second model.
[0225] In some embodiments, a model training method is also provided, such as Figure 7 As shown, in this method, the candidate tags may include reliable tags and uncertain tags. In this case, steps S71-S79. Steps S71-S76 and S79 are the same as steps S61-S66 and S68, and are not repeated here. Steps S77-S78 are an implementation of step S67.
[0226] Step S77 : Determine, from among the multiple second predicted labels for each second unlabeled data, a second predicted label whose confidence is greater than a first confidence threshold of the label category to which it belongs, as a reliable label for the second unlabeled data.
[0227] Step S78: Determine, from among the multiple second predicted labels of each second unlabeled data except the reliable label, a second predicted label whose confidence is greater than a second confidence threshold of the label category to which it belongs, as the uncertain label of the second unlabeled data.
[0228] After obtaining multiple second predicted labels for each second unlabeled data and the confidence of each second predicted label, for each second unlabeled data, among the multiple second predicted labels of the second unlabeled data excluding the reliable label, determine the second predicted label whose confidence is greater than the second confidence threshold of the label category to which it belongs as the uncertain label of the second unlabeled data.
[0229] For example, the first confidence threshold of label a is 0.9, the first confidence threshold of label b is 0.6, and the first confidence threshold of label c is 0.7. The second confidence threshold of label a is 0.4, the second confidence threshold of label b is 0.4, and the second confidence threshold of label c is 0.3.
[0230] The electronic device uses the first model to predict the second unlabeled data 1, and obtains in the second unlabeled data 1: the confidence level that the label of detection frame 1 is label a is 0.98; the confidence level that the label of detection frame 1 is label b is 0.01; the confidence level that the label of detection frame 1 is label c is 0.01; the confidence level that the label of detection frame 2 is label a is 0.5; the confidence level that the label of detection frame 2 is label b is 0.5, and the confidence level that the label of detection frame 2 is label c is 0; the confidence level that the label of detection frame 3 is label a is 0.03; the confidence level that the label of detection frame 3 is label b is 0.85, and the confidence level that the label of detection frame 3 is label c is 0.12.
[0231] For label a, 0.98>0.9, therefore, the label a of detection frame 1 corresponding to 0.98 is a reliable label, that is, the reliable label of the second unlabeled data 1 includes the label a of detection frame 1; 0.9>0.5>0.4, therefore, the label a of detection frame 2 corresponding to 0.5 is an uncertain label; for label b, 0.85>0.6, therefore, the label b of detection frame 3 corresponding to 0.85 is a reliable label, that is, the reliable label of the second unlabeled data 1 includes the label b of detection frame 3; 0.6>0.5>0.4, therefore, the label b of detection frame 2 corresponding to 0.5 is an uncertain label; for label c, the confidence of the labels of all the above detection frames for label c is less than 0.7, and less than 0.3, therefore, the label c of any detection frame is neither a reliable label nor an uncertain label, that is, the reliable label of the second unlabeled data 1 does not include the label c of any detection frame, and the uncertain label of the second unlabeled data 1 does not include the label c of any detection frame.
[0232] In summary, the reliable labels of the second unlabeled data 1 include label a of detection frame 1 and label b of detection frame 3, and the uncertain labels of the second unlabeled data 1 include label a of detection frame 2 and label b of detection frame 2.
[0233] In the technical solution provided in the embodiment of the present application, the electronic device divides the second predicted label into a reliable label and an uncertain label, which facilitates subsequent different and appropriate training for different labels, thereby improving the accuracy of the training model.
[0234] In some embodiments, a model training method is also provided, such as Figure 8 As shown, Figure 8 for Figure 7The diagram shows an implementation of step S79 in the model training method shown, where step S79 can be broken down into the following steps.
[0235] In step S81, the labeled data and at least one second unlabeled data are input into a second model to determine the confidence that the labels of multiple first candidate boxes are corresponding reliable labels. A first candidate box is a box whose intersection-over-union ratio (IoU) with a detection box labeled with a reliable label is greater than a first preset IoU. For details, see the description of step S38.
[0236] In step S82, the confidence levels corresponding to the plurality of first candidate boxes are used to determine a first loss. For details, please refer to the description of step S39.
[0237] In step S83, at least one second unlabeled data item is input into the first model and the second model to obtain a plurality of second candidate boxes labeled with the first and second confidence levels of the corresponding uncertain labels. The second candidate boxes are those whose intersection-over-union ratio (IoU) with the detection boxes labeled with the uncertain labels is greater than a second preset IoU. For details, see the description of step S57.
[0238] In step S84, the second loss is determined using the first confidence level and the second confidence level corresponding to each second candidate box. For details, please refer to the description of step S58.
[0239] In step S85, the parameters of the second model are updated using the first loss and the second loss. For details, please refer to the relevant descriptions of step S310 and step S59.
[0240] In the technical solution provided in the embodiment of the present application, the electronic device adopts different training methods for different tags and jointly trains the second model, thereby improving the accuracy of the trained second model and reducing the false detection rate of subsequent detection of the second model.
[0241] In some embodiments, a model training method is also provided, such as Figure 9 As shown, the method may include steps S91-S97, wherein steps S91-S95 are the same as the above steps S11-S15.
[0242] Step S96: During the training of the second model, after each update of the parameters of the second model, weighted processing is performed on the updated parameters of the second model and the parameters of the first model to obtain weighted parameters.
[0243] During the training of the second model, the electronic device updates the parameters of the second model each time the training is completed. After each update of the parameters of the second model, the electronic device may use an EMA (Exponential Moving Average) algorithm to weight the updated parameters of the second model and the current parameters of the first model to obtain weighted parameters.
[0244] In the embodiment of the present application, the second weights of the updated parameters of the second model and the first weights of the parameters of the first model can be set according to actual needs. For example, the first weight is 0.1 and the second weight is 0.9, or the first weight is 0.05 and the second weight is 0.95, or the first weight is 0.01 and the second weight is 0.99, and so on.
[0245] Step S97: using the weighted parameters, update the parameters of the first model.
[0246] In the technical solution provided in the embodiment of the present application, while updating the parameters of the second model, the parameters of the first model are updated based on the updated parameters of the second model. This allows the first model to comprehensively consider the historical parameters and the current newly learned parameters, making the first model more instructive for the training of the second model and improving the training efficiency of the second model.
[0247] In some embodiments, a number threshold is pre-set in the electronic device, that is, a preset number threshold. The preset number threshold can be set according to actual needs. For example, the preset number threshold can be 1, 2, or 3.
[0248] After updating the parameters of the first model, the electronic device may detect whether the number of parameter updates for the first model or the second model has reached a preset threshold. If so, that is, the number of parameter updates for the first model has reached the preset threshold, or the number of parameter updates for the second model has reached the preset threshold, the electronic device clears the parameter update count and re-executes step S11. If not, that is, the number of parameter updates for the first model or the second model has not reached the preset threshold, step S13 is re-executed.
[0249] In an embodiment of the present application, during the training of the second model, the electronic device updates the first confidence threshold and the second confidence threshold once after iterating a preset number of times, which can ensure that the label distribution of the unlabeled data is always consistent with the label distribution of the labeled data.
[0250] In some embodiments, a model training method is also provided, such as Figure 10 As shown, the method may include steps S101-S107, wherein steps S103-S107 are the same as steps S11-S15.
[0251] Step S101: Perform supervised training on the third model using labeled data.
[0252] In the embodiment of the present application, the third model has the same structure as the first model and the second model, and the third model is a baseline model. The process of the electronic device using labeled data to perform supervised training on the third model can be found in the above Figure 3 Part of the description.
[0253] Step S102: assign the parameters of the trained third model to the first model and the second model.
[0254] After the third model is trained, the electronic device assigns the parameters of the trained third model to the first model and the second model. At this time, the parameters of the first model, the second model and the third model are consistent.
[0255] In the technical solution provided in the embodiment of the present application, the electronic device uses labeled data to perform supervised training on the third model, and assigns the parameters of the trained third model to the first model and the second model. The first model and the second model are based on the parameters of the third model that have been initially learned, which can effectively improve the training speed of the model.
[0256] The following combination Figure 11 The model training flow chart shown provides a detailed description of the model training method provided in the embodiment of the present application. Figure 11 In the example, labeled data is represented as X' i , the label of the labeled data is represented by Y' i , the unlabeled data is represented as X i , the label of the labeled data is represented by Y i , N, U, B, and C represent the number of corresponding data.
[0257] Step 1: Electronic devices will have label data Input model M1 (such as the third model above), based on the output of model M1 and Calculate the first loss L1, complete the training of model M1, and assign the parameters of the trained model M1 to model M2 (such as the second model mentioned above) and model M3 (such as the first model mentioned above). In addition, the electronic device uses labeled data Statistics on the distribution of each tag category, such as the proportion of the above-mentioned various tag categories in the tag set For details, please refer to the above Figure 7 The representation of the first loss L1 can be found in the description of step S36.
[0258] Step 2: Electronic devices transfer unlabeled data Input model M3 to get unlabeled data The predicted label based on Combined with the corresponding label categories in the labeled data The prior knowledge of the first confidence threshold is used to obtain the dynamic threshold of each label category that satisfies the distribution consistency. and the second confidence threshold
[0259] Step 3: The electronic device performs joint training on the labeled and unlabeled data, as follows:
[0260] 1) Using model M3 for unlabeled data Make predictions and get prediction labels Using the above and Identifying reliable labels and uncertain labels
[0261] 2) Unlabeled data Input model M2, combine the output of model M2 with reliable labels The model M2 is trained under supervision, and its loss can adopt the first loss L1 mentioned above.
[0262] 3) There will be labeled data Input model M2, combine the output of model M2 with the label The model M2 is trained under supervision, and its loss can adopt the first loss L1 mentioned above.
[0263] 4) Get the candidate box corresponding to the uncertain label and convert the unlabeled data Input models M2 and M3, and use the same candidate box to output the predicted label P in models M2 and M3 respectively M2 and P M3 and confidence, and conduct comparative training on model M2, whose loss can adopt L2 described in step S59.
[0264] Step 4. The electronic device completes one training of the model M2 based on the losses calculated in parts 2)-4) above. If the number of training times of the model M2 (i.e., the number of parameter updates of the above-mentioned second model) does not reach the preset threshold at this time, step 3 is re-executed; if the number of training times of the model M2 (i.e., the number of parameter updates of the above-mentioned second model) reaches the preset threshold at this time, step 2 is re-executed to update the dynamic threshold.
[0265] Corresponding to the above model training method, the embodiment of the present application also provides a target detection method, such as Figure 12 As shown, the following steps are included:
[0266] Step S121: Acquire data to be detected, wherein the data to be detected may include at least one of images, videos, audios, and texts.
[0267] In step S122, the data to be detected is input into the second model trained by the above-mentioned model training method to obtain the target detection result of the data to be detected.
[0268] In the technical solution provided by the embodiment of the present application, the electronic device uses the first model to predict the second unlabeled data, combines the confidence threshold, determines the candidate labels for the second unlabeled data, and then uses the labeled data and the second unlabeled data with the candidate labels to train the second model. It can be seen that in the technical solution provided by the embodiment of the present application, the electronic device uses a semi-supervised approach to complete the training of the second model, that is, using the first model to add candidate labels to the unlabeled data to complete the training of the second model, without the need for manual labeling of the unlabeled data, thereby reducing the human resources required for model training.
[0269] In addition, in the technical solution provided in the embodiment of the present application, the electronic device determines the confidence threshold of each label category based on the distribution of each label category in the label set of the labeled data, and then estimates the potential objects of the unlabeled data in various label categories. This makes the distribution of candidate labels of the unlabeled data determined by the electronic device consistent with the distribution of labels in the label set of the labeled data, avoiding the occurrence of too many false positive labels and false negative labels, and improving the generalization ability of the model.
[0270] Corresponding to the above-mentioned model training method, the embodiment of the present application provides a model training device, such as Figure 13 As shown, the device may include:
[0271] A first prediction module 131 is configured to use a first model to predict at least one first unlabeled data, and obtain a plurality of first predicted labels for each first unlabeled data and a confidence level of each first predicted label;
[0272] A first determination module 132 is configured to determine a confidence threshold for a label category based on the distribution of each label category in the label set of labeled data and the confidences of all first predicted labels belonging to the label category;
[0273] A second prediction module 133 is configured to use the first model to predict at least one second unlabeled data, and obtain a plurality of second predicted labels for each second unlabeled data and a confidence level of each second predicted label;
[0274] A second determining module 134 is configured to determine, from among the multiple second predicted labels of each second unlabeled data, a second predicted label whose confidence is greater than a confidence threshold of the label category to which it belongs, as a candidate label for the second unlabeled data;
[0275] The first training module 135 is configured to train the second model using the labeled data, at least one second unlabeled data, and a candidate label for each second unlabeled data.
[0276] Optionally, the confidence threshold includes a first confidence threshold; the first determination module 132 may be specifically configured to:
[0277] Determining a multiple relationship between a total number of at least one first unlabeled data and a total number of labeled data;
[0278] Determining a second number of labels of each label category in the label set with label data, according to a first number of labels of the label category, wherein the second number of labels of the label category satisfies a multiple relationship with the first number of labels of the label category;
[0279] Determine the product of the second number of tags of each tag category and a preset reliability coefficient to obtain a third number of tags of the tag category;
[0280] In descending order, the confidences of all first predicted labels belonging to each label category are determined at corresponding third number of positions as the first confidence threshold of the label category.
[0281] Optionally, the first training module 135 may be specifically used to:
[0282] Inputting the labeled data and at least one second unlabeled data into the second model respectively, obtaining confidences that the labels of multiple first candidate boxes are corresponding candidate labels, wherein the first candidate box is a detection box whose intersection-over-union ratio with the detection box marked with the candidate label is greater than a first preset intersection-over-union ratio;
[0283] Determine a first loss using confidence scores corresponding to the plurality of first candidate boxes;
[0284] Using the first loss, update the parameters of the second model.
[0285] Optionally, the confidence threshold includes a second confidence threshold; the first determination module 132 may be specifically configured to:
[0286] Determining a multiple relationship between a total number of at least one first unlabeled data and a total number of labeled data;
[0287] Determining a second number of labels of each label category in the label set with label data, according to a first number of labels of the label category, wherein the second number of labels of the label category satisfies a multiple relationship with the first number of labels of the label category;
[0288] In descending order, the confidences of all first predicted labels belonging to each label category are determined at corresponding second number of positions as the second confidence threshold of the label category.
[0289] Optionally, the first training module 135 may be specifically used to:
[0290] Inputting at least one second unlabeled data into the first model and the second model, obtaining a plurality of second candidate boxes whose labels are first confidence levels and second confidence levels of the corresponding candidate tags, wherein the second candidate boxes are detection boxes whose intersection-over-union ratio with the detection box marked with the candidate tags is greater than a second preset intersection-over-union ratio;
[0291] Determine a second loss using the first confidence level and the second confidence level corresponding to each second candidate box;
[0292] Using the second loss, update the parameters of the second model.
[0293] Optionally, the confidence threshold includes a first confidence threshold and a second confidence threshold; the first determination module 132 may be specifically configured to:
[0294] Determining a multiple relationship between a total number of at least one first unlabeled data and a total number of labeled data;
[0295] Determining a second number of labels of each label category in the label set with label data, according to a first number of labels of the label category, wherein the second number of labels of the label category satisfies a multiple relationship with the first number of labels of the label category;
[0296] Determine the product of the second number of tags of each tag category and a preset reliability coefficient to obtain a third number of tags of the tag category;
[0297] In order from large to small, from the confidences of all the first predicted labels belonging to each label category, determine the confidence at the corresponding third number of positions as the first confidence threshold of the label category, and determine the confidence at the corresponding second number of positions as the second confidence threshold of the label category.
[0298] Optionally, the second determining module 134 may be specifically configured to:
[0299] Determine, from among the multiple second predicted labels of each second unlabeled data, a second predicted label having a confidence level greater than a first confidence threshold of the label category to which it belongs, as a reliable label for the second unlabeled data;
[0300] Among the multiple second predicted labels of each second unlabeled data except the reliable label, a second predicted label with a confidence greater than a second confidence threshold of the label category to which it belongs is determined as the uncertain label of the second unlabeled data.
[0301] Optionally, the first training module 135 may be specifically used to:
[0302] Inputting the labeled data and at least one second unlabeled data into the second model respectively, obtaining confidences that the labels of the plurality of first candidate boxes are corresponding reliable labels, wherein the first candidate box is a detection box whose intersection-over-union ratio with the detection box marked with the reliable label is greater than a first preset intersection-over-union ratio;
[0303] Determine a first loss using confidence scores corresponding to the plurality of first candidate boxes;
[0304] Inputting at least one second unlabeled data into the first model and the second model, obtaining a plurality of second candidate boxes whose labels are first confidence levels and second confidence levels of the corresponding uncertain labels, wherein the second candidate boxes are detection boxes whose intersection-over-union ratios with the detection boxes marked with the uncertain labels are greater than a second preset intersection-over-union ratio;
[0305] Determine a second loss using the first confidence level and the second confidence level corresponding to each second candidate box;
[0306] Using the first loss and the second loss, update the parameters of the second model.
[0307] Optionally, the above-mentioned model training device may further include:
[0308] The second training module is used to weight the updated parameters of the second model and the parameters of the first model to obtain weighted parameters after each update of the parameters of the second model during the training of the second model; and use the weighted parameters to update the parameters of the first model.
[0309] Model training: The above-mentioned model training device may further include a processing module for:
[0310] If it is detected that the number of parameter updates of the second model reaches a preset number threshold, the number of parameter updates is cleared, and the step of using the first model to predict at least one first unlabeled data to obtain multiple first predicted labels for each first unlabeled data and the confidence level of each first predicted label is re-executed;
[0311] If it is detected that the number of parameter updates of the second model does not reach the preset threshold, the step of using the first model to predict at least one second unlabeled data to obtain multiple second prediction labels for each second unlabeled data and the confidence of each second prediction label is re-executed.
[0312] The above-mentioned model training, the above-mentioned model training device may further include a third training module for:
[0313] Before using the first model to predict at least one first unlabeled data, supervised training is performed on the third model using labeled data; and parameters of the trained third model are assigned to the first model and the second model.
[0314] In the technical solution provided by the embodiment of the present application, the electronic device uses the first model to predict the second unlabeled data, combines the confidence threshold, determines the candidate labels for the second unlabeled data, and then uses the labeled data and the second unlabeled data with the candidate labels to train the second model. It can be seen that in the technical solution provided by the embodiment of the present application, the electronic device uses a semi-supervised approach to complete the training of the second model, that is, using the first model to add candidate labels to the unlabeled data to complete the training of the second model, without the need for manual labeling of the unlabeled data, thereby reducing the human resources required for model training.
[0315] In addition, in the technical solution provided in the embodiment of the present application, the electronic device determines the confidence threshold of each label category based on the distribution of each label category in the label set of the labeled data, and then estimates the potential objects of the unlabeled data in various label categories. This makes the distribution of candidate labels of the unlabeled data determined by the electronic device consistent with the distribution of labels in the label set of the labeled data, avoiding the occurrence of too many false positive labels and false negative labels, and improving the generalization ability of the model.
[0316] Corresponding to the above target detection method, the embodiment of the present application provides a target detection device, such as Figure 14 As shown, the device may include:
[0317] An acquisition module 141 is used to acquire data to be detected;
[0318] The third prediction module 142 is used to input the data to be detected into the second model trained by any of the above-mentioned model training devices to obtain the target detection result of the data to be detected.
[0319] Optionally, the data to be detected includes at least one of images, videos, audio, and text.
[0320] In the technical solution provided by the embodiment of the present application, the electronic device uses the first model to predict the second unlabeled data, combines the confidence threshold, determines the candidate labels for the second unlabeled data, and then uses the labeled data and the second unlabeled data with the candidate labels to train the second model. It can be seen that in the technical solution provided by the embodiment of the present application, the electronic device uses a semi-supervised approach to complete the training of the second model, that is, using the first model to add candidate labels to the unlabeled data to complete the training of the second model, without the need for manual labeling of the unlabeled data, thereby reducing the human resources required for model training.
[0321] In addition, in the technical solution provided in the embodiment of the present application, the electronic device determines the confidence threshold of each label category based on the distribution of each label category in the label set of the labeled data, and then estimates the potential objects of the unlabeled data in various label categories. This makes the distribution of candidate labels of the unlabeled data determined by the electronic device consistent with the distribution of labels in the label set of the labeled data, avoiding the occurrence of too many false positive labels and false negative labels, and improving the generalization ability of the model.
[0322] Corresponding to the above-mentioned model training method and target detection method, the embodiment of the present application further provides an electronic device, such as Figure 15 As shown, it includes a processor 151, a communication interface 152, a memory 153 and a communication bus 154, wherein the processor 151, the communication interface 152, and the memory 153 communicate with each other through the communication bus 154;
[0323] Memory 153, for storing computer programs;
[0324] The processor 151 is used to implement the steps of any of the above-mentioned model training methods or the steps of the above-mentioned target detection method when executing the program stored in the memory 153.
[0325] The communication bus mentioned in the electronic device mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.
[0326] The communication interface is used for communication between the above electronic device and other devices.
[0327] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.
[0328] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0329] In another embodiment provided in the present application, a computer-readable storage medium is also provided, which stores a computer program. When the computer program is executed by a processor, it implements the steps of any of the above-mentioned model training methods or the steps of the above-mentioned target detection method.
[0330] In another embodiment provided in the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute the steps of any model training method in the above embodiments, or enables the computer to execute the steps of the target detection method in the above embodiments.
[0331] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0332] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0333] Each embodiment in this specification is described in a related manner. Similar portions between embodiments can be referenced to each other. Each embodiment focuses on the differences between other embodiments. In particular, the device, electronic device, computer-readable storage medium, and computer program product embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For related portions, reference can be made to the descriptions of the method embodiments.
[0334] The above description is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application are included in the scope of protection of the present application.
Claims
1. A model training method, characterized in that: The method comprises: Using a first model, predicting at least one first unlabeled data to obtain multiple first predicted labels for each first unlabeled data and a confidence score for each first predicted label, wherein the first unlabeled data is an image, and the first predicted label of each first unlabeled data is a predicted label of a detection box in each first unlabeled data; Determining a confidence threshold for a label category based on the distribution of each label category in a label set of labeled data and the confidence of all first predicted labels belonging to the label category, wherein the labeled data is an image and the labels in the label set are labels of detection boxes in the labeled data; Using the first model, predicting at least one second unlabeled data to obtain multiple second predicted labels for each second unlabeled data and a confidence level of each second predicted label, where the second unlabeled data is an image; Among the multiple second predicted labels of each second unlabeled data, determine a second predicted label whose confidence is greater than the confidence threshold of the label category to which it belongs, as a candidate label for the second unlabeled data, the second predicted label of each second unlabeled data is the predicted label of the detection box in each second unlabeled data, and the distribution of the determined candidate labels of the unlabeled data is consistent with the distribution of the labels in the label set of the labeled data; Training a second model using the labeled data, the at least one second unlabeled data, and a candidate label for each second unlabeled data, wherein the second model is used to perform object detection on the image; The confidence threshold includes a first confidence threshold and / or a second confidence threshold; The step of determining the confidence threshold of the label category according to the distribution of each label category in the label set of the labeled data and the confidence of all first predicted labels belonging to the label category includes: Determine a multiple relationship between the total number of the at least one first unlabeled data and the total number of labeled data; Determining, based on a first number of labels in each label category in the label set having label data, a second number of labels in the label category, wherein the second number of labels in the label category satisfies the multiple relationship with the first number of labels in the label category; Determine the product of the second number of labels of each label category and the preset reliability coefficient to obtain a third number of labels of the label category; determine the confidence level at the corresponding third number of positions from the confidence levels of all first predicted labels belonging to each label category in descending order as the first confidence level threshold of the label category; and / or, In descending order, the confidences of all first predicted labels belonging to each label category are determined at corresponding second number of positions as the second confidence threshold of the label category.
2. The method according to claim 1, characterized in that The confidence threshold comprises a first confidence threshold; The step of training the second model using the labeled data, the at least one second unlabeled data, and the candidate label of each second unlabeled data comprises: Inputting the labeled data and the at least one second unlabeled data into the second model respectively, and obtaining confidences that the labels of a plurality of first candidate boxes are corresponding candidate labels, wherein the first candidate boxes are detection boxes whose intersection-over-union ratio with the detection boxes marked with the candidate labels is greater than a first preset intersection-over-union ratio; Determining a first loss using confidence levels corresponding to the multiple first candidate boxes; Using the first loss, the parameters of the second model are updated.
3. The method according to claim 1, characterized in that The confidence threshold includes a second confidence threshold; The step of training the second model using the labeled data, the at least one second unlabeled data, and the candidate label of each second unlabeled data comprises: Inputting the at least one second unlabeled data into the first model and the second model, obtaining a plurality of second candidate boxes having labels with first confidence levels and second confidence levels corresponding to the candidate labels, wherein the second candidate boxes are detection boxes having an intersection-over-union ratio (IOR) with the detection boxes marked with the candidate labels that is greater than a second preset IOR; Determine a second loss using the first confidence level and the second confidence level corresponding to each second candidate box; Utilizing the second loss, parameters of the second model are updated.
4. The method according to claim 1, wherein The confidence threshold includes a first confidence threshold and a second confidence threshold; The step of determining, from among the multiple second predicted labels of each second unlabeled data, a second predicted label whose confidence is greater than a confidence threshold of the label category to which it belongs as a candidate label for the second unlabeled data includes: Determine, from among the multiple second predicted labels of each second unlabeled data, a second predicted label having a confidence level greater than a first confidence threshold of the label category to which it belongs, as a reliable label for the second unlabeled data; Among the multiple second predicted labels of each second unlabeled data except the reliable label, a second predicted label with a confidence greater than a second confidence threshold of the label category to which it belongs is determined as the uncertain label of the second unlabeled data.
5. The method according to claim 4, characterized in that The step of training the second model using the labeled data, the at least one second unlabeled data, and the candidate label of each second unlabeled data comprises: Inputting the labeled data and the at least one second unlabeled data into the second model respectively, and obtaining confidences that the labels of a plurality of first candidate boxes are corresponding reliable labels, wherein the first candidate boxes are detection boxes whose intersection-over-union ratios with the detection boxes marked with the reliable labels are greater than a first preset intersection-over-union ratio; Determining a first loss using confidence levels corresponding to the multiple first candidate boxes; Inputting the at least one second unlabeled data into the first model and the second model, obtaining a plurality of second candidate boxes whose labels are first confidence levels and second confidence levels of the corresponding uncertain labels, wherein the second candidate boxes are detection boxes whose intersection-over-union ratios with the detection boxes marked with the uncertain labels are greater than a second preset intersection-over-union ratio; Determine a second loss using the first confidence level and the second confidence level corresponding to each second candidate box; Utilizing the first loss and the second loss, parameters of the second model are updated.
6. The method according to claim 1, characterized in that During the training of the second model, the method further includes: After each update of the parameters of the second model, weighting the updated parameters of the second model and the parameters of the first model to obtain weighted parameters; The parameters of the first model are updated using the weighted parameters.
7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: If it is detected that the number of parameter updates of the second model reaches a preset number threshold, the number of parameter updates is cleared, and the step of using the first model to predict at least one first unlabeled data to obtain multiple first predicted labels for each first unlabeled data and the confidence level of each first predicted label is re-executed; If it is detected that the number of parameter updates of the second model does not reach the preset threshold, the step of using the first model to predict at least one second unlabeled data to obtain multiple second prediction labels for each second unlabeled data and the confidence of each second prediction label is re-executed.
8. The method according to any one of claims 1 to 6, characterized in that Before using the first model to predict at least one first unlabeled data, the method further includes: Performing supervised training on the third model using the labeled data; The parameters of the trained third model are assigned to the first model and the second model.
9. A target detection method, characterized in that: The method comprises: Acquiring data to be detected, wherein the data to be detected is an image; The data to be detected is input into a second model trained by the method according to any one of claims 1 to 8 to obtain a target detection result of the data to be detected.
10. A model training device, characterized in that: The device comprises: a first prediction module, configured to use a first model to predict at least one first unlabeled data to obtain a plurality of first predicted labels for each first unlabeled data and a confidence level for each first predicted label, wherein the first unlabeled data is an image, and the first predicted label for each first unlabeled data is a predicted label for a detection box in each first unlabeled data; a first determination module, configured to determine a confidence threshold for a label category based on the distribution of each label category in a label set of labeled data and the confidences of all first predicted labels belonging to the label category, wherein the labeled data is an image and the labels in the label set are labels of detection boxes in the labeled data; a second prediction module, configured to use the first model to predict at least one second unlabeled data to obtain a plurality of second predicted labels for each second unlabeled data and a confidence level for each second predicted label, wherein the second unlabeled data is an image; A second determination module is configured to determine, from among the multiple second predicted labels for each second unlabeled data, a second predicted label whose confidence is greater than a confidence threshold of the label category to which it belongs, as a candidate label for the second unlabeled data, wherein the second predicted label for each second unlabeled data is the predicted label of the detection box in each second unlabeled data, and the distribution of the determined candidate labels for the unlabeled data is consistent with the distribution of labels in the label set of the labeled data; a first training module, configured to train a second model using the labeled data, the at least one second unlabeled data, and a candidate label for each second unlabeled data, wherein the second model is configured to perform object detection on an image; The confidence threshold includes a first confidence threshold and / or a second confidence threshold; The first determining module is specifically configured to: Determine a multiple relationship between the total number of the at least one first unlabeled data and the total number of labeled data; Determining, based on a first number of labels in each label category in the label set having label data, a second number of labels in the label category, wherein the second number of labels in the label category satisfies the multiple relationship with the first number of labels in the label category; Determine the product of the second number of labels of each label category and the preset reliability coefficient to obtain a third number of labels of the label category; determine the confidence level at the corresponding third number of positions from the confidence levels of all first predicted labels belonging to each label category in descending order as the first confidence level threshold of the label category; and / or, In descending order, the confidences of all first predicted labels belonging to each label category are determined at corresponding second number of positions as the second confidence threshold of the label category.
11. A target detection device, characterized in that: The device comprises: An acquisition module, used for acquiring data to be detected, wherein the data to be detected is an image; The third prediction module is used to input the data to be detected into the second model trained by the device according to claim 10 to obtain the target detection result of the data to be detected.
Citation Information
Patent Citations
Method for identifying and positioning power transmission line insulators in unmanned aerial vehicle aerial images
CN105528595A
Method and device for determining label
CN112686316A