Model training methods, apparatus, computer equipment, and media for text detection

By using the similarity calculation and iterative update between pre-trained templates and human templates during text detection model training, the problems of high training cost and poor generalization ability are solved, and efficient and accurate text detection model training is achieved.

CN114925700BActive Publication Date: 2026-03-13ONE CONNECT SMART TECH CO LTD SHENZHEN
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-31
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing text detection models have high training costs and poor generalization ability, making it difficult to adapt to the complexity of text information in different scenarios.

Method used

By inputting the known labeled training text into the template prediction model, a pre-trained template is generated. The similarity between the template and N artificial templates is calculated, and the maximum value is determined as the training reference value. The parameters of the template prediction model and the text detection model are iteratively updated until convergence, thus avoiding the design of fixed templates.

Benefits of technology

It reduces the time cost of template design, improves the training efficiency and generalization ability of the text detection model, and ensures the accuracy and generalization of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114925700B_ABST
    Figure CN114925700B_ABST
Patent Text Reader

Abstract

This invention relates to the field of artificial intelligence technology, and more particularly to a model training method, apparatus, computer equipment, and medium for text detection. The method involves inputting training text into a template prediction model to obtain a pre-trained template, and determining the maximum similarity between the pre-trained template and multiple artificial templates as a training reference value. The training text and the pre-trained template are concatenated to form a pre-detection text, which is then input into the text detection model to obtain a pre-detection result. Based on the pre-detection result, annotations, and the training reference value, a template prediction model is trained. The training text is then input into the trained template prediction model again, and the output predicted template is concatenated with the training text to form the detection text, which is then input into the text detection model to obtain a detection result. Based on the detection result and annotations, the text detection model is trained to obtain a trained text detection model. Using a prediction template can effectively improve the training efficiency and accuracy of the text detection model, as well as its generalization ability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a model training method, apparatus, computer equipment, and medium for text detection. Background Technology

[0002] Currently, with the development of artificial intelligence technology, traditional manual detection can be replaced by machine detection, improving efficiency. Text detection of electronic documents is an important application scenario in machine detection. Text detection relies on corresponding text detection models for identification, classification, and discrimination, ultimately outputting detection results. Text detection models can be based on neural networks. These models require training to accurately detect text. Existing text detection models use pre-set manual templates and concatenated text samples as training samples, and the corresponding answers to the text samples as labels. After inputting the training samples into the text detection model, a loss function is calculated based on the model's output and the labels. The parameters in the model are then modified until the loss function converges.

[0003] However, text information in text detection scenarios is often complex. Different scenarios require different manually created templates, leading to high costs in constructing training samples. Furthermore, because the format of these templates is fixed, even if corresponding templates are built for each text sample for training, the generalization ability of the resulting text detection model will still be poor. Therefore, reducing the training cost and improving the generalization ability of the model has become an urgent problem to be solved. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a model training method for text detection to solve the problems of high training cost and poor generalization ability of the trained model.

[0005] In a first aspect, embodiments of the present invention provide a model training method for text detection, the model training method comprising:

[0006] After inputting the known labeled training text into the template prediction model to obtain the pre-trained template, the pre-trained template is compared with N artificial templates to calculate the similarity. The maximum value of the calculation result is determined to be the training reference value, where N is an integer greater than zero.

[0007] The pre-detection text, formed by concatenating the training text with the pre-trained template, is input into the pre-trained text detection model to obtain the pre-detection result.

[0008] Based on the comparison between the pre-detection results and the annotations of the training text, as well as the training reference values, the parameters of the template prediction model are updated, and the iteration continues until convergence, resulting in a trained template prediction model.

[0009] The training text is input into the trained template prediction model, the output prediction template is concatenated with the training text to form the detection text, and the detection text is input into the pre-trained text detection model to obtain the detection result;

[0010] Based on the comparison between the detection results and the annotations of the training text, the parameters of the text detection model are updated, and the process is iterated until convergence to obtain a trained text detection model.

[0011] Secondly, embodiments of the present invention provide a model training apparatus for text detection, the model training apparatus comprising:

[0012] The reference value calculation module is used to input the known labeled training text into the template prediction model to obtain the pre-trained template, and then calculate the similarity between the pre-trained template and N artificial templates to determine the maximum value of the calculation result as the training reference value, where N is an integer greater than zero.

[0013] The pre-detection module is used to input the pre-detection text, which is formed by concatenating the training text with the pre-trained template, into the pre-trained text detection model to obtain the pre-detection result.

[0014] The prediction model training module is used to update the parameters of the template prediction model based on the comparison results of the pre-detection results and the annotation of the training text, as well as the training reference values, and iterate until convergence to obtain the trained template prediction model.

[0015] The detection module is used to input the training text into the trained template prediction model, concatenate the output prediction template with the training text to form the detection text, and input the detection text into the pre-trained text detection model to obtain the detection result;

[0016] The detection model training module is used to update the parameters of the text detection model based on the comparison results between the detection results and the annotations of the training text, and iterate until convergence to obtain the trained text detection model.

[0017] Thirdly, embodiments of the present invention provide a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the model training method as described in the first aspect.

[0018] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the model training method as described in the first aspect.

[0019] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows:

