A method, device, electronic device and storage medium for training a sequence recognition model

Through the combination of student models, teacher models and credibility learning models, errors in pseudo-label sequences are identified and corrected, improving the accuracy of the sequence recognition model.

CN114254706BActive Publication Date: 2025-08-01HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111577279.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-22
Publication Date
2025-08-01
Estimated Expiration
2041-12-22

AI Technical Summary

Technical Problem

In the prior art, when using pseudo-label sequences to train a sequence to identify a model, there are errors in the pseudo-label sequences, which affects the accuracy of the model.

Method used

The preset student model and the preset teacher model identify the sample data without label information, combine the preset trustworthiness learning model to determine the credibility value of each character in the pseudo-label sequence, calculate the loss value and iterative training until the model converges, correcting the errors in the pseudo-label sequence.

Benefits of technology

The accuracy of characters in the pseudo-label sequence is improved, thereby improving the accuracy of the trained sequence recognition model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114254706B_ABST
    Figure CN114254706B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a method, apparatus, electronic device, and storage medium for training a sequence recognition model. The solution is as follows: Obtain a plurality of first sample data without labeled information; for each first sample data, obtain a first predicted sequence based on a preset student model; obtain a first pseudo-label sequence based on a preset teacher model; determine a first confidence value for each character in the first pseudo-label sequence based on a preset confidence learning model; calculate a first loss value of the preset student model; perform multiple iterations based on the first loss value until the preset student model converges, and obtain a sequence recognition model for sequence recognition. Through the technical solution provided by the embodiment of the present application, the accuracy of each character in the determined pseudo-label sequence is improved, thereby improving the accuracy of the trained sequence recognition model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data processing, and in particular, to a method, apparatus, electronic device, and storage medium for training a sequence recognition model. Background Art

[0002] As an important means of information collection or entry, sequence recognition technology has been widely applied in many fields. Currently, during the sequence recognition process, a pre-trained sequence recognition model is often used to recognize the sequences in the data to be recognized.

[0003] In the related art, a sequence recognition model is obtained by training a preset model through semi-supervised learning. Specifically, a large number of sample data without label information are input into a preset teacher model to obtain the pseudo-label sequence of each sample data, and then the preset student model is trained with the sample data carrying the pseudo-label sequence to obtain a trained sequence recognition model.

[0004] However, during the above-mentioned pseudo-label sequence prediction process, there are a small number of errors in the predicted pseudo-label sequence, which will seriously affect the accuracy of the trained sequence recognition model. Summary of the Invention

[0005] The purpose of the embodiments of the present application is to provide a method, apparatus, electronic device, and storage medium for training a sequence recognition model, so as to improve the accuracy of each character in the determined pseudo-label sequence, thereby improving the accuracy of the trained sequence recognition model. The specific technical solutions are as follows:

[0006] The embodiments of the present application provide a method for training a sequence recognition model, and the method includes:

[0007] Obtain multiple sample data without label information from a preset training set as first sample data;

[0008] For each first sample data, recognize the text included in the first sample data based on a preset student model to obtain a first prediction sequence of the first sample data;

[0009] Recognize the text included in the first sample data based on a preset teacher model to obtain a first pseudo-label sequence of the first sample data;

[0010] Based on a preset confidence learning model, determine a first confidence value for each character in the first pseudo-label sequence of the first sample data, where the first confidence value of a character is used to indicate the probability that the character is a correctly recognized character;

[0011] Calculate the first loss value of the preset student model according to the first prediction sequence and the first pseudo-label sequence of each first sample data, and the first confidence value of each character in the first pseudo-label sequence of each first sample data;

[0012] Perform multiple iterations based on the first loss value until the preset student model converges, and obtain a sequence recognition model for sequence recognition.

[0013] Optionally, before calculating the first loss value of the preset student model according to the first prediction sequence and the first pseudo-label sequence of each first sample data, and the first confidence value of each character in the first pseudo-label sequence of each first sample data, the method further includes:

[0014] For each first sample data, based on the edit distance between the first prediction sequence of the first sample data and each character in the first pseudo-label sequence of the first sample data, correct the misalignment of the characters in the first pseudo-label sequence of the first sample data to obtain the second pseudo-label sequence of the first sample data;

[0015] The step of calculating the first loss value of the preset student model according to the first prediction sequence and the first pseudo-label sequence of each first sample data, and the first confidence value of each character in the first pseudo-label sequence of each first sample data includes:

[0016] Calculate the first loss value of the preset student model according to the first prediction sequence and the second pseudo-label sequence of each first sample data, and the second confidence value of each character in the second pseudo-label sequence of each first sample data;

[0017] Wherein, the second confidence value of each character in the second pseudo-label sequence of each first sample data is the same as the first confidence value of each character in the pseudo-label sequence of the first sample data.

[0018] Optionally, the step of, for each first sample data, based on the edit distance between the first prediction sequence of the first sample data and each character in the first pseudo-label sequence of the first sample data, correcting the misalignment of the characters in the first pseudo-label sequence of the first sample data to obtain the second pseudo-label sequence of the first sample data includes:

[0019] For each first sample data, construct an edit distance matrix between the first prediction sequence and the first pseudo-label sequence according to each character in the first prediction sequence and the first pseudo-label sequence of the first sample data;

[0020] According to each matrix element in the edit distance matrix, perform a backward search for a path that matches the minimum edit distance as the optimal matching path;

[0021] Construct a first matching matrix according to the optimal matching path; wherein, the matrix element at the position corresponding to the optimal matching path in the first matching matrix is a first value, and the matrix elements at other positions are second values;

[0022] For each column of matrix elements in the first matching matrix, when there are multiple first values in this column of matrix elements, correct the other first values except the first value with the largest row number to second values to obtain a second matching matrix;

[0023] Calculate the product of the second matching matrix and the first pseudo-label sequence of the first sample data to obtain the second pseudo-label sequence of the first sample data.

[0024] Optionally, the step of determining the first credibility value of each character in the first pseudo-label sequence of the first sample data based on the preset credibility learning model includes:

[0025] Input the feature data extracted by the feature extraction module in the preset teacher model into the preset credibility learning model to obtain the credibility value sequence of the first sample data, and each credibility value in the credibility value sequence is the first credibility value of the character at the same position in the first pseudo-label sequence of the first sample data.

[0026] Optionally, the preset training set further includes second sample data and the label information of each second sample data, and the number of first sample data included in the preset training set is more than the number of second sample data included;

[0027] If the model structure of the first preset model is the same as the model structure of the second preset model, then before identifying the text included in each first sample data based on the preset student model to obtain the first prediction sequence of the first sample data, the method further includes:

[0028] Obtain multiple second sample data from the preset training set;

[0029] For each second sample data, identify the text included in the second sample data based on the first preset model to obtain the second prediction sequence of the second sample data;

[0030] Identify the text included in the second sample data based on the second preset model to obtain the third pseudo-label sequence of the second sample data;

[0031] Calculate the second loss value of the first preset model based on the label information and the second prediction sequence of each second sample data;

[0032] When the first preset model has not converged, the parameters of the first preset model are adjusted based on the second loss value, and the parameters of the second preset model are adjusted according to the preset parameter adjustment algorithm, and the step of identifying the text included in each second sample data based on the first preset model to obtain a second prediction sequence for the second sample data is returned to execution, until the first preset model converges, the first preset model is determined as the preset student model, and the second preset model is determined as the preset teacher model.

[0033] Optionally, when there are multiple preset credibility learning models, the step of determining the first credibility value of each character in the first pseudo-label sequence of the first sample data based on the preset credibility learning model includes:

[0034] Using each preset credibility learning model, respectively, the text included in the first sample data is recognized to obtain a third prediction sequence of the first sample data;

[0035] A first credibility value of each character in the first pseudo label sequence of the first sample data is determined according to the third prediction sequence and the first pseudo label sequence corresponding to the first sample data.

[0036] Optionally, the method further includes:

[0037] Obtaining data to be identified;

[0038] The text contained in the data to be recognized is recognized based on the sequence recognition model to obtain a target sequence.

[0039] The present application also provides a sequence recognition model training device, the device comprising:

[0040] A first acquisition module is used to acquire a plurality of sample data without label information from a preset training set as first sample data;

[0041] A first recognition module is configured to recognize, for each first sample data, the text contained in the first sample data based on a preset student model, and obtain a first prediction sequence for the first sample data;

[0042] A second recognition module is used to recognize the text contained in the first sample data based on a preset teacher model to obtain a first pseudo label sequence of the first sample data;

[0043] A first determination module is configured to determine a first credibility value of each character in the first pseudo-label sequence of the first sample data based on a preset credibility learning model, wherein the first credibility value of a character is used to indicate a probability that the character is a correctly recognized character;

[0044] A first calculation module, configured to calculate a first loss value of the preset student model according to a first prediction sequence and a first pseudo-label sequence of each first sample data, and a first credibility value of each character in the first pseudo-label sequence of each first sample data;

[0045] A second determination module, configured to perform multiple iterations based on the first loss value until the preset student model converges, so as to obtain a sequence recognition model for sequence recognition.

[0046] An embodiment of the present application further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;

[0047] The memory is used to store a computer program;

[0048] The processor is configured to implement the steps of the sequence recognition model training method described in any one of the above when executing the program stored on the memory.

