Object recognition model training method and apparatus, electronic device, and medium
Patent Information
- Application Number
- CN202211690086.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2042-12-27
AI Technical Summary
[0005]本申请实施例的目的是提供一种对象识别模型训练方法、装置、电子设备及介质,能够解决训练出的对象识别模型的识别精度较低的问题
[0012] In this embodiment, the electronic device first acquires a first data sample without a sample label; then, it inputs this first data sample without a sample label into an object recognition model cluster for processing to obtain a second data sample carrying a target sample label. The object recognition model cluster includes N first object recognition models, each outputting N first sample labels. The target sample label is the label with the highest confidence among the N first sample labels, where N is a positive integer. Finally, based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model, a target object recognition model is obtained. This improves the recognition accuracy of the finally trained target object recognition model.
Smart Images

Figure CN115861770B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of artificial intelligence technology, specifically relating to an object recognition model training method, device, electronic device, and medium. Background Technology
[0002] With the development of human-computer interaction and the popularization of electronic devices, voice, images, and videos are increasingly widely used in production and daily life as important interaction interfaces. How to train an object recognition model with high recognition accuracy is an urgent problem to be solved.
[0003] In related technologies, the training method is generally based on iterative training with pseudo-labels. First, a large amount of unlabeled data is labeled by the model to obtain multiple pseudo-labels corresponding to the large amount of unlabeled data. Then, the pseudo-label with the highest confidence is selected from these multiple pseudo-labels, and the data with the pseudo-label with the highest confidence is labeled by the model again. The above process is repeated many times to train the final object recognition model.
[0004] However, when using the above model training method, the accuracy of the pseudo-labels obtained from each model labeling is low after multiple labeling operations. This results in low recognition accuracy of the object recognition model trained based on these low-accuracy pseudo-labels. Summary of the Invention
[0005] The purpose of this application is to provide an object recognition model training method, apparatus, electronic device, and medium that can solve the problem of low recognition accuracy of the trained object recognition model.
[0006] In a first aspect, embodiments of this application provide a method for training an object recognition model. The method includes: acquiring a first data sample without a sample label; inputting the first data sample without a sample label into an object recognition model cluster for processing to obtain a second data sample carrying a target sample label, wherein the object recognition model cluster includes N first object recognition models, and the N first object recognition models output N first sample labels, wherein the target sample label is the sample label with the highest confidence among the N first sample labels, and N is a positive integer; and obtaining a target object recognition model based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model.
[0007] Secondly, embodiments of this application provide an object recognition model training apparatus, which includes an acquisition module and a processing module, wherein: the acquisition module is used to acquire a first data sample without carrying a sample label; the processing module is used to input the first data sample without carrying a sample label acquired by the acquisition module into an object recognition model cluster for processing to obtain a second data sample carrying a target sample label, the object recognition model cluster including N first object recognition models, the N first object recognition models corresponding to output N first sample labels, the target sample label being the sample label with the highest confidence among the N first sample labels, and N being a positive integer; the processing module is also used to obtain a target object recognition model based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model.
[0008] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0009] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0010] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.
[0011] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.
[0012] In this embodiment, the electronic device first acquires a first data sample without a sample label; then, it inputs this first data sample without a sample label into an object recognition model cluster for processing to obtain a second data sample carrying a target sample label. The object recognition model cluster includes N first object recognition models, each outputting N first sample labels. The target sample label is the label with the highest confidence among the N first sample labels, where N is a positive integer. Finally, based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model, a target object recognition model is obtained. This improves the recognition accuracy of the finally trained target object recognition model. Attached Figure Description
[0013] Figure 1 This is a flowchart illustrating an object recognition model training method provided in an embodiment of this application;
[0014] Figure 2 This is an internal flowchart of knowledge distillation provided in an embodiment of this application;
[0015] Figure 3 This is a schematic diagram of the structure of an object recognition model training device provided in an embodiment of this application;
[0016] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0017] Figure 5 This is a hardware schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0018] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0019] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0020] The object recognition model training method, apparatus, electronic device, and medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0021] In related technologies, when training an object recognition model, electronic devices first need to acquire a large number of unlabeled data samples. Then, they use an existing trained object recognition model to label these data samples, obtaining multiple sample labels. Next, the sample label with the highest confidence is selected from these multiple sample labels, and the data samples with the highest confidence label are labeled by the model again, obtaining multiple sample labels. This process is repeated until the final trained object recognition model is obtained. However, this training method requires multiple iterations of training, and the accuracy of the labeled sample labels is relatively low each time the model is labeled, resulting in low recognition accuracy of the trained object recognition model.
[0022] In the object recognition model training method, apparatus, electronic device, and medium provided in this application embodiment, the electronic device can first acquire a first data sample without carrying a sample label; input the first data sample without carrying a sample label into an object recognition model cluster for processing to obtain a second data sample carrying a target sample label. The object recognition model cluster includes N first object recognition models, and the N first object recognition models output N first sample labels. The target sample label is the sample label with the highest confidence among the N first sample labels, where N is a positive integer; then, based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model, a target object recognition model is obtained. This improves the recognition accuracy of the finally trained target object recognition model.
[0023] The execution entity of the object recognition model training method provided in this embodiment can be an object recognition model training device, which can be an electronic device, or a control module or processing module within the electronic device. The following description uses an electronic device as an example to illustrate the technical solution provided in this application embodiment.
[0024] This application provides a method for training an object recognition model, such as... Figure 1 As shown, the object recognition model training method may include the following steps 201 to 203:
[0025] Step 201: The electronic device acquires the first data sample without carrying a sample tag.
[0026] In this embodiment of the application, the first data sample refers to the data used for model training.
[0027] For example, the data sample mentioned above can be an audio file, an image file, or a video file, etc.
[0028] For example, the above-mentioned audio files are audio files from a real-world application environment. For instance, voice messages sent by users in social media applications.
[0029] For example, the image files mentioned above are image files from a real-world application environment. For instance, images sent by users in social media applications.
[0030] For example, the video file mentioned above is a video file from a real-world application environment. For instance, a video clip sent by a user in social media software.
[0031] For example, when the above data sample is an audio file, the above sample label is used to identify the text content of the audio file.
[0032] For example, when the above data sample is an image file, the above sample label is used to identify the image type of the above image file.
[0033] For example, when the above data sample is a video file, the above sample label is used to identify the video type of the above video file.
[0034] Step 202: The electronic device inputs the first data sample without the sample label into the object recognition model cluster for processing to obtain the second data sample carrying the target sample label.
[0035] In this embodiment of the application, the above-mentioned object recognition model cluster can be an existing object recognition model cluster.
[0036] In this embodiment of the application, the above-mentioned object recognition model cluster includes N first object recognition models, where N is a positive integer.
[0037] For example, the first object recognition model described above can be an existing object recognition model.
[0038] For example, the above N first object recognition models output N first sample labels.
[0039] It should be noted that the first sample label mentioned above is a pseudo-label. That is to say, when the first data sample is an audio file, the text content identified by the first sample label may be different from the actual text content of the first data sample.
[0040] In this embodiment of the application, the target sample label is the sample label with the highest confidence among the N first sample labels.
[0041] For example, the confidence level mentioned above is used to indicate the credibility of the sample label. The higher the confidence level, the higher the credibility of the sample label.
[0042] In this embodiment of the application, the second data sample is the first data sample after being processed by the object recognition model.
[0043] In this embodiment, the electronic device can use N object recognition models from an existing cluster of object recognition models to label data samples that do not carry sample labels, thus assigning N labels to the data samples. Since these N labels are identified by the model and may contain errors, they can be called "pseudo-labels." Then, the electronic device compares these N pseudo-labels and selects the pseudo-label with the highest confidence level as the target sample label.
[0044] Step 203: The electronic device obtains a target object recognition model based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model.
[0045] In this embodiment of the application, the processing accuracy of the second object recognition model is greater than that of the first object recognition model.
[0046] In this embodiment, the second object recognition model can be an existing object recognition model or a currently trained object recognition model; this embodiment does not limit the specific model.
[0047] In this embodiment of the application, after obtaining the sample label with the highest confidence level of the above-mentioned data sample, the electronic device can input the data sample carrying the sample label into the second object recognition model and at least one object recognition model respectively to obtain the final target object recognition model.
[0048] In this embodiment of the application, the target object recognition model is composed of an encoder and a decoder.
[0049] In the object recognition model training method provided in this application embodiment, the electronic device can first acquire a first data sample without carrying a sample label; input the first data sample without carrying a sample label into an object recognition model cluster for processing to obtain a second data sample carrying a target sample label. The object recognition model cluster includes N first object recognition models, and the N first object recognition models output N first sample labels. The target sample label is the sample label with the highest confidence among the N first sample labels, where N is a positive integer; then, based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model, a target object recognition model is obtained. This improves the recognition accuracy of the finally trained target object recognition model.
[0050] Optionally, in this embodiment of the application, before step 203 above, the object recognition model training method provided in this embodiment of the application may further include the following steps 301 and 302:
[0051] Step 301: The electronic device acquires multiple third-party data samples.
[0052] In the embodiments of this application, each of the aforementioned third data samples carries a sample label.
[0053] For example, the aforementioned third data sample can be publicly available data. In other words, this data can be used directly for model training without any processing.
[0054] Step 302: The electronic device trains the model using multiple third data samples to obtain a second object recognition model.
[0055] In this embodiment of the application, the second object recognition model is a trained object recognition model.
[0056] For example, the second object recognition model mentioned above can be a currently trained object recognition model or an existing object recognition model that has already been trained.
[0057] In this embodiment of the application, the electronic device can input publicly available data samples into a pre-trained object recognition model, output the sample label corresponding to the data sample, and then compare the output sample label with the real sample label carried by the data sample to complete the training of the pre-trained object recognition model and obtain a second object recognition model.
[0058] For example, when the third data sample is a voice file, the second object recognition model can be a voice recognition model.
[0059] For example, when the third data sample is an image file, the second object recognition model can be an image recognition model.
[0060] For example, when the third data sample is a video file, the second object recognition model can be a video recognition model.
[0061] In this way, an initial object recognition model is trained using existing publicly available data samples, so that further processing can be carried out based on this object recognition model.
[0062] Optionally, in this embodiment of the application, step 203 above, "the electronic device obtains a target object recognition model based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model," may include the following step 203a:
[0063] Step 203a: The electronic device performs knowledge distillation on the second object recognition model and supervises the training of the first object recognition model based on the second data sample carrying the target sample label to obtain the target object recognition model.
[0064] In this embodiment of the application, the knowledge distillation described above is used to distill the generalization ability of the second object recognition model onto the first object recognition model, so as to improve the recognition accuracy of the first object recognition model and generate a new object recognition model.
[0065] For example, the knowledge distillation described above uses a teacher-student model, where the teacher is the producer of "knowledge" and the student is the recipient of "knowledge".
[0066] For example, the second object recognition model mentioned above is the teacher model, and the first object recognition model mentioned above is the student model.
[0067] Thus, through knowledge distillation and supervised training, the recognition accuracy of the first object recognition model is improved by using a second object recognition model, thereby improving the recognition accuracy of the final generated target object recognition model.
[0068] Optionally, in this embodiment of the application, step 203a above, "the electronic device performs knowledge distillation on the second object recognition model and performs supervised training on the first object recognition model based on the second data sample carrying the target sample label to obtain the target object recognition model," may include the following steps 203a1 to 203a7:
[0069] Step 203a1: The electronic device inputs the second data sample carrying the target sample label into the second object recognition model for processing to obtain the fourth data sample carrying the second sample label.
[0070] In this embodiment of the application, the second sample label may include a soft label.
[0071] For example, the second sample label is used to identify the predicted value of the sample content of the second data sample by the second object recognition model.
[0072] Step 203a2: The electronic device inputs the second data sample carrying the target sample label into the third object recognition model for processing to obtain the fifth data sample carrying the third sample label.
[0073] In this embodiment of the application, the processing accuracy of the second object recognition model is greater than that of the third object recognition model.
[0074] In this embodiment of the application, the aforementioned third sample label may include soft labels and hard labels.
[0075] For example, the soft label in the third sample label is used to identify the predicted value of the third object recognition model for the sample content of the second data sample.
[0076] For example, the hard label in the third sample label can be the sample content obtained by the third object recognition model processing the second data sample.
[0077] Step 203a3: The electronic device calculates the first loss value of the third object recognition model based on the similarity between the second sample label and the third sample label; and calculates the second loss value of the third object recognition model based on the similarity between the third sample label and the target sample label.
[0078] In this embodiment of the application, the similarity between the soft tags in the second sample tag and the third sample tag is used to characterize the degree of closeness between the predicted value of the second object recognition model for the sample content of the second data sample and the predicted value of the third object recognition model for the sample content of the second data sample.
[0079] In this embodiment of the application, the first loss value is used to characterize the degree of difference in the processing capabilities of the second object recognition model and the third object recognition model for data samples.
[0080] In this embodiment of the application, the similarity between the hard label in the third sample label and the target sample label is used to characterize the degree of closeness between the sample content obtained by the third object recognition model from the processing of the second data sample and the sample content identified by the target label.
[0081] In this embodiment of the application, the second loss value is used to characterize the degree of difference between the processing result of the third object recognition model on the data sample and the target label.
[0082] Step 203a4: The electronic device obtains the target loss value based on the first loss value and the second loss value.
[0083] In this embodiment of the application, the electronic device can perform a weighted calculation of the first loss value and the second loss value to obtain the total loss value, i.e. the target loss value.
[0084] For example, the target loss value mentioned above can be the distillation loss value.
[0085] In this embodiment of the application, after obtaining the distillation loss value, the electronic device can perform knowledge distillation on the second object recognition model based on the distillation loss value to update the parameters in the second object recognition model.
[0086] The following will explain the knowledge distillation involved in the embodiments of this application:
[0087] In related technologies, the Teacher (i.e., the second object recognition model mentioned above) is the outputter of "knowledge," and the Student (i.e., the third object recognition model mentioned above) is the receiver of "knowledge." The Teacher model is typically more complex and can be composed of multiple separately trained models integrated together. Furthermore, the Teacher model has no limitations on model architecture or the number of parameters; it only requires that for each input data sample, it outputs the corresponding label. This label is mapped by a normalization function (softmax) to output the probability value of the corresponding label. The Student model typically has fewer parameters and a relatively simple model structure. In addition, knowledge distillation uses "soft labels" containing the "temperature" hyperparameter T, which differs from the "hard labels" output by softmax. Its output can be expressed by Equation 1, which is a softmax function based on the aforementioned softmax function formula, with the "temperature" hyperparameter T added as a variable:
[0088]
[0089] It should be noted that in the knowledge distillation method used in this application, the model structure and number of parameters of Teacher and Student are consistent. The Teacher model provides an alignment based on a loss function (Connection-Temporal Classification, CTC). Through joint training, the Student model is forced to approach the label output by the Teacher model as closely as possible with minimal modifications, based on the original alignment of the Teacher model. That is, the minimum edit distance modification of the label identified by the Student model is completed using the recognition of the Teacher model.
[0090] For example, the minimum edit distance modification described above is used to indicate the number of times Student is updated.
[0091] For example, such as Figure 2The diagram illustrates the internal process of knowledge distillation. The data stream input x is processed by the teacher model to obtain soft labels; then, it is processed by the student model to obtain soft predictions and hard predictions. The soft labels and soft predictions are then compared to obtain a loss value (Loss fn 1), and the hard predictions are compared with the ground truth labels of input x to obtain another loss value (Loss fn 2). Finally, these two loss values are summed to update the student model, resulting in the final object recognition model.
[0092] Step 203a5: The electronic device inputs the second data sample carrying the target sample label into the first object recognition model for processing to obtain the sixth data sample carrying the fourth sample label.
[0093] In this embodiment of the application, the fourth sample label is a hard label.
[0094] For example, the fourth sample label can be the sample content obtained after the first object recognition model processes the second data sample again.
[0095] Step 203a6: The electronic device calculates the third and fourth loss values of the first object recognition model based on the similarity between the fourth sample label and the target sample label.
[0096] In this embodiment of the application, the similarity between the fourth sample label and the target sample label is used to characterize the degree of closeness between the sample content obtained by the first object recognition model from processing the second data sample and the sample content identified by the target label.
[0097] For example, the third loss value mentioned above can be the attention loss value.
[0098] For example, the fourth loss value mentioned above can be the CTC loss value.
[0099] Step 203a7: The electronic device updates the first object recognition model based on the target loss value, the third loss value, and the fourth loss value to obtain the target object recognition model.
[0100] In this embodiment of the application, after obtaining the distillation loss value, attention loss value and CTC loss value, the electronic device can add the distillation loss value, attention loss value and CTC loss value to obtain the total loss value, and then use the total loss value to train the first object recognition model to obtain the final target object recognition model.
[0101] For example, the distillation loss value mentioned above can be L. soft The aforementioned attention loss value can be L. att The above CTC loss value can be L hard Electronic devices can use formula 2 to transfer L... hard L soft L att The sums are the total loss value, Loss. Formula 2 is as follows:
[0102] Loss=αL hard +βL att +γL soft Formula 2
[0103] Among them, L soft It is the distillation loss, L hard It is the form of CTC loss, L att It is an attention loss function, where α, β, and γ are hyperparameters. These hyperparameters cannot be updated during the computation process; that is, their values are determined before the computation begins.
[0104] The above L hard It is calculated using formulas 3 and 4, which are as follows:
[0105]
[0106]
[0107] Among them, L hard This is a special case equivalent to any of the following sequence-level distillations:
[0108] 1) Only use the best (1-best) path for sequence distillation. This best path is the target label mentioned above.
[0109] 2) Instead of directly providing the optimal distillation sequence π, all possible πs are generated using the target label sequence h and the mapping B. Here, B is the mapping from sequence π to the target label sequence h. Sequence π contains spaces 'blank' and repeated characters, and is processed according to CTC rules (B mapping) to obtain the target label sequence h. -1It is the inverse mapping, that is, the process of generating all corresponding CTC sequences π from the target label sequence h. In other words, the B mapping is to process h according to the rules of CTC.
[0110] The above L soft It is calculated using Formula 5, which is as follows:
[0111]
[0112] Thus, the distillation loss is first obtained through knowledge distillation, and then the attention loss and CTC loss of the first object recognition model are calculated by inputting the second data sample carrying the target label into the first object recognition model. At the same time, the first object recognition model is updated in combination with the above distillation loss, which further improves the recognition accuracy of the final target object recognition model.
[0113] Optionally, in this embodiment of the application, after step 203 above, the object recognition model training method provided in this embodiment of the application further includes the following steps 204 to 206:
[0114] Step 204: The electronic device acquires multiple seventh data samples.
[0115] In this embodiment of the application, each of the aforementioned seventh data samples does not carry a sample label.
[0116] For example, the seventh data sample mentioned above is private, unlabeled data. In other words, the seventh data sample mentioned above has not been labeled by the model.
[0117] For example, the seventh data sample mentioned above can be an audio file, an image file, a video file, etc.
[0118] Step 205: The electronic device uses multiple seventh data samples to iteratively train the target object recognition model to obtain target gradient information.
[0119] In this embodiment of the application, the target gradient information can be a weight value.
[0120] For example, the aforementioned weight values are used to update the parameter information of the aforementioned target object recognition model.
[0121] In this embodiment of the application, the iterative training involves repeatedly inputting the aforementioned multiple seventh data samples into the target object recognition model to generate multiple weight values.
[0122] Step 206: The electronic device updates the parameter information of the target object recognition model based on the target gradient information to obtain the updated target object recognition model.
[0123] In this embodiment, the electronic device uses a large sample batch as much as possible and uses cumulative gradient to update the parameters of the target object recognition model to obtain the final target object recognition model.
[0124] For example, after each time the electronic device obtains a weight value, it updates the parameter information of the target object recognition model based on the weight value, so as to continuously update the parameters of the target object recognition model.
[0125] In this way, by using a large number of data samples without sample labels, the target object recognition model is updated and iterated multiple times, further improving the recognition accuracy of the target object recognition model.
[0126] The object recognition model training method provided in this application can be executed by an object recognition model training device. This application uses an object recognition model training device executing the object recognition model training method as an example to illustrate the object recognition model training device provided in this application.
[0127] This application provides an object recognition model training device, such as... Figure 3 As shown, the object recognition model training device 400 includes an acquisition module 401 and a processing module 402, wherein: the acquisition module 401 is used to acquire a first data sample without carrying a sample label; the processing module 402 is used to input the first data sample without carrying a sample label acquired by the acquisition module 401 into an object recognition model cluster for processing to obtain a second data sample carrying a target sample label, the object recognition model cluster includes N first object recognition models, the N first object recognition models output N first sample labels, the target sample label is the sample label with the highest confidence among the N first sample labels, and N is a positive integer; the processing module 402 is also used to obtain a target object recognition model based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model.
[0128] Optionally, in this embodiment of the application, the acquisition module 401 is further configured to acquire multiple third data samples before the processing module 402 obtains the target object recognition model based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model, each third data sample carrying a sample label; the processing module 402 is further configured to perform model training using the multiple third data samples acquired by the acquisition module 401 to obtain the second object recognition model.
[0129] Optionally, in this embodiment of the application, the processing module 402 is specifically used to perform knowledge distillation on the second object recognition model and supervise the training of the first object recognition model based on the second data sample carrying the target sample label to obtain the target object recognition model.
[0130] Optionally, in this embodiment, the processing module 402 is specifically configured to: input the second data sample carrying the target sample label into the second object recognition model for processing to obtain a fourth data sample carrying the second sample label; input the second data sample carrying the target sample label into a third object recognition model for processing to obtain a fifth data sample carrying the third sample label, wherein the processing accuracy of the second object recognition model is greater than that of the third object recognition model; calculate a first loss value of the third object recognition model based on the similarity between the second sample label and the third sample label; calculate a second loss value of the third object recognition model based on the similarity between the third sample label and the target sample label; obtain a target loss value based on the first loss value and the second loss value; input the second data sample carrying the target sample label into the first object recognition model for processing to obtain a sixth data sample carrying the fourth sample label; calculate a third loss value and a fourth loss value of the first object recognition model based on the similarity between the fourth sample label and the target sample label; and update the first object recognition model based on the target loss value, the third loss value, and the fourth loss value to obtain the target object recognition model.
[0131] Optionally, in this embodiment, the acquisition module 401 is further configured to acquire multiple seventh data samples after the processing module 402 obtains the target object recognition model, each seventh data sample not carrying a sample label; the processing module 402 is further configured to: use the multiple seventh data samples acquired by the acquisition module 401 to iteratively train the target object recognition model to obtain target gradient information; and update the parameter information of the target object recognition model according to the target gradient information to obtain an updated target object recognition model.
[0132] In the object recognition model training device provided in this application embodiment, the device can first acquire a first data sample without carrying a sample label; input the first data sample without carrying a sample label into an object recognition model cluster for processing to obtain a second data sample carrying a target sample label. The object recognition model cluster includes N first object recognition models, and each of the N first object recognition models outputs N first sample labels. The target sample label is the sample label with the highest confidence among the N first sample labels, where N is a positive integer; then, based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model, a target object recognition model is obtained. This improves the recognition accuracy of the finally trained target object recognition model.
[0133] The object recognition model training device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the specific device.
[0134] The object recognition model training device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.
[0135] The object recognition model training device provided in this application embodiment can achieve... Figure 1 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.
[0136] Optionally, such as Figure 4As shown, this application embodiment also provides an electronic device 600, including a processor 601 and a memory 602. The memory 602 stores a program or instructions that can run on the processor 601. When the program or instructions are executed by the processor 601, they implement the various steps of the above-described object recognition model training method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0137] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0138] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0139] The electronic device 100 includes, but is not limited to, components such as: radio frequency unit 101, network module 102, audio output unit 103, input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, and processor 110.
[0140] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 110 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0141] The processor 110 is configured to acquire a first data sample without a sample label; the processor 110 is also configured to input the first data sample without a sample label into an object recognition model cluster for processing to obtain a second data sample carrying a target sample label, the object recognition model cluster including N first object recognition models, the N first object recognition models corresponding to output N first sample labels, the target sample label being the sample label with the highest confidence among the N first sample labels, where N is a positive integer; the processor 110 is also configured to obtain a target object recognition model based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model.
[0142] Optionally, in this embodiment of the application, the processor 110 is further configured to acquire multiple third data samples before obtaining the target object recognition model based on the second object recognition model, the second data samples carrying target sample labels, and the first object recognition model, each third data sample carrying a sample label; and to obtain the second object recognition model by training the model using the multiple third data samples.
[0143] Optionally, in this embodiment of the application, the processor 110 is specifically used to perform knowledge distillation on the second object recognition model and supervise the training of the first object recognition model based on the second data sample carrying the target sample label to obtain the target object recognition model.
[0144] Optionally, in this embodiment, the processor 110 is specifically configured to: input the second data sample carrying the target sample label into the second object recognition model for processing to obtain a fourth data sample carrying the second sample label; input the second data sample carrying the target sample label into a third object recognition model for processing to obtain a fifth data sample carrying the third sample label, wherein the processing accuracy of the second object recognition model is greater than that of the third object recognition model; calculate a first loss value of the third object recognition model based on the similarity between the second sample label and the third sample label; calculate a second loss value of the third object recognition model based on the similarity between the third sample label and the target sample label; obtain a target loss value based on the first loss value and the second loss value; input the second data sample carrying the target sample label into the first object recognition model for processing to obtain a sixth data sample carrying the fourth sample label; calculate a third loss value and a fourth loss value of the first object recognition model based on the similarity between the fourth sample label and the target sample label; and update the first object recognition model based on the target loss value, the third loss value, and the fourth loss value to obtain the target object recognition model.
[0145] Optionally, in this embodiment of the application, the processor 110 is further configured to, after obtaining the target object recognition model, acquire multiple seventh data samples, each of which does not carry a sample label; use the multiple seventh data samples to iteratively train the target object recognition model to obtain target gradient information; and update the parameter information of the target object recognition model according to the target gradient information to obtain an updated target object recognition model.
[0146] In the electronic device provided in this application embodiment, the electronic device can first acquire a first data sample without carrying a sample label; input the first data sample without carrying a sample label into an object recognition model cluster for processing to obtain a second data sample carrying a target sample label. The object recognition model cluster includes N first object recognition models, and the N first object recognition models output N first sample labels. The target sample label is the sample label with the highest confidence among the N first sample labels, where N is a positive integer; then, based on the second object recognition model, the second data sample carrying the target sample label, and the first object recognition model, a target object recognition model is obtained. This improves the recognition accuracy of the finally trained target object recognition model.
[0147] It should be understood that, in this embodiment, the input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.
[0148] The memory 109 can be used to store software programs and various data. The memory 109 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 109 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 109 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.
[0149] Processor 110 may include one or more processing units; optionally, processor 110 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 110.
[0150] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described object recognition model training method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0151] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0152] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described object recognition model training method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0153] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0154] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the object recognition model training method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0155] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0156] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0157] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A method for training an object recognition model, characterized in that, The method includes: Obtain the first data sample without sample labels; The first data sample without sample label is input into the object recognition model cluster for processing to obtain the second data sample carrying the target sample label. The object recognition model cluster includes N first object recognition models, and the N first object recognition models output N first sample labels. The target sample label is the sample label with the highest confidence among the N first sample labels, where N is a positive integer. The second object recognition model is subjected to knowledge distillation, and the first object recognition model is trained under supervision based on the second data sample carrying the target sample label to obtain the target object recognition model. Wherein, the processing accuracy of the second object recognition model is greater than that of the first object recognition model, and the knowledge distillation is used to distill the generalization ability of the second object recognition model onto the first object recognition model; The step of performing knowledge distillation on the second object recognition model and supervising the training of the first object recognition model based on the second data samples carrying the target sample labels to obtain the target object recognition model includes: The second data sample carrying the target sample label is input into the second object recognition model for processing to obtain a fourth data sample carrying the second sample label; The second data sample carrying the target sample label is input into the third object recognition model for processing to obtain the fifth data sample carrying the third sample label. The processing accuracy of the second object recognition model is greater than that of the third object recognition model. Based on the similarity between the second sample label and the third sample label, a first loss value of the third object recognition model is calculated; based on the similarity between the third sample label and the target sample label, a second loss value of the third object recognition model is calculated. Based on the first loss value and the second loss value, the target loss value is obtained; The second data sample carrying the target sample label is input into the first object recognition model for processing to obtain the sixth data sample carrying the fourth sample label; Based on the similarity between the fourth sample label and the target sample label, the third loss value and the fourth loss value of the first object recognition model are calculated; Based on the target loss value, the third loss value, and the fourth loss value, the first object recognition model is updated to obtain the target object recognition model.
2. The method according to claim 1, characterized in that, Before performing knowledge distillation on the second object recognition model and supervising training of the first object recognition model based on the second data samples carrying the target sample labels to obtain the target object recognition model, the method further includes: Multiple third data samples are acquired, each of which carries a sample label; The second object recognition model is obtained by training the model using the multiple third data samples.
3. The method according to claim 1, characterized in that, After obtaining the target object recognition model, the method further includes: Multiple seventh data samples are obtained, each of which does not carry a sample label; The target object recognition model is iteratively trained using the multiple seventh data samples to obtain target gradient information. Based on the target gradient information, the parameter information of the target object recognition model is updated to obtain the updated target object recognition model.
4. An object recognition model training device, characterized in that, The device includes: an acquisition module and a processing module, wherein: The acquisition module is used to acquire a first data sample that does not carry a sample label; The processing module is used to input the first data sample without sample label obtained by the acquisition module into the object recognition model cluster for processing to obtain a second data sample carrying the target sample label. The object recognition model cluster includes N first object recognition models, and the N first object recognition models output N first sample labels. The target sample label is the sample label with the highest confidence among the N first sample labels, where N is a positive integer. The processing module is further configured to perform knowledge distillation on the second object recognition model and supervise the training of the first object recognition model based on the second data sample carrying the target sample label to obtain the target object recognition model; Wherein, the processing accuracy of the second object recognition model is greater than that of the first object recognition model, and the knowledge distillation is used to distill the generalization ability of the second object recognition model onto the first object recognition model; The processing module is specifically used for: The second data sample carrying the target sample label is input into the second object recognition model for processing to obtain a fourth data sample carrying the second sample label; The second data sample carrying the target sample label is input into the third object recognition model for processing to obtain the fifth data sample carrying the third sample label. The processing accuracy of the second object recognition model is greater than that of the third object recognition model. Based on the similarity between the second sample label and the third sample label, a first loss value of the third object recognition model is calculated; based on the similarity between the third sample label and the target sample label, a second loss value of the third object recognition model is calculated. Based on the first loss value and the second loss value, the target loss value is obtained; The second data sample carrying the target sample label is input into the first object recognition model for processing to obtain the sixth data sample carrying the fourth sample label; Based on the similarity between the fourth sample label and the target sample label, the third loss value and the fourth loss value of the first object recognition model are calculated; Based on the target loss value, the third loss value, and the fourth loss value, the first object recognition model is updated to obtain the target object recognition model.
5. The apparatus according to claim 4, characterized in that, The acquisition module is further configured to acquire multiple third data samples before the processing module performs knowledge distillation on the second object recognition model and performs supervised training on the first object recognition model based on the second data samples carrying target sample labels to obtain the target object recognition model. Each of the third data samples carries a sample label. The processing module is also used to train the model using the multiple third data samples to obtain a second object recognition model.
6. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the object recognition model training method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Underwater scene target detection integration method and system for label generation
CN111666979A
Model distillation method and device and electronic equipment
CN114519416A