[0020] This invention involves inputting known labeled training text into a template prediction model to obtain a pre-trained template. The pre-trained template is then compared with N artificial templates to calculate similarity. The maximum value of the calculated result is determined as the training reference value. The pre-detection text, formed by concatenating the training text and the pre-trained template, is input into the pre-trained text detection model to obtain a pre-detection result. Based on the comparison between the pre-detection result and the labeled training text, as well as the training reference value, the parameters of the template prediction model are updated. This process is iterated until convergence, resulting in a trained template prediction model. Finally, the training text is input into the trained template prediction model, and the output prediction template is concatenated with the training text to form the detection text. This detection text is then input into the pre-trained model. A good text detection model obtains detection results. Based on the comparison between the detection results and the annotations of the training text, the parameters of the text detection model are updated. This process is iterated until convergence, resulting in a well-trained text detection model. A prediction template model is used to predict templates. The text detection model is then trained based on the predicted templates and the training text. This avoids designing fixed templates, reducing the time cost of template design and effectively improving the training efficiency of the text detection model. Before training the detection model, the prediction template model is also trained, which improves the template generalization while ensuring the accuracy of template prediction, thereby improving the accuracy of subsequent text detection model training and the generalization ability of the text detection model. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a schematic diagram of an application environment for a model training method for text detection provided in Embodiment 1 of the present invention;

[0023] Figure 2 This is a flowchart illustrating a model training method for text detection provided in Embodiment 1 of the present invention;

[0024] Figure 3 This is a flowchart illustrating a model training method for text detection provided in Embodiment 2 of the present invention;

[0025] Figure 4 This is a schematic diagram of a model training device for text detection provided in Embodiment 3 of the present invention;

[0026] Figure 5 This is a schematic diagram of the structure of a computer device provided in Embodiment 4 of the present invention. Detailed Implementation

[0027] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.

[0028] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0029] It should also be understood that the term “and / or” as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0030] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."

[0031] Furthermore, in the description of this invention and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0032] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of the invention include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0033] The embodiments of this invention can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that utilize digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0034] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0035] It should be understood that the sequence number of each step in the following embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0036] To illustrate the technical solution of the present invention, specific embodiments are described below.

[0037] The first embodiment of this invention provides a model training method for text detection, which can be applied to, for example... Figure 1 In this application environment, the client and server communicate with each other. Clients include, but are not limited to, handheld computers, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud terminal devices, and personal digital assistants (PDAs). The server can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0038] See Figure 2This is a flowchart illustrating a model training method for text detection provided in Embodiment 1 of the present invention. The above model training method can be applied to... Figure 1 The client-side computer device contains the model architecture for template prediction and text detection models. This model architecture can be built using machine learning frameworks such as TensorFlow and PyTorch. The client accesses the server to obtain known labeled training text, manually generated templates, and other data for training the template prediction and text detection models. Figure 2 As shown, the model training method may include the following steps:

[0039] Step S201: Input the known labeled training text into the template prediction model to obtain the pre-trained template, then calculate the similarity between the pre-trained template and N artificial templates, and determine the maximum value of the calculation result as the training reference value.

[0040] Where N is a positive integer, the training text can be text obtained from speech conversion, text obtained from handwritten character recognition, or printed character text, etc., labeled as the category identifier corresponding to the training text, the identifier is specifically the expected output of the training text, the category usually includes "yes" and "no", the category identifier can be represented by symbols, numbers, one-hot encoding, etc., the artificial template can be a template constructed by humans containing template fields, the template fields usually include prompt fields and occlusion fields, the occlusion field can be represented by [mask], the occlusion field is used to guide the text detection model to output detection information at the position of the occlusion field in the template, the prompt field can be characters and words in natural language, etc., in this embodiment, the template prediction model adopts a convolutional neural network model.

[0041] Specifically, the aforementioned template prediction model includes a predictive encoder and a predictive decoder. During training, the input to the predictive encoder is the training text, and its output is the training feature tensor corresponding to the training text. The input to the predictive decoder is the aforementioned training feature tensor, and its output is the pre-trained template. Furthermore, if the predictive encoder has a fixed structure and can only accept inputs of a fixed size, then the data format of the training text needs to be standardized. Using the maximum size of all training texts as the standard size, zeros or spaces are added to the end of any training text until its size matches the standard size.

[0042] For example, if the content of a training sample is "Insurance business can only be handled online", which contains 10 characters and the standard size is 12 characters, then the input of the predictive encoder in the template prediction model should be "Insurance business can only be handled online φφ", where φ is used to represent blank characters. The training feature tensor output by the predictive encoder is denoted by F. F is input into the predictive decoder, and the output is a pre-trained template. For example, the form of the pre-trained template can be "this sentence", "is", "[mask]", or "of".

[0043] In one embodiment, the template prediction model can also be a fully convolutional neural network model, a long short-term memory network model, etc.

[0044] Optionally, the similarity between the pre-trained template and N artificial templates is calculated, and the maximum value of the calculation result is determined as the training reference value, including:

[0045] Using a pre-trained semantic model, extract the predicted word vectors of the pre-trained template and the artificial word vectors of N artificial templates;

[0046] Calculate the cosine similarity between the predicted word vector and each artificial word vector, and determine the maximum value among the N cosine similarities as the training reference value.

[0047] The semantic model can employ models such as Word2Vec and GloVe for natural language processing, capable of converting templates into word vector representations. A word vector is a vector that maps words or phrases in a dictionary to real numbers; specifically, it can be a multi-dimensional matrix. Predicted word vectors refer to the word vectors corresponding to pre-trained templates, while artificial word vectors refer to the word vectors corresponding to artificially generated templates.