[0049] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of the sequence recognition model training method described in any one of the above are implemented.

[0050] An embodiment of the present application further provides a computer program product including instructions, which when running on a computer, causes the computer to execute the sequence recognition model training method described in any one of the above.

[0051] Advantageous effects of the embodiments of the present application:

[0052] The technical solution provided by the embodiments of the present application respectively uses a preset student model and a preset teacher model to recognize the text included in the first sample data without label information in the preset training set, so as to obtain a prediction sequence and a pseudo-label sequence corresponding to each first sample data. Then, a preset credibility learning model is used to determine the credibility of each character in the pseudo-label sequence of each first sample data. According to the prediction sequence and the pseudo-label sequence of each first sample data, and the first credibility value of each character in the first pseudo-label sequence of each first sample data, a first loss value of the preset student model is calculated. When the preset student model does not converge, the parameters of the preset student model are adjusted based on the first loss value, and the preset student model is retrained until the preset student model converges, and then the preset student model is determined as the sequence recognition model.

[0053] Compared with the related art, after obtaining the pseudo-label sequence of each first sample data, the credibility value of each character in the pseudo-label sequence of the first sample data is determined through a preset credibility learning model, that is, the probability that each character in the pseudo-label sequence of each first sample data is the correctly recognized character is determined. This effectively improves the accuracy of each character in the determined pseudo-label sequence, thereby improving the accuracy of the preset student model trained based on the first credibility value.

[0054] Of course, it is not necessary for any product or method implementing the present application to achieve all the above-mentioned advantages simultaneously. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can also obtain other embodiments based on these drawings.

[0056] Figure 1 It is the first flowchart of the sequence recognition model training method provided by the embodiment of the present application;

[0057] Figure 2 It is a structural schematic diagram of a preset teacher model or a preset student model provided by the embodiment of the present application;

[0058] Figure 3 It is the second flowchart of the sequence recognition model training method provided by the embodiment of the present application;

[0059] Figure 4 It is the third flowchart of the sequence recognition model training method provided by the embodiment of the present application;

[0060] Figure 5 It is the fourth flowchart of the sequence recognition model training method provided by the embodiment of the present application;

[0061] Figure 6 It is the fifth flowchart of the sequence recognition model training method provided by the embodiment of the present application;

[0062] Figure 7 It is the sixth flowchart of the sequence recognition model training method provided by the embodiment of the present application;

[0063] Figure 8 It is the seventh flowchart of the sequence recognition model training method provided by the embodiment of the present application;

[0064] Figure 9 It is a structural schematic diagram of a sequence recognition model training device provided by the embodiment of the present application;

[0065] Figure 10 This is a schematic structural diagram of the electronic device provided by the embodiment of the present application. Detailed implementation manners

[0066] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art based on the present application belong to the scope of protection of the present application.

[0067] The relevant noun explanations in the embodiments of the present application are as follows:

[0068] Semi-supervised Learning (SSL): On the premise of a certain number of existing labeled sample data, a large number of unlabeled sample data are used to complete the model training and learning process to improve the model performance.

[0069] Teacher Model (TM): Derived from the concept of "teacher", it can refer to a pre-trained model or a model to be trained in semi-supervised learning. During the training process, it provides some guiding knowledge for the model that needs to perform semi-supervised learning (such as assigning pseudo-labels to sample data without label information), and then performs iterative training.

[0070] Student Model (SM): Opposite to the above teacher model concept, it refers to the model that will perform semi-supervised learning.

[0071] Edit Distance (ED): An index used to measure the similarity degree of two sequences. Generally speaking, the edit distance refers to the minimum number of single-character editing operations required to convert one sequence (such as a word) into another sequence between two sequences.

[0072] In the related art, when using a preset teacher model to obtain the pseudo-label sequence corresponding to the sample data without label information, there are a small number of errors in the obtained pseudo-label sequence. For example, the order of each character in the pseudo-label sequence is correct, but one or more characters are incorrect. For another example, the order of one or more characters in the pseudo-label sequence is misaligned, such as missing characters or having extra characters.

[0073] For ease of understanding, an example of the situation where errors occur in the pseudo-label sequence is given. Now assume that the true sequence corresponding to a certain piece of data is represented as: 14, 26, 27, 23, 16, 30, 1. The pseudo-label sequence obtained through the preset teacher model may be: 14, 26, 27, 16, 30, 30, 1. At this time, the fourth character in this pseudo-label sequence has a character error due to character misalignment, and the fifth and sixth characters have character errors due to character repetition. The character errors in the pseudo-label sequence will seriously affect the accuracy of the sequence recognition model obtained by training.

[0074] To solve the problems in the related art, an embodiment of the present application provides a method for training a sequence recognition model. This method can be applied to any electronic device, such as a server, a mobile device, etc. Here, no specific limitation is imposed on this electronic device. As Figure 1 shown, Figure 1 This is the first flowchart of the method for training a sequence recognition model provided by an embodiment of the present application. The method includes the following steps.

[0075] Step S101, obtain multiple sample data without label information from a preset training set as the first sample data.

[0076] Step S102, for each first sample data, identify the text included in the first sample data based on a preset student model to obtain the first prediction sequence of the first sample data.

[0077] Step S103, identify the text included in the first sample data based on a preset teacher model to obtain the first pseudo-label sequence of the first sample data.

[0078] Step S104, based on a preset credibility learning model, determine the first credibility value of each character in the first pseudo-label sequence of the first sample data, where the first credibility value of a character is used to indicate the probability that the character is a correctly recognized character.

[0079] Step S105, calculate the first loss value of the preset student model according to the first prediction sequence and the first pseudo-label sequence of each first sample data, and the first credibility value of each character in the first pseudo-label sequence of each first sample data.

[0080] Step S106, perform multiple iterations based on the first loss value until the preset student model converges to obtain a sequence recognition model for sequence recognition.

[0081] Through Figure 1The method shown uses a preset student model and a preset teacher model respectively to identify the text contained in the first sample data without label information in the preset training set, obtaining a prediction sequence and a pseudo-label sequence corresponding to each first sample data. Then, using a preset confidence learning model, the confidence of each character in the pseudo-label sequence of each first sample data is determined. According to the prediction sequence and pseudo-label sequence of each first sample data, and the first confidence values of each character in the first pseudo-label sequence of each first sample data, the first loss value of the preset student model is calculated. When the preset student model has not converged, based on this first loss value, the parameters of the preset student model are adjusted, and the preset student model is retrained until the preset student model converges, and then the preset student model is determined as the sequence recognition model.

[0082] Compared with the related technology, after obtaining the pseudo-label sequence of each first sample data, the confidence value of each character in the pseudo-label sequence of this first sample data is determined through a preset confidence learning model, that is, the probability that each character in the pseudo-label sequence of each first sample data is the correctly recognized character is determined. This effectively improves the accuracy of each character in the determined pseudo-label sequence, thereby improving the accuracy of the preset student model trained based on this first confidence value.

[0083] The embodiments of the present application will be described below through specific examples.

[0084] Regarding the above step S101, that is, obtaining multiple sample data without label information from the preset training set as the first sample data.

[0085] The above preset training set includes multiple sample data. For each sample data, when the preset training set does not include the label information corresponding to this sample data, this sample data is the first sample data without label information; when the preset training set includes the label information corresponding to this sample data, this sample data is the second sample data with label information.

[0086] In the embodiments of the present application, the number of the first sample data included in the above preset training set is more than the number of the second sample data included therein. For example, the number of the first sample data included in the above preset training set can be 2 times, 3 times, or 10 times the number of the second sample data included therein, etc. Here, the numbers of the first sample data and the second sample data included in the above preset training set are not specifically limited.

[0087] When the electronic device trains the preset student model to obtain the sequence recognition model, it can use the sample data in the preset training set to perform multiple iterative trainings on the preset learning model to obtain the sequence recognition model. In each iterative training process, the electronic device can obtain multiple first sample data without label information from the preset training set.

[0088] The above-mentioned multiple first sample data may be all the first sample data in the above-mentioned preset training set, or may be part of the first sample data in the above-mentioned preset training set. Here, the quantity of the obtained first sample data is not specifically limited.

[0089] For ease of understanding, only one iteration training process is taken as an example for illustration in the embodiments of the present application. Other iteration processes can refer to this iteration process and will not be specifically described here.

[0090] In the embodiments of the present application, the sample data in the above-mentioned preset training set is used to train a sequence recognition model. This sequence recognition model can be used to recognize the text included in data of types such as speech data, image text data, and natural language data. According to the different application scenarios corresponding to the sequence recognition model, the sample data in the above-mentioned preset training set is also different.

[0091] For example, when the sequence recognition model is applied to a speech recognition scenario, the above-mentioned sample data may be speech data. For another example, when the sequence recognition model is applied to a text content recognition scenario, the above-mentioned sample data may be a text image.

[0092] In the embodiments of the present application, the type of the above-mentioned sample data is not specifically limited. For ease of understanding, only the text content recognition scenario is taken as an example for illustration below, which does not play any limiting role.

[0093] In the embodiments of the present application, the label information of the above-mentioned second sample data may be the text sequence included in the second sample data.

[0094] Regarding the above-mentioned step S102, that is, for each first sample data, based on a preset student model, the text included in the first sample data is recognized to obtain the first predicted sequence of the first sample data.

