A training method and device for formula recognition model

Through the feature extraction and decoding process when training the model, combined with the use of the semantic learning module and the language sub-module, the problem that the formula recognition model cannot accurately identify the formula trajectory is solved, and the recognition accuracy is significantly improved.

CN113919293BActive Publication Date: 2024-10-22BEIJING SOGOU TECHNOLOGY DEVELOPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111155060.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-29
Publication Date
2024-10-22
Estimated Expiration
2041-09-29

AI Technical Summary

Technical Problem

The existing formula recognition model cannot accurately identify the formula corresponding to the formula trajectory, resulting in poor recognition results.

Method used

By obtaining training formula trajectories and labels, perform feature extraction and decoding, adjust the parameters of the formula recognition model, and use the semantic learning module to combine pre-trained language sub-modules and self-learning language sub-modules to adaptively fuse semantic information to improve recognition accuracy. .

Benefits of technology

The recognition accuracy of the formula recognition model is improved, allowing it to more effectively identify the formula corresponding to the formula trajectory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113919293B_ABST
    Figure CN113919293B_ABST
Patent Text Reader

Abstract

The present application discloses a training method for a formula recognition model, and a formula recognition model is obtained by training according to a training formula trajectory and a formula corresponding to the training formula trajectory. When training the formula recognition model, feature extraction is performed on the training formula trajectory to obtain a feature sequence; at the first decoding moment: the first semantic vector and the feature sequence are decoded to obtain a first context vector, wherein the first semantic vector is obtained according to the first hidden layer vector decoded at the second decoding moment, and the second decoding moment is the previous decoding moment of the first decoding moment; based on the first context vector and the label, the parameters of the formula recognition module are adjusted. It can be seen that in the model training stage, decoding is performed based on the first semantic vector and the feature sequence, so that the trained formula recognition model can adaptively fuse semantic information, thereby making the recognition accuracy of the formula recognition model higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a training method and device for a formula recognition model. Background Art

[0002] At present, the machine learning model can identify the formula trajectory to obtain the formula corresponding to the formula trajectory. However, the formula recognition model currently used to identify the formula trajectory cannot accurately identify the formula corresponding to the formula trajectory. The formula trajectory mentioned in this application includes the trajectory points that make up the formula.

[0003] Therefore, there is an urgent need for a solution that can accurately identify the corresponding formula based on the formula trajectory. Summary of the invention

[0004] The technical problem to be solved by the present application is that the formula recognition model cannot accurately recognize the formula corresponding to the formula trajectory, and a training method and device for a formula recognition model are provided.

[0005] In a first aspect, an embodiment of the present application provides a method for training a formula recognition model, the method comprising:

[0006] Obtaining a training formula track and a label corresponding to the training formula track, wherein the label corresponding to the training formula track is used to indicate a formula corresponding to the training formula track;

[0007] Based on the training formula trajectory and the label, the formula recognition model is trained in the following manner:

[0008] Performing feature extraction on the training formula trajectory to obtain a feature sequence;

[0009] At the first decoding moment:

[0010] Decoding the first semantic vector and the feature sequence to obtain a first context vector, wherein the first semantic vector is obtained according to the first hidden layer vector decoded at a second decoding time, and the second decoding time is a decoding time before the first decoding time;

[0011] Based on the first context vector and the label, parameters of the formula recognition model are adjusted.

[0012] Optionally, the formula recognition model includes a semantic learning module, and the first semantic vector is obtained by the semantic learning module according to the first hidden layer vector.

[0013] Optionally, the semantic learning module includes a pre-trained first language submodule, a self-learned second language submodule and a semantic selection submodule; the first semantic vector is obtained in the following manner:

[0014] At the first decoding moment:

[0015] The first language submodule outputs a corresponding semantic vector according to the first hidden layer vector;

[0016] The second language submodule outputs a corresponding semantic vector according to the first hidden layer vector and the second semantic vector, where the second semantic vector is obtained by the pre-trained third language submodule according to the first hidden layer vector;

[0017] The semantic selection submodule selects one of the semantic vectors output by the first language submodule and the semantic vector output by the second language submodule as the first semantic vector.

[0018] Optionally, adjusting parameters of the formula recognition model based on the first context vector and the label includes:

[0019] Based on the first context vector, the second semantic vector, the semantic vector output by the second language submodule, and the label, the parameters of the formula recognition model and the third language submodule are adjusted.

[0020] Optionally, the adjusting the parameters of the formula recognition model includes:

[0021] The parameters of the network other than the first language submodule in the formula recognition model are adjusted.

[0022] Optionally, the decoding of the first semantic vector and the feature sequence is implemented by a decoder, and the decoder is a gated recurrent unit GRU based on an attention mechanism.

[0023] Optionally, the method further includes:

[0024] Get the formula trajectory to be identified;

[0025] The formula trajectory to be identified is input into the trained formula recognition model to obtain a target formula corresponding to the formula trajectory to be identified.

[0026] In a second aspect, an embodiment of the present application provides a training device for a formula recognition model, the device comprising:

