A formula recognition method and device

By processing image features from multiple directions and combining forward and reverse recognition results, the problem of low formula recognition accuracy in the existing technology is solved and higher recognition accuracy is achieved.

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

Patent Information

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

AI Technical Summary

Technical Problem

Existing formula recognition methods cannot accurately identify formulas in images, and the recognition accuracy is not high.

Method used

By processing image features from multiple directions, formula recognition results in multiple directions are obtained, and the final formula recognition results are determined based on these results, using encoders and decoders, such as based on convolutional neural networks, attention mechanisms or Transformer The model's decoder combines forward and reverse processing methods to improve recognition accuracy.

Benefits of technology

It effectively improves the accuracy of formula recognition, makes up for the shortcomings of single-direction processing, and improves the accuracy of recognition of image features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113869312B_ABST
    Figure CN113869312B_ABST
Patent Text Reader

Abstract

The present application discloses a formula recognition method, which can obtain an image to be processed including a formula, and then process the image to be processed to obtain formula recognition results in at least two directions. The formula recognition results in at least two directions are the formula recognition results obtained by processing the image features of the image to be processed in at least two directions. Then, based on the formula recognition results in at least two directions, the formula included in the image to be processed is determined. It can be seen that in the embodiment of the present application, when processing the image features, the image features are no longer processed in a single direction, but the image features are processed from at least two directions. Furthermore, based on the formula recognition results in at least two directions, the formula included in the image to be processed is determined to make up for the shortcomings of processing the image to be processed from a single direction, thereby improving the recognition accuracy.
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 formula recognition method and device. Background Art

[0002] In some scenarios, it is necessary to recognize formulas in images. The current methods for recognizing formulas cannot accurately recognize formulas in images.

[0003] Therefore, there is an urgent need for a solution that can accurately identify the formula in the image. Summary of the invention

[0004] The technical problem to be solved by the present application is that the formula in the image cannot be accurately identified, and a formula identification method and device are provided.

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

[0006] Obtaining an image to be processed including a formula;

[0007] Processing the image to be processed to obtain formula recognition results in at least two directions, wherein the formula recognition results in at least two directions are: formula recognition results obtained by processing image features of the image to be processed according to the at least two directions;

[0008] According to the formula recognition results in the at least two directions, the formula included in the image to be processed is determined.

[0009] Optionally, the processing of the image to be processed to obtain formula recognition results in at least two directions includes:

[0010] Encoding the image to be processed to obtain image features of the image to be processed;

[0011] The image features are processed according to the at least two directions to obtain formula recognition results in the at least two directions.

[0012] Optionally, encoding the image to be processed to obtain image features of the image to be processed is achieved through an encoder, and the network structure of the encoder is determined by a neural network architecture search (NAS) algorithm.

[0013] Optionally, the processing of the image features according to the at least two directions to obtain the formula recognition results of the at least two directions is implemented by a decoder, and the decoder is:

[0014] A decoder based on connection time classification CTC, or a decoder based on attention, or a decoder in a Transformer model.

[0015] Optionally, the formula recognition results in at least two directions include a forward recognition result and a reverse recognition result, the forward formula recognition result being a formula recognition result obtained by processing the image features of the image to be processed in a front-to-back order, and the reverse formula recognition result being a formula recognition result obtained by processing the image features in a back-to-front order.

[0016] Optionally, determining the formula included in the image to be processed according to the forward formula recognition result and the reverse formula recognition result includes:

[0017] Determine the standard value corresponding to the reverse formula recognition result according to the forward formula recognition result, and determine the standard value corresponding to the forward formula recognition result according to the reverse formula recognition result;

[0018] Obtaining a score for the forward recognition result according to the standard values ​​corresponding to the forward recognition result and the forward formula recognition result, and obtaining a score for the reverse recognition result according to the standard values ​​corresponding to the reverse recognition result and the reverse formula recognition result;

[0019] The formula included in the image to be processed is determined according to the recognition result with a higher score between the score of the forward recognition result and the score of the reverse recognition result.

[0020] Optionally, the formula recognition results in at least two directions include at least two of the following:

[0021] The formula recognition results corresponding to the direction from top to bottom, the formula recognition results corresponding to the direction from bottom to top, the formula recognition results corresponding to the direction from front to back, and the formula recognition results corresponding to the direction from back to front.

[0022] In a second aspect, an embodiment of the present application provides a formula recognition device, the device comprising:

[0023] An acquisition unit, used for acquiring an image to be processed including a formula;

[0024] A processing unit, used for processing the image to be processed to obtain formula recognition results in at least two directions, wherein the formula recognition results in at least two directions are: formula recognition results obtained by processing image features of the image to be processed according to the at least two directions;