[0095] In this step, for each obtained first sample data, the electronic device may input the first sample data into the preset student model. The preset student model will output the predicted sequence corresponding to the first sample data. The electronic device may obtain this predicted sequence as the first predicted sequence of the first sample data.

[0096] Regarding the above-mentioned step S103, that is, based on a preset teacher model, the text included in the first sample data is recognized to obtain the first pseudo-label sequence of the first sample data.

[0097] In this step, for each piece of first sample data, the electronic device can input the first sample data into a preset teacher model. The preset teacher model will output a pseudo-label sequence corresponding to the first sample data. The electronic device can obtain the pseudo-label sequence as the first pseudo-label sequence of the first sample data.

[0098] In the embodiments of the present application, the above-mentioned preset teacher model and the above-mentioned preset student model are both network models for sequence recognition. The model structures corresponding to the preset teacher model and the preset student model may be the same or different. Here, the model structures of the preset teacher model and the preset student model are not specifically limited. For ease of understanding, the model structures of the preset teacher model and the preset student model are taken as examples for illustration below, which does not play any limiting role.

[0099] In an optional embodiment, as Figure 2 shown, Figure 2 is a schematic structural diagram of a preset teacher model or a preset student model provided by an embodiment of the present application.

[0100] The above-mentioned preset teacher model and preset student model may include a lightweight residual backbone network (Residual Neural Network, ResNet), that is, Figure 2 the shown ResNet_GNT, two layers of bidirectional long short-term memory (Long Short-Term Memory, LSTM) networks, and an attention head (Attention Head).

[0101] The above-mentioned ResNet_GNT is used to extract features from the input first sample data to obtain feature data. The two layers of bidirectional LSTM are used to perform context modeling based on the feature data extracted by ResNet_GNT. The Attention Head can be composed of one layer of LSTM and one layer of fully connected network (Fully Conncected) and is used to obtain the sequence recognition prediction value corresponding to the text contained in the input first sample data, that is, to obtain the above-mentioned first prediction sequence or first pseudo-label sequence.

[0102] In the embodiments of the present application, the execution order of the above-mentioned step S102 and step S103 is not specifically limited.

[0103] Regarding the above-mentioned step S104, that is, based on a preset credibility learning model, determine the first credibility value of each character in the first pseudo-label sequence of the first sample data, where the first credibility value of a character is used to indicate the probability that the character is a correctly recognized character.

[0104] In this step, for each first sample data, the electronic device can use a preset confidence learning model to determine the confidence value of each character in the first pseudo-label sequence of the first sample data, denoted as the first confidence value.

[0105] In the embodiments of the present application, the first confidence value of each character is used to indicate the probability that the recognized character is the correct character. The magnitude of the first confidence value is proportional to the probability that the character is the correct character. That is, when the first confidence value of a certain character is larger, the electronic device can determine that the probability that the recognized character is the correct character is higher; when the first confidence value of a certain character is smaller, the electronic device can determine that the probability that the recognized character is the correct character is lower.

[0106] For example, when the first confidence value of a certain character in the first pseudo-label sequence of the first sample data is 1, the electronic device can determine that the character is correctly recognized; when the first confidence value of a certain character in the first pseudo-label sequence of the first sample data is 0, the electronic device can determine that the character is incorrectly recognized.

[0107] The value range of the first confidence value of each character in the above first pseudo-label sequence is between 0 and 1, and can also be 0 or 1. Here, the above first confidence value is not specifically limited. For the method of determining the first confidence value, refer to the following description and no specific description is given here.

[0108] In the embodiments of the present application, the above preset confidence learning model can be an online module in the electronic device or an offline module. When the preset confidence learning model is an offline module, the number of the preset confidence learning models can be multiple. For the description of the above preset confidence learning model, refer to the following description and no specific description is given here.

[0109] The above preset confidence learning model is obtained by training a preset third model using sample data with labeled information. For the training method of the preset confidence learning model, refer to the following description and no specific description is given here.

[0110] Regarding the above step S105, that is, according to the first prediction sequence and the first pseudo-label sequence of each first sample data, and the first confidence value of each character in the first pseudo-label sequence of each first sample data, calculate the first loss value of the preset student model.

[0111] In this step, the electronic device can use a first preset loss function to calculate the first loss value of the above preset student model according to the first prediction sequence and the first pseudo-label sequence of each first sample data, and the first confidence value of each character in the first pseudo-label sequence of each first sample data.

[0112] In an alternative embodiment, the electronic device may utilize the cross entropy loss function to calculate the cross entropy of the first prediction sequence, the first pseudo-label sequence, and the first credibility values of each character in the first pseudo-label sequence corresponding to the above-mentioned multiple first sample data, and determine the cross entropy as the first loss value of the above-mentioned preset student model.

[0113] In the embodiments of the present application, in addition to the cross entropy loss function, the above-mentioned first preset loss function may also be other loss functions. For example, the mean squared error loss function, etc. Here, no specific limitation is imposed on the above-mentioned first preset loss function.

[0114] When the above-mentioned first preset loss function is different, the calculation method of the above-mentioned first loss value is also different. Here, no specific description is made on the calculation method of the first loss value of the above-mentioned preset student model.

[0115] Regarding the above-mentioned step S106, that is, performing multiple iterations based on the first loss value until the preset student model converges to obtain a sequence recognition model for sequence recognition.

[0116] In the embodiments of the present application, after each iteration training is completed, the electronic device may determine whether the preset student model converges. When the model performance of the preset student model no longer improves after continuous multiple iteration trainings, the electronic device may determine that the preset student model converges.

[0117] In an alternative embodiment, the electronic device may obtain a preset validation set, which includes multiple third sample data and the label information of each third sample data, input the third sample data in the preset validation set into the preset student model after each iteration training, and when the prediction sequences of each third sample data are the same as the label information of the third sample data after continuous multiple, such as 3 times or 5 times, iteration trainings, the electronic device may determine that the preset student model converges.

[0118] In another alternative embodiment, the electronic device may compare the first loss value of the above-mentioned preset student model with a preset loss value threshold. When the first loss value is greater than the preset loss value threshold, the electronic device may determine that the preset student model does not converge; when the first loss value is less than or equal to the preset loss value threshold, the electronic device may determine that the preset student model converges.

[0119] In the embodiments of the present application, no specific limitation is imposed on the method for determining whether the above-mentioned preset student model converges.

[0120] In an alternative embodiment, when the above-mentioned preset student model does not converge, the electronic device needs to continue to perform a new round of iterative training on the preset learning model based on the above-mentioned first loss value. At this time, the electronic device can adjust the parameters of the current preset student model based on the above-mentioned first loss value, and re-execute the above-mentioned steps S101-S105. That is, after adjusting the parameters of the preset student model, the electronic device returns to execute the above-mentioned step S101, and obtains multiple sample data without labeled information from the preset training set as the first sample data.

[0121] In the embodiments of the present application, the method for adjusting the parameters of the above-mentioned preset learning model includes, but is not limited to, the gradient descent method and the backpropagation method. The parameters of the above-mentioned preset learning model include, but are not limited to, the bias and the weight.

[0122] In another alternative embodiment, after performing multiple iterative trainings, if the above-mentioned preset student model converges, the electronic device can determine that the training process of the preset student model is completed. At this time, the electronic device can determine the current preset student model as the sequence recognition model for sequence recognition.

[0123] In the embodiments of the present application, the number of iterative trainings for the above-mentioned preset student model is not specifically limited. That is, the number of the above-mentioned multiple iterations is not specifically limited.

[0124] In an alternative embodiment, based on Figure 1 the method shown, the embodiments of the present application also provide a method for training a sequence recognition model. As Figure 3 shown, Figure 3 FIG. is the second flowchart of the method for training a sequence recognition model provided by the embodiments of the present application. The method includes the following steps.

[0125] Step S301: Obtain multiple sample data without labeled information from the preset training set as the first sample data.

[0126] Step S302: For each first sample data, identify the text included in the first sample data based on the preset student model to obtain the first predicted sequence of the first sample data.

[0127] Step S303: Identify the text included in the first sample data based on the preset teacher model to obtain the first pseudo-label sequence of the first sample data.

[0128] Step S304: Based on the preset confidence learning model, determine the first confidence value of each character in the first pseudo-label sequence of the first sample data, where the first confidence value of a character is used to indicate the probability that the character is a correctly recognized character.

[0129] The above steps S301 - S304 are the same as the above steps S101 - S104.

[0130] Step S305: For each first sample data, based on the edit distance between the characters in the first prediction sequence and the first pseudo - label sequence of the first sample data, correct the misalignment of the characters in the first pseudo - label sequence of the first sample data to obtain the second pseudo - label sequence of the first sample data.

[0131] In the embodiment of the present application, for the first pseudo - label sequence recognized by the above - mentioned preset teacher model, in addition to the above - mentioned situation of incorrect characters, there may also be a situation of character misalignment in the first pseudo - label sequence. Therefore, in order to further improve the accuracy of the recognized first pseudo - label sequence, the electronic device can, for each first sample data, correct the misalignment of the characters in the first pseudo - label sequence of the first sample data through the edit distance between the characters in the first prediction sequence of the first sample data recognized by the preset student model and the first pseudo - label sequence of the first sample data recognized by the preset teacher model, to obtain the first pseudo - label sequence after misalignment correction, denoted as the second pseudo - label sequence of the first sample data.