[0027] A first acquisition unit is used to acquire a training formula trajectory and a label corresponding to the training formula trajectory, wherein the label corresponding to the training formula trajectory is used to indicate a formula corresponding to the training formula trajectory;

[0028] A training unit is used to train a formula recognition model based on the training formula trajectory and the label in the following manner:

[0029] Performing feature extraction on the training formula trajectory to obtain a feature sequence;

[0030] At the first decoding moment:

[0031] Decoding the first semantic vector and the feature sequence to obtain a first context vector, wherein the first semantic vector is obtained according to the first hidden layer vector decoded at a second decoding time, and the second decoding time is a decoding time before the first decoding time;

[0032] Based on the first context vector and the label, parameters of the formula recognition model are adjusted.

[0033] Optionally, the formula recognition model includes a semantic learning module, and the first semantic vector is obtained by the semantic learning module according to the first hidden layer vector.

[0034] Optionally, the semantic learning module includes a pre-trained first language submodule, a self-learned second language submodule and a semantic selection submodule; the first semantic vector is obtained in the following manner:

[0035] At the first decoding moment:

[0036] The first language submodule outputs a corresponding semantic vector according to the first hidden layer vector;

[0037] The second language submodule outputs a corresponding semantic vector according to the first hidden layer vector and the second semantic vector, where the second semantic vector is obtained by the pre-trained third language submodule according to the first hidden layer vector;

[0038] The semantic selection submodule selects one of the semantic vectors output by the first language submodule and the semantic vector output by the second language submodule as the first semantic vector.

[0039] Optionally, adjusting parameters of the formula recognition model based on the first context vector and the label includes:

[0040] Based on the first context vector, the second semantic vector, the semantic vector output by the second language submodule, and the label, the parameters of the formula recognition model and the third language submodule are adjusted.

[0041] Optionally, the adjusting the parameters of the formula recognition model includes:

[0042] The parameters of the network other than the first language submodule in the formula recognition model are adjusted.

[0043] Optionally, the decoding of the first semantic vector and the feature sequence is implemented by a decoder, and the decoder is a gated recurrent unit GRU based on an attention mechanism.

[0044] Optionally, the device further comprises:

[0045] A second acquisition unit, used for acquiring a trajectory of a formula to be identified;

[0046] The recognition unit is used to input the formula trajectory to be recognized into the trained formula recognition model to obtain the target formula corresponding to the formula trajectory to be recognized.

[0047] In a third aspect, an embodiment of the present application provides a training device for a formula recognition model, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations:

[0048] Obtaining a training formula track and a label corresponding to the training formula track, wherein the label corresponding to the training formula track is used to indicate a formula corresponding to the training formula track;

[0049] Based on the training formula trajectory and the label, the formula recognition model is trained in the following manner:

[0050] Performing feature extraction on the training formula trajectory to obtain a feature sequence;

[0051] At the first decoding moment:

[0052] Decoding the first semantic vector and the feature sequence to obtain a first context vector, wherein the first semantic vector is obtained according to the first hidden layer vector decoded at a second decoding time, and the second decoding time is a decoding time before the first decoding time;

[0053] Based on the first context vector and the label, parameters of the formula recognition model are adjusted.

[0054] Optionally, the formula recognition model includes a semantic learning module, and the first semantic vector is obtained by the semantic learning module according to the first hidden layer vector.

[0055] Optionally, the semantic learning module includes a pre-trained first language submodule, a self-learned second language submodule and a semantic selection submodule; the first semantic vector is obtained in the following manner:

[0056] At the first decoding moment:

[0057] The first language submodule outputs a corresponding semantic vector according to the first hidden layer vector;

[0058] The second language submodule outputs a corresponding semantic vector according to the first hidden layer vector and the second semantic vector, where the second semantic vector is obtained by the pre-trained third language submodule according to the first hidden layer vector;

[0059] The semantic selection submodule selects one of the semantic vectors output by the first language submodule and the semantic vector output by the second language submodule as the first semantic vector.

[0060] Optionally, adjusting parameters of the formula recognition model based on the first context vector and the label includes:

[0061] Based on the first context vector, the second semantic vector, the semantic vector output by the second language submodule, and the label, the parameters of the formula recognition model and the third language submodule are adjusted.

[0062] Optionally, the adjusting the parameters of the formula recognition model includes:

[0063] The parameters of the network other than the first language submodule in the formula recognition model are adjusted.

[0064] Optionally, the decoding of the first semantic vector and the feature sequence is implemented by a decoder, and the decoder is a gated recurrent unit GRU based on an attention mechanism.

[0065] Optionally, the operation further includes:

[0066] Get the formula trajectory to be identified;

[0067] The formula trajectory to be identified is input into the trained formula recognition model to obtain a target formula corresponding to the formula trajectory to be identified.

[0068] In a fourth aspect, an embodiment of the present application provides a computer-readable medium having instructions stored thereon, which, when executed by one or more processors, enables the device to execute any of the methods described in the first aspect above.

[0069] Compared with the prior art, the embodiments of the present application have the following advantages:

[0070] An embodiment of the present application provides a method for training a formula recognition model. Specifically, the formula recognition model can be trained based on a training formula trajectory and a label corresponding to the training formula trajectory, wherein the label corresponding to the training formula trajectory is used to indicate the formula corresponding to the training formula trajectory. When training the formula recognition model, the training formula trajectory can be subjected to feature extraction to obtain a feature sequence; at a first decoding moment: a first semantic vector and the feature sequence are decoded to obtain a first context vector, wherein the first semantic vector is obtained based on a first hidden layer vector decoded at a second decoding moment, and the second decoding moment is a decoding moment before the first decoding moment; based on the first context vector and the label, the parameters of the formula recognition module are adjusted. It can be seen that in an embodiment of the present application, in the model training stage, decoding is performed based on the first semantic vector and the feature sequence, so that the trained formula recognition model can adaptively fuse semantic information, thereby making the recognition accuracy of the formula recognition model higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0072] Figure 1 A flowchart of a method for training a formula recognition model provided in an embodiment of the present application;

[0073] Figure 2 A schematic diagram of the structure of a formula recognition model provided in an embodiment of the present application;

[0074] Figure 3 A schematic diagram of the structure of a training device for a formula recognition model provided in an embodiment of the present application;

[0075] Figure 4 A schematic diagram of the structure of the client provided in the embodiment of the present application;

[0076] Figure 5 A schematic diagram of the structure of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0077] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0078] The inventor of the present application has found through research that, currently, when identifying formula trajectories, the formula recognition model and the language model can be trained separately, and then the formula trajectories can be identified using the language model and the formula recognition model. When the formula trajectories are identified using the language model and the formula recognition model, the semantic information identified by the language model can be added with a fixed weight. However, in this way, the formula recognition model and the language model cannot be adaptively fused, which results in poor results in identifying the formula trajectories.

[0079] Among them, the language model can output the corresponding semantic vector based on the word embedding vector.

[0080] In order to solve the above problems, an embodiment of the present application provides a method and device for training a formula recognition model.

[0081] Various non-limiting implementations of the present application are described in detail below in conjunction with the accompanying drawings.

[0082] Exemplary Methods

[0083] See also Figure 1 , which is a flow chart of a training method for a formula recognition model provided in an embodiment of the present application.

[0084] The method provided in the embodiment of the present application can be executed by a first device, for example. The first device mentioned here includes but is not limited to a terminal device and a server.

[0085] Figure 1 The method shown can be implemented, for example, through the following S101-S102.

[0086] S101: Acquire a training formula trajectory and a label corresponding to the training formula trajectory, wherein the label corresponding to the training formula trajectory is used to indicate a formula corresponding to the training formula trajectory.

[0087] In an embodiment of the present application, the training formula trajectory input by the user through a handwriting input method can be obtained, the training formula trajectory can be obtained from a database storing formula trajectories, and the training formula trajectory can also be obtained from network resources, which is not specifically limited in the embodiment of the present application.

[0088] In one example, the label corresponding to the training formula trajectory may be manually labeled.

[0089] S102: Based on the training formula trajectory and the label, a formula recognition model is obtained through training.

[0090] In the embodiment of the present application, S102 can be implemented through the following S1021-S1023.

[0091] S1021: Extract features from the training formula trajectory to obtain a feature sequence.

[0092] In the embodiment of the present application, S1021 may be implemented by an encoder. The embodiment of the present application does not specifically limit the structure of the encoder. In one example, the encoder may include two gate recurrent unit (GRU) layers.

[0093] S1022: At a first decoding moment: decode the first semantic vector and the feature sequence to obtain a first context vector, wherein the first semantic vector is obtained according to a first hidden layer vector decoded at a second decoding moment, and the second decoding moment is a decoding moment before the first decoding moment.

[0094] In the embodiment of the present application, S1023 can be implemented by a decoder. The embodiment of the present application does not specifically limit the structure of the decoder. In one example, the decoder can be a decoder based on an attention mechanism, and the decoder can also include a GRU layer. A decoder based on an attention mechanism including a GRU layer can also be referred to as a GRU based on an attention mechanism.

[0095] In the embodiment of the present application, the decoder will output a context vector and a hidden layer vector at any decoding time. The context vector is used to determine the output at the decoding time, and the hidden layer vector contains certain semantic information.

[0096] The previous decoding moment of the first decoding moment is the second decoding moment. For the second decoding moment, the output of the second decoding moment includes the first hidden layer vector and a context vector. In an embodiment of the present application, at the first decoding moment, the first semantic vector can be obtained according to the first hidden layer vector, and the decoder performs decoding based on the first semantic vector and the feature sequence.

[0097] In one example, the formula recognition model includes a semantic learning module, and the semantic learning module is used to obtain the first semantic vector according to the first hidden layer vector. In an embodiment of the present application, the semantic learning module can be the language model mentioned above.

