Method for recognizing a writing trajectory, computer device and storage means
Patent Information
- Application Number
- CN202211160942.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-22
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2042-09-22
AI Technical Summary
[0004]目前,通常利用手写识别模型对书写轨迹进行文字识别,识别过程较为繁琐,计算量大,从而导致对书写轨迹进行文字识别出现识别错字或漏字等的情况,识别效率或准确率不高
[0009]上述方案,通过在书写输入过程中,基于当前输入的文本书写轨迹的轨迹特征进行第一文本识别,得到目标文本识别结果,可以在用户书写输入的过程中实时获取轨迹特征的目标文本识别结果,减少用户等待识别结果的时间,提高文本识别的效率;在书写输入结束之后,可以响应于书写输入满足结束条件,基于输入的所有文本书写轨迹的轨迹特征进行第二文本识别,得到准确率较高的参考文本识别结果,利用参考文本识别结果对目标文本识别结果进行校正,得到经校正的目标文本识别结果,可以提升目标文本识别结果的准确率,从而兼顾文本识别效率和准确率。
Smart Images

Figure CN115565184B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method for recognizing writing trajectories, a computer device, and a storage device. Background Technology
[0002] With the widespread use of smart devices such as smartphones, tablets, and laptops, handwriting input has gradually become the mainstream input method. Compared with keyboard input methods, handwriting input can greatly improve input speed. It can be achieved using only a stylus or finger, is closer to human writing habits, and is one of the most natural and convenient means of human-computer interaction.
[0003] Handwriting recognition refers to the process of converting ordered trajectory information generated when writing on a handwriting device into text. During the writing process, it is possible to recognize the text input by handwriting.
[0004] Currently, handwriting recognition models are commonly used to recognize characters from writing trajectories. The recognition process is quite cumbersome and computationally intensive, which can lead to errors such as misrecognition or omissions, resulting in low recognition efficiency or accuracy. Summary of the Invention
[0005] The main technical problem addressed by this application is to provide a method, computer device, and storage device for recognizing writing trajectories, which can improve the efficiency and accuracy of writing trajectory recognition.
[0006] To address the aforementioned issues, the first aspect of this application provides a method for recognizing writing trajectories. This method includes: during writing input, performing first text recognition based on the trajectory features of the currently input text writing trajectory to obtain a target text recognition result; responding to the writing input meeting an end condition, performing second text recognition based on the trajectory features of all input text writing trajectories to obtain a reference text recognition result; and using the reference text recognition result to correct the target text recognition result to obtain a corrected target text recognition result.
[0007] To address the aforementioned problems, a second aspect of this application provides a computer device comprising a memory and a processor coupled to each other, wherein the memory stores program data and the processor executes the program data to implement any step of the aforementioned method for recognizing writing trajectories.
[0008] To address the aforementioned problems, a third aspect of this application provides a storage device that stores program data executable by a processor, the program data being used to implement any step of the aforementioned method for recognizing writing trajectories.
[0009] The above scheme performs first text recognition based on the trajectory features of the currently input text during the writing input process to obtain the target text recognition result. This allows for real-time acquisition of the target text recognition result based on the trajectory features during user writing input, reducing the user's waiting time for recognition results and improving text recognition efficiency. After the writing input ends, in response to the completion of the writing input, a second text recognition is performed based on the trajectory features of all input text writing trajectories to obtain a reference text recognition result with higher accuracy. The target text recognition result is then corrected using the reference text recognition result to obtain the corrected target text recognition result, which can improve the accuracy of the target text recognition result, thus balancing text recognition efficiency and accuracy. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in this application, the accompanying drawings required in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Among them:
[0011] Figure 1 This is a flowchart illustrating the first embodiment of the writing trajectory recognition method of this application;
[0012] Figure 2 This is a flowchart illustrating the second embodiment of the writing trajectory recognition method of this application;
[0013] Figure 3 This is a schematic diagram of an embodiment of the text writing trajectory and the trajectory points contained therein in this application;
[0014] Figure 4 This is a schematic diagram of an embodiment of the trajectory points included in the text writing trajectory after removing redundant points in this application;
[0015] Figure 5 This is a schematic diagram of an embodiment of the Bézier curve in this application;
[0016] Figure 6 This is a schematic diagram of an embodiment of the writing trajectory recognition model of this application;
[0017] Figure 7 This is a schematic diagram of the structure of an embodiment of the writing trajectory recognition device of this application;
[0018] Figure 8 This is a schematic diagram of the structure of an embodiment of the computer device of this application;
[0019] Figure 9 This is a schematic diagram of the structure of an embodiment of the storage device of this application. Detailed Implementation
[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0021] The terms "first" and "second" in this application are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus.
[0022] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0023] This application provides the following embodiments, and each embodiment is described in detail below.
[0024] Please see Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the writing trajectory recognition method of this application. The method may include the following steps:
[0025] S11: During the writing input process, the first text recognition is performed based on the trajectory features of the currently input text writing trajectory to obtain the target text recognition result.
[0026] The writing trajectory recognition method of this embodiment can be applied to devices such as smart terminals (such as mobile phones, smartwatches, etc.) and computers with writing input functions. This application does not limit this application.
[0027] The device can interactively receive the user's text writing trajectory. Users can write on the device's interactive module using a stylus or finger. The interactive module can include input software and input devices, such as smart terminals, tablets, and laptops with writable input capabilities. During the writing process, sensors can be used to collect the movement trajectory of the stylus or finger, thereby obtaining the written text trajectory.
[0028] In some implementations, the written text trajectory can be received through human-computer interaction. For example, the device's interaction module may use a mouse, touchscreen, keyboard, touch keyboard, or display as a channel for human-computer interaction, but this application is not limited to these.
[0029] In some implementations, users can use a stylus or finger to perform touch operations on the interaction module, so that the interaction module can respond to the touch operation of writing input, collect the trajectory points of the position movement trajectory of the touch operation, and obtain the writing trajectory of the written input text.
[0030] During the writing input process, the writing trajectory of the currently input text can be collected simultaneously, and character recognition can be performed on the writing trajectory of the currently input text. Specifically, the trajectory points of the writing trajectory of the currently input text can be obtained to obtain trajectory features, and the first character recognition can be performed on the trajectory features to obtain the target text recognition result.
[0031] In some implementations, the first text recognition is achieved using streaming decoding, which utilizes the trajectory features of the currently acquired text writing trajectory for character recognition. For example, the first text recognition may include using a streaming recognition model to perform character recognition on the current text writing trajectory to obtain the target text recognition result. The streaming recognition model can achieve single-character recognition of the currently input text writing trajectory.
[0032] S12: In response to the writing input meeting the termination condition, perform second text recognition based on the trajectory features of all text writing trajectories in the input to obtain the reference text recognition result.
[0033] When a user completes handwritten input of text information, that is, when the writing input meets the termination condition, a second recognition can be performed based on the trajectory features of all the text writing trajectories to obtain the reference text recognition result.
[0034] In some implementations, the second text recognition is achieved using a non-streaming decoding method, which utilizes the context between all trajectory features for text recognition. For example, the second text recognition includes using a non-streaming model to recognize text based on the trajectory features of all text writing trajectories, yielding reference text recognition results corresponding to all text writing trajectories. During the text recognition process, semantic expression can be performed based on the context of all writing trajectory features to obtain reference text recognition results with semantic information, resulting in better text recognition results.
[0035] S13: Correct the target text recognition result using the reference text recognition result to obtain the corrected target text recognition result.
[0036] After obtaining the reference text recognition result, since the reference text recognition result has semantic information, it can be used to correct the target text recognition result, so as to obtain a more accurate target text recognition result.
[0037] In this embodiment, by performing first text recognition based on the trajectory features of the currently input text during the writing input process, a target text recognition result is obtained. This allows for real-time acquisition of the target text recognition result based on the trajectory features during the user's writing input, reducing the user's waiting time for the recognition result and improving the efficiency of text recognition. After the writing input ends, in response to the writing input meeting the termination condition, a second text recognition is performed based on the trajectory features of all input text writing trajectories to obtain a reference text recognition result with higher accuracy. The target text recognition result is then corrected using the reference text recognition result to obtain a corrected target text recognition result, which can improve the accuracy of the target text recognition result, thus balancing text recognition efficiency and accuracy.
[0038] In some embodiments, before performing step S11 above, multiple trajectory points for each text writing trajectory can be obtained, thereby utilizing these multiple trajectory points to obtain the trajectory features of each text writing trajectory. Specifically, please refer to... Figure 2 , Figure 2 This is a flowchart illustrating a second embodiment of the writing trajectory recognition method of this application. This embodiment may include the following steps:
[0039] S21: For each detected input text writing trajectory, obtain multiple target trajectory points in the detected text writing trajectory.
[0040] In some implementations, before acquiring the trajectory points in step S21, it can be determined whether the writing input meets the recognition conditions. Specifically, it is determined whether the number of text writing trajectories currently input by the user meets the recognition conditions. A writing trajectory can include the strokes entered by the user from the first stroke to the last stroke during the input process. The recognition conditions include the number of writing trajectories reaching a preset number, which can be a number specified by the user, such as 15, 20, etc. This application does not limit the preset number.
[0041] In some implementations, if the number of text writing trajectories meets the recognition criteria, then the step of obtaining multiple trajectory points in the detected text writing trajectory is performed for each detected input text writing trajectory.
[0042] In some implementations, if the number of text writing trajectories meets the recognition criteria, the process continues to detect the text writing trajectories input by the user and determine whether the number of currently input text writing trajectories meets the recognition criteria.
[0043] Please see Figure 3 Each text writing trajectory includes multiple trajectory points. A text writing trajectory can be a set of trajectory points entered by the user during the input process, from the first stroke to the last stroke. The trajectory points of a text writing trajectory can be represented as (x1, y1, s1), (x2, y2, s2), ..., (xi, yi, si), where xi and yi are the horizontal and vertical coordinates of the trajectory point, and si indicates that the trajectory point (i.e., the coordinate information) belongs to the i-th text writing trajectory. After obtaining multiple trajectory points, the text writing trajectory can be represented in the form of a graph. For example, black dots can represent the input trajectory points, and curves of different colors (curves composed of trajectory points) can represent different text writing trajectories.
[0044] In some implementations, the set of multiple trajectory points included in the text writing trajectory can determine the width w and height h of the text writing trajectory. The coordinate information of all trajectory points can be used, and the maximum difference in the horizontal coordinate information can be used as the width w, and the maximum difference in the vertical coordinate information can be used as the height h.
[0045] Since the text writing trajectory contains too many trajectory points, the coordinate information of multiple trajectory points in the text writing trajectory can be used to remove redundant points in multiple trajectory points, thereby reducing the number of trajectory points in each text writing trajectory.
[0046] In some implementations, the coordinate information of each trajectory point is used to determine whether each trajectory point meets the redundancy point condition. The redundancy point condition includes: the distance between the trajectory point and the next trajectory point is less than a preset distance; and / or, the angle formed by the trajectory point with the previous trajectory point and the next trajectory point meets a preset angle requirement. If a trajectory point meets any of the redundancy point conditions, the trajectory point is determined to be a redundancy point and is removed.
[0047] In some application scenarios, the preset distance can be determined based on the width and height of the text writing trajectory, or by using preset statistical values. This application does not impose any restrictions on this.
[0048] In some implementations, the preset distance can be expressed as: a*min(h,w), where a is a preset ratio, which can be represented by a constant, such as 0.01, 0.02, etc. This embodiment uses a as an example of a = 0.01, but this application is not limited thereto. min(h,w) means that the value is the smaller of the width and the height.
[0049] In some implementations, the preset angle requirement may include the cosine value of the angle being greater than a preset value, such as 0.96 or 0.98. This embodiment uses a preset value of 0.98 as an example for illustration, but this application is not limited thereto.
[0050] Please see Figure 4 For the j-th text writing trajectory, let it be composed of trajectory points p1, p2, ..., pn. To determine whether the i-th trajectory point pi is a redundant point and whether it should be removed, we can determine whether the distance between the current trajectory point pi and the previous trajectory point pi-1 is less than a preset distance. If it is less than the preset distance, then the current trajectory point pi is determined to be a redundant point and can be removed.
[0051] It can obtain the cosine value of the angle formed by the current trajectory point pi and the previous trajectory point pi-1 and the next trajectory point pi+1. That is, it can determine whether the cosine value of the angle between pipi-1 and pipi+1 is greater than a preset value. If it is greater than the preset value, the current trajectory point pi is determined to be a redundant point and can be removed.
[0052] By removing redundant points from the text writing trajectory using the above methods, the number of trajectory points representing the text writing trajectory can be greatly reduced, the amount of data stored for trajectory points can be reduced, and the efficiency of subsequent processing of the text writing trajectory can be improved.
[0053] In some implementations, after removing redundant points, the coordinate information of multiple trajectory points contained in the text writing trajectory can be used to calculate the height or width of the area where the currently input text writing trajectory is located. The aspect ratio of the text writing trajectory is kept constant, and the height or width of the text writing trajectory is normalized, such as by scaling the height or width. Specifically, if the aspect ratio of the text writing trajectory is less than a first preset aspect ratio, it indicates that the width of the text writing trajectory is small and the height is large, so the width of the text writing trajectory can be normalized and scaled. Similarly, if the aspect ratio of the text writing trajectory is greater than a second preset aspect ratio, the height of the text writing trajectory can be normalized and scaled to make the trajectory of the text writing trajectory more obvious.
[0054] S22: Based on multiple target trajectory points, determine the trajectory features of the detected text writing trajectory.
[0055] Curve fitting is performed on multiple target trajectory points contained in each text writing trajectory. Curve fitting is a data processing method that uses a continuous curve to approximate or analogize the functional relationship between the coordinates represented by a discrete group of points (multiple target trajectory points) on a plane. It is a method of approximating discrete data (multiple target trajectory points) with analytical expressions. An appropriate curve type can be selected to fit multiple target trajectory points, and the fitted curve can be used to analyze the relationship between two variables. This application does not limit the method of curve fitting.
[0056] Curve fitting allows text writing trajectories to be represented using curves (i.e., curve expressions), resulting in trajectory curves for multiple target trajectory points. Using trajectory curves to express multiple target trajectory points can reduce the amount of data required to record or express trajectory points.
[0057] In some implementations, please refer to Figure 5 The trajectory curve of multiple target points can include a Bézier curve. A Bézier curve, also known as a Bézier curve or Bézier curve, is a mathematical curve used in two-dimensional graphics applications. The definition of a Bézier curve includes: data points (the start and end points of a path) and control points. Control points determine the curvature of a path; by adjusting the control points, the shape of the Bézier curve changes.
[0058] In some implementations, Bézier curves are classified into first-order Bézier curves (0 control points), second-order Bézier curves (1 control point), third-order Bézier curves (2 control points), and so on, depending on the number of control points. This application uses a third-order Bézier curve for curve fitting to multiple target trajectory points as an example. In other implementations, different Bézier curves can be selected based on factors such as the shape of the text writing trajectory; this application is not limited to this.
[0059] Please continue reading Figure 5 Multiple target trajectory points of a text writing trajectory can be represented by one or more Bézier curves. A third-order Bézier curve consists of two control points, one start point, and one end point. The start point and end point are one of the target trajectory points included in the text writing trajectory, and the end point can be a coordinate point outside the trajectory points included in the text writing trajectory; this application does not impose any restrictions on this. After removing redundant points, the amount of data for the trajectory points of the text writing trajectory can be reduced, for example, the number of remaining trajectory points can be reduced to 70% of the original number of trajectory points. Furthermore, using a third-order Bézier curve to represent the trajectory composed of multiple target trajectory points can further reduce the amount of data representing the trajectory points, thus further reducing the amount of data required to express the trajectory points of the text writing trajectory.
[0060] After obtaining the trajectory curves of multiple target trajectory points, an encoder can be used to encode the trajectory curves to obtain the trajectory features of the detected text writing trajectory. The encoder can contain multiple layers of Transformer or Conformer. The Conformer consists of four parts: a first feedforward module, a multi-head attention module, a convolutional module, and a second feedforward module, each of which contains several sub-modules. The output of the Conformer is ultimately normalized using LayerNorm. The encoder can be selected based on the trajectory curves; this application does not impose any restrictions on this.
[0061] In some embodiments, a writing trajectory recognition model can be used to implement the specific implementation process of steps S11 to S13 (or the writing trajectory recognition method described above) of the above embodiments, as follows.
[0062] Please see Figure 6 The writing trajectory recognition model 30 may include an encoder 31, a streaming model 32, and a non-streaming model 33. The encoder 31 is connected to both the streaming model 32 and the non-streaming model 33, and the streaming model 32 and the non-streaming model 33 share the encoder 31.
[0063] The encoder 31 can encode the trajectory curve of the input text writing trajectory to obtain the trajectory features of each text writing trajectory, and can send the trajectory features to the streaming model 32 and the non-streaming model 33 respectively.
[0064] Streaming model 32 employs streaming decoding, enabling initial text recognition based on the trajectory features of the currently input text during the writing input process, thereby obtaining the target text recognition result. For example, streaming model 32 can be a CTC decoder. CTC decoding is fast and can quickly perform initial text recognition, meaning it can perform initial text recognition on the trajectory features of the input text in real time and output the target text recognition result of the text writing trajectory in real time. CTC decoder has a fast recognition speed, but its recognition accuracy is relatively low.
[0065] The non-streaming model 33 uses a non-streaming decoding method, which can perform second text recognition based on the trajectory features of all text writing trajectories in response to the writing input meeting the termination condition, and obtain the reference text recognition result.
[0066] In some implementations, the non-streaming model 33 sequentially performs multiple semantic recognitions based on trajectory features to obtain the corresponding text recognition result. Each semantic recognition is based on the previous text recognition result and trajectory features, and each text recognition result corresponds to different parts of the input text writing trajectory. For example, the non-streaming model 33 performs text recognition on all trajectory features (e.g., 100 trajectory features). Text recognition can be described as a weighted summation process to obtain a classification, resulting in the first text recognition result being "you". The first text recognition result "you" and the 100 trajectory features are then used for text recognition again, for example, the second text recognition result is "good". When predicting the second text recognition result "good", the semantic information of the first text recognition result "you" can be considered for semantic recognition. This sequential text recognition process yields a reference text recognition result, ensuring that the text recognition of the text writing trajectory has semantic information and high text recognition accuracy.
[0067] In some implementations, the non-streaming model 33 further corrects the target text recognition result using the reference text recognition result to obtain the corrected target text recognition result. It can correct the semantic information of the ambiguous text writing trajectory by using the reference text recognition result to obtain the final text recognition result with a high accuracy. It does not require explicit segmentation of the input text writing trajectory, which can ensure recognition speed and improve recognition accuracy.
[0068] In some implementations, the non-streaming model 33 may also receive the target text recognition result of the streaming model 32 and re-evaluate the target text recognition result to obtain a corrected target text recognition result.
[0069] In some implementations, the writing trajectory recognition model can be trained using training samples, which include trajectory points representing sample trajectories of text information. During training, the training samples can be preprocessed, including at least one of removing redundant points or normalizing the height or width. To further reduce the amount of data, preprocessing can also include representing the original trajectory points of the training samples using a Bézier curve. The resulting training label can be represented as (c1, c2, c3, c4, pen), where ci is the coordinate of the i-th control point in the Bézier curve, and pen indicates whether the sample trajectory represented by the Bézier curve is a pen lift or fall marker.
[0070] The training labels are input into the writing trajectory recognition model, and the encoder is used to encode the training labels to obtain trajectory features. The encoder can be a Transformer. When using a streaming model for text recognition, a window can be used to mask several of the input training labels. For example, if 100 handwritings are input at once, but in actual recognition, the user might input 10 handwritings at a time, during training, 10 handwritings can be randomly selected, and the others can be masked (i.e., assigned a value of 0), ensuring that a certain number of training labels are input each time. During training, the size of the masking window is randomized, which can improve the robustness of the encoder later.
[0071] Regarding the above embodiments, this application provides a device for recognizing writing trajectories. Please refer to... Figure 7 , Figure 7 This is a schematic diagram of an embodiment of the writing trajectory recognition device of this application. The writing trajectory recognition device 40 includes a first text recognition module 41, a second text recognition module 42, and a correction module 43.
[0072] The first text recognition module 41 is used to perform first text recognition based on the trajectory features of the currently input text writing trajectory during the writing input process, and obtain the target text recognition result. The first text recognition is implemented using streaming decoding.
[0073] The second text recognition module 42 is used to perform second text recognition based on the trajectory features of all text writing trajectories in response to the writing input meeting the termination condition, and obtain a reference text recognition result. The second text recognition is implemented using a non-streaming decoding method.
[0074] The correction module 43 is used to correct the target text recognition result using the reference text recognition result to obtain the corrected target text recognition result.
[0075] In some embodiments, the writing trajectory recognition device 40 may further include a feature extraction module (not shown), which is used to determine whether the number of currently input text writing trajectories meets the recognition conditions; if the number of text writing trajectories meets the recognition conditions, then for each detected input text writing trajectory, multiple trajectory points in the detected text writing trajectory are obtained.
[0076] In some implementations, the feature extraction module is used to remove redundant points from the multiple trajectory points using the coordinate information of the multiple trajectory points contained in the text writing trajectory; and / or, to normalize the height or width of the text writing trajectory using the coordinate information of the multiple trajectory points contained in the text writing trajectory.
[0077] The process involves using the coordinate information of multiple trajectory points within the text writing trajectory to remove redundant points. This includes: using the coordinate information of each trajectory point to determine whether each trajectory point meets the redundancy point condition; if the condition is met, the trajectory point is identified as redundant and removed. The redundancy point condition includes: the distance between the trajectory point and the previous trajectory point is less than a preset distance; and / or, the angle formed by the trajectory point with the previous and next trajectory points meets a preset angle requirement.
[0078] In some implementations, the feature extraction module is used to obtain multiple target trajectory points in the detected text writing trajectory for each detected input text writing trajectory; and to determine the trajectory features of the detected text writing trajectory based on the multiple target trajectory points.
[0079] Among them, the trajectory features of the detected text writing trajectory are determined based on multiple target trajectory points, including: curve fitting of multiple target trajectory points to obtain trajectory curves of multiple target trajectory points; and encoding of trajectory curves to obtain trajectory features of the detected text writing trajectory.
[0080] Among them, the trajectory curves of multiple target trajectory points include Bézier curves.
[0081] In some implementations, the second text recognition module 42 is used to perform second text recognition based on the trajectory features of all input text writing trajectories in response to the writing input meeting the termination condition, and to obtain a reference text recognition result, including: performing multiple semantic recognitions sequentially based on the trajectory features to obtain the corresponding text recognition result for this time, wherein the current semantic recognition is based on the previous corresponding text recognition result and trajectory features, and each text recognition result is the text information corresponding to different parts of the text writing trajectory in all input text writing trajectories.
[0082] The specific implementation of this embodiment can be referred to the implementation process of the above embodiments, and will not be repeated here.
[0083] Regarding the above embodiments, this application provides a computer device; please refer to [link / reference]. Figure 8 , Figure 8 This is a schematic diagram of the structure of a computer device according to an embodiment of the present application. The computer device 50 includes a memory 51 and a processor 52, wherein the memory 51 and the processor 52 are coupled to each other. The memory 51 stores program data, and the processor 52 is used to execute the program data to implement the steps of any embodiment of the writing trajectory recognition method described above.
[0084] In this embodiment, processor 52 can also be referred to as CPU (Central Processing Unit). Processor 52 may be an integrated circuit chip with signal processing capabilities. Processor 52 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. The general-purpose processor can be a microprocessor, or processor 52 can be any conventional processor.
[0085] The specific implementation of this embodiment can be referred to the implementation process of the above embodiments, and will not be repeated here.
[0086] The methods described in the above embodiments can be implemented as computer programs; therefore, this application proposes a storage device. Please refer to [link to relevant documentation]. Figure 9 , Figure 9 This is a schematic diagram of the structure of a storage device according to an embodiment of the present application. The storage device 60 stores program data 61 that can be executed by a processor. The program data 61 can be executed by the processor to implement the steps of any embodiment of the writing trajectory recognition method described above.
[0087] In this embodiment, the storage device 60 can be a medium that can store program data 61, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. Alternatively, it can be a server that stores the program data 61. The server can send the stored program data 61 to other devices for execution, or it can run the stored program data 61 itself.
[0088] The specific implementation of this embodiment can be referred to the implementation process of the above embodiments, and will not be repeated here.
[0089] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0090] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0091] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0092] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage device, which is a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application.
[0093] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0094] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for recognizing writing trajectories, characterized in that, The method includes: Determine whether the number of writing trajectories of the currently input text meets the recognition criteria; If the number of text writing trajectories meets the recognition conditions, for each detected input text writing trajectory, multiple target trajectory points in the detected text writing trajectory are obtained; based on the multiple target trajectory points, the trajectory features of the detected text writing trajectory are determined. During the writing input process, first text recognition is performed based on the trajectory features of the currently input text writing trajectory to obtain the target text recognition result; wherein, the first text recognition is implemented using streaming decoding. In response to the writing input meeting the termination condition, a second text recognition is performed based on the trajectory features of all the text writing trajectories in the input to obtain a reference text recognition result; wherein, the second text recognition is implemented using a non-streaming decoding method, which utilizes the context between all trajectory features to perform text recognition; The target text recognition result is corrected using the reference text recognition result to obtain the corrected target text recognition result.
2. The method according to claim 1, characterized in that, The determination of the trajectory features of the detected text writing trajectory based on the multiple target trajectory points includes: Curve fitting is performed on the plurality of target trajectory points to obtain the trajectory curves of the plurality of target trajectory points; The trajectory curve is encoded to obtain the trajectory features of the detected text writing trajectory.
3. The method according to claim 1, characterized in that, Before determining the trajectory features of the detected text writing trajectory based on the plurality of target trajectory points, the method further includes: Using the coordinate information of multiple trajectory points contained in the text writing trajectory, redundant points are removed from the multiple trajectory points; and / or, The height or width of the text writing trajectory is normalized using the coordinate information of multiple trajectory points contained in the text writing trajectory.
4. The method according to claim 3, characterized in that, The step of using the coordinate information of multiple trajectory points contained in the text writing trajectory to remove redundant points from the multiple trajectory points includes: Using the coordinate information of each trajectory point, determine whether each trajectory point satisfies the redundancy point condition; If the redundant point condition is met, the trajectory point is determined to be a redundant point, and the redundant point is removed.
5. The method according to claim 4, characterized in that, The redundant point conditions include: the distance between the trajectory point and the previous trajectory point is less than a preset distance; and / or, the angle formed by the trajectory point, the previous trajectory point, and the next trajectory point satisfies the preset angle requirement.
6. The method according to claim 1, characterized in that, The trajectory curves of the multiple target trajectory points include Bézier curves.
7. The method according to claim 1, characterized in that, The second text recognition is performed based on the trajectory features of all input text writing trajectories to obtain a reference text recognition result, including: Sequential semantic recognition is performed multiple times based on the trajectory features to obtain the corresponding text recognition result. The current semantic recognition is based on the previous corresponding text recognition result and trajectory features, and each text recognition result is the text information corresponding to different parts of the text writing trajectory in all input text writing trajectories.
8. The method according to claim 1, characterized in that, The method further includes: In response to a touch operation on the writing input, the trajectory points of the position movement trajectory of the touch operation are collected to obtain the text writing trajectory of the writing input.
9. A computer device, characterized in that, The method includes a memory and a processor coupled to each other, the memory storing program data and the processor executing the program data to implement the steps of the method according to any one of claims 1 to 8.
10. A storage device, characterized in that, The system stores program data that can be executed by a processor, the program data being used to implement the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Character recognition method and electronic equipment
CN111079501A
Handwriting track segmentation method for complex scene handwriting recognition and computer product
CN113468972A