[0025] A determination unit is used to determine the formula included in the image to be processed according to the formula recognition results in the at least two directions.

[0026] Optionally, the processing unit is used to:

[0027] Encoding the image to be processed to obtain image features of the image to be processed;

[0028] The image features are processed according to the at least two directions to obtain formula recognition results in the at least two directions.

[0029] Optionally, encoding the image to be processed to obtain image features of the image to be processed is achieved through an encoder, and the network structure of the encoder is determined by a neural network architecture search (NAS) algorithm.

[0030] Optionally, the processing of the image features according to the at least two directions to obtain the formula recognition results of the at least two directions is implemented by a decoder, and the decoder is:

[0031] A decoder based on connection time classification CTC, or a decoder based on attention, or a decoder in a Transformer model.

[0032] Optionally, the formula recognition results in at least two directions include a forward recognition result and a reverse recognition result, the forward formula recognition result being a formula recognition result obtained by processing the image features of the image to be processed in a front-to-back order, and the reverse formula recognition result being a formula recognition result obtained by processing the image features in a back-to-front order.

[0033] Optionally, the determining unit is used to:

[0034] Determine the standard value corresponding to the reverse formula recognition result according to the forward formula recognition result, and determine the standard value corresponding to the forward formula recognition result according to the reverse formula recognition result;

[0035] Obtaining a score for the forward recognition result according to the standard values ​​corresponding to the forward recognition result and the forward formula recognition result, and obtaining a score for the reverse recognition result according to the standard values ​​corresponding to the reverse recognition result and the reverse formula recognition result;

[0036] The formula included in the image to be processed is determined according to the recognition result with a higher score between the score of the forward recognition result and the score of the reverse recognition result.

[0037] Optionally, the formula recognition results in at least two directions include at least two of the following:

[0038] The formula recognition results corresponding to the direction from top to bottom, the formula recognition results corresponding to the direction from bottom to top, the formula recognition results corresponding to the direction from front to back, and the formula recognition results corresponding to the direction from back to front.

[0039] In a third aspect, an embodiment of the present application provides a formula recognition device, 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, wherein the one or more programs include instructions for performing the following operations:

[0040] Obtaining an image to be processed including a formula;

[0041] Processing the image to be processed to obtain formula recognition results in at least two directions, wherein the formula recognition results in at least two directions are: formula recognition results obtained by processing image features of the image to be processed according to the at least two directions;

[0042] According to the formula recognition results in the at least two directions, the formula included in the image to be processed is determined.

[0043] Optionally, the processing the image to be processed to obtain formula recognition results in at least two directions includes:

[0044] Encoding the image to be processed to obtain image features of the image to be processed;

[0045] The image features are processed according to the at least two directions to obtain formula recognition results in the at least two directions.

[0046] Optionally, encoding the image to be processed to obtain image features of the image to be processed is achieved through an encoder, and the network structure of the encoder is determined by a neural network architecture search (NAS) algorithm.

[0047] Optionally, the processing of the image features according to the at least two directions to obtain the formula recognition results of the at least two directions is implemented by a decoder, and the decoder is:

[0048] A decoder based on connection time classification CTC, or a decoder based on attention, or a decoder in a Transformer model.

[0049] Optionally, the formula recognition results in at least two directions include a forward recognition result and a reverse recognition result, the forward formula recognition result being a formula recognition result obtained by processing the image features of the image to be processed in a front-to-back order, and the reverse formula recognition result being a formula recognition result obtained by processing the image features in a back-to-front order.

[0050] Optionally, determining the formula included in the image to be processed according to the forward formula recognition result and the reverse formula recognition result includes:

[0051] Determine the standard value corresponding to the reverse formula recognition result according to the forward formula recognition result, and determine the standard value corresponding to the forward formula recognition result according to the reverse formula recognition result;

[0052] Obtaining a score for the forward recognition result according to the standard values ​​corresponding to the forward recognition result and the forward formula recognition result, and obtaining a score for the reverse recognition result according to the standard values ​​corresponding to the reverse recognition result and the reverse formula recognition result;

[0053] The formula included in the image to be processed is determined according to the recognition result with a higher score between the score of the forward recognition result and the score of the reverse recognition result.

[0054] Optionally, the formula recognition results in at least two directions include at least two of the following:

[0055] The formula recognition results corresponding to the direction from top to bottom, the formula recognition results corresponding to the direction from bottom to top, the formula recognition results corresponding to the direction from front to back, and the formula recognition results corresponding to the direction from back to front.

[0056] 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.

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