[0098] Considering that for the decoder in the formula recognition model, at the initial stage of decoding, the decoded features are relatively few, and the hidden vector output by the decoder itself carries relatively little semantic information. Therefore, the hidden vector output by the decoder can be processed with the help of a pre-trained language module to obtain a corresponding semantic vector. However, as the decoding process proceeds, the decoded features gradually increase, so the hidden vector output by the decoder itself contains relatively more semantic information. Therefore, the semantic information contained in the hidden vector can be learned to obtain the corresponding semantic vector.

[0099] In view of this, in one example, the semantic learning module may include a pre-trained first language submodule, a self-learned second language submodule, and a semantic selection submodule.

[0100] The pre-trained first language submodule can process the hidden layer vector output by the decoder and output the corresponding semantic vector. In other words, at the first decoding moment, the first language submodule can output the corresponding semantic vector according to the first hidden layer vector. The embodiment of the present application does not specifically limit the structure of the first language submodule. In one example, the first language submodule may include a GRU layer.

[0101] The self-learning second language submodule is used to learn the semantic information from the hidden layer vector output by the decoder. It can be understood that the second language submodule has the function of semantic enhancement. As the decoding process proceeds, the second language submodule can learn more and more semantic information. In order to enable the second language submodule to efficiently learn the semantic information in the hidden layer vector, supervised learning can be performed with the help of a pre-trained third language submodel. In one example, the third language submodule can be a language module based on n-gram. In some embodiments, the third language submodel can be a pre-trained model trained using formula data.

[0102] The third language submodule is similar to the first language submodule, and can also process the hidden vector output by the decoder and output the corresponding semantic vector. In an embodiment of the present application, the first hidden vector output by the decoder at the second decoding moment can be input into the third language submodule, and the third language submodule can output the second language vector. Then, the second language vector and the first hidden vector are both input into the second language submodule to assist the second language submodule in learning the semantic information in the first hidden vector. After the first hidden vector and the second semantic vector are input into the second language submodule, the second language submodule can output the corresponding semantic vector.

[0103] It is understandable that at the first decoding moment, the first language submodule and the second language submodule each output a corresponding semantic vector. In an embodiment of the present application, the semantic selection submodule can be used to select one of the semantic vectors output by the first language submodule and the semantic vector output by the second language submodule as the first semantic vector.

[0104] As mentioned above, at the initial stage of decoding, the hidden vector output by the decoder can be processed with the help of a pre-selected trained language module to obtain a corresponding semantic vector. As the decoding process proceeds, the semantic information contained in the hidden vector can be learned to obtain a corresponding semantic vector. Therefore, at the initial stage of decoding, the first semantic vector is the semantic vector output by the first language submodule, and after a period of decoding, the first semantic vector is the semantic vector output by the second language submodule.

[0105] It can be understood that in the process of training the formula recognition model, for the first decoding moment, the semantic selection submodule can adaptively determine whether to use the semantic vector output by the first language submodule as the first semantic vector or the semantic vector output by the second language submodule as the first semantic vector based on the decoding step size.

[0106] The embodiment of the present application does not specifically limit the structure of the semantic selection submodule. In one example, the semantic selection submodule of Sohu may include a fully connected layer and an activation layer.

[0107] S1023: Adjust parameters of the formula recognition model based on the first context vector and the label.

[0108] As mentioned above, at any decoding moment, the decoder can output a corresponding context vector, and the context vector is used to determine the decoding result of the decoding moment. Therefore, the first context vector can be used to determine the decoding result of the first decoding moment. The label is used to indicate the formula corresponding to the training formula trajectory. In other words, the label includes the standard value of the decoding result corresponding to the first decoding moment. Therefore, the parameters of the formula recognition module can be adjusted based on the first context vector and the label. For example, the loss function can be calculated based on the first context vector and the label, and the parameters of the formula recognition model can be further adjusted based on the loss function.

[0109] As mentioned above, the third language submodule is used to supervise the training of the second language submodule. In addition, the third language submodel can be a pre-trained model. In this case, in one example, while training the formula recognition model, the parameters of the third language submodule can also be updated.

[0110] In this case, during specific implementation of S1023, parameters of the formula recognition model and the third language submodule may be adjusted based on the first context vector, the second semantic vector, and the semantic vector output by the second language submodule.

[0111] In one example, the first context vector and the label may be used to calculate a first loss function. The second semantic vector and the semantic vector output by the second language submodule may be used to calculate a second loss function, and the first loss function and the second loss function may be weighted summed to obtain a comprehensive loss function. Then, according to the comprehensive loss function, the parameters of the formula recognition model and the third language submodule may be adjusted.

[0112] The embodiment of the present application does not specifically limit the first loss function and the second loss function. In an example, the second loss function may be, for example, a cosine loss function.

[0113] The embodiment of the present application also does not specifically limit the weights corresponding to the first loss function and the second loss function respectively when the weighted sum of the first loss function and the second loss function is performed.

[0114] Considering that the first language submodule is pre-trained, it can accurately obtain the corresponding semantic vector according to the hidden layer vector. Therefore, in order to improve the speed of model convergence, in one example, when adjusting the parameters of the formula recognition model, the parameters of the first language submodule may not be adjusted.