[0048] Specifically, the method for calculating cosine similarity is as follows: Among them, S i Let S be the cosine similarity between the artificial word vector corresponding to the i-th artificial template and the predicted word vector corresponding to the pre-trained template. i The range of values ​​is [0, 1], A i Let A be the artificial word vector corresponding to the i-th artificial template, and B be the predicted word vector corresponding to the pre-trained template. i | is the modulus of the artificial word vector corresponding to the i-th artificial template, and |B| is the modulus of the predicted word vector corresponding to the pre-trained template.

[0049] In this embodiment, cosine similarity is used to calculate the similarity, and the maximum value among the N cosine similarities is determined as the training reference value. This controls the training reference value to be within the range of [0, 1], which can omit the normalization step and avoid the normalization step causing the normalized training reference value to deviate too much, thus affecting the subsequent training process.

[0050] The above steps involve inputting the known labeled training text into the template prediction model to obtain a pre-trained template, calculating the similarity between the pre-trained template and N artificial templates, and determining the maximum value of the calculation result as the training reference value. By calculating the similarity between the pre-trained template and the artificial templates, the training reference value is obtained, which can be used to guide the training of the template prediction model in subsequent training. This ensures that the templates output by the template prediction model are sufficiently similar to the artificial templates, thus guaranteeing the effectiveness of the predicted templates for the text detection task.

[0051] Step S202: Input the pre-detection text, which is formed by concatenating the training text and the pre-trained template, into the pre-trained text detection model to obtain the pre-detection result.

[0052] The way the training text and the pre-training template are joined can be by linking, that is, by linking the pre-training template to the end of the training text.

[0053] A text detection model can refer to a classification model, which can employ deep neural networks, convolutional neural networks, etc. Pre-training refers to training the text detection model in advance using a small batch of samples and annotations to avoid situations where the output of an untrained text detection model has poor correlation with the text detection task. The pre-detection result refers to the output quantity of the text detection model corresponding to the pre-detection text after the pre-detection text is input into the text detection model.

[0054] In one embodiment, the text detection model includes a text feature encoder and a fully connected layer. The text feature encoder extracts input features and outputs a text feature tensor. The fully connected layer maps the text feature tensor to the output space, which is also the classification space. The pre-training samples of the text detection model can be constructed by concatenating the training text with the artificial template. However, to avoid overfitting, it is recommended to use other texts of the same type and other artificial templates to construct the pre-training samples. The artificial annotations corresponding to the text in the pre-training samples are used as pre-training annotations. The annotations are usually one-hot encoded, such as [0, 1] and [1, 0]. The cross-entropy loss function is calculated based on the output obtained from the pre-training sample input to the text detection model and the pre-training annotations. Based on the cross-entropy loss function, the parameters of the text detection model are updated in reverse using the gradient descent method until the cross-entropy loss function converges, thus obtaining the pre-trained text detection model.

[0055] The above steps, which involve concatenating the training text with the pre-trained template to form the pre-detection text, and inputting it into the pre-trained text detection model to obtain the pre-detection results, can obtain the pre-detection results corresponding to the pre-detection text containing the pre-trained template. This can then be used to guide the prediction direction of the pre-trained template during subsequent parameter updates, thereby improving its performance in text detection tasks.

[0056] Step S203: Based on the comparison results between the pre-detection results and the annotations of the training text, as well as the training reference values, update the parameters of the template prediction model, iterate until convergence, and obtain the trained template prediction model.

[0057] The comparison result can refer to whether the pre-detection result is the same as the label. The comparison result includes whether they are the same or different. The parameters of the template prediction model can refer to the neuron weight parameters of the prediction encoder and prediction decoder mentioned above.

[0058] When updating the parameters of the template prediction model, it is necessary to calculate the update amount of these parameters. The calculation of the parameter update amount can be carried out using optimization algorithms such as stochastic gradient descent, batch gradient descent, momentum optimization, and adaptive learning rate optimization. After calculating the corresponding parameter update amount, the Dropout strategy is used to improve training efficiency. This strategy can avoid model overfitting and enhance the model's generalization ability.

[0059] Optionally, the pre-detection results include the text pre-detection category and the corresponding pre-detection confidence score;

[0060] Based on the comparison between the pre-detection results and the labeled training text, as well as the training reference values, the parameters of the template prediction model are updated, and the iteration continues until convergence, resulting in a well-trained template prediction model including:

[0061] The text pre-detection category is compared with the annotation of the training text to obtain the first comparison result, which includes the same and different results;

[0062] Based on the first comparison result, the pre-training index value is determined. When the first comparison result is the same, the pre-training index value is the corresponding pre-detection confidence. When the first comparison result is different, the pre-training index value is the first preset value.

[0063] The parameters of the template prediction model are updated based on the training reference value and the pre-training index value. The iteration continues until convergence, resulting in a well-trained template prediction model.

[0064] Here, confidence level can refer to the probability that the output result belongs to each category. Pre-detection confidence level is the maximum category confidence level output after inputting the pre-detection template into the text detection model. The text pre-detection category is the category corresponding to the maximum category confidence level. The category can refer to "yes" or "no". The corresponding representation can be one-hot encoding, for example, "yes" is represented as [0, 1] and "no" is represented as [1, 0]. If the comparison results are the same, it means that the one-hot encoding corresponding to the text pre-detection category is consistent with the one-hot encoding corresponding to the label. If the comparison results are different, it means that the one-hot encoding corresponding to the text pre-detection category is inconsistent with the one-hot encoding corresponding to the label. Pre-training index value can refer to the parameter used to calculate the update amount of the template prediction model parameters. The first preset value is set to 0.01 in this embodiment. The implementer can adjust the first preset value according to the actual situation, but should ensure that the first preset value is as close to 0 as possible to avoid poor parameter update effect.