[0058] The embodiment of the present application provides a formula recognition method, specifically: an image to be processed including a formula can be obtained, and then the image to be processed is processed to obtain formula recognition results in at least two directions. Among them, the formula recognition results in at least two directions are the formula recognition results obtained by processing the image features of the image to be processed in at least two directions. It can be understood that one direction can correspond to one formula recognition result. Then, according to the formula recognition results in at least two directions, the formula included in the image to be processed is determined. It can be seen that in the embodiment of the present application, when processing the image features, the image features are no longer processed in a single direction, but the image features are processed from at least two directions. Further, according to the formula recognition results in at least two directions, the formula included in the image to be processed is determined to make up for the shortcomings of processing the image to be processed from a single direction, thereby improving the recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] 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.

[0060] Figure 1 A flow chart of a formula recognition method provided in an embodiment of the present application;

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

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

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

[0064] 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.

[0065] The inventor of the present application has found through research that, currently, when identifying a formula in an image, the image features can be processed in a certain direction, for example, in a sequence from front to back, so as to obtain the formula in the image. However, using this method, the recognition accuracy is not very high.

[0066] After research, the inventor of this application discovered that if the image features can be processed from multiple directions to obtain formula recognition results corresponding to the multiple directions, and then the final formula recognition result is determined based on the formula recognition results corresponding to the multiple directions, it can effectively make up for the shortcomings of processing the image to be processed from a single direction, thereby effectively improving the recognition accuracy.

[0067] In view of this, an embodiment of the present application provides a formula recognition method and device.

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

[0069] Exemplary Methods

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

[0071] 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. The terminal device mentioned here can be a mobile terminal such as a smart phone or a tablet computer, or a terminal device such as a desktop computer.

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

[0073] S101: Acquire an image to be processed including a formula.

[0074] It should be noted that the image to be processed in the embodiment of the present application can be any one of a network screenshot, a printed text scan image, a word document image, and a pdf document image.

[0075] S102: Processing the image to be processed to obtain formula recognition results in at least two directions, wherein the formula recognition results in at least two directions are: formula recognition results obtained by processing image features of the image to be processed according to the at least two directions.

[0076] In the embodiment of the present application, the at least two directions may include at least two of: from front to back, from back to front, from top to bottom, and from bottom to top. For example, the at least two directions may include from front to back and from top to bottom. For another example, the at least two directions may include from front to back and from back to front. For another example, the at least two directions may include from front to back, from back to front, from top to bottom, and from bottom to top, etc.

[0077] In one example, when S102 is implemented, the image features of the image to be processed may be first extracted, and then the image features may be processed to obtain the formula recognition results in the at least two directions.

[0078] In an embodiment of the present application, the image to be processed can be encoded to obtain image features of the image to be processed. In one example, encoding the image to be processed can be implemented by an encoder. In an embodiment of the present application, the encoder can adopt a convolutional neural network (CNN) structure. In one example, in order to determine a better encoder structure without greatly affecting the accuracy, a neural network architecture search (NAS) algorithm can be used to determine the network structure of the encoder. For example, the NAS algorithm can be used to determine that the convolution layer of the encoder is a 5*5 convolution.

[0079] After obtaining the image features, the image features can be processed in at least two directions to obtain the formula recognition results in the at least two directions. In one example, the image features can be processed in a front-to-back order to obtain the forward formula recognition result, and the image features can be processed in a back-to-front order to obtain the reverse formula recognition result. For example: the image features are embodied as a sequence {a, b, c, d, e}, then the image features are processed in the order of a→b→c→d→e to obtain the forward formula recognition result, and the image features are processed in the order of e→d→c→b→a to obtain the reverse formula recognition result.

[0080] In one example, the image features may be processed by a decoder to obtain the formula recognition results in the at least two directions. The decoder mentioned here may be pre-trained. For the specific content of the decoder and the training of the decoder, please refer to the relevant description section below, which will not be described in detail here.

[0081] S103: Determine the formula included in the image to be processed according to the formula recognition results in the at least two directions.

[0082] In one example, if a certain formula recognition result appears the most times among the formula recognition results in the at least two directions, it means that the accuracy of the formula recognition result is the highest. Therefore, when S103 is implemented, the formula recognition result that appears the most times among the formula recognition results in the at least two directions can be determined as the formula included in the image to be processed. For example: After executing S102, 4 formula recognition results are obtained, namely: y=a+b, y=a+b, y=a+b and y=a*b, and y=a+b appears the most times, so y=a+b is determined as the formula included in the image to be processed.

[0083] In one example, considering that when processing the image features, if the image features are processed in order from front to back, a processing result with relatively high accuracy can be obtained for the features closer to the front of the image features. If the image features are processed in order from back to front, a processing result with relatively high accuracy can be obtained for the features closer to the back of the image features. Therefore, if the image features can be processed in order from front to back, and in order from back to front, and the results obtained by the two processing methods are combined to determine the final formula recognition result, the accuracy of formula recognition can be effectively improved.