[0115] From the above description, it can be seen that by utilizing the solution provided in the embodiment of the present application, in the model training stage, decoding is performed based on the first semantic vector and the feature sequence, so that the trained formula recognition model can adaptively fuse semantic information, thereby making the recognition accuracy of the formula recognition model higher.

[0116] After the formula recognition model is trained, the formula recognition model can be used to recognize the formula trajectory to be recognized and obtain the corresponding target formula. Specifically, the formula trajectory to be recognized can be obtained, and then the formula trajectory to be recognized can be input into the formula recognition model to obtain the target formula corresponding to the formula trajectory to be recognized. Now let's take an example with specific scenarios:

[0117] When a user inputs a formula using a handwriting input method, the formula trajectory to be recognized input by the user can be obtained. Further, the formula trajectory to be recognized is input into a formula recognition model, and the formula recognition model displays the recognized target formula as a character candidate in the character input area of ​​the input method.

[0118] Regarding the training method of the formula recognition model provided in the embodiment of the present application, it can be combined with Figure 2 Please understand the structure diagram shown.

[0119] like Figure 2 As shown, the formula recognition model 100 includes: an encoder 110, a decoder 120 and a semantic learning module 130. The semantic learning module 130 includes a first language submodule 131, a second language submodule 132 and a semantic selection submodule 133. The second language submodule 132 can be supervised by the third language submodule 140 for training. Figure 2 For the functions of the various modules shown, please refer to the relevant description of the above embodiments, and no repeated description will be given here.

[0120] Exemplary Devices

[0121] Based on the method provided in the above embodiment, the embodiment of the present application further provides a device, which is described below in conjunction with the accompanying drawings.

[0122] See also Figure 3 , which is a schematic diagram of the structure of a training device for a formula recognition model provided in an embodiment of the present application. The device 200 may specifically include: a first acquisition unit 201 and a training unit 202.

[0123] A first acquisition unit 201 is used to acquire a training formula trajectory and a label corresponding to the training formula trajectory, wherein the label corresponding to the training formula trajectory is used to indicate a formula corresponding to the training formula trajectory;

[0124] The training unit 202 is used to train a formula recognition model based on the training formula trajectory and the label in the following manner:

[0125] Performing feature extraction on the training formula trajectory to obtain a feature sequence;

[0126] At the first decoding moment:

[0127] Decoding the first semantic vector and the feature sequence to obtain a first context vector, wherein the first semantic vector is obtained according to the first hidden layer vector decoded at a second decoding time, and the second decoding time is a decoding time before the first decoding time;

[0128] Based on the first context vector and the label, parameters of the formula recognition model are adjusted.

[0129] Optionally, the formula recognition model includes a semantic learning module, and the first semantic vector is obtained by the semantic learning module according to the first hidden layer vector.

[0130] Optionally, the semantic learning module includes a pre-trained first language submodule, a self-learned second language submodule and a semantic selection submodule; the first semantic vector is obtained in the following manner:

[0131] At the first decoding moment:

[0132] The first language submodule outputs a corresponding semantic vector according to the first hidden layer vector;

[0133] The second language submodule outputs a corresponding semantic vector according to the first hidden layer vector and the second semantic vector, where the second semantic vector is obtained by the pre-trained third language submodule according to the first hidden layer vector;

[0134] The semantic selection submodule selects one of the semantic vectors output by the first language submodule and the semantic vector output by the second language submodule as the first semantic vector.

[0135] Optionally, adjusting parameters of the formula recognition model based on the first context vector and the label includes:

[0136] Based on the first context vector, the second semantic vector, the semantic vector output by the second language submodule, and the label, the parameters of the formula recognition model and the third language submodule are adjusted.

[0137] Optionally, the adjusting the parameters of the formula recognition model includes:

[0138] The parameters of the network other than the first language submodule in the formula recognition model are adjusted.

[0139] Optionally, the decoding of the first semantic vector and the feature sequence is implemented by a decoder, and the decoder is a gated recurrent unit GRU based on an attention mechanism.

[0140] Optionally, the device further comprises:

[0141] A second acquisition unit, used for acquiring a trajectory of a formula to be identified;

[0142] The recognition unit is used to input the formula trajectory to be recognized into the trained formula recognition model to obtain the target formula corresponding to the formula trajectory to be recognized.

[0143] Since the device 200 is a device corresponding to the method provided in the above method embodiment, the specific implementation of each unit of the device 200 is based on the same concept as the above method embodiment. Therefore, for the specific implementation of each unit of the device 200, reference can be made to the description part of the above method embodiment, which will not be repeated here.

[0144] The method provided in the embodiment of the present application can be executed by a client or a server. The client and server that execute the above method are described below respectively.

[0145] Figure 4 1 shows a block diagram of a client 300. For example, the client 300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0146] Reference Figure 4 The client 300 may include one or more of the following components: a processing component 302 , a memory 304 , a power component 306 , a multimedia component 308 , an audio component 310 , an input / output (I / O) interface 33 , a sensor component 314 , and a communication component 316 .