[0065] This embodiment uses training reference values ​​and pre-training index values ​​to update the parameters of the template prediction model, which can provide direction for the parameter update of the template prediction model, thereby avoiding the parameters from being updated in the wrong direction, and also avoiding the situation of getting stuck in local optima during parameter update to a certain extent.

[0066] Optionally, the parameters of the template prediction model are updated based on the training reference values ​​and pre-trained metric values, iterating until convergence, to obtain a trained template prediction model including:

[0067] The first loss function is calculated based on the training reference values ​​and pre-training metric values. Using this first loss function as a basis, the parameters of the template prediction model are updated backward using gradient descent. This process is iterated until the first loss function converges, resulting in the trained template prediction model. Specifically, the first loss function is:

[0068] L1 = k1(s-1) 2 +k2(p1-1) 2

[0069] Where L1 is the first loss function, s is the training reference value with a range of [0, 1], p1 is the pre-training index value with a range of [0, 1], k1 is the first weight, and k2 is the second weight.

[0070] Specifically, the template prediction model updates model parameters based on backpropagation, with the learning rate set to 0.05. Implementers can adjust the learning rate between [0, 1] according to the actual situation to achieve better training results. The stochastic gradient descent method is used to calculate the parameter update amount. The stochastic gradient descent method refers to taking an arbitrary training sample and then using the first loss function calculated by the corresponding training reference value and pre-training index value of the sample for updating. It can quickly calculate the gradient and make the loss function converge well when the noise is small.

[0071] Since the training reference value is the maximum value among N cosine similarities, and the range of cosine similarity is [0, 1], the range of the training reference value is also [0, 1]. The pre-training metric is either the pre-detection confidence or the first preset value, with the first preset value set within the range of [0, 1]. The pre-detection confidence needs to be normalized using the Softmax function, and the normalized range is [0, 1]. Therefore, the range of the pre-training metric is [0, 1]. For (s-1)... 2 For each term, the smaller the training reference value s, the (s-1) 2 The larger the term, and the more it decreases with the decrease of the training reference value, (s-1) 2 The faster the term increases, the better. It should be noted that the first weight k1 is a positive number to ensure that the smaller the training reference value, the larger the first loss function. In this embodiment, the first weight k1 is set to 9, for (p1-1). 2 For each term, the smaller the pre-training metric value p1, the better (p1-1) 2 The larger the term, and the more pronounced the decrease in pre-training metric values ​​(p1-1)... 2 The faster the rate of increase of the term, the better. It should be noted that the second weight k2 is also a positive number to ensure that the smaller the pre-training index value, the larger the first loss function. In this embodiment, the second weight k2 is set to 10. The purpose of setting the first weight and the second weight differently is to guide the training of the template prediction model to output a prediction template that makes the text detection results more accurate, rather than outputting a prediction template that is similar to the human template. The implementer can adjust the values ​​of the first weight and the second weight according to actual needs.

[0072] This embodiment constructs a first loss function, which can guide the parameter update direction during template prediction model training and has a fast gradient calculation speed, thereby improving training efficiency.

[0073] The above steps, which involve comparing the pre-detection results with the labeled training text and using the training reference values ​​to update the parameters of the template prediction model and iterating until convergence, result in a well-trained template prediction model. This process enables the template prediction model to output a predicted template that is similar to the human template and makes the text detection results more accurate, ensuring the practicality of the predicted template and improving the efficiency of subsequent text detection model training.

[0074] Step S204: Input the training text into the trained template prediction model, concatenate the output prediction template with the training text to form the detection text, and input the detection text into the pre-trained text detection model to obtain the detection result.

[0075] The concatenation method between the training text and the training template can refer to concatenation, that is, concatenating the training template at the end of the training text in a concatenating manner. The detection result refers to the output quantity of the text detection model corresponding to the detected text after the detected text is input into the text detection model.

[0076] Specifically, to increase the number of training samples for the text detection model, a training text can be concatenated with different prediction templates, or a prediction template can be concatenated with different training texts to obtain a sufficient number of detection texts, thereby reducing the time required to build the training set.

[0077] The above steps involve inputting the training text into the trained template prediction model, concatenating the output prediction template with the training text to form the detection text, and then inputting the detection text into the pre-trained text detection model to obtain the detection result. By using the detection text formed by concatenating the prediction template with the training text as input to the text detection model, the number of training samples is expanded while ensuring that the prediction template has a positive effect on the text detection task. This improves the generalization ability of the text detection model and eliminates the need for manually constructing templates, thus improving training efficiency.

[0078] Step S205: Based on the comparison between the detection results and the annotations of the training text, update the parameters of the text detection model, iterate until convergence, and obtain the trained text detection model.

[0079] The comparison result can refer to whether the detection result is the same as the label. The comparison result includes whether they are the same or different. The parameters of the text detection model can refer to the neuron weight parameters of the text feature encoder and the fully connected layer mentioned above.

[0080] When updating the parameters of a text detection model, it is necessary to calculate the update amount of these parameters. The calculation of the parameter update amount can be carried out using optimization algorithms such as stochastic gradient descent, batch gradient descent, momentum optimization, and adaptive learning rate optimization. After calculating the corresponding parameter update amount, the Dropout strategy is used to improve training efficiency. This strategy can avoid model overfitting and enhance the model's generalization ability.

[0081] Optionally, the detection results include the text detection category and the corresponding detection confidence level;

[0082] Based on the comparison between the detection results and the annotations of the training text, the parameters of the template prediction model are updated, and the iteration continues until convergence, resulting in a well-trained template prediction model including:

[0083] The text detection category is compared with the annotation of the training text to obtain a second comparison result, which includes whether they are the same or different.

[0084] Based on the second comparison result, the training index value is determined. When the second comparison result is the same, the training index value is the corresponding detection confidence. When the second comparison result is different, the training index value is the second preset value.

[0085] The parameters of the template prediction model are updated based on the training metric values, and the process is repeated until convergence, resulting in a well-trained text detection model.

[0086] The detection confidence score is the highest category confidence score output after inputting the training text into the text detection model. The text detection category is the category corresponding to the highest category confidence score. The category can be "yes" or "no". The corresponding representation can be a one-hot encoding, for example, "yes" is represented as [0, 1] and "no" is represented as [1, 0]. If the comparison results are the same, it means that the one-hot encoding corresponding to the text detection category is consistent with the one-hot encoding corresponding to the label. If the comparison results are different, it means that the one-hot encoding corresponding to the text detection category is inconsistent with the one-hot encoding corresponding to the label. The training index value can be a parameter used to calculate the update amount of the text detection model parameters. The second preset value is set to 0.01 in this embodiment. The implementer can adjust the second preset value according to the actual situation, but should ensure that the second preset value is as close to 0 as possible to avoid poor parameter update effect.

[0087] This embodiment uses training metric values ​​to update the parameters of the text detection model, which can provide direction for updating the model parameters, thereby avoiding updating the parameters in the wrong direction and also avoiding getting stuck in local optima during parameter updates to a certain extent.

[0088] Optionally, the parameters of the template prediction model are updated based on the training metric values, and this process is iterated until convergence, resulting in a trained text detection model, including:

[0089] The second loss function is calculated based on the training metric values. Using this second loss function as a basis, the parameters of the template prediction model are updated backwards using gradient descent. This process is iterated until the second loss function converges, resulting in a trained template prediction text detection model. Specifically, the second loss function is:

[0090] L2 = k3(p2-1) 2

[0091] Where L2 is the second loss function, p2 is the training index value with a range of [0,1], and k3 is the third weight value.

[0092] Specifically, the text detection model updates its parameters based on backpropagation, with a learning rate of 0.05. Implementers can adjust the learning rate between [0, 1] according to the actual situation to achieve better training results, and the stochastic gradient descent method is used to calculate the parameter update amount.

[0093] Since the training metric is either the detection confidence or a second preset value, and the second preset value is set in the range of [0, 1], and the detection confidence needs to be normalized by the Softmax function, the normalized value range is [0, 1], then the training metric value range is [0, 1]. The smaller the training metric value p2, the more (p2-1) 2 The larger the term, and the more it decreases as the training metric value decreases (p1-1) 2 The faster the rate at which the term increases, the better. It should be noted that the third weight k3 is also a positive number to ensure that the smaller the pre-training index value, the larger the first loss function. In this embodiment, the third weight k3 is set to 10. Implementers can adjust the value of the third weight according to actual needs.

[0094] This embodiment constructs a second loss function, which can guide the parameter update direction during the training of the text detection model and has a faster gradient calculation speed, thereby improving the training efficiency of the text detection model.

[0095] The above steps, which update the parameters of the text detection model based on the comparison between the detection results and the annotations of the training text, iterate until convergence to obtain a trained text detection model, can guide the update of model parameters through training metric values, thereby improving the training efficiency and accuracy of the text detection model.

[0096] This embodiment uses a predictive template model to predict templates, and trains the text detection model based on the predicted templates and training text. This avoids designing fixed templates, reduces the time cost of template design, and effectively improves the training efficiency of the text detection model. Before training the detection model, the predictive template model is also trained, which improves the template generalization while ensuring the accuracy of template prediction, thereby improving the accuracy of subsequent text detection model training and the generalization ability of the text detection model.

[0097] See Figure 3 This is a flowchart illustrating a model training method for text detection provided in Embodiment 2 of the present invention. In this model training method, the cosine similarity between the predicted word vector and each manual word vector can be directly calculated based on the predicted word vector and the manual word vector, or the predicted word vector can be updated first, and then calculated based on the updated predicted word vector and the manual word vector.

[0098] When calculating cosine similarity based on predicted word vectors and artificial word vectors, the implementer can refer to the calculation method in step S201, which will not be repeated here.

[0099] First, the predicted word vectors are updated. Then, when calculating the cosine similarity between the updated predicted word vectors and the artificial word vectors, the predicted word vectors include M predicted word terms, and the artificial word vectors include K artificial word terms, where M and K are both positive integers. The calculation method includes the following steps:

[0100] Step S301: For any artificial word vector, the maximum weight matching algorithm is used to match the predicted word terms of the predicted word vector with the artificial word terms of the artificial word vector to obtain the matching artificial word terms of the corresponding predicted word terms.

[0101] Step S302: Extract the position order of all matching artificial terms in the artificial word vector, update the position order of the corresponding predicted terms in the predicted word vector according to the position order, and obtain the updated predicted word vector.

[0102] Step S303: Calculate the cosine similarity between the updated predicted word vector and the artificial word vector used for updating.

[0103] In this embodiment, a term can refer to a unit that makes up a word vector. Typically, a term can be represented as a vector of one dimension in the multidimensional matrix corresponding to the word vector. A predicted term can refer to a unit that makes up a predicted word vector.

[0104] Artificial terms can refer to the constituent units of artificial word vectors. The maximum weight matching algorithm can refer to the algorithm that matches vertices within two subsets, such as the Kuhn-Munkras (KM) matching algorithm and the Hungarian matching algorithm. Matching artificial terms can refer to the artificial terms corresponding to the predicted terms determined based on the matching results of the maximum weight matching algorithm.