[0084] Therefore, in one example, the formula recognition results in at least two directions include a forward recognition result and a reverse recognition result. The forward formula recognition result is a formula recognition result obtained by processing the image features of the image to be processed in a front-to-back order, and the reverse formula recognition result is a formula recognition result obtained by processing the image features in a back-to-front order.

[0085] For the convenience of description, "the features closer to the front of the image features" are called "the features closer to the back of the image features" are called "the features closer to the back of the image features", "processing the image features in the order from front to back" is called "forward processing of the image features", and "processing the image features in the order from back to front" is called "reverse processing of the image features". Then:

[0086] In the embodiment of the present application, the image features are forward processed, and the accuracy of the result corresponding to the front time slice feature is relatively high, and the image features are reversely processed, and the accuracy of the result corresponding to the back time slice feature is relatively high. Therefore, the formula included in the image to be processed is determined based on the forward formula recognition result and the reverse recognition result, and the result corresponding to the front time slice feature and the result corresponding to the back time slice feature can be combined, so that the determined formula is relatively accurate.

[0087] In one example, if the formula recognition result of at least one direction includes a forward formula recognition result and a reverse formula recognition result, then in the specific implementation of S103, the first half of the formula corresponding to the forward formula recognition result and the second half of the formula corresponding to the reverse recognition result can be taken to form the formula included in the image to be processed.

[0088] In yet another example, if the formula recognition result of the at least one direction includes a forward formula recognition result and a reverse formula recognition result, S103 can be implemented through the following steps AC during specific implementation.

[0089] Step A: Determine the standard value corresponding to the reverse formula recognition result based on the forward formula recognition result, and determine the standard value corresponding to the forward formula recognition result based on the reverse formula recognition result.

[0090] It should be noted that the result corresponding to each character in the forward formula recognition result may include two parts, one of which is the recognized character and the other is the probability value corresponding to the character. Similarly, the result corresponding to each character in the reverse formula recognition result may include two parts, one of which is the recognized character and the other is the probability value corresponding to the character. For example, the forward recognition result is shown in Table 1 below, and the reverse recognition result is shown in Table 2 below:

[0091] Table 1

[0092] character Probability y 0.8 = 0.9 a 0.8 + 0.7 b 0.9

[0093] Table 2

[0094] character Probability a 0.8 * 0.6 b 0.8 = 0.7 y 0.9

[0095] In one example, the characters included in the formula corresponding to the forward formula recognition result can be arranged in reverse order to obtain the standard value corresponding to the reverse formula recognition result. Similarly, the characters included in the formula corresponding to the reverse formula recognition result can be arranged in reverse order to obtain the standard value corresponding to the forward formula recognition result. For example: the formula corresponding to the forward recognition result is: y=a+b, then the standard value of the reverse recognition result is: b+a=y; the formula corresponding to the reverse recognition result is: a+c=b, then the standard value of the forward recognition result is: b=a+c.

[0096] Step B: Obtain the score of the forward recognition result according to the standard values ​​corresponding to the forward recognition result and the forward formula recognition result, and obtain the score of the reverse recognition result according to the standard values ​​corresponding to the reverse recognition result and the reverse formula recognition result.

[0097] In the embodiment of the present application, after determining the standard values ​​of the forward recognition result and the forward formula recognition result, the two can be compared and the corresponding scores can be calculated.

[0098] In one example, the formula corresponding to the positive recognition result and the standard value of the positive recognition result can be compared, and for unmatched characters, the score of the positive recognition result can be calculated in combination with the probability value corresponding to the character. For example: the positive recognition result is: y=a+b, and the standard value corresponding to the positive recognition result is y=a+b, and the two are exactly the same, then the score can be defaulted to 1; if the positive recognition result is: y=a+b, and the standard value corresponding to the positive recognition result is y=a*b, then the character "+" in the positive recognition result does not match the character "*" in the standard value corresponding to the positive recognition result, and the probability corresponding to the character "+" is 0.6, then the score corresponding to the positive recognition result can be: 1-(-log0.6)=0.78.

[0099] The specific method for calculating the score of the reverse recognition result is similar to the method for calculating the score of the forward recognition result, so it will not be repeated here.

[0100] Step C: Determine the formula included in the image to be processed according to the recognition result with a higher score among the scores of the forward recognition result and the reverse recognition result.