[0147] The processing component 302 generally controls the overall operation of the client 300, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 302 may include one or more processors 320 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 302 may include one or more modules to facilitate the interaction between the processing component 302 and other components. For example, the processing component 302 may include a multimedia module to facilitate the interaction between the multimedia component 308 and the processing component 302.

[0148] The memory 304 is configured to store various types of data to support operations on the client 300. Examples of such data include instructions for any application or method operating on the client 300, contact data, phone book data, messages, pictures, videos, etc. The memory 304 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0149] The power supply component 306 provides power to the various components of the client 300. The power supply component 306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the client 300.

[0150] The multimedia component 308 includes a screen that provides an output interface between the client 300 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 308 includes a front camera and / or a rear camera. When the client 300 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0151] The audio component 310 is configured to output and / or input audio signals. For example, the audio component 310 includes a microphone (MIC), and when the client 300 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 304 or sent via the communication component 316. In some embodiments, the audio component 310 also includes a speaker for outputting audio signals.

[0152] The I / O interface provides an interface between the processing component 302 and the peripheral interface module, which may be a keyboard, a click wheel, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0153] The sensor assembly 314 includes one or more sensors for providing various aspects of status assessment for the client 300. For example, the sensor assembly 314 can detect the open / closed state of the client 300, the relative positioning of components, such as the display and keypad of the client 300, and the sensor assembly 314 can also detect the position change of the client 300 or a component of the client 300, the presence or absence of user contact with the client 300, the orientation or acceleration / deceleration of the client 300, and the temperature change of the client 300. The sensor assembly 314 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 314 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 314 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0154] The communication component 316 is configured to facilitate wired or wireless communication between the client 300 and other devices. The client 300 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 316 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 316 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0155] In an exemplary embodiment, the client 300 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the following methods:

[0156] Obtaining a training formula track and a label corresponding to the training formula track, wherein the label corresponding to the training formula track is used to indicate a formula corresponding to the training formula track;

[0157] Based on the training formula trajectory and the label, the formula recognition model is trained in the following manner:

[0158] Performing feature extraction on the training formula trajectory to obtain a feature sequence;

[0159] At the first decoding moment:

[0160] Decoding the first semantic vector and the feature sequence to obtain a first context vector, wherein the first semantic vector is obtained according to the first hidden layer vector decoded at a second decoding time, and the second decoding time is a decoding time before the first decoding time;

[0161] Based on the first context vector and the label, parameters of the formula recognition model are adjusted.

[0162] Optionally, the formula recognition model includes a semantic learning module, and the first semantic vector is obtained by the semantic learning module according to the first hidden layer vector.

[0163] Optionally, the semantic learning module includes a pre-trained first language submodule, a self-learned second language submodule and a semantic selection submodule; the first semantic vector is obtained in the following manner:

[0164] At the first decoding moment:

[0165] The first language submodule outputs a corresponding semantic vector according to the first hidden layer vector;

[0166] The second language submodule outputs a corresponding semantic vector according to the first hidden layer vector and the second semantic vector, where the second semantic vector is obtained by the pre-trained third language submodule according to the first hidden layer vector;

[0167] The semantic selection submodule selects one of the semantic vectors output by the first language submodule and the semantic vector output by the second language submodule as the first semantic vector.

[0168] Optionally, adjusting parameters of the formula recognition model based on the first context vector and the label includes:

[0169] Based on the first context vector, the second semantic vector, the semantic vector output by the second language submodule, and the label, the parameters of the formula recognition model and the third language submodule are adjusted.

[0170] Optionally, the adjusting the parameters of the formula recognition model includes:

[0171] The parameters of the network other than the first language submodule in the formula recognition model are adjusted.

[0172] Optionally, the decoding of the first semantic vector and the feature sequence is implemented by a decoder, and the decoder is a gated recurrent unit GRU based on an attention mechanism.

[0173] Optionally, the method further includes:

[0174] Get the formula trajectory to be identified;

[0175] The formula trajectory to be identified is input into the trained formula recognition model to obtain a target formula corresponding to the formula trajectory to be identified.

[0176] Figure 5 4 is a schematic diagram of the structure of the server in the embodiment of the present application. The server 400 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 422 (for example, one or more processors) and memory 432, and one or more storage media 430 (for example, one or more mass storage devices) storing application programs 442 or data 444. Among them, the memory 432 and the storage medium 430 can be short-term storage or permanent storage. The program stored in the storage medium 430 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 422 can be configured to communicate with the storage medium 430 to execute a series of instruction operations in the storage medium 430 on the server 400.

[0177] Furthermore, the CPU 422 may execute the following method:

[0178] Obtaining a training formula track and a label corresponding to the training formula track, wherein the label corresponding to the training formula track is used to indicate a formula corresponding to the training formula track;

[0179] Based on the training formula trajectory and the label, the formula recognition model is trained in the following manner:

[0180] Performing feature extraction on the training formula trajectory to obtain a feature sequence;

[0181] At the first decoding moment:

[0182] Decoding the first semantic vector and the feature sequence to obtain a first context vector, wherein the first semantic vector is obtained according to the first hidden layer vector decoded at a second decoding time, and the second decoding time is a decoding time before the first decoding time;