[0105] The above positional order is a relative positional order, that is, the relative positional relationship between terms. For example, a word vector consists of terms X, Y, and Z, specifically XZY. The relative positional order of terms X and Y means that term X is to the left of term Y.

[0106] Updating the positional order of the corresponding predicted terms in the predicted word vector means adjusting the positional order of each predicted term in the predicted word vector to be consistent with the positional order of the corresponding artificial terms in the artificial word vector.

[0107] The artificial word vectors used for updating refer to the artificial word vectors that provide the positional order for updating the predicted word vectors. Obviously, before calculating the cosine similarity between the predicted word vectors and each artificial word vector, different updates are needed based on the different artificial word vectors. In this embodiment, when calculating the cosine similarity between the predicted word vectors and each artificial word vector, the predicted word vectors updated in the previous calculation can be used for the subsequent calculation.

[0108] In one implementation, when calculating the cosine similarity between the predicted word vector and each manual word vector, the unupdated predicted word vector can be used for each calculation.

[0109] Specifically, the set of predicted terms is designated as the first set, and the set of manually generated terms is designated as the second set. Each term in each set is a matching vertex. Weights are assigned between matching vertices belonging to different sets. These weights can be the similarity between terms, which can be obtained using methods such as cosine similarity or Euclidean distance. The matching result consists of multiple matching pairs, each containing one predicted term and one manually generated term. The number of matching pairs is the smaller of M and K. The positional order of the manually generated terms in all matching pairs is obtained. For example, following a left-to-right order, the positional order can be represented by the identifier of the matching pair. Suppose there are three matching pairs, then the positional order is represented as the second matching pair, the first matching pair, and the third matching pair. According to the above positional order, the positional order of the corresponding predicted terms in the predicted word vector is updated, that is, the predicted term in the second matching pair is to the left of the predicted term in the first matching pair and the predicted term in the third matching pair, and the predicted term in the first matching pair is to the left of the predicted term in the third matching pair.

[0110] In one implementation, the positional order can be an absolute positional order, meaning that each term corresponds to a fixed position. For example, a word vector consists of terms X, Y, and Z, specifically XZY. Regarding the absolute positional relationship between terms X and Y, term X corresponds to the first position from the left in the word vector, and term Y corresponds to the third position from the left in the word vector.

[0111] This embodiment updates the order of predicted terms in the predicted word vectors according to the order of manually generated terms in the manually generated word vectors based on the matching relationship between terms. This can improve the accuracy of subsequent similarity calculations and avoid situations where semantically identical word vectors have lower calculated similarity due to different word order.

[0112] Corresponding to the model training method for text detection in Example 1 above, Figure 4 The diagram illustrates a structural block diagram of a model training device for text detection provided in Embodiment 3 of the present invention. This model training device is applied to a client. The computer device corresponding to the client contains a model architecture for a template prediction model and a text detection model. The client obtains known labeled training text, manually generated templates, and other data by accessing the server. See also... Figure 4 The model training device includes:

[0113] The reference value calculation module 41 is used to input the known labeled training text into the template prediction model to obtain the pre-trained template, and then calculate the similarity between the pre-trained template and N artificial templates to determine the maximum value of the calculation result as the training reference value, where N is an integer greater than zero.

[0114] The pre-detection module 42 is used to input the pre-detection text, which is formed by concatenating the training text and the pre-trained template, into the pre-trained text detection model to obtain the pre-detection result.

[0115] The prediction model training module 43 is used to update the parameters of the template prediction model based on the comparison results of the pre-detection results and the annotation of the training text, as well as the training reference values, and iterate until convergence to obtain the trained template prediction model.

[0116] The detection module 44 is used to input the training text into the trained template prediction model, concatenate the output prediction template with the training text to form the detection text, and input the detection text into the pre-trained text detection model to obtain the detection result.

[0117] The detection model training module 45 is used to update the parameters of the text detection model based on the comparison results between the detection results and the annotations of the training text, and iterate until convergence to obtain the trained text detection model.

[0118] Optionally, the reference value calculation module 41 mentioned above includes:

[0119] The word vector extraction unit is used to extract predicted word vectors from pre-trained templates and artificial word vectors from N artificial templates using a pre-trained semantic model.

[0120] The reference value determination unit is used to calculate the cosine similarity between the predicted word vector and each manual word vector, and determine the maximum value among the N cosine similarities as the training reference value.

[0121] Optionally, the predicted word vectors include M predicted words, and the artificial word vectors include K artificial words, where M and K are both integers greater than zero;

[0122] The aforementioned reference value calculation module 41 includes:

[0123] The term matching unit is used to match the predicted terms of the predicted term with the artificial term in the artificial term vector using the maximum weight matching algorithm for any artificial term vector, so as to obtain the matching artificial term of the corresponding predicted term.

[0124] The word vector update unit is used to extract the position order of all matching artificial words in the artificial word vector, update the position order of the corresponding predicted words in the predicted word vector according to the position order, and obtain the updated predicted word vector.

[0125] The similarity calculation unit is used to calculate the cosine similarity between the updated predicted word vector and the artificial word vector used for the update.

[0126] Optionally, the above pre-detection results include text pre-detection categories and corresponding pre-detection confidence scores;

[0127] The above-mentioned prediction model training module 43 includes:

[0128] The first comparison unit is used to compare the text pre-detection category with the annotation of the training text to obtain the first comparison result, which includes the same and different results;