[0132] Step S306: According to the first prediction sequence and the second pseudo - label sequence of each first sample data, and the second confidence value of each character in the second pseudo - label sequence of each first sample data, calculate the first loss value of the preset student model.

[0133] The calculation of the first loss value in the above step S306 can refer to the calculation method of the first loss value in the above step S105, and will not be specifically described here.

[0134] In the embodiment of the present application, the second confidence value of each character in the second pseudo - label sequence of each first sample data is the same as the first confidence value of each character in the pseudo - label sequence of the first sample data.

[0135] Through the above steps S305 and S306, the electronic device can perform misalignment correction processing on each character in each first pseudo - label sequence recognized by the preset teacher model, thereby reducing the impact of character misalignment on the accuracy of the recognized first pseudo - label sequence, improving the accuracy of the recognized first pseudo - label sequence, and further improving the accuracy of the sequence recognition model trained based on the corrected first pseudo - label sequence.

[0136] Step S307: Perform multiple iterations based on the first loss value until the preset student model converges to obtain a sequence recognition model for sequence recognition.

[0137] The above step S307 is the same as the above step S106.

[0138] In an optional embodiment, based on Figure 3 The method shown in the embodiment of the present application also provides a sequence recognition model recognition method. Figure 4 As shown, Figure 4 This is a third flow chart of the sequence recognition model training method provided in an embodiment of the present application. In this method, the above step S305 is specifically refined into the following steps, namely, step S3051 to step S3055.

[0139] Step S3051 : for each first sample data, construct an edit distance matrix between the first prediction sequence and the first pseudo label sequence according to the first prediction sequence of the first sample data and each character in the first pseudo label sequence.

[0140] In an optional embodiment, for each first sample data, the electronic device may construct an edit distance matrix between the first prediction sequence and the first pseudo label sequence of the first sample data using the following formula:

[0141]

[0142] Among them, lev a,b (i,j) is the i-th character in sequence a (i.e. a i ) and the jth character in sequence b (i.e. b j ), min is the minimum operation, max is the maximum operation, is the indicator function.

[0143] When min(i,j)=0, that is, a i and b j When one of the characters in is empty, sequence a can be converted to sequence b by performing max(i,j) single-character editing operations, that is, a i and b j The edit distance between them is max(i,j), that is, a i and b j The maximum value in is expressed as: lev a,b (i,j)=max(i,j).

[0144] When min(i,j)≠0, that is, a i and b j When both are not empty, the calculation of edit distance allows three operations, namely deletion, insertion and replacement.

[0145] Among them, lev a,b (i-1,j)+1 means delete a i ,lev a,b (i,j-1)+1 means insert bj , represents replacing b j . When a i =b j , When a i ≠b j ,

[0146] For ease of understanding, an example is given to illustrate the construction of the above edit distance matrix.

[0147] Now assume that there is a certain first sample data, and the first pseudo-label identified by the preset teacher model is: 14, 26, 27, 23, 16, 30, 1; the first prediction sequence identified by the preset student model is: 14, 26, 27, 16, 30, 30, 1.

[0148] The electronic device can construct the edit distance matrix shown in Table 1 according to the formula. Each value in Table 1 is an element of the matrix in the edit distance matrix.

[0149] Table 1

[0150] 0 1 2 3 4 5 6 7 1 0 1 2 3 4 5 6 2 1 0 1 2 3 4 5 3 2 1 0 1 2 3 4 4 3 2 1 1 1 2 3 5 4 3 2 2 2 1 2 6 5 4 3 3 3 2 2 7 6 5 4 4 4 3 2

[0151] Among them, the sequence corresponding to the horizontal direction (i.e., the above sequence a i ) is the above first pseudo-label sequence, and the sequence corresponding to the vertical direction (i.e., the above sequence b j ) is the above first prediction sequence.

[0152] In the edit distance matrix shown in Table 1, the elements of the first row and the first column of the matrix are calculated according to lev a,b (i,j)=max(i,j), that is, calculated when i = 0 and j = 0. Each element of each row and each column of the matrix except for the elements of the first row and the first column of the matrix is calculated according to the above calculation.

[0153] For ease of understanding, only the determination of the matrix element 2 in the lower right corner is taken as an example for illustration. As shown in Table 2, Table 2 is a schematic diagram of the three matrix elements adjacent to the matrix element (a i , b j ).

[0154] Table 2

[0155] <![CDATA[(a i -1, b j -1)]]> <![CDATA[(a i ,b j -1)]]> <![CDATA[(a i -1, b j )]]> <![CDATA[(a i ,b j )]]>

[0156] The row number and column number corresponding to the above matrix element 2 are both 8, that is, the matrix element (a 7=8-1 , b 7=8-1)。The character corresponding to a7 is 1 in the first pseudo-label sequence, and the character corresponding to b7 is 1 in the first prediction sequence.

[0157] Since lev a,b (i - 1, j)+1 = lev a,b (6, 7)+1 = 3 + 1 = 4; lev a,b (i, j - 1)+1 = lev a,b (7, 6)+1 = 2 + 1 = 3; 4 > 3 > 2, so the electronic device can determine that lev a,b (7, 7)=2.

[0158] Each matrix element except the first row and first column matrix elements can be determined by referring to the determination method of the above matrix element 2, which will not be specifically described here.

[0159] In the above edit distance calculation process, for a sequence of length n, the value ranges of the above i and j are 0 - n. At this time, the size of the edit distance matrix is (n + 1)*(n + 1), that is, the edit distance matrix includes n + 1 rows and n + 1 columns.

[0160] Taking the above first pseudo-label sequence and first prediction sequence as an example for illustration. The above first pseudo-label sequence and first prediction sequence both include 7 characters, that is, the length of the first pseudo-label sequence and the first prediction sequence is 7. Therefore, the edit distance matrix between the first prediction sequence and the first pseudo-label sequence is shown in Table 1, and the size of this edit distance matrix is 8*8, that is, (7 + 1)*(7 + 1).

[0161] Step S3052, according to each matrix element in the edit distance matrix, reverse-search the path that matches the minimum edit distance as the optimal matching path.

[0162] In this step, the electronic device can start from the optimal matrix element in the lower right corner according to each matrix element in the edit distance matrix, and reverse-search the path that matches the minimum edit distance to obtain the optimal matching path.

[0163] For easy understanding, still taking the above Table 1 as an example for illustration. In the edit distance matrix shown in Table 1, the electronic device starts from the matrix element 2 in the lower right corner. Taking this matrix element as the target matrix element, reverse-search the 3 adjacent matrix elements corresponding to this target matrix element (i.e., the left matrix element, the upper matrix element, and the upper left matrix element). Determine the smallest matrix element (i.e., the matrix element 2 in the second category of the penultimate row) as the matrix element on the path that matches the minimum edit distance, and continue to reverse-search with the matrix element as the target matrix element until the matrix element 0 in the upper left corner is reached when the reverse-search process is completed.

[0164] In an alternative embodiment, during the above-mentioned backward search process, when there are multiple smallest matrix elements among the three matrix elements adjacent to the target matrix element, the electronic device may determine the matrix elements on the path that matches the minimum edit distance according to the preset editing operation priority.

[0165] For ease of understanding, still taking the edit distance matrix shown in Table 1 above as an example. Now assume that the preset editing operation priority from high to low is represented as: substitution operation, insertion operation, deletion operation.

[0166] During the above-mentioned backward search process, after the matrix element 1 in the third column of the fourth row from the bottom is determined as the current target matrix element, since there are two smallest matrix elements among the three adjacent matrix elements of this matrix element, that is, the left matrix element 1 and the upper left matrix element 1. At this time, when the electronic device determines the next target matrix element, it can be determined according to the above-mentioned preset editing operation priority. For example, since the substitution operation has the highest priority in the preset editing operation priority, and the current target matrix element 1 is obtained by the substitution operation from the upper left matrix element 1, the electronic device can determine the upper left matrix element 1 of the current target matrix element 1 as the next target matrix element, that is, the matrix element in the above-mentioned optimal matching path.

[0167] Through the above-mentioned backward search method, the electronic device can determine a unique optimal matching path according to the edit distance matrix, ensuring the minimum edit distance while ensuring the uniqueness of the optimal matching path. Specifically, as shown in Table 3, the path formed by the () matrix elements in Table 3 is the determined optimal matching path.

[0168] Table 3

[0169] (0) 1 2 3 4 5 6 7 1 (0) 1 2 3 4 5 6 2 1 (0) 1 2 3 4 5 3 2 1 (0) (1) 2 3 4 4 3 2 1 1 (1) 2 3 5 4 3 2 2 2 (1) 2 6 5 4 3 3 3 (2) 2 7 6 5 4 4 4 3 (2)

[0170] Step S3053, construct a first matching matrix according to the optimal matching path; wherein, the matrix elements at the positions corresponding to the optimal matching path in the first matching matrix are the first value, and the matrix elements at other positions are the second value.

[0171] In an alternative embodiment, the above-mentioned first value may be 1, and the second value may be 0.