[0183] Based on the first context vector and the label, parameters of the formula recognition model are adjusted.

[0184] Optionally, the formula recognition model includes a semantic learning module, and the first semantic vector is obtained by the semantic learning module according to the first hidden layer vector.

[0185] Optionally, the semantic learning module includes a pre-trained first language submodule, a self-learned second language submodule and a semantic selection submodule; the first semantic vector is obtained in the following manner:

[0186] At the first decoding moment:

[0187] The first language submodule outputs a corresponding semantic vector according to the first hidden layer vector;

[0188] The second language submodule outputs a corresponding semantic vector according to the first hidden layer vector and the second semantic vector, where the second semantic vector is obtained by the pre-trained third language submodule according to the first hidden layer vector;

[0189] The semantic selection submodule selects one of the semantic vectors output by the first language submodule and the semantic vector output by the second language submodule as the first semantic vector.

[0190] Optionally, adjusting parameters of the formula recognition model based on the first context vector and the label includes:

[0191] Based on the first context vector, the second semantic vector, the semantic vector output by the second language submodule, and the label, the parameters of the formula recognition model and the third language submodule are adjusted.

[0192] Optionally, the adjusting the parameters of the formula recognition model includes:

[0193] The parameters of the network other than the first language submodule in the formula recognition model are adjusted.

[0194] Optionally, the decoding of the first semantic vector and the feature sequence is implemented by a decoder, and the decoder is a gated recurrent unit GRU based on an attention mechanism.

[0195] Optionally, the method further includes:

[0196] Get the formula trajectory to be identified;

[0197] The formula trajectory to be identified is input into the trained formula recognition model to obtain a target formula corresponding to the formula trajectory to be identified.

[0198] The server 400 may also include one or more power supplies 426, one or more wired or wireless network interfaces 450, one or more input and output interfaces 458, one or more keyboards 456, and / or, one or more operating systems 441, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0199] The present application also provides a computer-readable medium having instructions stored thereon, which, when executed by one or more processors, causes the device to perform the following method:

[0200] Obtaining a training formula track and a label corresponding to the training formula track, wherein the label corresponding to the training formula track is used to indicate a formula corresponding to the training formula track;

[0201] Based on the training formula trajectory and the label, the formula recognition model is trained in the following manner:

[0202] Performing feature extraction on the training formula trajectory to obtain a feature sequence;

[0203] At the first decoding moment:

[0204] Decoding the first semantic vector and the feature sequence to obtain a first context vector, wherein the first semantic vector is obtained according to the first hidden layer vector decoded at a second decoding time, and the second decoding time is a decoding time before the first decoding time;

[0205] Based on the first context vector and the label, parameters of the formula recognition model are adjusted.

[0206] Optionally, the formula recognition model includes a semantic learning module, and the first semantic vector is obtained by the semantic learning module according to the first hidden layer vector.

[0207] Optionally, the semantic learning module includes a pre-trained first language submodule, a self-learned second language submodule and a semantic selection submodule; the first semantic vector is obtained in the following manner:

[0208] At the first decoding moment:

[0209] The first language submodule outputs a corresponding semantic vector according to the first hidden layer vector;

[0210] The second language submodule outputs a corresponding semantic vector according to the first hidden layer vector and the second semantic vector, where the second semantic vector is obtained by the pre-trained third language submodule according to the first hidden layer vector;

[0211] The semantic selection submodule selects one of the semantic vectors output by the first language submodule and the semantic vector output by the second language submodule as the first semantic vector.

[0212] Optionally, adjusting parameters of the formula recognition model based on the first context vector and the label includes:

[0213] Based on the first context vector, the second semantic vector, the semantic vector output by the second language submodule, and the label, the parameters of the formula recognition model and the third language submodule are adjusted.

[0214] Optionally, the adjusting the parameters of the formula recognition model includes:

[0215] The parameters of the network other than the first language submodule in the formula recognition model are adjusted.

[0216] Optionally, the decoding of the first semantic vector and the feature sequence is implemented by a decoder, and the decoder is a gated recurrent unit GRU based on an attention mechanism.

[0217] Optionally, the method further includes:

[0218] Get the formula trajectory to be identified;

[0219] The formula trajectory to be identified is input into the trained formula recognition model to obtain a target formula corresponding to the formula trajectory to be identified.

[0220] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0221] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

[0222] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A training method for a formula recognition model, characterized in that: The method comprises: Obtaining a training formula track and a label corresponding to the training formula track, wherein the label corresponding to the training formula track is used to indicate a formula corresponding to the training formula track; Based on the training formula trajectory and the label, the formula recognition model is trained in the following manner: Performing feature extraction on the training formula trajectory to obtain a feature sequence; At the first decoding moment: Decoding the first semantic vector and the feature sequence to obtain a first context vector, wherein the first semantic vector is obtained according to the first hidden layer vector decoded at a second decoding time, and the second decoding time is a decoding time before the first decoding time; Adjusting parameters of the formula recognition model based on the first context vector and the label; The formula recognition model includes a semantic learning module, the first semantic vector is obtained by the semantic learning module according to the first hidden layer vector, the semantic learning module includes a pre-trained first language submodule, a self-learned second language submodule and a semantic selection submodule; the first semantic vector is obtained by: At the first decoding moment: The first language submodule outputs a corresponding semantic vector according to the first hidden layer vector; The second language submodule outputs a corresponding semantic vector according to the first hidden layer vector and the second semantic vector, where the second semantic vector is obtained by the pre-trained third language submodule according to the first hidden layer vector; The semantic selection submodule selects one of the semantic vectors output by the first language submodule and the semantic vector output by the second language submodule as the first semantic vector.