[0129] The pre-training index determination unit is used to determine the pre-training index value based on the first comparison result. When the first comparison result is the same, the pre-training index value is the corresponding pre-detection confidence. When the first comparison result is different, the pre-training index value is the first preset value.

[0130] The prediction model training unit is used to update the parameters of the template prediction model based on the training reference value and the pre-training index value, iterating until convergence to obtain the trained template prediction model.

[0131] Optionally, the parameters of the template prediction model are updated based on the training reference values ​​and pre-trained metric values, iterating until convergence, to obtain a trained template prediction model including:

[0132] The first loss function is calculated based on the training reference values ​​and pre-training metric values. Using this first loss function as a basis, the parameters of the template prediction model are updated backwards using gradient descent until the first loss function converges, resulting in the trained template prediction model. Specifically, the first loss function is:

[0133] L1 = k1(s-1) 2 +k2(p1-1) 2

[0134] Where L1 is the first loss function, s is the training reference value with a range of [0,1], p1 is the pre-training index value with a range of [0,1], k1 is the first weight, and k2 is the second weight.

[0135] Optionally, the detection results include the text detection category and the corresponding detection confidence level;

[0136] The above detection model training module 45 includes:

[0137] The second comparison unit is used to compare the text detection category with the annotation of the training text to obtain a second comparison result, which includes whether they are the same or different.

[0138] The training metric determination unit is used to determine the training metric value based on the second comparison result. When the second comparison result is the same, the training metric value is the corresponding detection confidence. When the second comparison result is different, the training metric value is the second preset value.

[0139] The detection model training unit is used to update the parameters of the text detection model based on the training metric values, iterating until convergence to obtain the trained text detection model.

[0140] Optionally, the parameters of the text detection model are updated based on the training metric values, iterating until convergence, resulting in a trained text detection model including:

[0141] The second loss function is calculated based on the training metrics. Using this second loss function as a basis, the parameters of the text detection model are updated in reverse using gradient descent. This process is iterated until the second loss function converges, resulting in the trained text detection model. The second loss function is specifically:

[0142] L2 = k3(p2-1) 2

[0143] Where L2 is the second loss function, p2 is the training index value with a range of [0,1], and k3 is the third weight value.

[0144] It should be noted that the information interaction and execution process between the above modules and units are based on the same concept as the method embodiments of the present invention. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.

[0145] Figure 5 This is a schematic diagram of the structure of a computer device provided in Embodiment 4 of the present invention. Figure 5 As shown, the computer device of this embodiment includes: at least one processor ( Figure 5 Only one is shown in the diagram), a memory, and a computer program stored in the memory and executable on at least one processor, which, when executed by the processor, implements the steps in any of the above-described health prediction method embodiments.

[0146] This computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 5 The examples of computer devices are merely examples and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown in the illustration, or combinations of certain components, or different components, such as network interfaces, displays, and input devices.

[0147] The processor referred to can be a CPU, but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0148] Memory includes readable storage media, internal memory, etc., wherein internal memory can be the RAM of a computer device, providing an environment for the operation of the operating system and computer-readable instructions stored in the readable storage media. The readable storage media can be the hard drive of a computer device, or in other embodiments, it can be an external storage device of the computer device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, memory can include both internal storage units and external storage devices of a computer device. Memory is used to store the operating system, applications, bootloader, data, and other programs, such as program code for computer programs. Memory can also be used to temporarily store data that has been output or will be output.

[0149] Those skilled in the art will understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the functions described above can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this invention. The specific working process of the units and modules in the above device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention can implement all or part of the processes in the methods of the above embodiments by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0150] The present invention can implement all or part of the processes in the above embodiments of the method, or it can be accomplished by a computer program product. When the computer program product is run on a terminal device, the terminal device executes the steps in the above method embodiments.

[0151] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0152] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0153] In the embodiments provided by this invention, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0154] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0155] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A model training method for text detection, characterized in that, The method comprises: After inputting the known labeled training text into the template prediction model to obtain a pre-trained template, the pre-trained template and N artificial templates are subjected to similarity calculation, the maximum value of the calculation result is determined as a training reference value, and N is an integer greater than zero; The pre-detection text formed by splicing the training text and the pre-trained template is input into the pre-trained text detection model to obtain a pre-detection result; According to the comparison result of the pre-detection result and the label of the training text and the training reference value, the parameters of the template prediction model are updated, and iteration is performed until convergence is achieved to obtain a trained template prediction model; The training text is input into the trained template prediction model, the prediction template output by the trained template prediction model is spliced with the training text to form a detection text, and the detection text is input into the pre-trained text detection model to obtain a detection result; According to the comparison result of the detection result and the label of the training text, the parameters of the text detection model are updated, and iteration is performed until convergence is achieved to obtain a trained text detection model; The similarity calculation of the pre-trained template and N artificial templates to determine the maximum value of the calculation result as a training reference value comprises: A pre-trained semantic model is used to extract a predicted word vector of the pre-trained template and an artificial word vector of N artificial templates; The cosine similarity of the predicted word vector and each artificial word vector is calculated, and the maximum value of the N cosine similarities is determined as the training reference value; The predicted word vector comprises M predicted word items, and the artificial word vector comprises K artificial word items, wherein M and K are both integers greater than zero; After extracting the predicted word vector of the pre-trained template and the artificial word vector of N artificial templates, the following steps are further included: For any artificial word vector, a maximum weight matching algorithm is used to match the predicted word items of the predicted word vector with the artificial word items of the artificial word vector to obtain a matching artificial word item corresponding to the predicted word item; The position order of all matching artificial word items in the artificial word vector is extracted, and the position order of the corresponding predicted word item in the predicted word vector is updated according to the position order to obtain an updated predicted word vector; The calculation of the cosine similarity of the predicted word vector and each artificial word vector comprises: The cosine similarity of the updated predicted word vector and the updated artificial word vector is calculated; The position order is a relative position order, that is, the relative position relationship between the word items, and updating the position order of the corresponding predicted word item in the predicted word vector means adjusting the position order of each predicted word item in the predicted word vector to be consistent with the position order of the artificial word item corresponding to each predicted word item in the artificial word vector, and the updated artificial word vector refers to the artificial word vector that provides the position order for the prediction word vector update.