[0101] In an embodiment of the present application, if the score of the forward recognition result is higher than the score of the reverse recognition result, it means that the accuracy of the forward recognition result is higher than the accuracy of the reverse recognition result, and therefore, the formula corresponding to the forward recognition result can be determined as the formula included in the image to be processed. Similarly, if the score of the reverse recognition result is higher than the score of the forward recognition result, it means that the accuracy of the reverse recognition result is higher than the accuracy of the forward recognition result, and therefore, the formula corresponding to the reverse recognition result can be determined as the formula included in the image to be processed.

[0102] It can be understood that since the standard value corresponding to the forward formula recognition result is determined according to the reverse formula recognition result, the standard value corresponding to the reverse formula recognition result is determined according to the forward formula recognition result. Therefore, the score corresponding to the forward formula recognition result and the score corresponding to the reverse formula recognition result calculated both take into account the result corresponding to the previous time slice feature and the result corresponding to the next time slice feature. Therefore, using this solution, when determining the formula included in the image to be processed, both the result corresponding to the previous time slice feature and the result corresponding to the next time slice feature are taken into account, and therefore, the determined formula has high accuracy.

[0103] In one example, the aforementioned S101-S102 can be implemented using a formula recognition model. The formula recognition model may include an encoder and a decoder. The encoder is used to process an image to be processed that includes a formula to obtain image features of the image to be processed. The decoder can process the image features to obtain a forward formula recognition result and a reverse formula recognition result. Of course, the decoders that obtain the forward formula recognition result and the reverse formula recognition result may also be two independent decoders, which is not specifically limited in the embodiments of the present application. In other words:

[0104] The aforementioned S101-S102 can be implemented using one or two formula recognition models.

[0105] When a formula recognition model is used to perform S101-S102, the formula recognition model may include an encoder and a decoder. The encoder is used to process the image to be processed including the formula to obtain the image features of the image to be processed. The decoder may process the image features to obtain the forward formula recognition result and the reverse formula recognition result.

[0106] When two formula recognition models are used to perform S101-S102, both formula recognition models may include an encoder and a decoder. The encoders are used to process the image to be processed including the formula to obtain the image features of the image to be processed. The decoder of the first formula recognition model is used to process the image features to obtain the forward formula recognition result, and the decoder of the second formula recognition model is used to process the image features to obtain the reverse formula recognition result.

[0107] Regarding the encoder, please refer to the relevant description part above and no detailed description is given here.

[0108] The decoder in the embodiment of the present application may be an attention-based decoder, a decoder in a Transformer model, or a decoder based on Connectionist Temporal Classification (CTC), which is not specifically limited in the embodiment of the present application.

[0109] In the embodiment of the present application, the formula recognition model can be pre-trained. Specifically, the formula recognition model can be trained using training images and forward formulas and reverse formulas corresponding to the training images. The specific training process of the formula recognition model is not described in detail here.

[0110] Of course, if the decoders for obtaining the forward formula recognition result and the reverse formula recognition result are two independent decoders, two formula recognition models can be trained separately. Specifically, the first formula recognition model can be trained using the training image and the forward formula corresponding to the training image, and the second formula recognition model can be trained using the training image and the reverse formula corresponding to the training image. The specific training process of the first formula recognition model and the second formula recognition model will not be described in detail here.

[0111] Exemplary Devices

[0112] 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.

[0113] See also Figure 2 , which is a schematic diagram of the structure of a formula recognition device provided in an embodiment of the present application. The device 200 may specifically include: an acquisition unit 201, a processing unit 202 and a determination unit 203.

[0114] An acquisition unit 201 is used to acquire an image to be processed including a formula;

[0115] The processing unit 202 is used to process the image to be processed to obtain formula recognition results in at least two directions, where the formula recognition results in at least two directions are: formula recognition results obtained by processing the image features of the image to be processed according to the at least two directions;

[0116] The determination unit 203 is used to determine the formula included in the image to be processed according to the formula recognition results in the at least two directions.

[0117] Optionally, the processing unit 202 is configured to:

[0118] Encoding the image to be processed to obtain image features of the image to be processed;

[0119] The image features are processed according to the at least two directions to obtain formula recognition results in the at least two directions.

[0120] Optionally, encoding the image to be processed to obtain image features of the image to be processed is achieved through an encoder, and the network structure of the encoder is determined by a neural network architecture search (NAS) algorithm.

[0121] Optionally, the processing of the image features according to the at least two directions to obtain the formula recognition results of the at least two directions is implemented by a decoder, and the decoder is:

[0122] A decoder based on connection time classification CTC, or a decoder based on attention, or a decoder in a Transformer model.