[0172] In the embodiments of the present application, the above-mentioned first value may also be other values, such as 2, 3, etc. Here, the above-mentioned first value is not specifically limited.

[0173] For ease of understanding, the following takes the first value as 1 and the second value as 0 to illustrate the above-mentioned first matching matrix. As shown in Table 4, Table 4 is the first matching matrix constructed according to the optimal matching path shown in Table 3 above.

[0174] Table 4

[0175] 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1

[0176] In the embodiment of the present application, since the first-row matrix elements and the second matrix elements in the above edit distance matrix are calculated in the cases where the above i = 0 and the above j = 0, that is, calculated when the initial character in the sequence is empty, therefore, when constructing the above first matching matrix, it only changes according to the lengths of the first pseudo-label sequence and the first predicted label sequence. That is, when constructing the matching matrix, the first-row matrix elements and the first-column matrix elements in the edit matrix are ignored, that is, the 0 in the upper left corner of the optimal matching path is ignored.

[0177] Step S3054, for each column matrix element in the first matching matrix, when there are multiple first values in this column matrix element, correct other first values except the first value with the largest row number to the second value to obtain the second matching matrix.

[0178] In the embodiment of the present application, in the above first matching matrix, for each row matrix element in this first matching matrix, when there are multiple first values in this row matrix element, the electronic device can determine that there is a phenomenon of missing characters in the first predicted sequence predicted by the preset student model compared with the first pseudo-label sequence determined by the preset teacher model. For example, character 23 is missing in the above first predicted sequence. For each column matrix element in this first matching matrix, when there are multiple first values in this column matrix element, the electronic device can determine that there is a phenomenon of redundant characters or repeated characters in the first predicted sequence predicted by the preset student model compared with the first pseudo-label sequence determined by the preset teacher model. For example, the repeated character 30 in the above first predicted sequence.

[0179] For the situation where there are multiple first values in a certain column or multiple column matrix elements in the above first matching matrix, the electronic device needs to perform misalignment correction. That is, correct other first values except the first value with the largest row number in the column matrix element with multiple first values to the second value to obtain the second matching matrix.

[0180] For easy understanding, the first matching matrix shown in Table 4 above is used for illustration. Since there are two matrix elements 1 in the sixth column, the electronic device can correct the matrix element 1 in the fifth row of this column to the matrix element 0 to obtain the second matching matrix shown in Table 5.

[0181] Table 5

[0182] 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1

[0183] The above-mentioned electronic device specifically represents the execution of steps S3053 and S3054 as directly constructing the matching matrix corresponding to each first sample data according to the optimal matching path. In the embodiments of the present application, for the convenience of understanding, the construction of the matching matrix is split into two steps for execution, which does not play any restrictive role.

[0184] Step S3055: Calculate the product of the second matching matrix and the first pseudo-label sequence of the first sample data to obtain the second pseudo-label sequence of the first sample data.

[0185] For the convenience of understanding, the second matching matrix shown in Table 5 is taken as an example for illustration.

[0186] The electronic device can calculate the product of the second matching matrix shown in Table 5 and the above-mentioned first pseudo-label sequence to obtain the second pseudo-label sequence of the first sample data. Specifically, it is expressed as follows:

[0187]

[0188] In the embodiments of the present application, for the case where there are multiple first values in a certain row or multiple rows of the above-mentioned first matching matrix, the electronic device does not handle this situation, which makes there still be multiple first values in the corresponding row of the above-mentioned second matching matrix. For example, the third-row matrix elements of the second matching matrix shown in the above-mentioned second Table 5 include two 1s. At this time, when calculating the second pseudo-label sequence of the first sample data using the second matching matrix and the first pseudo-label sequence of the first sample data, the matrix elements in the corresponding row of the second pseudo-label sequence will impose constraints on the characters at the corresponding positions in the first prediction sequence, thereby reducing the probability of missing characters in the prediction sequence and improving the accuracy of the prediction sequence.

[0189] For example, the third-row characters in the above-mentioned second pseudo-label sequence are expressed as: 27 + 13, which makes the adjusted parameters be jointly affected by 27 and 23 in the second pseudo-label sequence when the electronic device adjusts the parameters of the preset student model according to the above-mentioned first loss value, thereby improving the accuracy of the adjusted parameters and the accuracy of the preset student model obtained by training.

[0190] In an optional embodiment, for the case where there are multiple first values in a certain row or multiple rows of the above-mentioned first matching matrix, the electronic device can also adjust the number of first values in that row, that is, adjust the multiple first values included in that row to a second value to obtain a second matching matrix, and only one first value is included in the second matching matrix, and the first value can be any one of the multiple first values.

[0191] In an alternative embodiment, since the above step S305 can be executed before step S304 or after step S304, when the above step S305 is executed after step S304, in order to further improve the accuracy of the corrected first pseudo-label sequence (i.e., the above second pseudo-label sequence), when the electronic device executes the above step S3055, it can calculate the second pseudo-label by integrating the first credibility values of the characters in the first pseudo-label sequence.

[0192] For example, for each first sample data, the electronic device can calculate the product of the first matching matrix corresponding to the first matching matrix, the first pseudo-label sequence, and the first credibility values of the characters in the first pseudo-label sequence to obtain the second pseudo-label sequence of the first sample data.

[0193] Through the above steps S3051 - S3055, the electronic device can perform misalignment correction on the first pseudo-label sequence of each first sample data according to the edit distance between the first pseudo-label sequence and the first prediction sequence corresponding to each first sample data, thereby improving the accuracy of the pseudo-label sequence matching of each first sample data.

[0194] In an alternative embodiment, when the above preset credibility learning model is an online module in the electronic device, based on Figure 1 the method shown, the embodiments of the present application also provide a method for training a sequence recognition model. As Figure 5 shown, Figure 5 FIG. 4 is a fourth flowchart of the method for training a sequence recognition model provided by the embodiments of the present application. In this method, the above step S104 is represented as step S1041.

[0195] Step S1041: Input the feature data extracted by the feature extraction module in the preset teacher model into the preset credibility learning model to obtain the credibility value sequence of the first sample data. Each credibility value in the credibility value sequence is the first credibility value of the character at the same position in the first pseudo-label sequence of the first sample data.

[0196] In the embodiments of the present application, when the preset credibility learning model is an online module in the electronic device, the preset credibility learning model can be represented as: a one-layer fully connected network. It can also be represented as: a combination of a deep self-attention transformation network (transformer) and a one-layer fully connected network.

[0197] When the above-mentioned preset credibility learning model is the above-mentioned online module, for each first sample data, the electronic device can obtain the feature data extracted by the feature extraction module in the above-mentioned preset teacher model for the first sample data, and input the feature data into the above-mentioned preset credibility learning model to obtain the credibility value sequence of the first sample data.

[0198] In the embodiment of the present application, for each first sample data, the number of sequence elements included in the credibility value sequence corresponding to the first sample data and the first pseudo-label sequence is the same. Each credibility value in the credibility value sequence of the first sample data is the first credibility value of the character at the same position in the first pseudo-label sequence of the first sample data.

[0199] For ease of understanding, take a certain first sample data, such as data A, as an example for illustration. Now assume that the first pseudo-label sequence of data A includes 3 characters, then the credibility value sequence of data A also includes 3 credibility values, and the credibility values in the credibility value sequence correspond one-to-one with the characters in the first pseudo-label sequence. That is, the first credibility value in the credibility value sequence is the first credibility value of the first character in the first pseudo-label sequence; the second credibility value in the credibility value sequence is the first credibility value of the second character in the first pseudo-label sequence; the third credibility value in the credibility value sequence is the first credibility value of the third character in the first pseudo-label sequence.

[0200] Through the above step S1041, the electronic device can accurately determine the first credibility value of each character in the first pseudo-label sequence of each first sample data, effectively improving the accuracy of the first pseudo-label sequence of each first sample data, thereby improving the accuracy of the sequence recognition model trained based on the first pseudo-label sequence.

[0201] In an optional embodiment, in order to improve the accuracy of the trained sequence recognition model, the electronic device can pre-train the first preset model, the second preset model, and the third preset model by using the sample data with labeled information (i.e., the second sample data) to obtain the above-mentioned preset student model, preset teacher model, and preset credibility learning model. That is, train the first preset model to obtain the above-mentioned preset student model, train the second preset model to obtain the above-mentioned preset teacher model, and train the third preset model to obtain the preset credibility learning model.

[0202] The model structure of the above-mentioned first preset model and the model structure of the above-mentioned second preset model may be the same or different.

[0203] In an optional embodiment, when the model structure of the above-mentioned first preset model is the same as the model structure of the second preset model, based on Figure 1For the method shown above, an embodiment of the present application further provides a method for training a sequence recognition model. As Figure 6 shown, Figure 6 FIG. 5 is a schematic flowchart of the fifth method for training a sequence recognition model provided by an embodiment of the present application. The method includes the following steps.

[0204] Step S601: Obtain multiple sample data without labeled information from a preset training set as first sample data.

[0205] The above step S601 is the same as the above step S101.

[0206] Step S602: Obtain multiple second sample data from the preset training set.

[0207] In this step, in addition to the first sample data without labeled information in the preset training set, the preset training set further includes multiple second sample data. The electronic device can obtain multiple second sample data from the preset training set.

