A character division method, device, computer equipment and storage medium
By constructing a neural network character classification model, different types of mathematical formula characters are identified and fused, solving the problem of inaccurate recognition of two-dimensional mathematical formulas and achieving higher recognition accuracy and character element integrity.
Patent Information
- Application Number
- CN202411714490.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2044-11-27
AI Technical Summary
Existing technologies lack sufficient accuracy in recognizing mathematical formulas with multi-layered two-dimensional structures, especially matrices and determinants.
A character classification model based on neural networks is constructed to determine the type of the character to be recognized. The model is then fused by determining the range coordinates and attractiveness of compound characters, variable characters, and binary characters to improve recognition accuracy.
By classifying and integrating different types of characters, the accuracy of recognizing two-dimensional mathematical formulas is improved, ensuring the integrity and accuracy of character elements.
Smart Images

Figure CN119649385B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of character recognition, and particularly relates to a character division method and device, computer equipment and a storage medium. BACKGROUND
[0002] Mathematical formula recognition technology is mainly divided into two types: one type is based on syntax driving, which includes three steps, namely character segmentation, recognition and spatial relationship structure analysis. Such as applying SVM, K-means, graph structure, syntax tree and the like for recognition. The other type is based on the theory and method of deep learning, such as realizing end-to-end recognition of mathematical formula by improving the network structure; adopting the framework of encoding and decoding, and introducing attention mechanism. Such as adopting an end-to-end model architecture, while introducing an attention mechanism; applying a dense convolutional network as an encoder, a gated recurrent unit as a decoder, and an attention mechanism for mathematical formula recognition; applying a paired adversarial learning algorithm to recognize printed mathematical formulas; decoding the formula into a tree structure through a sequence relationship decoder for online handwritten mathematical expression recognition. This kind of recognition algorithm is the main research field of current mathematical formula recognition.
[0003] However, so far, the recognition object is general mathematical formula, ignoring the particularity of the multi-layer two-dimensional structure of matrix, determinant and the like, resulting in inaccurate recognition of mathematical formula with the above two-dimensional structure of matrix or determinant. SUMMARY
[0004] In order to solve the problem of inaccurate recognition of mathematical formula with two-dimensional structure, the present application provides a character division method, device, computer equipment and storage medium.
[0005] In order to achieve the above purpose, the present application provides the following technical scheme:
[0006] Firstly, a character division method is provided, which comprises:
[0007] A character classification model based on neural network is constructed, and the character type of the to-be-recognized character is determined according to the character classification model; the character type includes composite character, variable character, binary character and general character; the composite character is a two-dimensional structure character with a boundary symbol as a peripheral boundary, the variable character is a character containing only a giant operator, the binary character is a character containing only a binary operator, and the general character is a character other than the composite character, variable character and binary character;
[0008] The range coordinates of the region where the composite character, variable character, binary character and general character are located are determined;
[0009] In the range coordinates of the same composite character, the attraction degrees between regions where different characters are located are determined according to the range coordinates of the variable character, the binary character and the general character;
[0010] The variable character, the binary character and the general character are fused according to the attraction degrees, and a target character is determined.
[0011] Optionally, the constructing the character classification model, and determining the character type of the to-be-recognized character according to the character classification model comprises:
[0012] The YOLOv8 model is constructed, the YOLOv8 model is trained through the pre-acquired training sample, and a character classification model is obtained;
[0013] The to-be-recognized character is input into the character classification model, and the character type of the to-be-recognized character is determined.
[0014] Optionally, the range coordinates of the regions where the composite character, the variable character, the binary character and the general character are located are determined as follows:
[0015] The range coordinates of the region where the composite character is located are determined according to the left upper corner point coordinates and the right lower corner point coordinates of the composite character;
[0016] The range coordinates of the region where the variable character is located are determined as follows:
[0017]
[0018] The range coordinates of the region where the binary character is located are determined as follows:
[0019]
[0020] The range coordinates of the region where the general character is located are determined according to the left upper corner point coordinates and the right lower corner point coordinates of the general character;
[0021] wherein, maxx is the maximum horizontal coordinate of the range coordinates, minx is the minimum horizontal coordinate of the range coordinates, maxy is the maximum vertical coordinate of the range coordinates, miny is the minimum vertical coordinate of the range coordinates, charmax is the maximum value of the region, charmin is the minimum value of the region, h is the bounding box height of the region where the character is located, and w is the bounding box width of the region where the character is located.
[0022] Optionally, the determination formula of the attraction degree is as follows:
[0023]
[0024] wherein, d(E, F) is the attraction degree of the regions where two different characters E and F are located, dx and dy are respectively the horizontal distance and the vertical distance of the overlapping part of the range coordinates of different characters.
[0025] Optionally, the target character is determined by fusing the variable character, the binary character and the general character according to the attraction degrees.
[0026] In a case where the attraction degrees of regions where two adjacent different characters are located are less than or equal to a preset attraction degree, the two adjacent different characters are fused according to a preset fusion formula, and the target character is determined.
[0027] Optionally, the preset fusion formula is:
[0028]
[0029] wherein, L x1 , L y1 , L x2 and L y2 are horizontal and vertical coordinates of top-left points of range coordinates of two different characters to be fused, R x1 , R y1 , R x2 and R y2 are horizontal and vertical coordinates of bottom-right points of the range coordinates of the two different characters to be fused, NL x , NL y , NR x and NR y are horizontal and vertical coordinates of top-left points and horizontal and vertical coordinates of bottom-right points of range coordinates of the fused character.
[0030] Optionally, in a case where the attraction degrees of regions where two adjacent different characters are located are less than or equal to a preset attraction degree, the target character is determined by fusing the two adjacent different characters according to a preset fusion formula, and the target character is determined.
[0031] In a case where a first attraction degree between a region where a first character is located and a region where a second character is located, and a second attraction degree between the region where the first character is located and a region where a third character is located are less than or equal to a preset attraction degree, the first attraction degree and the second attraction degree are compared.
[0032] The two regions corresponding to the smaller attraction degree between the first attraction degree and the second attraction degree are fused.
[0033] In a case where the first attraction degree and the second attraction degree are the same, the regions where the first character, the second character and the third character are located are kept unchanged.
[0034] Secondly, a character division device is provided, and the device comprises:
[0035] The constructing module is configured to construct a neural network-based character classification model, and determine a character type of a character to be recognized according to the character classification model; the character type includes a composite character, a variable character, a binary character and a general character; the composite character is a two-dimensional structure character with a boundary delimiter, the variable character is a character containing only a macro operator, the binary character is a character containing only a binary operator, and the general character is a character other than the composite character, the variable character and the binary character;
[0036] The coordinate determining module is configured to determine range coordinates of regions where the composite character, the variable character, the binary character and the general character are located.
[0037] The attraction degree determining module is configured to determine an attraction degree between regions where different characters are located according to range coordinates of the variable character, the binary character and the general character in the range coordinates of the same composite character.
[0038] The fusing module is configured to fuse the variable character, the binary character and the general character according to the attraction degree, and determine a target character.
[0039] In addition, a computer readable storage medium is provided, and the storage medium stores a computer program, and the computer program is executed by a processor to implement the character division method.
[0040] Finally, a computer device is provided, which includes a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the character division method when executing the program.
[0041] The character division method has the following beneficial effects:
[0042] Firstly, the characters are classified to determine the character type of the character to be recognized, so that the characters to be recognized of different types can be processed respectively according to their particularities, which is beneficial to improve the accuracy of character processing; then, the composite character is used for range division, i.e., the range coordinates of regions where different characters are located in the composite character are determined, and the fusion degree is determined according to the range coordinates of the regions where different characters are located, and further fusion division is performed according to the fusion degree, so as to ensure the integrity and accuracy of the character elements, which fully considers the composite character with two-dimensional structure, and further performs character division in the composite character, which is beneficial to improve the recognition accuracy of mathematical formulas with two-dimensional structure. BRIEF DESCRIPTION OF DRAWINGS
[0043] In order to make the skilled in the art better understand the technical scheme of the present application and can be implemented, the following will be combined with the specific embodiments of the present application detailed description. The following examples are only used to more clearly illustrate the technical scheme of the present application, and can not be used to limit the protection scope of the present application.
[0044] Figure 1 Handwritten character schematic diagram provided by the present application according to an exemplary embodiment.
[0045] Figure 2 Flowchart of character segmentation method provided by the present application according to an exemplary embodiment.
[0046] Figure 3 Another handwritten character rough grouping schematic diagram provided by the present application according to an exemplary embodiment.
[0047] Figure 4 Block diagram of character segmentation device provided by the present application according to an exemplary embodiment. DETAILED DESCRIPTION
[0048] In order to make the skilled in the art better understand the technical scheme of the present application and can be implemented, the following will be combined with the specific embodiments of the present application detailed description. The following examples are only used to more clearly illustrate the technical scheme of the present application, and can not be used to limit the protection scope of the present application.
[0049] Handwritten compound formula and printed compound formula have differences in arrangement neatness. The rows and columns of printed compound formula are usually arranged more neatly. Handwritten compound formula often appears staggered between two columns or row inclined, etc., as shown in Figure 1 Therefore, the vertical projection and horizontal projection method is not suitable for its segmentation, so the effective segmentation of handwritten compound is a difficult problem in mathematical formula recognition.
[0050] The following will be combined with the specific embodiments of the present application detailed description of the technical scheme provided by each embodiment of the present application.
[0051] Firstly, the present application provides a character segmentation method, as shown in Figure 2 The method comprises the following steps:
[0052] S201, a character classification model based on neural network is constructed, and the character type of the to-be-recognized character is determined according to the character classification model.
[0053] Specifically, first, a YOLOv8 model can be constructed, and the YOLOv8 model is trained by pre-acquired training samples to obtain a character classification model. Secondly, the to-be-recognized character is input into the character classification model to determine the character type of the to-be-recognized character.
[0054] The character types include a composite character, a variable character, a binary character, and a general character; the composite character is a two-dimensional structure character with a delimiter as a boundary; the variable character is a character containing only a macro operator; the binary character is a character containing only a binary operator; and the general character is a character other than the composite character, the variable character, and the binary character.
[0055] Based on the high accuracy and fast processing capability of YOLOv8 on object classification problems, real-time effects can also be achieved on general edge devices. For these characters, because the classification is less, the minimum version YOLOv8n of YOLOv8 is applied to classify the composite character, the variable character, the binary character, and the general character, and to obtain the regions of these characters. During training, the pre-trained weights thereof are adopted, and after sample training, the weights for classifying such characters are obtained.
[0056] Illustratively, a plurality of sample formulas containing the composite character, the variable character, the binary character, and the general character and corresponding classification results thereof can be obtained in advance, the plurality of sample formulas are respectively input into YOLOv8 to obtain recognition results, YOLOv8 is trained to minimize the difference between the recognition results and the classification results, and a character classification model is obtained.
[0057] The outermost characters of the composite shape are relatively simple, including (, ), [, ], |, {,}, and ‖, that is, for the two-dimensional structure character with a delimiter as a boundary, the present application collectively refers to these as composite characters. The present application is to segment the composite characters, and the bounding box of the character needs to be used, that is, the range coordinates of the composite character are needed. At the same time, characters such as fraction lines, and macro operator characters have large size variations when written, so the present application refers to the above-mentioned characters containing only macro operators as variable characters. In addition, formula symbols such as "+", "-", "≥", and are binary operators, which are generally used for horizontal connection and require a wide area, and the present application refers to the above-mentioned characters containing only binary operators as binary characters. All characters other than the above-mentioned three types of characters, namely the composite character, the variable character, and the binary character, are referred to as general characters.
[0058] S202, determining the range coordinates of the region where the composite character, the variable character, the binary character, and the general character are located.
[0059] Because mathematical formulas express their mathematical meaning according to spatial relationship structures, and form some unique writing methods in the long-term use process, if the bounding box of each character is directly used as its region, the accuracy of the final result will be reduced, and this rule is also applicable to variable characters and binary characters.
[0060] Let the maximum and minimum horizontal and vertical coordinates of the region where the character is located be charmaxx, charminx, charmaxy and charminy, and the maximum and minimum horizontal and vertical coordinates of the region be maxx, maxy, minx and miny.
[0061] Specifically, for a composite character, the range coordinates of the region where the composite character is located are determined according to the upper-left corner point coordinates and the lower-right corner point coordinates of the composite character.
[0062] For a variable character, the character generally has upper and lower adjacent characters, and these adjacent characters are usually in a cell with the variable character in the formula. In order to effectively attract these characters to a region, the regions of these characters are increased by a value in the up and down directions of the original regions. According to experimental statistics of different values, the value is determined to be h / 6, and h is the height of the boundary box of the characters.
[0063] The range coordinates of the region where the variable character is located are determined as follows:
[0064]
[0065] The region where the variable character is located is expanded in the vertical direction to enhance the attraction degree between adjacent characters
[0066] For a binary character, the writing format of such a character in the formula is larger than the left and right spaces of general characters, so the regions of these characters are also increased by w / 4 on the left and right sides based on the original regions, and w represents the width of the boundary box of the characters. In the horizontal direction, the range coordinates of the region where the binary character is located are determined as follows:
[0067]
[0068] The region where the binary character is located is expanded in the horizontal direction to enhance the attraction degree between adjacent characters
[0069] The range coordinates of the region where the general character is located are determined according to the upper-left corner point coordinates and the lower-right corner point coordinates of the general character.
[0070] wherein, maxx is the maximum horizontal coordinate of the range coordinates, minx is the minimum horizontal coordinate of the range coordinates, maxy is the maximum vertical coordinate of the range coordinates, miny is the minimum vertical coordinate of the range coordinates, charmax is the maximum value of the region, charmin is the minimum value of the region, h is the height of the boundary box of the character, w is the width of the boundary box of the character, and int(·) is the integer function.
[0071] S203, in the range coordinates of the same composite character, the attraction degree between the regions where different characters are located is determined according to the range coordinates of the variable character, the binary character and the general character.
[0072] wherein, for the composite character, after obtaining the composite character through the character classification model, the region where the composite character is located and the characters within the range of the composite character can be located through the symmetry relationship of the composite character.
[0073] For example, let the horizontal and vertical coordinates of the top-left corner point of the left character region be (Lx, Ly), the horizontal and vertical coordinates of the bottom-right corner point of the right character region be (Rx, Ry), and the coordinates of the center point of the bounding box of all characters except the composite character be (Cx, Cy), then the characters within the composite shape are determined through the following algorithm 1. ix iy
[0074] Algorithm 1: / / According to the coordinates of the composite character in the matrix and determinant, find all characters within this region and put them in L.
[0075] s 1: Start empty, that is, start with nothing.
[0076] s2: traverse all variable characters, binary characters and general characters C i in the mathematical formula.
[0077] If Rx> C ix x and Ry> C iy y, then L <- C i .
[0078] s3: return L.
[0079] The center point coordinates of the variable character, the binary character and the general character are used because of the irregularity of the handwritten formula. It often appears that the upper boundary of the first row of characters or the lower boundary of the last row of characters exceeds the upper and lower boundaries of the composite character. Therefore, the center point coordinates of the bounding box of all characters except the composite character are used for calculation.
[0080] In the same composite character, the attraction degree between the regions where different characters are located is determined according to the range coordinates of the variable character, the binary character and the general character; the variable character, the binary character and the general character are fused according to the attraction degree to determine the target character.
[0081] The attraction degree refers to the degree of attraction between two character regions. In a handwritten mathematical formula, the farther apart the two regions are, the weaker the attraction degree is. If the two regions do not intersect, the direction farther apart in the horizontal and vertical directions is more likely to indicate the degree of separation of the two regions. If the two regions intersect, the more overlapping, the stronger the attraction.
[0082] For example, here E and F represent two regions (E on the left and F on the right), and the determination formula of the attraction degree d(E, F) of the two regions is as follows:
[0083]
[0084] Where d(E, F) is the attraction degree of the regions of two different characters E and F, and dx and dy are the horizontal distance and vertical distance of the overlapping part of the coordinates of the ranges of different characters, respectively.
[0085] When E and F intersect, dx and dy are the horizontal distance and vertical distance of the overlapping part, respectively. If dx or dy is 0, it is determined that the two regions do not intersect.
[0086] When E and F do not intersect, dx represents the shortest horizontal distance of the vertical edge lines of the two regions, and dy represents the shortest vertical distance of the horizontal edge lines. Alpha is a coefficient. It is found through experiments that characters with an up-down relationship in different regions are easily attracted to one region only according to the distance, and therefore different alpha is applied for experiments, and the optimal result is alpha = 1.5. Finally, 1 is added for the continuity of the distance formula.
[0087] max(·) represents the maximum value of all parameters. If d(E, F) is smaller, it indicates that the attraction degree of the two rectangles is stronger, and vice versa. The two regions with a stronger attraction degree should be merged.
[0088] S204, according to the attraction degree, merging the variable character, binary character and general character to determine the target character.
[0089] In the case where the attraction degree of the regions of two adjacent different characters is less than or equal to a preset attraction degree, the two adjacent different characters are merged according to a preset merging formula to determine the target character.
[0090] Specifically, if the distance between the two regions is less than a threshold value δ (different values are taken in experiments according to different situations), the two regions are said to be attracted, otherwise the two regions are said to be not attracted. As shown in the following formula. When d(E, F) is less than δ, result is 1, indicating that the two regions are attracted, otherwise 0.
[0091] result = d(E, F) < δ.
[0092] If two regions are attracted, then merge them to form a new region. Let the horizontal and vertical coordinates of the left upper corner point and the right lower corner point of the two regions be (L x1 ,L y1 ), (R x1 ,R y1 ), (L x2 ,L y2 ), (R x2 ,R y2 ), and the horizontal and vertical coordinates of the left upper corner point and the right lower corner point of the new region be (NL x ,NL y ), (NR x ,NR y ), then the preset merging formula is:
[0093]
[0094] wherein L x1 , L y1 , L x2 and L y2 are respectively the horizontal and vertical coordinates of the left upper point of the range coordinates of the two different characters to be merged, R x1 , R y1 , R x2 and R y2 are respectively the horizontal and vertical coordinates of the right lower point of the range coordinates of the two different characters to be merged, NL x , NL y , NR x and NR y are respectively the horizontal and vertical coordinates of the left upper point and the right lower point of the range coordinates of the merged character.
[0095] After the type of the character is obtained, the range coordinates of the region where the character of different types is located are determined, and the attraction degree is determined based on the range coordinates of the region where the character is located, and then whether the regions where the two adjacent different characters are located are attracted is determined, specifically, the algorithm is called the adsorption method. It is divided into the following two parts:
[0096] (1) The non-complex character is divided into formula elements, that is, the characters belonging to the i-th row and j-th column are determined.
[0097] (2) The formula elements are numbered in rows and columns, and the structure of the complex character is determined.
[0098] In a complex character, there is a certain distance between the rows and columns, and in most cases, the attraction degree of the character region in the same cell is smaller than that of the character region in different cells, and the attraction degree of the complex character in the same cell is smaller than that of the complex character in different cells. According to this rule, the region formed by the characters attracted is first determined.
[0099] For example, let L = (C1, C2,..., C n ), C i (i = 1, 2,... n) represents the area where the composite character is located. First, take C1 as the area A1 where the first target character is located, and calculate d(A1, C t ), (t = 2,... n). Assume that the first area that attracts A1 is C t , that is, d(A1, C t ) < δ, then merge A1 and C t into a new composite character area, still named A1. Through experimental comparative analysis, the threshold δ finally takes the value of 5 here.
[0100] Then calculate d(A1, C p1 ), where t < p1 ≤ n. Similarly, if there is C p1 that attracts A1, then continue to merge C p1 and A1 into a new composite character area, still named A1, and continue to judge whether the subsequent character areas of C p1 attract A1 until C n . Finally, a composite character area A1 is obtained, and this area is called the first area. Let L1 represent the set formed by the character areas within the first area.
[0101] For the first unmerged character area C 21 , C 21 in L, take it as the area A2 where the second target character is located, and sequentially find the first character area C 21 in L that is different from C 21 but attracts C p2 (1 ≤ p2 ≤ n), merge these two areas, still named A2, and continue to use A2 to judge the attraction with the subsequent character areas in L until C p2 As shown, the character '3' in the first column of the second row is attracted to two different regions (indicated by the dashed boxes), so it is necessary to determine which region the '3' will ultimately be divided into.
[0105] The second problem is that a character region that should have been divided into one region is divided into different regions. For example, Figure 2 in the case of the second column of the second row in 22 "P 22 " and '3' are divided into different regions. The reason for this situation is that due to the different order of character extraction, when '3' is ranked before P 22 in L, since '3' is not attracted to any character region, it forms an independent region by itself. In the subsequent discrimination of character regions in P and L, because '3' is extracted and discriminated first, and then attracted to the region of '2' on the left. Although a new region is formed and attracted to '3' at this time, '3' has already been discriminated, so '3' will not be discriminated to be attracted to the region where 22 "P
[0106] First, deal with the first problem. When the first attraction degree between the region where the first character is located and the region where the second character is located, and the second attraction degree between the region where the first character is located and the region where the third character is located are both less than or equal to the preset attraction degree, determine the magnitudes of the first attraction degree and the second attraction degree; determine the two regions corresponding to the smaller attraction degree among the first attraction degree and the second attraction degree for fusion; when the first attraction degree and the second attraction degree are the same, keep the regions where the first character, the second character, and the third character are located unchanged.
[0107] [[ID=!7]]That is, when a character region belongs to two different regions, let the character region of the first region be and the character region of the second region be Let the composite region formed by the former be M, and the region formed by the latter be N. If d(M, P) < d(N, P), then p belongs to the first region; otherwise, it belongs to the second region.
[0108] On the basis of solving the first problem, for the second problem, group all the independent regions A i using the character region division algorithm for adsorption grouping. Since this is a discrimination based on the adsorption of the composite region and a single character, if the threshold δ is too large, two similar regions will be attracted into a large composite region. Therefore, the adsorption threshold should be relatively reduced at this time. Through experimental analysis, take this threshold as ⅓ of δ.
[0109] Finally, obtain a set of regions A' = (A1, A2,..., A r ), and a character region belongs to only one region. It can be considered that these regions are the formula elements in the composite characters.
[0110] By using the above method, firstly, the characters are classified to determine the character type of the to-be-recognized character, so that the to-be-recognized characters of different types can be processed respectively according to the particularity of the to-be-recognized characters, which is beneficial to improve the accuracy of character processing; and then the range of the composite character is divided, that is, the range coordinates of the regions of different characters in the composite character are determined, and the fusion degree is determined according to the range coordinates of the regions of different characters, and the fusion division is further performed according to the fusion degree, so as to ensure the integrity and accuracy of the character elements, so that the composite character with two-dimensional structure is fully considered, and the character division is further performed in the composite character, which is beneficial to improve the recognition accuracy of the mathematical formula with two-dimensional structure.
[0111] Secondly, the application further provides a character division device, as shown in the description, Figure 4 as shown in the description,
[0112] The construction module 401 is configured to construct a character classification model based on a neural network, and determine the character type of the to-be-recognized character according to the character classification model; the character type includes a composite character, a variable character, a binary character and a general character; the composite character is a two-dimensional structure character with a delimiter as a boundary, the variable character is a character containing only a big operator, the binary character is a character containing only a binary operator, and the general character is a character other than the composite character, the variable character and the binary character.
[0113] The coordinate determination module 402 is configured to determine the range coordinates of the regions of the composite character, the variable character, the binary character and the general character.
[0114] The attraction degree determination module 403 is configured to determine the attraction degree between the regions of different characters in the range coordinates of the same composite character according to the range coordinates of the variable character, the binary character and the general character.
[0115] The fusion module 404 is configured to fuse the variable character, the binary character and the general character according to the attraction degree to determine a target character.
[0116] By using the above device, firstly, the characters are classified to determine the character type of the to-be-recognized character, so that the to-be-recognized characters of different types can be processed respectively according to the particularity of the to-be-recognized characters, which is beneficial to improve the accuracy of character processing; and then the range of the composite character is divided, that is, the range coordinates of the regions of different characters in the composite character are determined, and the fusion division is further performed according to the range coordinates of the regions of different characters, so as to ensure the integrity and accuracy of the character elements, so that the composite character with two-dimensional structure is fully considered, and the character division is further performed in the composite character, which is beneficial to improve the recognition accuracy of the mathematical formula with two-dimensional structure.
[0117] The application further provides a computer readable storage medium, which stores a computer program, and the computer program can be used to execute the above method. Figure 1 The steps of the character division method are provided.
[0118] The application further provides a computer device, which comprises a processor, an internal bus, a network interface, a memory and a nonvolatile memory at a hardware level, and can further comprise other hardware required by a business. The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs, so as to implement the above method. Figure 1 The steps of the character division method are provided.
[0119] Those skilled in the art should understand that the embodiments of the application can be provided as a method, a system or a computer program product. Therefore, the application can adopt a completely hardware embodiment, a completely software embodiment or an embodiment combining software and hardware aspects. Moreover, the application can adopt a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0120] The application is described with reference to flowcharts and / or block diagrams of the method, device (system) and computer program product according to the embodiments of the application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams and the combination of the flows and / or blocks can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The device for implementing the functions specified in one or more flows and / or blocks. Figure 1 The device for implementing the functions specified in one or more flows and / or blocks.
[0121] These computer program instructions can also be stored in a computer readable memory capable of guiding the computer or other programmable data processing devices to work in a specific way, so that the instructions stored in the computer readable memory produce a product comprising instruction devices, which implement the functions specified in the flowcharts and / or block diagrams. Figure 1 The device for implementing the functions specified in one or more flows and / or blocks. Figure 1 The device for implementing the functions specified in one or more flows and / or blocks.
[0122] These computer program instructions can also be loaded into the computer or other programmable data processing devices, so that a series of operation steps are performed on the computer or other programmable devices to produce a computer implemented process, so that the instructions executed on the computer or other programmable devices provide a process for implementing the functions specified in the flowcharts and / or block diagrams.Figure 1 one or more processes and / or functions specified in one or more blocks one or more blocks or steps of the functions specified in the one or more blocks.
[0123] It should be noted that the above-mentioned detailed embodiments can make those skilled in the art more fully understand the present application, but in no way limit the present application. Therefore, although the present application has been described in detail in the specification, those skilled in the art should understand that the present application can still be modified or equivalently replaced; all technical solutions and improvements that do not depart from the spirit and scope of the present application are covered in the protection scope of the patent of the present application. Any reference signs in the claims should not be regarded as limiting the claims involved.
Claims
1. A character division method characterized by, The method comprises: constructing a character classification model based on a neural network, and determining a character type of a to-be-recognized character according to the character classification model; the character type comprises a composite character, a variable character, a binary character, and a general character; the composite character is a two-dimensional structure character with a boundary delimiter on the periphery, the variable character is a character containing only a large operator, the binary character is a character containing only a binary operator, and the general character is a character other than the composite character, the variable character, and the binary character; determining range coordinates of a region where the composite character, the variable character, the binary character, and the general character are located; determining an attraction degree between regions where different characters are located according to range coordinates of the variable character, the binary character, and the general character within the range coordinates of the same composite character; fusing the variable character, the binary character, and the general character according to the attraction degree, and determining a target character; determining the range coordinates of the region where the composite character, the variable character, the binary character, and the general character are located comprises: determining the range coordinates of the region where the composite character is located according to a top-left corner coordinate and a bottom-right corner coordinate of the composite character; determining the range coordinates of the region where the variable character is located as: ; determining the range coordinates of the region where the binary character is located as: ; determining the range coordinates of the region where the general character is located according to a top-left corner coordinate and a bottom-right corner coordinate of the general character; wherein, maxx is a maximum horizontal coordinate of the range coordinate, minx is a minimum horizontal coordinate of the range coordinate, maxy is a maximum vertical coordinate of the range coordinate, miny is a minimum vertical coordinate of the range coordinate, charmax is a maximum value of the area, charmin is a minimum value of the area, h is a frame height of the area where the character is located, w is a frame width of the area where the character is located; a determination formula of the attraction degree is: ; wherein d(E,F) is the attraction degree of the regions where the two different characters E and F are located, are the horizontal and vertical distances of the intersection and overlap of the coordinate ranges of the different characters, respectively.
2. The character division method according to claim 1, characterized by, constructing a character classification model, and determining a character type of a to-be-recognized character according to the character classification model comprises: constructing a YOLOv8 model, training the YOLOv8 model through a pre-acquired training sample, and obtaining a character classification model; inputting the to-be-recognized character into the character classification model, and determining the character type of the to-be-recognized character.
3. The character division method of claim 1, wherein, fusing the variable character, the binary character, and the general character according to the attraction degree, and determining a target character comprises: in a case where an attraction degree of regions where two adjacent different characters are located is less than or equal to a preset attraction degree, fusing the two adjacent different characters according to a preset fusion formula, and determining a target character.
4. The character division method of claim 3, wherein, the preset fusion formula is: ; wherein, , , and are the horizontal and vertical coordinates of the upper left point of the range coordinates of the two different characters that are fused together, respectively, , , and are the horizontal and vertical coordinates of the lower right point of the range coordinates of the two different characters that are fused together, respectively, , , and are the horizontal and vertical coordinates of the upper left point and the lower right point of the range coordinates of the fused character, respectively.
5. The character division method of claim 4, wherein, in a case where an attraction degree of regions where two adjacent different characters are located is less than or equal to a preset attraction degree, fusing the two adjacent different characters according to a preset fusion formula, and determining a target character comprises: determining the sizes of a first attraction degree between a region where a first character is located and a region where a second character is located, and a second attraction degree between the region where the first character is located and a region where a third character is located; fusing two regions corresponding to the smaller attraction degree of the first attraction degree and the second attraction degree; in a case where the first attraction degree and the second attraction degree are the same, keeping the regions where the first character, the second character, and the third character are located unchanged.
6. A character dividing apparatus characterized by comprising: the device comprises: The constructing module is configured to construct a neural network-based character classification model, and determine a character type of a character to be recognized according to the character classification model; the character type includes a composite character, a variable character, a binary character and a general character; the composite character is a two-dimensional structure character with a delimiter as a periphery, the variable character is a character containing only a macro operator, the binary character is a character containing only a binary operator, and the general character is a character other than the composite character, the variable character and the binary character; The coordinate determining module is configured to determine range coordinates of a region where the composite character, the variable character, the binary character and the general character are located; the determination of the range coordinates of the region where the composite character, the variable character, the binary character and the general character are located includes: determining the range coordinates of the region where the composite character is located according to a top-left corner coordinate and a bottom-right corner coordinate of the composite character; determining the range coordinates of the region where the variable character is located as: ; determining the range coordinates of the region where the binary character is located as: ; determining the range coordinates of the region where the general character is located according to a top-left corner coordinate and a bottom-right corner coordinate of the general character; wherein, maxx is a maximum horizontal coordinate of the range coordinate, minx is a minimum horizontal coordinate of the range coordinate, maxy is a maximum vertical coordinate of the range coordinate, miny is a minimum vertical coordinate of the range coordinate, charmax is a maximum value of the area, charmin is a minimum value of the area, h is a border height of the area of the character, w is a border width of the area of the character; The attraction degree determining module is configured to determine an attraction degree between regions where different characters are located according to the range coordinates of the variable character, the binary character and the general character in the range coordinates of the same composite character; a determination formula of the attraction degree is: ; wherein d(E, F) is the attraction degree of the regions where the two different characters E and F are located, respectively the horizontal distance and the vertical distance of the overlapping part of the coordinates of the different character ranges. The fusion module is configured to fuse the variable character, the binary character and the general character according to the attraction degree, and determine a target character.
7. A computer readable storage medium characterized in that, The storage medium stores a computer program, and the computer program is executed by the processor to implement the method in any one of claims 1-5.
8. A computer device, comprising: The computer program is stored in the memory and executable on the processor, and the processor implements the method in any one of claims 1-5 when executing the program.