[0123] Optionally, the formula recognition results in at least two directions include a forward recognition result and a reverse recognition result, the forward formula recognition result being a formula recognition result obtained by processing the image features of the image to be processed in a front-to-back order, and the reverse formula recognition result being a formula recognition result obtained by processing the image features in a back-to-front order.

[0124] Optionally, the determining unit 203 is configured to:

[0125] Determine the standard value corresponding to the reverse formula recognition result according to the forward formula recognition result, and determine the standard value corresponding to the forward formula recognition result according to the reverse formula recognition result;

[0126] Obtaining a score for the forward recognition result according to the standard values ​​corresponding to the forward recognition result and the forward formula recognition result, and obtaining a score for the reverse recognition result according to the standard values ​​corresponding to the reverse recognition result and the reverse formula recognition result;

[0127] The formula included in the image to be processed is determined according to the recognition result with a higher score between the score of the forward recognition result and the score of the reverse recognition result.

[0128] Optionally, the formula recognition results in at least two directions include at least two of the following:

[0129] The formula recognition results corresponding to the direction from top to bottom, the formula recognition results corresponding to the direction from bottom to top, the formula recognition results corresponding to the direction from front to back, and the formula recognition results corresponding to the direction from back to front.

[0130] 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.

[0131] 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.

[0132] Figure 31 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.

[0133] Reference Figure 3 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 .

[0134] 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.

[0135] 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.

[0136] 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.

[0137] 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.

[0138] 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.

[0139] 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.

[0140] 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 device 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.

[0141] 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.

[0142] 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:

[0143] Obtaining an image to be processed including a formula;

[0144] Processing the image to be processed to obtain formula recognition results in at least two directions, wherein the formula recognition results in at least two directions are: formula recognition results obtained by processing image features of the image to be processed according to the at least two directions;

[0145] According to the formula recognition results in the at least two directions, the formula included in the image to be processed is determined.

[0146] Optionally, the processing the image to be processed to obtain formula recognition results in at least two directions includes:

[0147] Encoding the image to be processed to obtain image features of the image to be processed;

[0148] The image features are processed according to the at least two directions to obtain formula recognition results in the at least two directions.

[0149] Optionally, encoding the image to be processed to obtain image features of the image to be processed is achieved through an encoder, and the network structure of the encoder is determined by a neural network architecture search (NAS) algorithm.

[0150] Optionally, the processing of the image features according to the at least two directions to obtain the formula recognition results of the at least two directions is implemented by a decoder, and the decoder is:

[0151] A decoder based on connection time classification CTC, or a decoder based on attention, or a decoder in a Transformer model.

[0152] Optionally, the formula recognition results in at least two directions include a forward recognition result and a reverse recognition result, the forward formula recognition result being a formula recognition result obtained by processing the image features of the image to be processed in a front-to-back order, and the reverse formula recognition result being a formula recognition result obtained by processing the image features in a back-to-front order.

[0153] Optionally, determining the formula included in the image to be processed according to the forward formula recognition result and the reverse formula recognition result includes:

[0154] Determine the standard value corresponding to the reverse formula recognition result according to the forward formula recognition result, and determine the standard value corresponding to the forward formula recognition result according to the reverse formula recognition result;

[0155] Obtaining a score for the forward recognition result according to the standard values ​​corresponding to the forward recognition result and the forward formula recognition result, and obtaining a score for the reverse recognition result according to the standard values ​​corresponding to the reverse recognition result and the reverse formula recognition result;

[0156] The formula included in the image to be processed is determined according to the recognition result with a higher score between the score of the forward recognition result and the score of the reverse recognition result.

[0157] Optionally, the formula recognition results in at least two directions include at least two of the following:

[0158] The formula recognition results corresponding to the direction from top to bottom, the formula recognition results corresponding to the direction from bottom to top, the formula recognition results corresponding to the direction from front to back, and the formula recognition results corresponding to the direction from back to front.

[0159] Figure 44 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.

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

[0161] Obtaining an image to be processed including a formula;

[0162] Processing the image to be processed to obtain formula recognition results in at least two directions, wherein the formula recognition results in at least two directions are: formula recognition results obtained by processing image features of the image to be processed according to the at least two directions;

[0163] According to the formula recognition results in the at least two directions, the formula included in the image to be processed is determined.

[0164] Optionally, the processing of the image to be processed to obtain formula recognition results in at least two directions includes:

[0165] Encoding the image to be processed to obtain image features of the image to be processed;

[0166] The image features are processed according to the at least two directions to obtain formula recognition results in the at least two directions.

[0167] Optionally, encoding the image to be processed to obtain image features of the image to be processed is achieved through an encoder, and the network structure of the encoder is determined by a neural network architecture search (NAS) algorithm.