[0208] Considering that in the semi-supervised learning process, the number of second sample data with labeled information in the preset training set is relatively small, the multiple second sample data obtained by the above electronic device can be all the second sample data in the preset training set. Here, the number of the obtained second sample data is not specifically limited.

[0209] In an optional embodiment, since the number of second sample data included in the preset training set is significantly less than the number of first sample data included therein, that is, only a small amount of second sample data is included in the preset training set. Therefore, in order to improve the accuracy of the preset student model and the preset confidence learning model obtained by training, the electronic device can obtain all the second sample data in the preset training set.

[0210] In the embodiment of the present application, the execution order of the above step S601 and step S602 is not specifically limited.

[0211] Step S603: For each second sample data, recognize the text included in the second sample data based on a first preset model to obtain a second prediction sequence of the second sample data.

[0212] The model structure of the above first preset model is the same as the model structure of the preset student model. The determination method of the above second prediction sequence can refer to the determination method of the first prediction sequence, and will not be specifically described here.

[0213] Step S604: Recognize the text included in the second sample data based on a second preset model to obtain a third pseudo-label sequence of the second sample data.

[0214] The determination method of the above third pseudo-label sequence can refer to the determination method of the above first pseudo-label sequence, and specific description is not provided here.

[0215] Step S605: Calculate the second loss value of the first preset model based on the label information of each second sample data and the second prediction sequence.

[0216] In this step, the electronic device can calculate the second loss value of the first preset model by using the second preset loss function with respect to the label information corresponding to each second sample data and the second prediction sequence.

[0217] The above second preset loss function includes but is not limited to the cross-entropy loss function and the mean squared error loss function.

[0218] Step S606: When the first preset model has not converged, adjust the parameters of the first preset model based on the second loss value, and adjust the parameters of the second preset model according to the preset parameter adjustment algorithm. Then return to execute the step of, for each second sample data, identifying the text included in the second sample data based on the first preset model to obtain the second prediction sequence of the second sample data, until the first preset model converges. At this time, determine the first preset model as the preset student model and the second preset model as the preset teacher model.

[0219] In this step, when the above first preset model has not converged, the electronic device can determine that the parameters of the first preset model and the second preset model need to be adjusted, and return to execute the above step S603, that is, return to execute the step of, for each second sample data, identifying the text included in the second sample data based on the first preset model to obtain the second prediction sequence of the second sample data. When the first preset model converges, the electronic device can determine the current first preset model as the above preset student model and the current second preset model as the above preset credibility learning model.

[0220] In an optional embodiment, when adjusting the parameters of the first preset model, the electronic device can adjust the parameters of the first preset model based on the above second loss value. The parameter adjustment method for the first preset model can refer to the parameter adjustment method of the above preset student model, and specific description is not provided here.

[0221] In an optional embodiment, for the above second preset model, since the model structure of the first preset model is the same as that of the second preset model, the electronic device can use the same method to adjust the parameters of the second preset model, that is, for each second sample data, calculate the loss value of the second preset model according to the label information of the second sample data and the third pseudo-label sequence of the second sample data, and then adjust the parameters of the second preset model based on the loss value.

[0222] In another optional embodiment, in order to reduce the computational complexity of the model parameter adjustment process and improve the model training efficiency, when the electronic device adjusts the above-mentioned second preset model parameters, it can determine the adjusted parameters of the second preset model by using the time-series moving average processing method according to the parameters of the current first preset model and the second preset model, so as to complete the adjustment of the second preset model parameters.

[0223] For ease of understanding, the above time-series moving average process is described.

[0224] Since the model structures of the first preset model and the second preset model are the same, there is a parameter A in both preset models. For the above-mentioned second preset model, if the value of parameter A in a certain iteration training of the second preset model is 2, and the value of parameter A in the next iteration training (i.e., after parameter adjustment) of the first preset model is 1. Now assume that the coefficient of the time-series smoothing average processing is 0.9, then the electronic device can determine that the value of parameter A in the second preset model in the next iteration training is: 2 * 0.9 + 1 * (1 - 0.9) = 1.9.

[0225] In the embodiments of the present application, during the training process of the first preset model and the second preset model, by performing time-series smoothing average processing on the parameters of the second preset model, the complexity of the parameter adjustment of the second preset model can be effectively reduced, thereby shortening the time required for parameter adjustment and improving the model training efficiency.

[0226] Through the above steps S602 - S606, before the electronic device uses the first sample data without label information to train the preset student model, it can first use the second sample data in the preset training set to train the first preset model and the second preset model to obtain the preset student model and the preset confidence learning model, which effectively improves the accuracy of the preset student model and the preset confidence learning model and effectively reduces the difficulty and complexity of subsequent training of the preset student model.

[0227] Step S607, for each first sample data, based on the preset student model, identify the text included in the first sample data to obtain the first prediction sequence of the first sample data.

[0228] Step S608, based on the preset teacher model, identify the text included in the first sample data to obtain the first pseudo-label sequence of the first sample data.

[0229] Step S609, based on the preset confidence learning model, determine the first confidence value of each character in the first pseudo-label sequence of the first sample data, where the first confidence value of a character is used to indicate the probability that the character is correctly recognized.

[0230] Step S610: Calculate the first loss value of the preset student model according to the first prediction sequence and the first pseudo-label sequence of each first sample data, and the first credibility value of each character in the first pseudo-label sequence of each first sample data.

[0231] Step S611: Perform multiple iterations based on the first loss value until the preset student model converges, and obtain a sequence recognition model for sequence recognition.

[0232] The above steps S607 - S611 are the same as the above steps S102 - S106.

[0233] In Figure 6 In the illustrated embodiment, while training the first preset model with the second sample data to obtain the preset student model, the second preset model is trained to obtain the preset teacher model. In addition, the electronic device can also train the above-mentioned third preset model to obtain the preset credibility learning model.

[0234] In an alternative embodiment, when the above-mentioned preset credibility learning model is the above-mentioned online module, during the training process, the above-mentioned third preset model can be a fully connected network layer set after the feature extraction module of the above-mentioned first preset model. When the electronic device trains the first preset model with the above-mentioned second sample data, the sample feature data obtained by the feature extraction module of the second preset model extracting features from the second sample data will be input into the third preset model to predict the prediction sequence of the second sample data. The electronic device calculates the loss value of the third preset model according to each character in the label information corresponding to each second sample data and each character in the prediction sequence of each sample output by the third preset model, and thus adjusts the parameters of the third preset model based on this loss value until the third preset model converges to obtain the preset credibility learning model.

[0235] The calculation method of the loss value of the above-mentioned third preset model can refer to the calculation method of the above-mentioned second loss value, and the parameter adjustment method of the above-mentioned third preset model can refer to the parameter adjustment mode of the above-mentioned first preset model, which will not be specifically described here.

[0236] In an alternative embodiment, when the model structures of the above-mentioned first preset model and the second preset model are different, before the electronic device executes the above-mentioned step S102, it can use the second sample data in the preset training set and the label information of each second sample data to train the first preset model and the second preset model respectively to obtain the above-mentioned preset student model and the preset teacher model.

[0237] In an alternative embodiment, the model structures of the first preset model and the second preset model may also be different. In this case, when the electronic device trains the first preset model and the second preset model, it can use the second sample data in the preset training set and the label information of each second sample data to train the first preset model and the second preset model to obtain the preset student model and the preset teacher model. At this time, the training of the first preset model and the second preset model can refer to the training process of the third preset model, which will not be described in detail here.

[0238] In an alternative embodiment, the preset confidence learning model can be not only the online module in the electronic device, but also the offline module in the electronic device. In this case, the number of the preset confidence learning models can be one or more.

[0239] In an alternative embodiment, when there are multiple preset confidence learning models, according to the above Figure 1 The method shown, the embodiments of the present application also provide a method for training a sequence recognition model. As Figure 7 shown, Figure 7 FIG. 6 is a sixth flowchart of the method for training a sequence recognition model provided by the embodiments of the present application. In this method, the above step S104 is specifically refined into the following steps, that is, step S1042-step S1043.

[0240] Step S1042: Use each preset confidence learning model to recognize the text included in the first sample data to obtain a third prediction sequence of the first sample data.

[0241] In this step, for each first sample data, the electronic device can input the first sample data into each preset confidence learning model respectively. At this time, each preset confidence learning model can obtain the prediction sequence corresponding to the first sample data (i.e., the third prediction sequence).

[0242] In the embodiments of the present application, each of the above preset confidence learning models is obtained by training the third preset model using the second sample data in the preset training set. The random number seeds of the third preset models corresponding to each preset confidence learning model are different, that is, the initialization states of the third preset models corresponding to each preset confidence learning model are different.

[0243] Step S1043: Determine the first confidence value of each character in the first pseudo-label sequence of the first sample data according to the third prediction sequence and the first pseudo-label sequence corresponding to the first sample data.

[0244] In this step, for each first sample data, the electronic device can perform a character-by-character match between each character in each third prediction sequence corresponding to the first sample data and each character in the first pseudo-label sequence of the first sample data to obtain a matching result, and thus determine the first credibility value of each character in the first pseudo-label sequence of the first sample data according to the matching result.