2. The method according to claim 1, characterized in that: The adjusting the parameters of the formula recognition model based on the first context vector and the label includes: Based on the first context vector, the second semantic vector, the semantic vector output by the second language submodule, and the label, the parameters of the formula recognition model and the third language submodule are adjusted.

3. The method according to claim 2, characterized in that The adjusting of the parameters of the formula recognition model includes: The parameters of the network other than the first language submodule in the formula recognition model are adjusted.

4. The method according to claim 1, characterized in that: The decoding of the first semantic vector and the feature sequence is implemented by a decoder, and the decoder is a gated recurrent unit GRU based on an attention mechanism.

5. The method according to claim 1, characterized in that The method further comprises: Get the formula trajectory to be identified; The formula trajectory to be identified is input into the trained formula recognition model to obtain a target formula corresponding to the formula trajectory to be identified.

6. A training device for a formula recognition model, characterized in that: The device comprises: A first acquisition unit is used to acquire a training formula trajectory and a label corresponding to the training formula trajectory, wherein the label corresponding to the training formula trajectory is used to indicate a formula corresponding to the training formula trajectory; A training unit is used to train a formula recognition model based on the training formula trajectory and the label in the following manner: Performing feature extraction on the training formula trajectory to obtain a feature sequence; At the first decoding moment: Decoding the first semantic vector and the feature sequence to obtain a first context vector, wherein the first semantic vector is obtained according to the first hidden layer vector decoded at a second decoding time, and the second decoding time is a decoding time before the first decoding time; Adjusting parameters of the formula recognition model based on the first context vector and the label; The formula recognition model includes a semantic learning module, the first semantic vector is obtained by the semantic learning module according to the first hidden layer vector, the semantic learning module includes a pre-trained first language submodule, a self-learned second language submodule and a semantic selection submodule; the first semantic vector is obtained by: At the first decoding moment: The first language submodule outputs a corresponding semantic vector according to the first hidden layer vector; The second language submodule outputs a corresponding semantic vector according to the first hidden layer vector and the second semantic vector, where the second semantic vector is obtained by the pre-trained third language submodule according to the first hidden layer vector; The semantic selection submodule selects one of the semantic vectors output by the first language submodule and the semantic vector output by the second language submodule as the first semantic vector.

7. The device according to claim 6, characterized in that The adjusting the parameters of the formula recognition model based on the first context vector and the label includes: Based on the first context vector, the second semantic vector, the semantic vector output by the second language submodule, and the label, the parameters of the formula recognition model and the third language submodule are adjusted.

8. The device according to claim 7, characterized in that The adjusting of the parameters of the formula recognition model includes: The parameters of the network other than the first language submodule in the formula recognition model are adjusted.

9. The device according to claim 6, characterized in that The decoding of the first semantic vector and the feature sequence is implemented by a decoder, and the decoder is a gated recurrent unit GRU based on an attention mechanism.

10. A training device for a formula recognition model, characterized in that: The system comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include instructions for performing the following operations: Obtaining a training formula track and a label corresponding to the training formula track, wherein the label corresponding to the training formula track is used to indicate a formula corresponding to the training formula track; Based on the training formula trajectory and the label, the formula recognition model is trained in the following manner: Performing feature extraction on the training formula trajectory to obtain a feature sequence; At the first decoding moment: Decoding the first semantic vector and the feature sequence to obtain a first context vector, wherein the first semantic vector is obtained according to the first hidden layer vector decoded at a second decoding time, and the second decoding time is a decoding time before the first decoding time; Adjusting parameters of the formula recognition model based on the first context vector and the label; The formula recognition model includes a semantic learning module, the first semantic vector is obtained by the semantic learning module according to the first hidden layer vector, the semantic learning module includes a pre-trained first language submodule, a self-learned second language submodule and a semantic selection submodule; the first semantic vector is obtained by: At the first decoding moment: The first language submodule outputs a corresponding semantic vector according to the first hidden layer vector; The second language submodule outputs a corresponding semantic vector according to the first hidden layer vector and the second semantic vector, where the second semantic vector is obtained by the pre-trained third language submodule according to the first hidden layer vector; The semantic selection submodule selects one of the semantic vectors output by the first language submodule and the semantic vector output by the second language submodule as the first semantic vector.

11. A computer-readable medium having instructions stored thereon, which, when executed by one or more processors, causes an apparatus to perform the method of any one of claims 1 to 5.