[0168] Optionally, the processing of the image features according to the at least two directions to obtain the formula recognition results of the at least two directions is implemented by a decoder, and the decoder is:

[0169] A decoder based on connection time classification CTC, or a decoder based on attention, or a decoder in a Transformer model.

[0170] Optionally, the formula recognition results in at least two directions include a forward recognition result and a reverse recognition result, the forward formula recognition result being a formula recognition result obtained by processing the image features of the image to be processed in a front-to-back order, and the reverse formula recognition result being a formula recognition result obtained by processing the image features in a back-to-front order.

[0171] Optionally, determining the formula included in the image to be processed according to the forward formula recognition result and the reverse formula recognition result includes:

[0172] Determine the standard value corresponding to the reverse formula recognition result according to the forward formula recognition result, and determine the standard value corresponding to the forward formula recognition result according to the reverse formula recognition result;

[0173] Obtaining a score for the forward recognition result according to the standard values ​​corresponding to the forward recognition result and the forward formula recognition result, and obtaining a score for the reverse recognition result according to the standard values ​​corresponding to the reverse recognition result and the reverse formula recognition result;

[0174] The formula included in the image to be processed is determined according to the recognition result with a higher score between the score of the forward recognition result and the score of the reverse recognition result.

[0175] Optionally, the formula recognition results in at least two directions include at least two of the following:

[0176] The formula recognition results corresponding to the direction from top to bottom, the formula recognition results corresponding to the direction from bottom to top, the formula recognition results corresponding to the direction from front to back, and the formula recognition results corresponding to the direction from back to front.

[0177] 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 456, one or more keyboards 456, and / or one or more operating systems 441, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0178] 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:

[0179] Obtaining an image to be processed including a formula;

[0180] Processing the image to be processed to obtain formula recognition results in at least two directions, wherein the formula recognition results in at least two directions are: formula recognition results obtained by processing image features of the image to be processed according to the at least two directions;

[0181] According to the formula recognition results in the at least two directions, the formula included in the image to be processed is determined.

[0182] Optionally, the processing the image to be processed to obtain formula recognition results in at least two directions includes:

[0183] Encoding the image to be processed to obtain image features of the image to be processed;

[0184] The image features are processed according to the at least two directions to obtain formula recognition results in the at least two directions.

[0185] Optionally, encoding the image to be processed to obtain image features of the image to be processed is achieved through an encoder, and the network structure of the encoder is determined by a neural network architecture search (NAS) algorithm.

[0186] Optionally, the processing of the image features according to the at least two directions to obtain the formula recognition results of the at least two directions is implemented by a decoder, and the decoder is:

[0187] A decoder based on connection time classification CTC, or a decoder based on attention, or a decoder in a Transformer model.

[0188] Optionally, the formula recognition results in at least two directions include a forward recognition result and a reverse recognition result, the forward formula recognition result being a formula recognition result obtained by processing the image features of the image to be processed in a front-to-back order, and the reverse formula recognition result being a formula recognition result obtained by processing the image features in a back-to-front order.

[0189] Optionally, determining the formula included in the image to be processed according to the forward formula recognition result and the reverse formula recognition result includes:

[0190] Determine the standard value corresponding to the reverse formula recognition result according to the forward formula recognition result, and determine the standard value corresponding to the forward formula recognition result according to the reverse formula recognition result;

[0191] Obtaining a score for the forward recognition result according to the standard values ​​corresponding to the forward recognition result and the forward formula recognition result, and obtaining a score for the reverse recognition result according to the standard values ​​corresponding to the reverse recognition result and the reverse formula recognition result;

[0192] The formula included in the image to be processed is determined according to the recognition result with a higher score between the score of the forward recognition result and the score of the reverse recognition result.

[0193] Optionally, the formula recognition results in at least two directions include at least two of the following:

[0194] The formula recognition results corresponding to the direction from top to bottom, the formula recognition results corresponding to the direction from bottom to top, the formula recognition results corresponding to the direction from front to back, and the formula recognition results corresponding to the direction from back to front.

[0195] 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.

[0196] 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.

[0197] 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 formula recognition method, It is characterized in that The method comprises: Obtaining an image to be processed including a formula; Processing the image to be processed to obtain formula recognition results in at least two directions, including: encoding the image to be processed to obtain image features of the image to be processed; processing the image features according to the at least two directions to obtain formula recognition results in the at least two directions; the formula recognition results in the at least two directions are: formula recognition results obtained by processing the image features of the image to be processed according to the at least two directions, and the formula recognition results in the at least two directions include at least two of the following: a formula recognition result corresponding to a direction from top to bottom, a formula recognition result corresponding to a direction from bottom to top, a formula recognition result corresponding to a direction from front to back, and a formula recognition result corresponding to a direction from back to front; According to the formula recognition results in the at least two directions, the formula included in the image to be processed is determined.