[0245] In an alternative embodiment, for each third prediction sequence determined by each preset credibility learning model, the electronic device can match the characters in the third prediction sequence with the characters at the same positions in the above-mentioned first pseudo-label sequence, so as to determine the third credibility value of each character in the first pseudo-label sequence. For each character in the first pseudo-label sequence, the electronic device can determine the first credibility value of the character according to each third credibility value corresponding to the character.

[0246] For example, the electronic device can calculate the average value of the third credibility values corresponding to each character as the first credibility value of the character.

[0247] For another example, the electronic device can determine the mode or median of the third credibility values corresponding to each character as the first credibility value of the character.

[0248] The determination method of the above-mentioned third credibility value can refer to the determination method of the first credibility value shown in the above step S1041, and will not be specifically described here.

[0249] In the embodiments of the present application, through the above-mentioned multiple preset credibility learning models, the electronic device can accurately determine the first credibility value of each character in the first pseudo-label sequence of each first sample data, improve the accuracy of the identified pseudo-label sequence, and thus improve the accuracy of the sequence recognition model trained based on the pseudo-label sequence.

[0250] When there are multiple preset credibility learning models, each preset credibility learning model can be trained by using the second sample data in the above-mentioned preset training set and the label information of each second sample data. Here, the training process of each preset credibility learning model will not be specifically described.

[0251] In the embodiments of the present application, before performing the above step S102, the first preset model, the second preset model, and the third preset model are trained by using the second sample data in the preset training set to obtain a preset student model, a preset teacher model, and a preset credibility learning model, which effectively improves the accuracy of the preset student model, the preset teacher model, and the preset credibility learning model, and effectively reduces the difficulty and complexity of subsequent training of the preset student model.

[0252] In an alternative embodiment, according to Figure 1For the method shown above, an embodiment of the present application further provides a method for training a sequence recognition model. As Figure 8 shown, Figure 8 FIG. Figure 8 is a seventh process schematic diagram of the method for training a sequence recognition model provided by an embodiment of the present application. The method further includes the following steps, namely step S107-step S108.

[0253] Step S107, obtaining data to be recognized.

[0254] The above data to be recognized includes but is not limited to the above speech data, image text data, and natural language data.

[0255] Step S108, recognizing the text included in the data to be recognized based on the sequence recognition model to obtain a target sequence.

[0256] The determination process of the above target sequence is the same as the determination process of the above first prediction sequence, and will not be specifically described here.

[0257] In an embodiment of the present application, after training the above sequence recognition model, the sequence recognition model can be used to accurately recognize the text included in the data to be recognized.

[0258] Based on the same inventive concept, according to the method for training a sequence recognition model provided by the above embodiment of the present application, an embodiment of the present application further provides a device for training a sequence recognition model. As Figure 9 shown, Figure 9 FIG. Figure 9 is a structural schematic diagram of a device for training a sequence recognition model provided by an embodiment of the present application. The device includes the following modules.

[0259] The first acquisition module 901 is configured to acquire a plurality of sample data without label information from a preset training set as first sample data;

[0260] The first recognition module 902 is configured to, for each first sample data, recognize the text included in the first sample data based on a preset student model to obtain a first prediction sequence of the first sample data;

[0261] The second recognition module 903 is configured to recognize the text included in the first sample data based on a preset teacher model to obtain a first pseudo-label sequence of the first sample data;

[0262] The first determination module 904 is configured to, based on a preset confidence learning model, determine a first confidence value of each character in the first pseudo-label sequence of the first sample data, where the first confidence value of a character is used to indicate the probability that the character is a correctly recognized character;

[0263] The first calculation module 905 is configured to calculate a first loss value of a preset student model according to the first prediction sequence and the first pseudo-label sequence of each first sample data, and the first credibility value of each character in the first pseudo-label sequence of each first sample data;

[0264] The second determination module 906 is configured to perform multiple iterations based on the first loss value until the preset student model converges, so as to obtain a sequence recognition model for sequence recognition.

[0265] Optionally, the above sequence recognition module training device may further include:

[0266] The third determination module is configured to, before calculating the first loss value of the preset student model according to the first prediction sequence and the first pseudo-label sequence of each first sample data, and the first credibility value of each character in the first pseudo-label sequence of each first sample data, for each first sample data, based on the edit distance between the first prediction sequence of the first sample data and each character in the first pseudo-label sequence of the first sample data, correct the misalignment of the characters in the first pseudo-label sequence of the first sample data to obtain a second pseudo-label sequence of the first sample data;

[0267] The above first calculation module 905 may specifically be configured to calculate a first loss value of the preset student model according to the first prediction sequence and the second pseudo-label sequence of each first sample data, and the second credibility value of each character in the second pseudo-label sequence of each first sample data; wherein, the second credibility value of each character in the second pseudo-label sequence of each first sample data is the same as the first credibility value of each character in the pseudo-label sequence of the first sample data.

[0268] Optionally, the above third determination module may specifically be configured to, for each first sample data, construct an edit distance matrix between the first prediction sequence and the first pseudo-label sequence according to each character in the first prediction sequence and the first pseudo-label sequence of the first sample data;

[0269] According to each matrix element in the edit distance matrix, search backward for a path that matches the minimum edit distance as the optimal matching path;

[0270] According to the optimal matching path, construct a first matching matrix; wherein, the matrix element at the position corresponding to the optimal matching path in the first matching matrix is a first value, and the matrix elements at other positions are second values;

[0271] For each column of matrix elements in the first matching matrix, when the column of matrix elements includes multiple first values, correct the other first values except the first value with the largest row number to second values to obtain a second matching matrix;

[0272] Calculate the product of the second matching matrix and the first pseudo-label sequence of the first sample data to obtain the second pseudo-label sequence of the first sample data.

[0273] Optionally, the above first determination module 904 can be specifically configured to input the feature data extracted by the feature extraction module in the preset teacher model into the preset credibility learning model to obtain the credibility value sequence of the first sample data. Each credibility value in the credibility value sequence is the first credibility value of the character at the same position in the first pseudo-label sequence of the first sample data.

[0274] Optionally, the above preset training set further includes second sample data and the label information of each second sample data. The number of first sample data included in the preset training set is more than the number of second sample data included.

[0275] The above sequence recognition model training device may further include:

[0276] A second acquisition module, configured to, if the model structure of the first preset model is the same as the model structure of the second preset model, before obtaining the first prediction sequence of the first sample data by identifying the text included in the first sample data based on the preset student model for each first sample data, obtain a plurality of second sample data from the preset training set;

[0277] A third recognition module, configured to, for each second sample data, identify the text included in the second sample data based on the first preset model to obtain the second prediction sequence of the second sample data;

[0278] A fourth recognition module, configured to identify the text included in the second sample data based on the second preset model to obtain the third pseudo-label sequence of the second sample data;

[0279] A second calculation module, configured to calculate the second loss value of the first preset model based on the label information of each second sample data and the second prediction sequence;

[0280] A fourth determination module, configured to, when the first preset model has not converged, adjust the parameters of the first preset model based on the second loss value, and adjust the parameters of the second preset model according to the preset parameter adjustment algorithm, and return to execute the step of, for each second sample data, identifying the text included in the second sample data based on the first preset model to obtain the second prediction sequence of the second sample data, until when the first preset model converges, determining the first preset model as the preset student model and determining the second preset model as the preset teacher model.

[0281] Optionally, the first determination module 904 may specifically be configured to, when there are multiple preset credibility learning models, respectively use each preset credibility learning model to identify the text included in the first sample data, so as to obtain a third prediction sequence of the first sample data; and determine a first credibility value of each character in the first pseudo-label sequence of the first sample data according to the third prediction sequence and the first pseudo-label sequence corresponding to the first sample data.

[0282] Optionally, the training of the above sequence recognition model may further include:

[0283] A third acquisition module, configured to acquire data to be recognized;

[0284] A fifth recognition module, configured to recognize the text included in the data to be recognized based on the sequence recognition model, so as to obtain a target sequence.

[0285] Through the device provided in the embodiments of the present application, the text included in the first sample data without label information in the preset training set is respectively recognized by using a preset student model and a preset teacher model, so as to obtain a prediction sequence and a pseudo-label sequence corresponding to each first sample data. Then, a preset credibility learning model is used to determine the credibility of each character in the pseudo-label sequence of each first sample data. According to the prediction sequence and the pseudo-label sequence of each first sample data, and the first credibility value of each character in the first pseudo-label sequence of each first sample data, a first loss value of the preset student model is calculated. When the preset student model is not converged, the parameters of the preset student model are adjusted based on the first loss value, and the preset student model is retrained until the preset student model converges, and then the preset student model is determined as the sequence recognition model.

[0286] Compared with the related art, after obtaining the pseudo-label sequence of each first sample data, the credibility value of each character in the pseudo-label sequence of the first sample data is determined by using a preset credibility learning model, that is, the probability that each character in the pseudo-label sequence of each first sample data is the correctly recognized character is determined, which effectively improves the accuracy of each character in the determined pseudo-label sequence, and thus improves the accuracy of the preset student model trained based on the first credibility value.

[0287] Based on the same inventive concept, according to the sequence recognition model training method provided in the embodiments of the present application, the embodiments of the present application further provide an electronic device, as Figure 10 shown, including a processor 1001, a communication interface 1002, a memory 1003, and a communication bus 1004. Among them, the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004.

[0288] The memory 1003 is used to store a computer program;