2. The model training method of claim 1, wherein, The pre-detection result comprises a text pre-detection category and a corresponding pre-detection confidence; The updating of the parameters of the template prediction model according to the comparison result of the pre-detection result and the label of the training text and the training reference value, and the iteration until convergence are achieved to obtain a trained template prediction model comprise: comparing the text detection category with the label of the training text to obtain a first comparison result, the first comparison result including same and not same; determining a pre-training index value according to the first comparison result, the pre-training index value being the corresponding pre-detection confidence when the first comparison result is same, and the pre-training index value being a first preset value when the first comparison result is not same; updating parameters of the template prediction model according to the training reference value and the pre-training index value, and iterating until convergence to obtain a trained template prediction model.

3. The model training method of claim 2, wherein, The updating of the parameters of the template prediction model according to the training reference value and the pre-training index value, and the iterating until convergence to obtain the trained template prediction model include: calculating a first loss function according to the training reference value and the pre-training index value, updating the parameters of the template prediction model in a reverse direction by using a gradient descent method according to the first loss function, and iterating until the first loss function converges to obtain the trained template prediction model, wherein the first loss function is specifically: wherein, is the first loss function, is the training reference value, and the value range is , is the pre-training index value, and the value range is , is the first weight, is the second weight. 4.The model training method of any one of claims 1 to 3, wherein, the detection result includes a text detection category and a corresponding detection confidence; The updating of the parameters of the text detection model according to the comparison result of the detection result and the label of the training text, and the iterating until convergence to obtain the trained text detection model include: comparing the text detection category with the label of the training text to obtain a second comparison result, the second comparison result including same and not same; determining a training index value according to the second comparison result, the training index value being the corresponding detection confidence when the second comparison result is same, and the training index value being a second preset value when the second comparison result is not same; updating the parameters of the text detection model according to the training index value, and iterating until convergence to obtain a trained text detection model.

5. The model training method of claim 4, wherein, The updating of the parameters of the text detection model according to the training index value, and the iterating until convergence to obtain the trained text detection model include: calculating a second loss function according to the training index value, updating the parameters of the text detection model in a reverse direction by using a gradient descent method according to the second loss function until the second loss function converges to obtain the trained text detection model, wherein the second loss function is specifically: wherein, is the second loss function, is the training indicator value, and the value range is , is a third weight value.

6. A model training apparatus for text detection, the apparatus comprising: The model training device includes: a reference value calculation module configured to input a training text with a known label into a template prediction model to obtain a pre-training template, perform similarity calculation on the pre-training template and N artificial templates, determine a maximum value of a calculation result as a training reference value, and N is an integer greater than zero; a pre-detection module configured to input a pre-detection text formed by splicing the training text and the pre-training template into a pre-trained text detection model to obtain a pre-detection result; a prediction model training module configured to update parameters of the template prediction model according to a comparison result of the pre-detection result and a label of the training text and the training reference value, and iterate until convergence to obtain a trained template prediction model. The detection module is configured to input the training text into the trained template prediction model, splice a prediction template output by the trained template prediction model with the training text to obtain a detection text, and input the detection text into a pre-trained text detection model to obtain a detection result. The detection model training module is configured to update parameters of the text detection model according to a comparison result of the detection result and the label of the training text, and iterate until convergence to obtain a trained text detection model. The reference value calculation module comprises: The word vector extraction unit is configured to extract a prediction word vector of the pre-trained template and an artificial word vector of each of the N artificial templates by using a pre-trained semantic model. The reference value determination unit is configured to calculate a cosine similarity between the prediction word vector and each artificial word vector, and determine a maximum value of the N cosine similarities as a training reference value. The word item matching unit is configured to, for each artificial word vector, match a prediction word item of the prediction word vector with an artificial word item of the artificial word vector by using a maximum weight matching algorithm to obtain a matched artificial word item corresponding to the prediction word item. The word vector updating unit is configured to extract a position sequence of all matched artificial word items in the artificial word vector, update a position sequence of the corresponding prediction word item in the prediction word vector according to the position sequence, and obtain an updated prediction word vector. The similarity calculation unit is configured to calculate a cosine similarity between the updated prediction word vector and an artificial word vector used for updating. The position sequence is a relative position sequence, that is, a relative position relationship between word items, and updating the position sequence of the corresponding prediction word item in the prediction word vector means adjusting the position sequence of each prediction word item in the prediction word vector to be consistent with a position sequence of the artificial word item corresponding to each prediction word item in the artificial word vector, and the artificial word vector used for updating means an artificial word vector providing a position sequence for updating the prediction word vector.

7. A computer device, characterized by The computer device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the model training method according to any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium storing a computer program, the computer-readable storage medium comprising: The computer program is executable on the processor to implement the model training method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Deep learning-based medical entity prediction method and system

    CN114139531A