2. The method according to claim 1, It is characterized in that The encoding of the image to be processed to obtain the image features of the image to be processed is achieved through an encoder, and the network structure of the encoder is determined by a neural network architecture search NAS algorithm.

3. The method according to claim 1, It is characterized in that The processing of the image features according to the at least two directions to obtain the formula recognition results of the at least two directions is implemented by a decoder, and the decoder is: A decoder based on connection time classification CTC, or a decoder based on attention, or a decoder in a Transformer model.

4. The method according to claim 1, It is characterized in that The formula recognition results in at least two directions include a forward formula recognition result and a reverse formula recognition result. The forward formula recognition result is a formula recognition result obtained by processing the image features of the image to be processed in a front-to-back order, and the reverse formula recognition result is a formula recognition result obtained by processing the image features in a back-to-front order.

5. The method according to claim 4, It is characterized in that Determining the formula included in the image to be processed according to the forward formula recognition result and the reverse formula recognition result, including: Determine the standard value corresponding to the reverse formula recognition result according to the forward formula recognition result, and determine the standard value corresponding to the forward formula recognition result according to the reverse formula recognition result; According to the forward formula recognition result and the standard value corresponding to the forward formula recognition result, a score of the forward formula recognition result is obtained; according to the reverse formula recognition result and the standard value corresponding to the reverse formula recognition result, a score of the reverse formula recognition result is obtained; The formula included in the image to be processed is determined according to the recognition result with a higher score among the scores of the forward formula recognition result and the reverse formula recognition result.

6. A formula recognition device, It is characterized in that The device comprises: An acquisition unit, used for acquiring an image to be processed including a formula; A processing unit is used to process the image to be processed to obtain formula recognition results in at least two directions, which includes: encoding the image to be processed to obtain image features of the image to be processed; processing the image features according to the at least two directions to obtain formula recognition results in the at least two directions; the formula recognition results in the at least two directions are: the formula recognition results obtained by processing the image features of the image to be processed according to the at least two directions, and the formula recognition results in the at least two directions include at least two of the following: the formula recognition result corresponding to the direction from top to bottom, the formula recognition result corresponding to the direction from bottom to top, the formula recognition result corresponding to the direction from front to back, and the formula recognition result corresponding to the direction from back to front; A determination unit is used to determine the formula included in the image to be processed according to the formula recognition results in the at least two directions.

7. The device according to claim 6, It is characterized in that The encoding of the image to be processed to obtain the image features of the image to be processed is achieved through an encoder, and the network structure of the encoder is determined by a neural network architecture search NAS algorithm.

8. The device according to claim 6, It is characterized in that The processing of the image features according to the at least two directions to obtain the formula recognition results of the at least two directions is implemented by a decoder, and the decoder is: A decoder based on connection time classification CTC, or a decoder based on attention, or a decoder in a Transformer model.

9. The device according to claim 6, It is characterized in that The formula recognition results in at least two directions include a forward formula recognition result and a reverse formula recognition result. The forward formula recognition result is a formula recognition result obtained by processing the image features of the image to be processed in a front-to-back order, and the reverse formula recognition result is a formula recognition result obtained by processing the image features in a back-to-front order.

10. The device according to claim 9, It is characterized in that The determining unit is used for: Determine the standard value corresponding to the reverse formula recognition result according to the forward formula recognition result, and determine the standard value corresponding to the forward formula recognition result according to the reverse formula recognition result; According to the forward formula recognition result and the standard value corresponding to the forward formula recognition result, a score of the forward formula recognition result is obtained; according to the reverse formula recognition result and the standard value corresponding to the reverse formula recognition result, a score of the reverse formula recognition result is obtained; The formula included in the image to be processed is determined according to the recognition result with a higher score among the scores of the forward formula recognition result and the reverse formula recognition result.

11. A formula recognition device, It is 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 an image to be processed including a formula; Processing the image to be processed to obtain formula recognition results in at least two directions, including: encoding the image to be processed to obtain image features of the image to be processed; processing the image features according to the at least two directions to obtain formula recognition results in the at least two directions; the formula recognition results in the at least two directions are: formula recognition results obtained by processing the image features of the image to be processed according to the at least two directions, and the formula recognition results in the at least two directions include at least two of the following: a formula recognition result corresponding to a direction from top to bottom, a formula recognition result corresponding to a direction from bottom to top, a formula recognition result corresponding to a direction from front to back, and a formula recognition result corresponding to a direction from back to front; According to the formula recognition results in the at least two directions, the formula included in the image to be processed is determined.

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