[0289] When the processor 1001 executes the program stored in the memory 1003, the following steps are implemented:

[0290] Obtain multiple sample data with unlabeled information from a preset training set as first sample data;

[0291] For each first sample data, identify the text included in the first sample data based on a preset student model to obtain a first prediction sequence of the first sample data;

[0292] Identify the text included in the first sample data based on a preset teacher model to obtain a first pseudo-label sequence of the first sample data;

[0293] Based on a preset confidence learning model, determine a first confidence value for each character in the first pseudo-label sequence of the first sample data, where the first confidence value of a character is used to indicate the probability that the character is a correctly identified character;

[0294] Calculate a first loss value of the preset student model according to the first prediction sequence and the first pseudo-label sequence of each first sample data, and the first confidence values of the characters in the first pseudo-label sequence of each first sample data;

[0295] Perform multiple iterations based on the first loss value until the preset student model converges to obtain a sequence recognition model for sequence recognition.

[0296] Through the electronic device provided in the embodiments of the present application, respectively use a preset student model and a preset teacher model to identify the text included in the first sample data with unlabeled information in the preset training set to obtain a prediction sequence and a pseudo-label sequence corresponding to each first sample data, thereby using a preset confidence learning model to determine the confidence of each character in the pseudo-label sequence of each first sample data, calculate a first loss value of the preset student model according to the prediction sequence and the pseudo-label sequence of each first sample data, and the first confidence values of the characters in the first pseudo-label sequence of each first sample data. When the preset student model has not converged, adjust the parameters of the preset student model based on the first loss value and retrain the preset student model until the preset student model converges, and then determine the preset student model as the sequence recognition model.

[0297] Compared with the related art, after obtaining the pseudo-label sequence of each first sample data, the confidence value of each character in the pseudo-label sequence of the first sample data is determined through a preset confidence learning model, that is, the probability that each character in the pseudo-label sequence of each first sample data is the correctly recognized character is determined, which effectively improves the accuracy of each character in the determined pseudo-label sequence, thereby improving the accuracy of the preset student model trained based on the first confidence value.

[0298] The communication bus mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0299] The communication interface is used for communication between the above electronic device and other devices.

[0300] The memory may include a Random Access Memory (RAM), and may also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.

[0301] The above-mentioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may 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, discrete hardware components.

[0302] Based on the same inventive concept, according to the sequence recognition model training method provided in the above embodiments of the present application, the embodiments of the present application also provide a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the above sequence recognition model training methods are implemented.

[0303] Based on the same inventive concept, according to the sequence recognition model training method provided in the embodiments of the present application above, the embodiments of the present application further provide a computer program product containing instructions, which when running on a computer, causes the computer to execute any one of the sequence recognition model training methods in the above embodiments.

[0304] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, 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 processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access, or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).

[0305] It should be noted that in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including", or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article, or device including the element.

[0306] Each embodiment in this specification is described in a related manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for embodiments such as devices, electronic devices, computer-readable storage media, and computer program products, since they are basically similar to the method embodiments, the description is relatively simple, and reference can be made to the corresponding parts of the method embodiments for the relevant content.

[0307] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application are all included in the protection scope of the present application.

Claims

1. A method for training a sequence recognition model, characterized in that, The method includes: Obtaining multiple sample data of unlabeled information from a preset training set as first sample data; For each first sample data, identifying the text included in the first sample data based on a preset student model to obtain a first prediction sequence of the first sample data; Identifying the text included in the first sample data based on a preset teacher model to obtain a first pseudo-label sequence of the first sample data; Based on a preset confidence learning model, determining a first confidence value for each character in the first pseudo-label sequence of the first sample data, where the first confidence value of a character is used to indicate the probability that the character is correctly recognized; For each first sample data, correcting the misalignment of the characters in the first pseudo-label sequence of the first sample data based on the edit distance between the first prediction sequence of the first sample data and each character in the first pseudo-label sequence of the first sample data to obtain a second pseudo-label sequence of the first sample data; Calculating a first loss value of the preset student model according to the first prediction sequence and the second pseudo-label sequence of each first sample data, and the second confidence value of each character in the second pseudo-label sequence of each first sample data; wherein, the second confidence value of each character in the second pseudo-label sequence of each first sample data is the same as the first confidence value of each character in the pseudo-label sequence of the first sample data; Performing multiple iterations based on the first loss value until the preset student model converges to obtain a sequence recognition model for sequence recognition.

2. The method according to claim 1, characterized in that, The step of, for each first sample data, correcting the misalignment of the characters in the first pseudo-label sequence of the first sample data based on the edit distance between the first prediction sequence of the first sample data and each character in the first pseudo-label sequence of the first sample data to obtain a second pseudo-label sequence of the first sample data includes: For each first sample data, constructing an edit distance matrix between the first prediction sequence and the first pseudo-label sequence according to each character in the first prediction sequence and the first pseudo-label sequence of the first sample data; According to each matrix element in the edit distance matrix, backward searching for a path matching the minimum edit distance as the optimal matching path; Constructing a first matching matrix according to the optimal matching path; wherein, the matrix element at the position corresponding to the optimal matching path in the first matching matrix is a first value, and the matrix elements at other positions are second values; For each column of matrix elements in the first matching matrix, when the column of matrix elements includes multiple first values, correcting the other first values except the first value with the largest row number to second values to obtain a second matching matrix; Calculating the product of the second matching matrix and the first pseudo-label sequence of the first sample data to obtain the second pseudo-label sequence of the first sample data.

3. The method according to claim 1, characterized in that, The step of, based on a preset confidence learning model, determining a first confidence value for each character in the first pseudo-label sequence of the first sample data includes: Input the feature data extracted by the feature extraction module in the preset teacher model into the preset credibility learning model to obtain a credibility value sequence of the first sample data, where each credibility value in the credibility value sequence is the first credibility value of the character at the same position in the first pseudo-label sequence of the first sample data.

4. The method according to claim 1, characterized in that, The preset training set further includes second sample data and label information of each second sample data, and the number of first sample data included in the preset training set is more than the number of second sample data included. If the model structure of the first preset model is the same as that of the second preset model, then before, for each first sample data, identifying the text included in the first sample data based on the preset student model to obtain a first prediction sequence of the first sample data, the method further includes: Obtain a plurality of second sample data from the preset training set; For each second sample data, identify the text included in the second sample data based on the first preset model to obtain a second prediction sequence of the second sample data; Identify the text included in the second sample data based on the second preset model to obtain a third pseudo-label sequence of the second sample data; Based on the label information and the second prediction sequence of each second sample data, calculate a second loss value of the first preset model; When the first preset model has not converged, adjust the parameters of the first preset model based on the second loss value, and adjust the parameters of the second preset model according to the preset parameter adjustment algorithm, and return to execute the step of, for each second sample data, identifying the text included in the second sample data based on the first preset model to obtain a second prediction sequence of the second sample data, until when the first preset model converges, determine the first preset model as the preset student model, and determine the second preset model as the preset teacher model.

5. The method according to claim 1, characterized in that When there are multiple preset credibility learning models, the step of, based on the preset credibility learning model, determining the first credibility value of each character in the first pseudo-label sequence of the first sample data includes: Respectively use each preset credibility learning model to identify the text included in the first sample data to obtain a third prediction sequence of the first sample data; Determine the first credibility value of each character in the first pseudo-label sequence of the first sample data according to the third prediction sequence and the first pseudo-label sequence corresponding to the first sample data.

6. The method according to any one of claims 1-5, characterized in that, The method further includes: Obtain the data to be recognized; Identify the text included in the data to be recognized based on the sequence recognition model to obtain a target sequence.

7. A sequence recognition model training device, characterized in that The device includes: A first acquisition module, configured to obtain a plurality of sample data without label information from a preset training set as first sample data; A first recognition module, configured to, for each first sample data, identify the text included in the first sample data based on a preset student model to obtain a first prediction sequence of the first sample data; A second recognition module, configured to identify the text included in the first sample data based on a preset teacher model to obtain a first pseudo-label sequence of the first sample data; A first determination module, configured to determine a first confidence value of each character in the first pseudo-label sequence of the first sample data based on a preset confidence learning model, where the first confidence value of a character is used to indicate the probability that the character is correctly recognized; A third determination module, configured to, for each first sample data, perform misalignment correction on the characters in the first pseudo-label sequence of the first sample data based on the edit distance between the first prediction sequence of the first sample data and the characters in the first pseudo-label sequence of the first sample data, to obtain a second pseudo-label sequence of the first sample data; A first calculation module, configured to calculate a first loss value of the preset student model according to the first prediction sequence and the second pseudo-label sequence of each first sample data, and the second confidence value of each character in the second pseudo-label sequence of each first sample data; where the second confidence value of each character in the second pseudo-label sequence of each first sample data is the same as the first confidence value of each character in the pseudo-label sequence of the first sample data; A second determination module, configured to perform multiple iterations based on the first loss value until the preset student model converges, to obtain a sequence recognition model for performing sequence recognition.

8. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus; The memory is used to store a computer program; The processor is configured to, when executing the program stored on the memory, implement the method steps described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the method steps described in any one of claims 1-6 are implemented.

Citation Information

Patent Citations

  • Knowledge distillation method and device, terminal equipment and medium

    CN113487028A