Training method and device of generative model, recognition method and device, terminal equipment and medium

By extracting and utilizing the stroke trajectory data of handwritten text samples, image samples similar to real samples are generated, which solves the problem of insufficient number of training samples and improves the training effect and recognition accuracy of the handwritten text recognition model.

CN118736607APending Publication Date: 2024-10-01BOE TECHNOLOGY GROUP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310325426.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-29
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

When training a handwritten text recognition model, since handwritten text samples need to be generated manually, the cost of sample acquisition is high, and the number of training samples is often small or insufficient.

Method used

By obtaining the pictures and labels of real samples, extracting stroke trajectory data, inputting it to the generator and discriminator for training, it generates picture samples similar to real samples, which are used to update the network model and generate high-similarity character samples.

Benefits of technology

It improves the amount and quality of training data for the handwritten text recognition model and ensures sufficient training and recognition accuracy of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118736607A_ABST
    Figure CN118736607A_ABST
Patent Text Reader

Abstract

The invention discloses a training method and device for a generative model, a recognition method and device, terminal equipment and a medium, and relates to the field of character recognition, and the method comprises the steps: obtaining a plurality of first real samples; obtaining stroke track data based on the first real label to serve as first real stroke track data; inputting the first real stroke trajectory data into a generator of a preset network model to obtain a reconstructed picture; inputting the reconstructed picture and the first real picture into a discriminator of a preset network model to obtain a first discrimination result and a second discrimination result; and finally, performing model updating based on the first identification result and the second identification result to obtain a generation model of the character sample. Therefore, the generation model of the corresponding character sample is trained through the picture and the label of the real sample, and the character and the writing track between the picture sample and the real sample are similar, so that when models such as a handwritten character recognition model and the like are trained, training can be performed based on enough samples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of character recognition, and more specifically, to a training method, recognition method, apparatus, terminal device and medium for generating a model. Background Art

[0002] In the related technologies for training handwritten text recognition models, since handwritten text samples need to be manually generated, the cost of obtaining training samples is high, and therefore the number of training samples is often small or insufficient. Summary of the invention

[0003] The present application provides a training method, recognition method, apparatus, terminal device and medium for generating a model.

[0004] The present application embodiment provides a training method for generating a model, including:

[0005] Acquire a plurality of first real samples, wherein the first real samples include a first real picture of a first character combination and a first real label of the first character combination;

[0006] Based on the first real label, obtaining stroke trajectory data of the first character combination in each of the first real samples as first real stroke trajectory data, wherein the stroke trajectory data represents the stroke position and stroke order of each character in the first character combination;

[0007] Inputting the first real stroke trajectory data of each first real sample into a generator of a preset network model to obtain a reconstructed image corresponding to the first real stroke trajectory data;

[0008] Input the reconstructed image and the first real image into the discriminator of the preset network model to obtain a first identification result and a second identification result, wherein the first identification result indicates whether the reconstructed image and the first real image input into the preset network model are true, and the second identification result indicates the similarity between the first real stroke trajectory data and the stroke trajectory data of the character combination in the corresponding reconstructed image;

[0009] The preset network model is updated based on the first identification result and the second identification result to obtain a generation model of the character sample, wherein the generation model of the character sample is used to generate at least one picture sample based on the first real stroke trajectory data of the input first real sample, the similarity between the picture sample and the picture of the first real sample is higher than a first preset threshold, and the similarity between the stroke trajectory data corresponding to the picture sample and the first real stroke trajectory data corresponding to the first real sample is higher than a second preset threshold.

[0010] In the implementation manner of the present application, the terminal device first obtains multiple first real samples; then, based on the first real label, obtains the stroke trajectory data of the first character combination in each first real sample as the first real stroke trajectory data, thereby knowing the stroke position and stroke order of each character in the first character combination in each first real sample; then, inputs the first real stroke trajectory data of each first real sample into the generator of the preset network model, so that the generator generates a corresponding reconstructed image according to the first real stroke trajectory data; then, inputs the reconstructed image and the first real image into the discriminator of the preset network model to determine the reconstructed image and the first real image. Whether the first real picture can be authenticated, and the similarity between the first real stroke trajectory data and the stroke trajectory data of the character combination in the corresponding reconstructed picture is determined, that is, the first identification result and the second identification result are obtained; finally, the preset network model is updated based on the first identification result and the second identification result, so that after the preset network model generates a picture sample according to the first real stroke trajectory data, the similarity between the picture sample and the picture of the first real sample is higher than the first preset threshold, and the similarity between the stroke trajectory data corresponding to the picture sample and the first real stroke trajectory data corresponding to the first real sample is higher than the second preset threshold, thereby obtaining a generation model of the character sample.

[0011] In this way, the present application trains the generative model of the corresponding character samples through the pictures and labels of the real samples, and the characters and writing trajectories between the picture samples and the real samples are similar, so the credibility of the character samples is relatively high. Therefore, when training models such as handwriting recognition models, sufficient samples can be generated based on the generative model of the character samples for training, so that the handwriting recognition model can be fully trained, thereby ensuring the accuracy of the handwriting recognition model.

[0012] In certain embodiments of the present application, the first character combination includes a plurality of first characters;

[0013] The step of acquiring the stroke trajectory data of the first character combination in each of the first real samples based on the first real label as the first real stroke trajectory data includes:

[0014] For each of the first real samples, using the first real label of the first real sample, obtaining trajectory reference data of each of the first characters in the first character combination from a preset character trajectory knowledge set, wherein the trajectory reference data includes a reference position and order of each stroke of the first character;

[0015] The trajectory reference data of each of the first characters of the first real sample are spliced ​​to obtain stroke trajectory data of the first real sample, and the stroke trajectory data is used as the first real stroke trajectory data.

[0016] In this way, the implementation method of the present application enables the first real stroke trajectory data to be obtained by extracting the trajectory reference data of each first character, without having to obtain it by sampling the stroke trajectory of the complete first character combination, thereby reducing the difficulty of obtaining the first real stroke trajectory data.

[0017] In certain embodiments of the present application, the step of splicing the trajectory reference data of each of the first characters of the first real sample to obtain the stroke trajectory data of the first real sample, and using the stroke trajectory data as the first real stroke trajectory data includes:

[0018] According to a preset sequence, from all the first characters of the first real samples, extract a first character that has not been extracted as the current character;

[0019] Using the trajectory data of the first character extracted before the current character at the preset position as a first offset, wherein the first offset of the first character extracted for the first time is 0;

[0020] Based on the first offset and a preset second offset, the trajectory reference data of the current character is corrected to obtain the trajectory data of the current character, wherein the second offset of the first character extracted for the first time is 0;

[0021] Returning to the step of extracting, from all the first characters of the first real sample in a preset order, a first character that has not been extracted as the current character, until all the first characters of the first real sample have been extracted, and obtaining the stroke trajectory data of the first real sample based on the trajectory data of each first character;

[0022] The stroke trajectory data is used as the first real stroke trajectory data.

[0023] In this way, the implementation method of the present application enables the stroke trajectory data of the first character combination to correctly express the sequence, adjacent relationship and position of each stroke of each character, and thus, the prediction accuracy of the model can be guaranteed during subsequent model training and reasoning.

[0024] In certain embodiments of the present application, the step of correcting the trajectory reference data of the current character based on the first offset and the preset second offset to obtain the trajectory data of the current character includes:

[0025] If the current character is identified as being in a special format, the trajectory reference data of the current character is corrected based on a third offset corresponding to the special format to obtain the trajectory data of the current character, wherein the special format includes a logarithmic base format and an exponential format;

[0026] If it is recognized that the current character is not in a special format, the trajectory reference data of the current character is corrected based on the first offset and the second offset to obtain the trajectory data of the current character.

[0027] In this way, the implementation method of the present application enables characters in general formats and special formats to obtain corresponding offset corrections, so that the actual stroke trajectory data can be further aligned with the actual situation, thereby further improving the training effect and reasoning accuracy of the model.

[0028] In some embodiments of the present application, the generator includes a first generator and a second generator, the discriminator includes a first discriminator and a second discriminator, and the reconstructed picture includes a first reconstructed picture and a second reconstructed picture;

[0029] The step of inputting the first real stroke trajectory data of each first real sample into a generator of a preset network model to obtain a reconstructed image corresponding to the first real stroke trajectory data includes:

[0030] Inputting the first real stroke trajectory data of each first real sample into the first generator to obtain the first reconstructed image of each first real sample;

[0031] Inputting the first reconstructed picture into the second generator to obtain the second reconstructed picture;

[0032] The step of inputting the reconstructed image and the first real image into the discriminator of the preset network model to obtain a first identification result and a second identification result includes:

[0033] Inputting the first reconstructed image and the first real image into the first discriminator to obtain the first identification result, wherein the first identification result also indicates whether the first reconstructed image and the first real image input into the first discriminator are true;

[0034] The second reconstructed image and the first real stroke trajectory data of each first real sample are input into the second discriminator to obtain a second identification result, wherein the second identification result also indicates the similarity between the second reconstructed image and the first real stroke trajectory.

[0035] In this way, the implementation of the present application enables the preset network model to be able to, based on the first reconstructed image and the second reconstructed image output by the first generator and the second generator during training, make the first identification result and the second identification result respectively characterize the ability of the preset network model to reconstruct a real picture through the real stroke trajectory data, and the ability of the stroke trajectory in the reconstructed image to be similar to the real stroke trajectory. Moreover, after back propagation, the ability of the preset network model to reconstruct pictures will continue to increase with the training rounds, thereby generating picture samples that are similar to the first real character combination and similar to the first real stroke trajectory data.

[0036] In some embodiments of the present application, the first discriminator and the second discriminator are both pre-trained networks, the first generator includes a first encoder and a first decoder, and the second generator includes a second encoder and a second decoder;

[0037] The updating of the preset network model based on the first identification result and the second identification result to obtain a generation model of the character sample includes:

[0038] The first decoder is updated based on the first identification result, and the first decoder and the second encoder are updated based on the second identification result to obtain a generation model of the character sample.

[0039] In this way, the implementation method of the present application enables the preset network model to only train some training parameters in the network during training, thereby reducing the amount of training parameters in the training process and improving training efficiency.

[0040] In certain embodiments of the present application, the first encoder, the second encoder, the first decoder and the second decoder all include residual networks, and the residual network of the first decoder and the residual network of the second decoder both include deconvolution layers.

[0041] In this way, the present application is based on the setting of the residual network, so that the preset network model can extract the first real stroke trajectory data and the deeper feature information in the first reconstructed picture during the training process, so that the first decoder and the second decoder can perform restoration operations based on the deep feature information, that is, the restoration operation can obtain strong data support; not only that, because the first decoder and the second decoder are both implemented based on the residual network, the generation of the first reconstructed picture and the second reconstructed picture can be based on a more in-depth / complex restoration operation, thereby improving the authenticity of the first reconstructed picture and the second reconstructed picture; and, the generation model of the character sample can output more realistic picture samples during the reasoning process.

[0042] In some embodiments of the present application, the second encoder includes a plurality of feature extraction layers;

[0043] The step of inputting the first reconstructed picture into the second generator to obtain the second reconstructed picture comprises:

[0044] Inputting the first reconstructed image into the multiple feature extraction layers to obtain a first feature map corresponding to each feature extraction layer;

[0045] The first feature map is input into the second decoder to obtain the second reconstructed picture.

[0046] In this way, the implementation mode of the present application enables the second decoder to complete the generation of the second reconstructed image based on multiple first feature maps, so that the generation of the second reconstructed image can be based on sufficient feature information, thereby ensuring that the second reconstructed image can be closer to the actual situation.

[0047] In some embodiments of the present application, the updating of the first decoder based on the first identification result, and the updating of the first decoder and the second encoder based on the second identification result to obtain the generation model of the character sample includes:

[0048] Inputting the first real stroke trajectory into the multiple feature extraction layers to obtain a second feature map corresponding to each feature extraction layer;

[0049] Calculating feature map pixel loss based on the first feature image and the second feature map corresponding to each feature extraction layer;

[0050] The first decoder is updated based on the first identification result, the second encoder is updated based on the pixel loss, and the first decoder and the second encoder are updated based on the second identification result to obtain a generation model of the character sample.

[0051] In this way, the implementation method of the present application introduces pixel loss, so that the second encoder can extract feature information that can better characterize the stroke trajectory for the second decoding layer to generate the second reconstructed picture, thereby ensuring that the second reconstructed picture and the first real picture are highly similar in stroke trajectory; and, based on the second reconstructed picture with highly similar stroke trajectories, the second identification result can also express the similarity of the stroke trajectories, and thus, when training, the first encoder will also complete the training in the update direction of "the stroke trajectory data of the character combination in the first reconstructed picture is similar to the first real stroke trajectory data", thereby improving the authenticity of the first reconstructed picture.

[0052] In certain embodiments of the present application, the generation model of the character sample is the first generator.

[0053] In this way, since only the first generator is used as the generation model of the trained character samples, the implementation mode of the present application avoids the situation where the generation model of the character samples needs to perform unnecessary parameter calculations during reasoning, improves the reasoning efficiency, and enables the generation model of the character samples to complete the generation of character samples with higher efficiency.

[0054] In certain embodiments of the present application, the first real stroke trajectory data further includes the trajectory points of each stroke of each character in the first character combination and the sequence numbers of the trajectory points.

[0055] In this way, the implementation method of the present application saves the real stroke trajectory data in this form, so that the visual style of the data can be preserved, and the previous and next stroke information of the character and the stroke interruption information are also saved, reducing the loss of trajectory information when the user writes the character.

[0056] The present application also provides an identification method, including:

[0057] Acquire a plurality of second real samples, wherein the second real samples include a second real picture of a second character combination and a second real label of the second character combination;

[0058] Based on the second real label, obtaining the stroke trajectory data of the second character combination in each of the second real samples as the second real stroke trajectory data;

[0059] Inputting the second real stroke trajectory data of the plurality of second real samples into a generation model of a character sample to obtain a plurality of picture samples, wherein the generation model of the character sample is obtained by the training method of the generation model described above;

[0060] Using the multiple image samples to train a preset recognition network model to obtain a recognition model;

[0061] In response to the calling operation of the recognition model, the recognition model is called to recognize characters in the target image.

[0062] In an implementation manner of the present application, the terminal device first obtains multiple second real samples; then, obtains second real stroke trajectory data of the second real samples; subsequently, based on the above-mentioned training method for generating a model, generates picture samples that are similar to the real pictures of the second real samples and similar to the second real stroke trajectories of the second real samples; then, uses all the picture samples to train the preset recognition network model, so that the preset recognition network model can be fully trained, thereby obtaining a recognition model with higher accuracy; finally, after obtaining a call request for the recognition model, uses the recognition model to recognize characters in the target picture.

[0063] In this way, the implementation mode of the present application trains a sufficient recognition model so that the character combination / characters in the target image can be accurately recognized, that is, a recognition result with a high accuracy rate can be obtained; and after the recognition result is transmitted to other processing modules of the mobile terminal, the other processing models can respond correctly; not only that, for the recognition model training in rare recognition scenarios, the present application can train a generation model of the corresponding character samples based on a small number of real samples, and generate a large number of character samples based on the generation model of the character samples, so that the recognition model in rare recognition scenarios can also be fully trained, thereby broadening the application scenarios of the recognition model.

[0064] In certain embodiments of the present application, the using of the plurality of image samples to train a preset recognition network model to obtain a recognition model includes:

[0065] The plurality of picture samples and the plurality of second real samples are used to train a preset recognition network model to obtain a recognition model.

[0066] In this way, the implementation mode of the present application enables the training of the preset recognition network model to be completed based on the second real sample and the image sample simulated by the second real sample, so the preset recognition network model can be more fully trained, thereby further improving the recognition accuracy of the preset recognition network model.

[0067] In certain embodiments of the present application, the preset recognition network model includes a first preset recognition network model, and the recognition model includes a first recognition model;

[0068] The obtaining of a plurality of second real samples comprises:

[0069] Acquire a plurality of the second real samples in a mathematical operation scenario, wherein each character in the second character combination in the mathematical operation scenario is a parameter character and an operator character;

[0070] The using the plurality of image samples to preset the recognition network model to obtain the recognition model comprises:

[0071] The first preset recognition network model is trained using the multiple image samples to obtain the first recognition model.

[0072] In this way, when the terminal device needs to identify characters / character combinations in a mathematical operation scenario, the first recognition model will be called to complete the corresponding recognition operation, so that the characters / character combinations will complete the recognition work based on their special / corresponding recognition models, ensuring the recognition accuracy of the characters / character combinations.

[0073] In some embodiments of the present application, in response to the calling operation of the recognition model, calling the recognition model to recognize characters in the target image includes:

[0074] In response to the calling operation of the first recognition model, determining a target image;

[0075] Recognize target parameter characters and target operator characters in the target image using the first recognition model;

[0076] The method further comprises:

[0077] Utilizing the target parameter characters and the target operator characters, corresponding operations are performed to obtain operation results, and the operation results are displayed.

[0078] In this way, the implementation method of the present application meets the user's need to check the calculation results; and, because the first recognition model is a fully trained model, the operator characters and parameter characters it recognizes have a high degree of credibility. Therefore, the calculation results displayed by the terminal device also have a high degree of credibility, reducing the possibility of errors in the calculation results.

[0079] In certain embodiments of the present application, the preset recognition network model includes a second preset recognition network model, and the recognition model includes a second recognition model;

[0080] The obtaining of a plurality of second real samples comprises:

[0081] Acquire a plurality of the second real samples in a text recognition scenario, wherein each character in the second character combination in the text operation scenario is a parameter character and an operator character;

[0082] The method of using the plurality of image samples to train a preset recognition network model to obtain a recognition model includes:

[0083] The second preset recognition network model is trained using the multiple image samples to obtain the second recognition model.

[0084] In this way, the implementation method of the present application enables the recognition of text characters to be completed based on the corresponding / special second recognition model, thereby ensuring the recognition accuracy of the text characters; at the same time, because the second recognition model is a model that has been trained with a large number of samples, the recognition accuracy of the second recognition model can be guaranteed; therefore, the recognition result of the second recognition model has a higher credibility, and then other processing models in the terminal device can perform correct / effective corresponding operations based on the high-credibility recognition result.

[0085] In some embodiments of the present application, in response to the calling operation of the recognition model, calling the recognition model to recognize characters in the target image includes:

[0086] In response to the calling operation of the second recognition model, determining the target image;

[0087] Recognize target text characters in the target image using the second recognition model;

[0088] The method further comprises:

[0089] The target text characters are displayed.

[0090] In this way, when the user needs to select and / or copy text characters in the note, the user can use the terminal to recognize the text characters in the note and generate an electronic version of the text that can be selected / copied, thereby meeting the user's needs.

[0091] In some embodiments of the present application, after displaying the target text characters, the method further includes:

[0092] In response to the first interactive operation, the target text characters are exported as a file in a preset format.

[0093] In this way, the implementation mode of the present application enables the user to export the target text characters into a file of a preset format as needed, thereby meeting the needs of the user.

[0094] In certain embodiments of the present application, the calling operation includes a circle selection operation;

[0095] In response to the calling operation of the recognition model, calling the recognition model to recognize characters in the target image includes:

[0096] In response to the circle selection operation in the current display area, obtaining the target image;

[0097] The recognition model is called to recognize characters in the target image.

[0098] In this way, the implementation mode of the present application enables users to select partial areas from an image containing multiple character types as recognition targets based on their own needs, thereby meeting the user's personalized recognition needs.

[0099] In some implementations of the present application, the calling operation includes a click operation;

[0100] In response to the calling operation of the recognition model, calling the recognition model to recognize characters in the target image includes:

[0101] In response to a click operation in the current display area, taking the current display area as the target image;

[0102] The recognition model is called to recognize characters in the target image.

[0103] In this way, the implementation mode of the present application enables the user to conveniently use the entire current display area as the target image, thereby efficiently completing character recognition and related processing based on the recognition results.

[0104] In some embodiments of the present application, calling the recognition model to recognize characters in the target image includes:

[0105] In response to the interactive confirmation operation, the recognition model is called to recognize characters in the target image.

[0106] In this way, the implementation method of the present application avoids the occurrence of recognition model calls due to false touches, and reduces the probability of the terminal device consuming unnecessary resources.

[0107] In certain embodiments of the present application, the method further comprises:

[0108] Identify all second characters in the currently displayed page;

[0109] In response to a second interactive operation, determining a writing style of a third character corresponding to the second interactive operation, wherein the writing style represents stroke thickness, stroke trend, stroke order, and stroke position of the third character;

[0110] The writing styles of all the second characters are adjusted to the writing style of the third character.

[0111] In this way, the implementation method of the present application enables users to adjust characters with different stroke styles to the same writing style based on their own needs, so that all characters in the notes are in the same writing style, allowing users to have a better review experience.

[0112] In some embodiments of the present application, the step of identifying all second characters in the currently displayed page includes:

[0113] If no operation is received within a preset time period, the second characters in different areas of the currently displayed page are used as a group of third character combinations, wherein a distance greater than a preset distance exists between two different third character combinations;

[0114] Based on the recognition model, each of the second characters in each group of the third character combinations is recognized.

[0115] In this way, the present application enables the second character to be identified based on its other adjacent second characters, avoiding label recognition errors that may occur due to context differences when a single character is identified, thereby ensuring the accuracy of writing style adjustment.

[0116] In some embodiments of the present application, after identifying each of the second characters in each group of the third character combination based on the recognition model, the method further includes:

[0117] If the first preset cache space has stored other data, the other data is replaced by the location data of the second character and the third character combination in each group of the third character combination;

[0118] If the first preset cache space does not store the other data, the location data of the second character and the third character combination in each group of the third character combination are stored in the first preset cache space.

[0119] Thus, the embodiment of the present application avoids the situation that every time the writing style is adjusted, all the second characters need to be recognized, which reduces the load of the terminal device and improves the conversion efficiency of the writing style. In addition, because the data in the first cache space is always the latest data, the effective conversion of the writing style of the second character can be ensured.

[0120] In some embodiments of the present application, in response to the second interaction operation, determining the writing style of the third character corresponding to the second interaction operation includes:

[0121] In response to the second interactive operation, the third character is input into a representation vector generation model to obtain a writing style representation vector of the third character, wherein the writing style representation vector represents the writing style of the third character;

[0122] The step of adjusting the writing styles of all the second characters to the writing style of the third character includes:

[0123] Based on the writing style representation vector, the writing style of the second character is adjusted so that the writing style of the second character is similar to the writing style of the third character.

[0124] In this way, the implementation mode of the present application enables the writing style of the third character to be determined based on the representation vector generation model, so the writing style can be represented based on an abstract but accurate digital expression, thereby ensuring the accurate conversion of each second character.

[0125] In certain embodiments of the present application, after inputting the third character into a representation vector generation network to obtain a writing style representation vector of the third character, the method further includes:

[0126] If the second preset cache space has stored other vectors, replacing the other vectors with the writing style representation vector;

[0127] If the second preset cache space does not store the other vectors, the writing style representation vector is stored in the second preset cache space.

[0128] Thus, the embodiment of the present application enables the terminal device to perform writing style conversion without having to repeat the operation of obtaining the writing style representation vector when the third character remains unchanged, thereby reducing the load of the terminal device and improving the writing style conversion efficiency. At the same time, because the data in the second preset cache space is always the latest data, the effective conversion of the writing style of the second character can be ensured.

[0129] The present application also provides a training device for generating a model, including:

[0130] A first sample acquisition module, configured to acquire a plurality of first real samples, wherein the first real samples include a first real picture of a first character combination and a first real label of the first character combination;

[0131] a first trajectory acquisition module, configured to acquire stroke trajectory data of the first character combination in each of the first real samples based on the first real label as first real stroke trajectory data, wherein the stroke trajectory data represents the stroke position and stroke order of each character in the first character combination;

[0132] A first input module, used for inputting the first real stroke trajectory data of each first real sample into a generator of a preset network model to obtain a reconstructed image corresponding to the first real stroke trajectory data;

[0133] A second input module, used for inputting the reconstructed image and the first real image into the discriminator of the preset network model to obtain a first identification result and a second identification result, wherein the first identification result indicates whether the reconstructed image and the first real image input into the preset network model are true, and the second identification result indicates the similarity between the first real stroke trajectory data and the stroke trajectory data of the character combination in the corresponding reconstructed image;

[0134] A training module is used to update the preset network model based on the first identification result and the second identification result to obtain a generation model of a character sample, wherein the generation model of the character sample is used to generate at least one picture sample according to the first real stroke trajectory data of the first real sample input, the similarity between the picture sample and the picture of the first real sample is higher than a first preset threshold, and the similarity between the stroke trajectory data corresponding to the picture sample and the first real stroke trajectory data corresponding to the first real sample is higher than a second preset threshold.

[0135] The present application also provides an identification device, including:

[0136] A second sample acquisition module, used to acquire a plurality of second real samples, wherein the second real samples include a second real picture of a second character combination and a second real label of the second character combination;

[0137] A second trajectory acquisition module, configured to acquire, based on the second real label, the stroke trajectory data of the second character combination in each of the second real samples as second real stroke trajectory data;

[0138] A sample obtaining module, used for inputting the second real stroke trajectory data of the plurality of second real samples into a generation model of a character sample to obtain a plurality of picture samples, wherein the generation model of the character sample is obtained by the training method of the generation model described above;

[0139] A model training module, used to train a preset recognition network model using the multiple image samples to obtain a recognition model;

[0140] The response module is used to call the recognition model to recognize characters in the target image in response to the calling operation of the recognition model.

[0141] An embodiment of the present application further provides a terminal device, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the above method is implemented.

[0142] The embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by one or more processors, the above method is implemented.

[0143] Additional aspects and advantages of the embodiments of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0144] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0145] Figure 1 A flowchart of a training method for generating a model according to certain embodiments of the present application;

[0146] Figure 2 A schematic diagram of a first real picture of certain embodiments of the present application;

[0147] Figure 3 A schematic diagram of application scenarios of certain embodiments of the present application;

[0148] Figure 4 A flowchart of a training method for generating a model according to certain embodiments of the present application;

[0149] Figure 5 A schematic diagram of a model training process for certain embodiments of the present application;

[0150] Figure 6 A schematic diagram of a flow chart of an identification method according to certain embodiments of the present application;

[0151] Figure 7 A schematic diagram of application scenarios of certain embodiments of the present application;

[0152] Figure 8 A schematic diagram of application scenarios of certain embodiments of the present application;

[0153] Fig. 9 A schematic diagram of application scenarios of certain embodiments of the present application;

[0154] Fig.10 A schematic diagram of application scenarios of certain embodiments of the present application;

[0155] Fig.11 A schematic diagram of application scenarios of certain embodiments of the present application;

[0156] Fig.12 A schematic diagram of application scenarios of certain embodiments of the present application;

[0157] Fig.13 A schematic diagram of a training device for generating a model according to certain embodiments of the present application;

[0158] Fig.14 This is a schematic diagram of an identification device according to some embodiments of the present application. DETAILED DESCRIPTION

[0159] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of the present application, and cannot be understood as limiting the embodiments of the present application.

[0160] See also Figure 1 , the present application provides a training method for generating a model, comprising:

[0161] 0110. Obtain multiple first real samples, where the first real sample includes a first real picture of a first character combination and a first real label of the first character combination.

[0162] It should be noted that the first real sample in the implementation mode of this application refers to the photo obtained by taking the "manually written characters" and the label obtained by annotating the "manually written characters". For a clearer explanation of the first real sample in this application, please refer to Figure 2 , Figure 2 This is a schematic diagram of a first real picture of certain embodiments of the present application. Figure 2 The first real label corresponding to the character combination in the first real picture is "'G', 'o', 'o', 'd', 'j', 'o', 'b'".

[0163] In addition, it is not difficult to understand that the first character combination in the implementation manner of the present application is composed of a plurality of minimum semantic units, such as the above Figure 2 The corresponding first character combination includes 7 minimum semantic units, namely, 'G', 'o', 'o', 'd', 'j', 'o' and 'b'.

[0164] Furthermore, in the handwriting recognition scenario, there are different minimum semantic units with similar writing trajectories / strokes, and similar different minimum semantic units may express completely different semantics, such as the letter 'C' and the left half bracket '('. Therefore, in order to ensure that the terminal device can accurately distinguish different minimum semantic units with similar writing trajectories / strokes and reduce the difficulty of collecting real samples, in certain embodiments of the present application, the terminal device will display two parts of characters according to known labels, one of which is the context character, and the other is the character to be written. Furthermore, because the terminal device generates the context character and the character to be written according to the real label of the known character, after receiving the character to be written written by the user, the character / character combination corresponding to the real label is obtained.

[0165] For a clearer explanation of this implementation, please refer to Figure 3 , Figure 3 A schematic diagram of application scenarios of certain embodiments of the present application. Figure 3 In the example, the context characters include '(', 'Sin', '2', '÷', '8', '6.7' and ')', and the characters to be written are characters marked with underlines, namely 'COS'. Therefore, when the terminal device displays the characters to be written based on the labels and receives the characters / character combinations written by the user, the terminal device uses the characters / character combinations written by the user as the real characters / real character combinations corresponding to the above labels, thereby obtaining real samples. In this way, each time the user writes a character, he only needs to write part of the characters in the text, thereby reducing the difficulty of collecting real samples; at the same time, because the characters to be written are generated by known labels, after receiving the characters input by the user, the user does not need to mark the input characters, thereby further reducing the difficulty of collecting real samples, improving the efficiency of collecting real samples, and ensuring the semantic correctness of real samples.

[0166] In addition, it is not difficult to understand that Figure 3 the character "COS" to be written is marked by an underline, but the underline is only a feasible highlighting method. In some other embodiments of the present application, the character to be written is highlighted by any one of font color adjustment, wireframe enclosure, and other methods.

[0167] In addition, to ensure the richness and diversity of data, the terminal device will display the same character 5 times or more for each user. In other words, a user needs to write the same character at least 5 times or more.

[0168] 0120, based on the first true label, obtain the stroke trajectory data of the first character combination in each first true sample as the first true stroke trajectory data, where the stroke trajectory data represents the stroke positions and stroke orders of the characters in the first character combination.

[0169] That is, the embodiments of the present application determine the stroke trajectories (i.e., stroke trajectory data) of the characters through the characters represented by the first true label, and merge the writing trajectories of the characters to obtain the stroke trajectory (i.e., true stroke trajectory data) corresponding to the complete first character combination.

[0170] Exemplarily, let the first character combination be "‘汉’‘字’". After the terminal device determines the first true labels '汉' and '字', it will obtain the stroke trajectory data corresponding to '汉' and '字'. For example, the stroke trajectory data of '汉' includes: dot ('丶'), dot ('丶'), tick (' ’), horizontal hook (' ’) and stroke (' ’) in total 5 strokes, as well as the positions of the 5 strokes.

[0171] Then, merge the stroke trajectory data corresponding to '汉' and '字', then obtain the stroke trajectory data of "‘汉’‘字’", and use this stroke trajectory data as the first true stroke trajectory data, so that the subsequent model training is performed through the first true stroke trajectory data.

[0172] In addition, it is not difficult to understand that the method for determining the stroke trajectory data corresponding to the label can be set according to the actual situation. For example, in some embodiments, after the terminal device obtains the first true label, it will obtain the stroke trajectory data corresponding to the first true label from the publicly available stroke trajectory resource library.

[0173] In other embodiments, in order to make the first real stroke trajectory data of the first real sample contain richer and more real information, in certain embodiments of the present application, when the user writes characters to complete the generation of the first real sample, the terminal device will continuously sample the trajectory points of the characters and generate serial numbers for each trajectory point, that is, the first real stroke trajectory data also includes the trajectory points of each stroke of each character in the first character combination and the serial numbers of the trajectory points.

[0174] Exemplarily, the stroke trajectory data recorded in the implementation mode of the present application is: [{"x":100, "y":100, "Last":0}, {"x":150, "y":150, "Last":1}, ...], wherein "x" and "y" represent the horizontal and vertical coordinates of the trajectory point (i.e., the trajectory point position), and "Last" represents the sequence number representing the trajectory point position.

[0175] Thus, the embodiment of the present application saves the real stroke trajectory data in this form, so that the visual style of the data can be saved, and the information of the previous and next strokes of the character and the stroke discontinuity information are also saved, reducing the loss of trajectory information when the user writes the character. Therefore, when the model is trained, the training can be completed based on the more real / effective first real stroke trajectory data.

[0176] In addition, it can be understood that the sampling time interval of the trajectory points can be set according to actual conditions. For example, in some embodiments, the sampling time interval is 0.05 seconds. After the user starts writing characters, the terminal device detects the touch coordinates / writing coordinates on the touch screen / writing screen every 0.05 seconds to obtain the trajectory points.

[0177] Optionally, in order to avoid the phenomenon that the data range of the coordinate value is too large and may cause poor training effect, in certain embodiments of the present application, after completing the collection of trajectory points, the embodiments of the present application will normalize and resample the horizontal and vertical coordinates of the trajectory points.

[0178] The normalization process can refer to the following formula:

[0179]

[0180] In the formula, x' i represents the horizontal coordinate of the i-th normalized trajectory point, min(x) and max(x) represent the minimum and maximum values ​​of the horizontal coordinates of all trajectory points.

[0181] The resampling process can refer to the following formula;

[0182] x resample,i =(1-λ)x′ i+1 +λx′i

[0183] λ=l d -α

[0184] In the formula, x (resample,i) represents the horizontal coordinate of the trajectory point after the i-th resampling process, λ represents the reference weight, l d represents the distance between the ith trajectory point and the (i+1)th trajectory point, and α represents the preset threshold.

[0185] It is not difficult to imagine that the normalization and resampling of the vertical coordinates can refer to the above two formulas, so I will not go into details here.

[0186] In this way, the implementation method of the present application is based on normalization and resampling processing, so that in the subsequent training process, the value range of the coordinate value of the trajectory point is maintained in the interval [0, 1], thereby avoiding the negative impact that may be caused by an excessively large value range.

[0187] 0130, input the first real stroke trajectory data of each first real sample into the generator of the preset network model to obtain a reconstructed image corresponding to the first real stroke trajectory data.

[0188] That is, after obtaining the first real stroke trajectory data, the present application inputs it into the generator of the preset network model, so that the generator generates a reconstructed image similar to the first real image but with image differences / pixel differences based on the first real stroke trajectory data.

[0189] It can be understood that the specific composition of the generator can be set according to actual conditions. For example, in some embodiments, the generator is the generator part of the end-to-end network Unet.

[0190] 0140, input the first reconstructed image and the real image into the discriminator of the preset network model to obtain a first identification result and a second identification result, wherein the first identification result indicates whether the reconstructed image and the first real image input into the preset network model are true, and the second identification result indicates the similarity between the first real stroke trajectory data and the stroke trajectory data of the character combination in the corresponding reconstructed image.

[0191] That is, after generating the reconstructed image, the embodiment of the present application will use the discriminator of the preset network model to discriminate / detect the generated reconstructed image and the first real image that actually exists, so as to discriminate whether the reconstructed image and the real image are "real", and discriminate whether the stroke trajectory data of the reconstructed image of each real sample and the first real image are similar. It is not difficult to understand that the meaning of "real" is: a reconstructed image that is not generated by the generator.

[0192] It is understandable that the discriminator in the embodiment of the present application is provided with at least two identification parts / identification modules, and the two identification modules are used to output the first identification result and the second identification result respectively. It is conceivable that the specific structure of the discriminator can be set according to the actual situation.

[0193] It is also understandable that what is not understandable is that the first identification result and the second identification result are actually probability values. When the first identification result is higher than the first preset threshold value / first preset probability, the reconstructed image / first real image can be determined to be true. When the second identification result is higher than the second preset threshold value / second preset probability, it means that the stroke trajectory data of the character combination in the reconstructed image is highly similar to the first real stroke trajectory data, and then it is determined that the stroke trajectory data of the character combination in the reconstructed image is similar to the first real stroke trajectory data.

[0194] 0150. Update the preset network model based on the first identification result and the second identification result to obtain a generation model of the character sample, wherein the generation model of the character sample is used to generate at least one image sample based on the first real stroke trajectory data of the input first real sample, and the similarity between the image sample and the image of the first real sample is higher than a first preset threshold, and the similarity between the stroke trajectory data corresponding to the image sample and the first real stroke trajectory data corresponding to the first real sample is higher than a second preset threshold.

[0195] That is, the present application will use the above-mentioned first identification result and second identification result to reversely update the various training parameters in the preset network model, so that after the preset network model completes the training, it can generate a picture with similar pixels and similar trajectories based on the first real stroke trajectory data of the received first real sample, that is, a picture sample is generated whose similarity with the first real picture of the first real sample is higher than the first preset threshold, and the stroke trajectory data of the character combination contained is higher than the second preset threshold in similarity with the first real stroke trajectory data corresponding to the first real sample.

[0196] It can be understood that the training completion flag of the preset network model can be set according to actual conditions. For example, in some embodiments, when the prediction accuracy of the preset network model is higher than the preset accuracy, it means that the training of the preset network model is completed, and then the generation model of the character sample is obtained.

[0197] In other implementations, when overfitting occurs during the training process of the preset network model, the training of the preset network model is stopped, and the preset network model before overfitting is used as the generation model of the character sample.

[0198] In this way, the present application trains the generative model of the corresponding character samples through the pictures and labels of the real samples, and the characters and writing trajectories between the picture samples and the real samples are similar, so the credibility of the character samples is relatively high. Therefore, when training models such as handwriting recognition models, sufficient samples can be generated based on the generative model of the character samples for training, so that the handwriting recognition model can be fully trained, thereby ensuring the accuracy of the handwriting recognition model.

[0199] In addition, it can be understood that, since each pixel point of the image sample can be represented as the stroke trajectory data of the corresponding character combination, the image sample in the implementation mode of the present application can be regarded as / equivalent to / replaced with the stroke trajectory data.

[0200] Optionally, in some embodiments of the present application, the first character combination includes multiple first characters.

[0201] Furthermore, the above 0120 includes:

[0202] For each first real sample, using the first real label of the first real sample, obtaining trajectory reference data of each first character in the first character combination from a preset character trajectory knowledge set, wherein the trajectory reference data includes a reference position and order of each stroke of the first character;

[0203] The trajectory reference data of each first character of the first real sample are spliced ​​to obtain the stroke trajectory data of the first real sample, and the stroke trajectory data is used as the first real stroke trajectory data.

[0204] That is, the present application will obtain the trajectory reference data of each first character in the first character combination based on a preset character trajectory knowledge set; after obtaining the trajectory reference data of all first character combinations in the first character combination, the various trajectory reference data will be spliced ​​to obtain the stroke trajectory data of the first character combination, that is, the first real stroke trajectory data of the first real sample.

[0205] It can be understood that the first character is a minimum semantic unit, and one minimum semantic unit corresponds to one track reference data.

[0206] It can also be understood that the reference position represents the position of each first character in a single writing / standard situation / real scene / normal situation, and therefore, the trajectory reference data of different first characters overlap. However, in the first real stroke trajectory data, the trajectory coordinates of different minimum semantic units / first characters should not overlap. For example, when the trajectory parameter data of a first character includes the coordinate (100, 100), all the coordinates of the trajectory reference data of the next first character should be located to the right of (100, 100) to indicate that the above two first characters do not overlap / superimpose.

[0207] In this way, the implementation method of the present application enables the first real stroke trajectory data to be obtained by extracting the trajectory reference data of each first character, without having to obtain it by sampling the stroke trajectory of the complete first character combination, thereby reducing the difficulty of obtaining the first real stroke trajectory data.

[0208] It is not difficult to understand that how to perform the splicing operation so that the trajectory coordinates of each first character do not overlap is a content that can be set according to actual conditions. For example, in some embodiments, the terminal device stores the area range of a single character. For example, the area range of a single first character is 300, and the first character combination is "'a', 'n'". The positive direction of the horizontal axis is the right direction, and the positive direction of the vertical axis is vertically upward. Then: the starting point of the trajectory reference data of 'a' is adjusted to the upper right side of (0, 0), and the end point of the trajectory reference data of 'a' is adjusted to the lower right side of (300, 300); the starting point of the trajectory reference data of 'n' is adjusted to the upper right side of (0, 300), and the end point of the trajectory reference data of 'n' is adjusted to the lower right side of (600, 600).

[0209] In some other embodiments of the present application, the above-mentioned splicing of the trajectory reference data of each first character of the first real sample to obtain the stroke trajectory data of the first real sample, and using the stroke trajectory data as the first real stroke trajectory data, includes:

[0210] According to a preset sequence, a first character that has not been extracted is extracted from all first characters of the first real sample to serve as the current character;

[0211] Using the trajectory data of the first character extracted before the current character at the preset position as the first offset, wherein the first offset of the first character extracted for the first time is 0;

[0212] Based on the first offset and the preset second offset, the trajectory reference data of the current character is corrected to obtain the trajectory data of the current character, wherein the second offset of the first character extracted for the first time is 0;

[0213] Returning to the step of extracting a first character that has not been extracted from all first characters of the first real sample in a preset order as the current character, until all first characters of the first real sample have been extracted, and obtaining the stroke trajectory data of the first real sample based on the trajectory data of each first character;

[0214] The stroke trajectory data is used as the first real stroke trajectory data.

[0215] That is, for the first character in the first character combination, the implementation mode of the present application will offset the trajectory reference data of each first character in turn based on the sequence of the first characters, and then merge the trajectory reference data / trajectory data of each first character after the offset processing to obtain the stroke trajectory data of the first character combination, that is, to obtain the first real stroke trajectory data of the first real sample.

[0216] For example, taking the first character combination / word "an" as an example, the first character combination "an" includes the first character 'a' and the first character 'n', the positive direction of the horizontal axis is the right direction, the preset sequence is from left to right, the preset position is the rightmost horizontal axis, the rightmost trajectory data of 'a' is (100, 100), the trajectory data of 'n' includes (50, 0), (50, 60), (60, 60) and (60, 0), and the second offset is 50 horizontal axis units, then:

[0217] First, from left to right, extract the first character that has not been extracted from 'a' and 'n', that is, 'a', as the current character;

[0218] Then, the trajectory data of the extracted character before 'a' on the rightmost horizontal axis is obtained as the first offset. However, since 'a' is the first extracted character in "an", the first offset of 'a' is 0.

[0219] Then, the first offset (0) and the second offset (0) are used to perform offset correction on the trajectory reference data of 'a'. It can be understood that since 'a' is the first character extracted from "an", its first offset and second offset are both 0, and thus the positions of the strokes of 'a' do not need to be corrected.

[0220] Then, 'n' is extracted as the new current character;

[0221] Afterwards, the trajectory data of 'a' on the rightmost horizontal axis is obtained as the first offset (100);

[0222] Next, based on the first offset (100) and the second offset (50), the trajectory reference data of 'n' is corrected. That is, the horizontal coordinates of (50, 0), (50, 60), (60, 60) and (60, 0) are all added to the first offset and the second offset, and then, the corrected trajectory reference data / trajectory data of 'n' are (200, 0), (200, 60), (210, 60) and (210, 0).

[0223] Finally, the trajectory data of 'a' and the trajectory data of 'n' are concatenated to obtain the real stroke trajectory data: {(100, 100), (200, 0), (200, 60), (210, 60), (210, 0)}.

[0224] In this way, the implementation method of the present application enables the stroke trajectory data of the first character combination to correctly express the sequence, adjacent relationship and position of each stroke of each character, and thus, the prediction accuracy of the model can be guaranteed during subsequent model training and reasoning.

[0225] In addition, it is understood that the second offset of 50 is only an example, and the specific size of the second offset can be set and adjusted according to actual conditions. For example, in some embodiments, when a user writes multiple characters, the interval between two characters is not fixed. Therefore, in order to make the real stroke trajectory data closer to the actual situation, the second offset is a uniformly distributed random amount within a preset range.

[0226] Optionally, in some implementations, the above preset interval is [-0.05, 0.20].

[0227] Optionally, since there may be a first character in a special format in the first character combination, such as a first character in a superscript format or a subscript format, in this case, an additional offset correction needs to be performed on the first character in the special format. Therefore, in certain embodiments of the present application, the trajectory reference data of the current character is corrected based on the first offset and the preset second offset to obtain the trajectory data of the current character, including:

[0228] If the current character is identified as being in a special format, the trajectory reference data of the current character is corrected based on a third offset corresponding to the special format to obtain the trajectory data of the current character, wherein the special format includes a logarithmic base format and an exponential format;

[0229] If it is recognized that the current character is not in a special format, the trajectory reference data of the current character is corrected based on the first offset and the second offset to obtain the trajectory data of the current character.

[0230] That is, the implementation mode of the present application is also provided with a third offset corresponding to different special formats, so that when the terminal device reads the first character of the special format, an additional offset correction is performed based on the third offset corresponding to the special format, so that the real stroke trajectory data can be more in line with its real label / real picture / actual situation.

[0231] For example, the first character combination "log 1024+0" as an example, which includes a first character '10' in a logarithmic base format. When the terminal device reads the '10' after 'log', the horizontal and vertical coordinates of '10' will be offset corrected based on the third offset corresponding to the logarithmic base format.

[0232] In one embodiment, the third offset corresponding to the logarithmic base format includes the horizontal and vertical coordinate scaling ratios and the vertical axis offset, and then, the process of offset correction for '10' is: calculating the product of the trajectory reference data of '10' and the horizontal and vertical coordinate scaling ratios to obtain the scaled trajectory reference data. Subtracting the vertical axis coordinate of the scaled trajectory reference data from the vertical axis offset to obtain the trajectory data of '10'.

[0233] In some embodiments, the scaling ratios of the horizontal and vertical axes are randomly taken from the interval [0.4, 0.6].

[0234] In some embodiments, the vertical axis scaling amount is a value randomly taken from the interval [0.5, 0.7].

[0235] In some embodiments, the first real label is a content in LaTex format. Thus, the first real label can explicitly express the first character in a special format or the first character in a non-special format.

[0236] In this way, the implementation method of the present application enables characters in general formats and special formats to obtain corresponding offset corrections, so that the actual stroke trajectory data can be further aligned with the actual situation, thereby further improving the training effect and reasoning accuracy of the model.

[0237] In addition, it can be understood that the third offset of different special formats can be set according to actual conditions.

[0238] Optional, please refer to Figure 4 , Figure 4 A flow chart of a training method for a generative model of certain embodiments of the present application, that is, in certain embodiments of the present application, the generator includes a first generator and a second generator, the discriminator includes a first discriminator and a second discriminator, and the reconstructed image includes a first reconstructed image and a second reconstructed image.

[0239] Furthermore, the above 0130 includes:

[0240] 0131, inputting the first real stroke trajectory data of each first real sample into the first generator to obtain a first reconstructed image of each first real sample;

[0241] 0132, input the first reconstructed image into the second generator to obtain a second reconstructed image.

[0242] Furthermore, the above 0140 includes:

[0243] 0141, input the first reconstructed image and the first real image into a first discriminator to obtain a first identification result, wherein the first identification result also indicates whether the first reconstructed image and the first real image input into the first discriminator are true;

[0244] 0142. Input the second reconstructed image and the first real stroke trajectory data of each first real sample into the second discriminator to obtain a second identification result, wherein the second identification result also indicates the similarity between the second reconstructed image and the first real stroke trajectory.

[0245] That is, the preset network model of the implementation mode of the present application is composed of two groups of generative adversarial networks, one group is used to make the preset network model output a reconstructed picture with the same characters / pixels / image as the first real picture, and the other group is used to make the preset network model output a reconstructed picture with stroke trajectory data of character combinations similar / identical to the first real stroke trajectory.

[0246] Specifically, after receiving the first real stroke trajectory data, the first generator will perform feature extraction on the first real stroke trajectory data to obtain a corresponding feature vector, and then restore the feature vector to obtain a first reconstructed image that is not completely the same as the first real image, but similar.

[0247] Then, the first reconstructed image corresponding to each first real sample and the first real image in each first real sample will be input to the first discriminator; the first discriminator will discriminate the input first reconstructed image and the first real image to determine whether the input image is a "real image" / "true", thereby outputting a first identification result, and then using the first identification result to reversely update the preset network model, so that the first generator can generate a reconstructed image similar to the first real image after the update. It is not difficult to understand that the meaning of "real image" / "true" is: an image that is not generated by the first generator using the first real stroke trajectory data.

[0248] Subsequently, the first reconstructed image reconstructed by the first generator using the first real stroke trajectory data will be input into the second generator to generate a corresponding second reconstructed image.

[0249] Afterwards, the second reconstructed image and the first real stroke data corresponding to the same first real sample will be input into the second discriminator, and the second discriminator determines whether the second reconstructed image is similar to the first real stroke data, that is, determines the degree of similarity between the second reconstructed image and the first real stroke data. If the degree of similarity is higher than a preset threshold, it indicates that the two are similar, otherwise they are not similar.

[0250] Finally, after using the first identification result and the second identification result to update the various training parameters in the preset network model, the preset network model generates a picture sample based on the first generator and the second generator that is similar to the first real picture (that is, the character combination in the picture sample is the same as the first character combination) and similar to the first real stroke trajectory (that is, the stroke trajectory data corresponding to the character combination in the picture sample is similar to the first real stroke trajectory data).

[0251] It should be noted that the first real stroke trajectory data is used to represent the strokes of each character of the first character combination in the first real picture. In other words, the first real stroke trajectory data can be regarded as a data-based expression of the first real picture, so the second reconstructed picture and the first real stroke trajectory data can be judged for similarity.

[0252] It should also be noted that in the present application, the specific network model used to implement the first generator, the second generator, the first identifier and the second identifier can be set according to actual conditions.

[0253] In this way, the implementation of the present application enables the preset network model to be able to, based on the first reconstructed image and the second reconstructed image output by the first generator and the second generator during training, make the first identification result and the second identification result respectively represent the ability of the preset network model to reconstruct a real picture through the real stroke trajectory data, and the ability of the stroke trajectory in the reconstructed image to be similar to the real stroke trajectory. Moreover, after back propagation, the ability of the preset network model to reconstruct pictures will continue to increase with the training rounds, thereby generating picture samples similar to the first real character combination and similar to the first real stroke trajectory data.

[0254] Moreover, when the first real stroke trajectory data in the present application is not "real data", such as the first real stroke trajectory data is the data obtained by the above-mentioned process of obtaining the trajectory reference data of the minimum language unit through the label, the offset correction of the trajectory reference data and the splicing of the corrected data, the deviation of each first character in the first real stroke trajectory data is actually the data simulated by the terminal device rather than artificially generated, so the first real stroke trajectory data is not "real data". In this case, due to the setting of the first generator and the first discriminator, the reconstructed picture / picture sample of the preset network model during training and inference can be similar to the real picture. Furthermore, the present application can also generate picture samples that are closer to the real situation / real picture through the first real stroke trajectory data when "the first real stroke trajectory data is not 'real data'". In this way, the present application can be used more simply and easily, reducing the difficulty of training and setting the preset network model and improving the generalization ability of the generation model of character samples.

[0255] In addition, it can be understood that the execution order of the above 0131, 0132, 0141 and 0142 can be set according to actual conditions. For example, in some embodiments, the execution order of the above 0131, 0132, 0141 and 0142 is: first execute 0131, then execute 0141, then execute 0132, and finally execute 0142.

[0256] Optionally, in order to increase the training difficulty of the preset network model, in some embodiments, the first discriminator and the second discriminator are both pre-trained networks, the first generator includes a first encoder and a first decoder, and the second generator includes a second encoder and a second decoder.

[0257] Furthermore, the above-mentioned updating of the preset network model based on the first identification result and the second identification result to obtain the generation model of the character sample includes:

[0258] The first decoder is updated based on the first identification result, and the first decoder and the second encoder are updated based on the second identification result to obtain a generation model of the character sample.

[0259] To more clearly illustrate the implementation methods provided by this application, please refer to Figure 5 , Figure 5 This is a schematic diagram of the model training process of certain embodiments of the present application. It is not difficult to understand that Figure 5 The first identification result output by the first discriminator in will be used to calculate the adversarial loss (i.e. Figure 5 Similarly, the second discriminator outputs the second discriminator and will also be used to counter the loss (i.e. Figure 5 It can be imagined that the calculation method of the two adversarial losses can be set according to the actual situation, so it will not be repeated here.

[0260] That is, the first discriminator and the second discriminator have been pre-trained, so the first discriminator and the second discriminator will not participate in network training. At the same time, because the first encoder in the first generator contains a certain amount of training parameters, in order to reduce the training parameters in the entire preset network model, the first encoder also does not participate in model training.

[0261] In this way, the implementation method of the present application enables the preset network model to only train some training parameters in the network during training, thereby reducing the amount of training parameters in the training process and improving training efficiency.

[0262] Optionally, in some embodiments, the pre-training process of the first discriminator is: obtaining multiple first real samples; obtaining a first reconstructed image corresponding to the first real stroke trajectory data in each first real sample based on the first generator; inputting the first real image of each first real sample and the first reconstructed image corresponding to each first real sample into the first discriminator; the first discriminator generates a first identification result corresponding to each image based on each input image; updating the training parameters in the first discriminator based on the first identification result corresponding to each image; after iteratively performing multiple rounds of training, obtaining the pre-trained first discriminator.

[0263] It is not difficult to understand that the pre-training process of the second discriminator is relatively similar to the pre-training process of the first discriminator mentioned above. The pre-training process of the second discriminator includes: obtaining first real stroke trajectory data of multiple first real samples and first reconstructed images corresponding to the first real samples; inputting the first real stroke trajectory data and the corresponding first reconstructed image of each first real sample into the second discriminator to obtain a second identification result of each first real sample; using all the second identification results to reversely update the training parameters in the second discriminator; after iteratively executing multiple rounds of training, a pre-trained second discriminator is obtained.

[0264] In addition, it can be understood that the first encoder and the second encoder are both used to extract features of the input data to achieve data dimensionality reduction, and the first decoder and the second decoder are both used to restore features of the input data to achieve data dimensionality increase.

[0265] It can also be understood that the specific structure of the first encoder, the second encoder, the first decoder and the second decoder can be set according to actual conditions. For example, in some embodiments, in order to enable the preset network model to complete training quickly, the structure of the first encoder, the second encoder, the first decoder and the second decoder is relatively simple, that is, the first encoder and the second encoder each include three convolution layers, which are respectively a first convolution layer with a convolution kernel size of 7*7, a second convolution layer with a convolution kernel size of 5*5 and a third convolution layer with a convolution kernel size of 3*3; the second decoder and the first decoder also include three convolution layers, which are respectively a fourth convolution layer with a convolution kernel size of 3*3, a fifth convolution layer with a convolution kernel size of 5*5 and a sixth convolution layer with a convolution kernel size of 7*7.

[0266] In other implementations, in order to ensure that the encoding process can extract enough feature information and the decoding process can perform a more sufficient restoration operation, the structures of the first encoder, the second encoder, the first decoder and the second decoder are more complicated, that is, the first encoder, the second encoder, the first decoder and the second decoder all include residual networks (Residual Network), and the residual network of the first decoder and the residual network of the second decoder both include deconvolution layers.

[0267] In this way, the present application is based on the setting of the residual network, so that the preset network model can extract the first real stroke trajectory data and the deeper feature information in the first reconstructed picture during the training process, so that the first decoder and the second decoder can perform restoration operations based on the deep feature information, that is, the restoration operation can obtain strong data support; not only that, because the first decoder and the second decoder are both implemented based on the residual network, the generation of the first reconstructed picture and the second reconstructed picture can be based on a more in-depth / complex restoration operation, thereby improving the authenticity of the first reconstructed picture and the second reconstructed picture; and, the generation model of the character sample can output more realistic picture samples during the reasoning process.

[0268] Optionally, in order to enable the second encoder to restore / reconstruct a more realistic picture, in some embodiments, the second encoder includes multiple feature extraction layers.

[0269] Furthermore, the first reconstructed image is input into the second generator to obtain the second reconstructed image, including:

[0270] Inputting the first reconstructed image into multiple feature extraction layers to obtain a first feature map corresponding to each feature extraction layer;

[0271] The first feature map is input into the second decoder to obtain a second reconstructed picture.

[0272] That is, the embodiment of the present application will use multiple feature extraction layers to perform multiple feature extraction and obtain multiple feature vectors / first feature maps. Furthermore, the second decoder will complete the generation of the second reconstructed image based on the multiple first feature maps, so that the generation of the second reconstructed image can be based on enough feature information, that is, it can obtain strong data support.

[0273] It can be understood that when all the first feature maps need to be input into the second decoder, the second encoder and the second decoder can be a cross-layer symmetric network structure, and the first feature map output by each feature extraction layer will be passed to the next feature extraction layer and the corresponding feature restoration layer in the second encoder.

[0274] It can also be understood that in order to speed up the training of the preset network model, only the first feature map output by the last feature extraction layer can be input into the second decoder. As a result, the second decoder does not need to be structurally similar to the second encoder, and the number of feature restoration layers can be less than the number of feature extraction layers in the second encoder.

[0275] In this way, the implementation mode of the present application enables the second decoder to complete the generation of the second reconstructed image based on multiple first feature maps, so that the generation of the second reconstructed image can be based on sufficient feature information, thereby ensuring that the second reconstructed image can be closer to the actual situation.

[0276] Optionally, in order to enable the preset network model to learn the difference in pixels between the reconstructed image and the first real image, in some implementations, specific reference may be made to Figure 5 That is, the above-mentioned updating of the first decoder based on the first identification result and the updating of the first decoder and the second encoder based on the second identification result to obtain a generation model of the character sample includes:

[0277] Inputting the first real stroke trajectory into multiple feature extraction layers to obtain a second feature map corresponding to each feature extraction layer;

[0278] Calculate the feature map pixel loss based on the first feature map and the second feature map corresponding to each feature extraction layer;

[0279] The first decoder is updated based on the first identification result, and the feature loss / pixel loss (i.e. Figure 5 The second encoder is updated based on the FEATURE LOSS in the character sample, and the first decoder and the second encoder are updated based on the second identification result to obtain a generation model of the character sample.

[0280] That is, in order to make the stroke trajectory data of the character combination in the second reconstructed image fit with the first real stroke trajectory data, the implementation mode of the present application uses a multi-layer feature extraction layer to obtain multiple first feature maps corresponding to the first reconstructed image, and also uses a multi-layer feature extraction layer to perform feature extraction on the first real stroke trajectory data to obtain the second feature map of each feature extraction layer corresponding to the first real stroke trajectory data; then, the pixel loss is calculated based on the first feature map and the second feature map, and the pixel loss is used to update the second encoder, so that after the second encoder is updated, it can more accurately extract the feature information in the first reconstructed image, so that the difference in pixels between the first reconstructed image and the first real image is as small as possible.

[0281] It can be understood that when calculating pixel loss, it is based on a single first real sample, that is: based on the first real stroke trajectory data of a first real sample, a first reconstructed image is obtained; multiple first feature maps are obtained using this first reconstructed image; multiple second feature maps are obtained using this first real stroke trajectory data; and the first feature map and the second feature map corresponding to this first real sample are used to complete the calculation of pixel loss.

[0282] In some embodiments, the pixel loss is calculated by taking the sum of square differences of the first feature map and the second feature map corresponding to each feature extraction layer pixel by pixel to obtain the pixel loss.

[0283] In this way, the implementation mode of the present application introduces pixel loss, so that the second encoder can extract feature information that can better characterize the stroke trajectory for the second decoding layer to generate the second reconstructed picture, thereby ensuring that the second reconstructed picture is highly similar to the first real picture in terms of stroke trajectory (that is, highly similar to the first real stroke trajectory data); and, based on the second reconstructed picture with highly similar stroke trajectories, the second identification result can also express the similarity of the stroke trajectories, and thus, when training, the first encoder will also complete the training in the update direction of "the stroke trajectory data of the character combination in the first reconstructed picture is similar to the first real stroke trajectory data", thereby improving the authenticity of the first reconstructed picture.

[0284] Optionally, in some embodiments, the generation model of the character sample is a first generator.

[0285] It is not difficult to understand that, based on the aforementioned training method, after the training of the first decoder is completed, the first identification result participates in the update of the first decoder, so that the first generator can generate a picture that is similar to the picture (the similarity between the first reconstructed picture and the first real picture is higher than the first preset threshold); and because the second identification result participates in the update of the first decoder, on the basis of the similarity of the pictures, the stroke trajectories are similar (the similarity between the stroke trajectory data corresponding to the second reconstructed picture and the first real stroke trajectory data is higher than the second preset threshold). Therefore, when the preset network model is trained, the implementation mode of the present application will use the trained first generator to generate picture samples.

[0286] In this way, since only the first generator is used as the generation model of the trained character samples, the implementation mode of the present application avoids the situation where the generation model of the character samples needs to perform unnecessary parameter calculations during reasoning, improves the reasoning efficiency, and enables the generation model of the character samples to complete the generation of character samples with higher efficiency.

[0287] Please refer to Figure 6 , the present application also provides an identification method, the identification method comprising:

[0288] 0210. Obtain multiple second real samples, where the second real samples include a second real picture of the second character combination and a second real label of the second character combination.

[0289] It should be understood that the second real sample in the embodiments of the present application may be the same as the first real sample, or may be a sample different from the first real sample.

[0290] In some embodiments, the first real sample and the second real sample belong to the same data set. When training the generation model of the character sample, a part of the data is extracted from the data set to serve as a plurality of first real samples; when the terminal device needs to generate a plurality of image samples, another part of the data is extracted from the data set to serve as a plurality of second real samples.

[0291] In other embodiments, the second real sample is data collected in real time. That is, when the terminal device needs to generate multiple image samples in the current time period, the second real image is obtained based on the image of the character combination input by the user in the current time period, and the label of the second character combination input by the user in the current time period, and then the second real label is obtained. Then the second real image and the second real label are associated to obtain the second real sample.

[0292] It is not difficult to understand that the second real sample in the implementation manner of the present application may only include the second real picture and the second real label, or other information / data, so there is no excessive limitation on the relationship between the first real sample and the second real sample.

[0293] 0220. Based on the second real label, obtain the stroke trajectory data of the second character combination in each second real sample as the second real stroke trajectory data.

[0294] It is understandable that the method for obtaining the second real stroke trajectory data can adopt the method for obtaining the first real stroke trajectory data described above, and can achieve the same technical effect, so it will not be repeated here.

[0295] 0230, input the second real stroke trajectory data of multiple second real samples into the generation model of the character sample to obtain multiple image samples, wherein the generation model of the character sample is obtained by the above-mentioned generation model training method.

[0296] That is, after the application inputs the second real sample into the generative model of the trained character sample, the generative model of the character sample generates a corresponding reconstructed image, i.e., an image sample, based on the received second real stroke trajectory data. The image sample is similar to the second real image, and the trajectory data corresponding to the character combination in the image sample is similar to the second real stroke trajectory data.

[0297] 0240, use multiple image samples to train a preset recognition network model to obtain a recognition model.

[0298] That is, the present application will use multiple character samples output by the generation model of character samples to complete the training of the preset recognition network model / recognition model.

[0299] Therefore, the implementation method of the present application enables the training of recognition models such as handwriting recognition models to be completed based on a large number of samples, ensuring that the preset recognition network model can be fully trained, avoiding the occurrence of underfitting, and improving the recognition accuracy of the preset recognition network model / recognition model.

[0300] In addition, it can be understood that in order to enable the preset recognition network model to complete the training in the shortest possible time, the embodiments of the present application only use the generated / simulated character samples to complete the training of the preset recognition network model. However, in some embodiments, in order to further improve the recognition accuracy of the recognition model, the above 0240 includes:

[0301] A preset recognition network model is trained using multiple image samples and multiple second real samples to obtain a recognition model.

[0302] That is, the implementation mode of the present application will use the second real sample and the character sample generated based on the second real sample to complete the training of the preset recognition network model, thereby further enriching the sample set of the preset recognition network model.

[0303] In this way, the implementation mode of the present application enables the training of the preset recognition network model to be completed based on the second real sample and the image sample simulated by the second real sample, so the preset recognition network model can be more fully trained, thereby further improving the recognition accuracy of the preset recognition network model.

[0304] 0250, in response to the calling operation of the recognition model, calling the recognition model to recognize characters in the target image.

[0305] That is, when there is an unknown / known picture to be identified / target picture containing a character combination that is similar to the second real sample, if the user needs to identify the character combination in this picture and performs corresponding operations on the terminal device, the terminal device will call the above-mentioned recognition model to identify the character combination in the target picture.

[0306] It is not difficult to understand that since the recognition model in the implementation mode of the present application is a model trained with a large number of samples (i.e., multiple image samples), it has a higher recognition accuracy and can therefore more accurately recognize the characters / character combinations in the target image.

[0307] In this way, the implementation mode of the present application trains a sufficient recognition model so that the character combination / characters in the target image can be accurately recognized, that is, a recognition result with a high accuracy rate can be obtained; and after the recognition result is transmitted to other processing modules of the terminal device, the other processing models can respond correctly; not only that, for the recognition model training in rare recognition scenarios, the present application can train a generation model of the corresponding character samples based on a small number of real samples, and generate a large number of character samples based on the generation model of the character samples, so that the recognition model in rare recognition scenarios can also be fully trained, thereby broadening the application scenarios of the recognition model.

[0308] Optionally, in some embodiments, the preset recognition network model includes a first preset recognition network model, and the recognition model includes a first recognition model.

[0309] Furthermore, the above 0210 includes:

[0310] A plurality of second real samples in a mathematical operation scenario are obtained, wherein each character in the second character combination in the mathematical operation scenario is a parameter character and an operator character.

[0311] Furthermore, the above 0230 includes:

[0312] A first preset recognition network model is trained using multiple image samples to obtain a first recognition model.

[0313] That is, for the mathematical operation scenario, the terminal device of the implementation mode of the present application collects / receives multiple second real samples under the mathematical operation scenario, and then trains a first recognition model dedicated to the mathematical operation scenario through the image samples under the mathematical operation scenario.

[0314] It is understandable that the second character combination of the second real sample in the mathematical operation scenario will include variable characters / parameter characters such as 'α', 'β' and 'γ', and operator characters such as '+', '-' and '×'. It is not difficult to understand that the second character combination in the mathematical operation scenario may include only the above-mentioned parameter characters and operator characters, and may also include other characters applicable to the mathematical operation scenario, which can be set according to actual conditions.

[0315] In this way, when the terminal device needs to identify characters / character combinations in a mathematical operation scenario, the first recognition model will be called to complete the corresponding recognition operation, so that the characters / character combinations will complete the recognition work based on their special / corresponding recognition models, ensuring the recognition accuracy of the characters / character combinations.

[0316] Optionally, when a user recognizes a character combination in a mathematical operation scenario through a terminal device, the user usually intends to enable the terminal to complete the operation corresponding to the character combination. For example, the purpose of a user recognizing a mathematical problem of four arithmetic operations through a terminal should be to "calculate the result of the mathematical problem of four arithmetic operations". Therefore, in order to meet the user's usage needs, in some implementations, the above 0240 includes:

[0317] In response to the calling operation of the first recognition model, determining a target image;

[0318] The target parameter characters and the target operator characters in the target image are recognized using the first recognition model.

[0319] Furthermore, the identification method of the embodiment of the present application also includes:

[0320] Utilize the target parameter characters and the target operator characters to perform corresponding operations to obtain the operation results, and then display the operation results.

[0321] That is, after the terminal device calls the first recognition model to complete the recognition of the target parameter characters (such as '3' and '4') and the target operator characters (such as '+') in the target image, it will use the target parameter characters and the target operator characters to complete the corresponding operation (ie "3+4") to obtain the operation result (7), and display the operation result.

[0322] For a better explanation of the above implementation, please refer to Figure 7 , Figure 7 This is a schematic diagram of application scenarios of certain implementation methods of this application. It should be noted that: Figure 7 The two black-background white-text images on the left and right are both target images. The images on the left and right include the following formulas, namely:

[0323]

[0324] Then, after the terminal device recognizes '3', '+', '4', '2' (exponent), '-' (fraction line), 'log', '2' (base), '9' and '=' in the above formula through the first recognition model, it will perform corresponding operations to obtain the operation result '5.99', and then display the operation result on the right side of '='. Figure 7 Shown on the right.

[0325] In addition, it can be understood that whether the '=' in the above formula is recognized does not affect the calculation.

[0326] In this way, the implementation method of the present application meets the user's need to check the calculation results; and, because the first recognition model is a fully trained model, the operator characters and parameter characters it recognizes have a high degree of credibility. Therefore, the calculation results displayed by the terminal device also have a high degree of credibility, reducing the possibility of errors in the calculation results.

[0327] Optionally, in some embodiments, the preset recognition network model includes a second preset recognition network model, and the recognition model includes a second recognition model.

[0328] Furthermore, the above 0210 includes:

[0329] A plurality of second real samples in a text recognition scenario are obtained, wherein each character in the second character combination in the text operation scenario is a parameter character and an operator character.

[0330] Furthermore, the above 0230 includes:

[0331] A second preset recognition network model is trained using multiple image samples to obtain a second recognition model.

[0332] That is, the terminal device in the implementation mode of the present application pre-collects / receives multiple second real samples in the text recognition scenario, so as to identify the character samples specifically used to generate the text recognition scenario through the multiple second real samples in the text recognition scenario, and use the multiple character samples in the text recognition scenario to train the preset recognition network model, and the identified second recognition model is a model specifically used to recognize text characters.

[0333] It is understood that the text characters may include Chinese characters, English characters, Korean characters, and other types.

[0334] It can also be understood that in order to further improve the recognition accuracy of the second recognition model, the second preset recognition network model can be trained as a recognition model for a specific type of text characters. For example, in some embodiments, the second character combination of each second real sample is a Chinese character combination, and thus, the second recognition model is dedicated to recognizing Chinese characters. In other embodiments, the second character combination of each second real sample is an English character combination, and thus the second recognition model is dedicated to recognizing English.

[0335] In this way, the implementation method of the present application enables the recognition of text characters to be completed based on the corresponding / special second recognition model, thereby ensuring the recognition accuracy of the text characters; at the same time, because the second recognition model is a model that has been trained with a large number of samples, the recognition accuracy of the second recognition model can be guaranteed; therefore, the recognition result of the second recognition model has a higher credibility, and then other processing models in the terminal device can perform correct / effective corresponding operations based on the high-credibility recognition result.

[0336] Optionally, in an online handwritten note scenario or an online meeting note scenario, the purpose of a user recognizing text characters through a terminal device may be to "select the recognized text characters for copying". Therefore, in order to meet the recording needs of customers, in some embodiments, the above 0240 includes:

[0337] In response to the calling operation of the second recognition model, determining the target image;

[0338] The target text characters in the target image are recognized using the second recognition model.

[0339] Furthermore, the identification method provided in the embodiment of the present application also includes:

[0340] Display the target text characters.

[0341] That is, when the user wants to identify the text in the target image through the terminal device, the terminal device will generate and display the electronic text that can be selected after identifying the target text characters in the target image, that is, the target text characters are displayed.

[0342] In this way, when the user needs to select and / or copy text characters in the note, the user can use the terminal to recognize the text characters in the note and generate an electronic version of the text that can be selected / copied, thereby meeting the user's needs.

[0343] In addition, it is understood that the specific location where the target text characters are to be displayed can be set according to the actual situation. In some embodiments, the target text characters are displayed directly below the character combination in the target image. For a clearer description of this embodiment, please refer to Figure 8 , Figure 8 A schematic diagram of application scenarios of certain embodiments of the present application.

[0344] In other embodiments, the target text character has the same stroke trajectory as the character combination in the target image, and the target text character will be displayed on the upper layer of the character combination in the target image. That is, the target text character will overlap with the character combination in the target image. In other words, when the user selects the character combination in the target image, the target text character is actually selected.

[0345] Optionally, in an online handwritten note scenario or an online conference note scenario, the purpose of a user recognizing text characters through a terminal device may also be to "save the recognized text characters to a terminal device for recording". Therefore, in order to meet the user's recording needs, in certain embodiments, after the target text characters are displayed, the recognition method provided in the embodiment of the present application further includes:

[0346] In response to the first interactive operation, the target text characters are exported as a file in a preset format.

[0347] That is, after the terminal device displays the electronic text / target text characters, if the terminal device receives a text export operation triggered by the user (i.e., the first interactive operation), the terminal device will generate a file in a preset format, such as a TXT format file, at a preset storage location; and then write the target text characters into this file, thereby completing the export of the target text characters.

[0348] It is understandable that the specific form of the first interactive operation can be set according to actual conditions. For example, in some embodiments, the first interactive operation is: the user's finger continuously clicks the touch screen of the terminal device for a preset number of times. In other embodiments, the terminal device will display an export button on the screen after displaying the target text characters, so that the user can click it to trigger the first interactive operation.

[0349] It can also be understood that the file in the preset format can be a file in the TXT format mentioned above, or a file in PDF (Portable Document Format) format, a file in Word format, or a file in other formats, and the implementation method of the present application does not limit this.

[0350] In this way, the implementation mode of the present application enables the user to export the target text characters into a file of a preset format as needed, thereby meeting the needs of the user.

[0351] Optionally, in an online meeting multi-person note-taking scenario, there may be notes from multiple people and the contents of different notes may be different, and the user may only need to identify text in a specific area to perform mathematical operations or text export. Therefore, in order to meet user needs, in certain embodiments of the present application, the above-mentioned calling operation includes a circle selection operation.

[0352] Furthermore, the above 0250 includes:

[0353] In response to a circle selection operation in the current display area, a target image is obtained;

[0354] Call the recognition model to recognize the characters in the target image.

[0355] For a clearer explanation of this implementation, please refer to Fig. 9 , Fig. 9 This is a schematic diagram of application scenarios of certain implementation methods of this application. It should be noted that: Fig. 9 The figure shows the situation when multiple people edit the same note file in an online meeting. It is not difficult to find that Fig. 9 English characters, mathematical operator characters, parameter characters, and Chinese characters are displayed.

[0356] Furthermore, if the user needs to obtain the calculation results corresponding to the mathematical operator characters and parameter characters, the user can circle the areas corresponding to the mathematical operator characters and parameter characters so that the terminal device calls the corresponding recognition model such as the first recognition model to complete the recognition of the mathematical operator characters and parameter characters, and calculates and displays the calculation results based on the recognition results.

[0357] For a clearer explanation of this implementation, please refer to Fig.10 and Fig.11 , Fig.10 and Fig.11 These are schematic diagrams of application scenarios of certain embodiments of the present application. Fig.10 The figure shows a situation where a user circles the area corresponding to the mathematical operator character and the parameter character. Fig.11 It shows a situation where the terminal device performs character recognition on the circled area image (ie, the target image), performs calculations based on the recognition results, and displays the calculation results.

[0358] In this way, the implementation mode of the present application enables users to select partial areas from an image containing multiple character types as recognition targets based on their own needs, thereby meeting the user's personalized recognition needs.

[0359] Optionally, if the terminal device is equipped with two or more recognition models at the same time, such as the first recognition model and the second recognition model mentioned above, the terminal device will perform a confirmation operation on the recognition scene corresponding to the target image before calling the recognition model to perform character recognition on the target image.

[0360] Demonstration, Fig.10 and Fig.11 For example, when the terminal device knows the area selected by the user and obtains the target image, it will determine whether the characters in the target image are characters in a mathematical operation scenario or characters in a text recognition scenario; when the terminal device determines that the characters in the target image are parameter characters or mathematical operator characters, the first recognition model is called to complete character recognition.

[0361] It should also be noted that in some implementations where two or more recognition models are installed in the terminal device at the same time, the target image may contain only one type of character in the recognition scenario, such as only operator characters and parameter characters, or only text characters, so as to ensure that different types of recognition models can complete character recognition with higher accuracy.

[0362] In other embodiments that are equipped with two or more recognition models at the same time, the target image may include characters of multiple recognition scenarios, such as operator characters, parameter characters, and text characters only. In this case, the embodiment of the present application will divide the target image into multiple areas in advance based on image segmentation, selective search or other methods, and input the image corresponding to each area into each recognition model. After each recognition model outputs the corresponding result and the probability corresponding to the corresponding result, the recognition result with the highest probability is retained and the other recognition results are deleted. It is not difficult to understand that when the recognition model predicts / recognizes the image, it will output the corresponding probability based on the classifier inside the model. This probability indicates the possibility that the recognition model believes that the characters in the image are predicted character labels.

[0363] Optionally, in some implementations, the calling operation includes a click operation;

[0364] Furthermore, the above 0250 includes:

[0365] In response to a click operation in the current display area, the current display area is used as a target image;

[0366] Call the recognition model to recognize the characters in the target image.

[0367] That is, in this implementation mode, if a click operation performed by the user is received, the terminal device will determine that the user wants to identify all the contents of the current display area.

[0368] In some implementations, the click operation is: the user clicks a preset area (such as the upper half area) of the touch screen three times in a row with a finger.

[0369] In some other implementations, the above-mentioned click operation is: the user clicks a blank area (ie, an area not containing characters) in the current display area three times in a row with a finger.

[0370] In this way, the implementation mode of the present application enables the user to conveniently use the entire current display area as the target image, thereby efficiently completing character recognition and related processing based on the recognition results.

[0371] In addition, it can be understood that when two or more recognition models are installed in the terminal device at the same time, if the current display area will be used as the target image, the current display area should only contain characters under one recognition scenario.

[0372] Optionally, to avoid invalid calling of the recognition model due to an accidental touch operation, in some embodiments, calling the recognition model to recognize characters in the target image includes:

[0373] In response to the interactive confirmation operation, the recognition model is called to recognize characters in the target image.

[0374] That is, when the terminal device determines the target image based on the user's click operation or circle operation, the target image may be the result of the user's accidental touch operation. Therefore, in order to avoid the situation where the recognition model is called due to the user's accidental touch operation, the embodiment of the present application will also wait for the user to trigger an interactive confirmation operation after the target image is determined to determine whether the recognition model needs to be called.

[0375] It is not difficult to understand that if the user does not trigger the interactive confirmation operation within a certain period of time, it means that the user has determined the target image due to an accidental touch operation, so the terminal device deletes the target image at the current moment.

[0376] If the user triggers the interactive confirmation operation within a certain period of time, it means that the user controls the terminal device to determine the target image based on subjective needs, so the terminal device will call the recognition model to complete subsequent related steps.

[0377] In this way, the implementation method of the present application avoids the occurrence of recognition model calls due to false touches, and reduces the probability of the terminal device consuming unnecessary resources.

[0378] Optionally, in some embodiments, when the user triggers a click operation or a circle operation, and the terminal device determines the target image, the terminal device will display the words "Do you need to identify the current page content" or "Do you need to identify the circled content" and display a "Confirm" button. If the user clicks the "Confirm" button, the terminal device will call the recognition model to complete the subsequent related steps. If the user does not click the "Confirm" button within 5 seconds, the terminal device will hide the above words and delete the target image.

[0379] Optionally, in some embodiments, the above-mentioned interactive confirmation operation is: performing two tap operations on the touch screen, and long pressing the second tap.

[0380] Optionally, in a multi-person online conference note-taking scenario, different users write notes in different ways (i.e., different writing styles), such as some users take notes in cursive fonts, and other users take notes in regular script fonts. As a result, when one user reviews everyone's notes, he needs to view notes in multiple fonts at the same time, which affects the review experience. In other words, there is a demand for users to unify different note styles into one note style for easy reference. Therefore, in some embodiments, the recognition method provided in the embodiments of the present application further includes:

[0381] Identify all second characters in the currently displayed page;

[0382] In response to the second interactive operation, determining a writing style of a third character corresponding to the second interactive operation, wherein the writing style represents stroke thickness, stroke trend, stroke order, and stroke position of the third character;

[0383] Adjust the writing style of all second characters to the writing style of the third character.

[0384] That is, the terminal device will identify each second character in the currently displayed page to determine the label of each second character. Then, if the user triggers the second interactive operation to indicate that the writing style of all second characters needs to be adjusted to the writing style of the third character, the terminal device will identify the writing style of the third character. Finally, based on the identified writing style and the label of each second character, the terminal device adjusts each second character so that all second characters have the same writing style.

[0385] To better illustrate the above implementation, please refer to Fig.12 , Fig.12 The following is a schematic diagram of application scenarios of certain embodiments of the present application. It is not difficult to understand that: Fig.12 The characters in the dashed circle are all the second characters, and the characters in the dashed circle are both the second characters and the third characters. Further, after the terminal device determines the third character based on the user-triggered circling operation, if it receives the second interactive operation triggered by the user, it converts all the second characters into the writing style of the third character based on the writing style of the third character, that is, Fig.12 The picture on the right shows the situation.

[0386] In some embodiments, the terminal device pre-stores a writing style information. Then, if the user does not specify the third character in the current display page, such as, Fig.12 As shown on the left, the third character is selected by the circle selection operation, and the terminal device will read the pre-stored writing style information as the writing style of the third character.

[0387] In this way, the implementation mode of the present application enables users to adjust characters with different stroke styles to the same writing style based on their own needs, so that all characters in the notes are in the same writing style, allowing users to have a better review experience.

[0388] It is understandable that the specific operation mode of the second interactive operation is a content that can be set according to actual conditions. For example, in some embodiments, the terminal device will display a "note style conversion" button on the current display page, and then, after the terminal device determines the third character, if the user clicks the "note style conversion" button, it indicates that the second interactive operation is triggered, and then the terminal device performs the note style conversion work.

[0389] In other embodiments, after the user has circled the third character to allow the terminal device to determine the third character and know the note style of the third character, if the user double-clicks the circled content, it represents the triggering of the second interactive operation, and the terminal device executes the note style conversion.

[0390] In addition, it can be understood that the method of identifying / determining the writing style of the third character is content that can be set according to actual conditions. For example, in some embodiments, the process of determining the writing style of the third character includes: when the user takes notes, recording the order and position of each stroke of each character to obtain the stroke order and stroke position; detecting the thickness of each stroke of each third character, and calculating the average thickness to obtain the stroke thickness; detecting the trajectory of the last stroke of each third character to obtain the stroke trend.

[0391] In other embodiments, since the neural network model can effectively extract the corresponding feature information after training, in some embodiments, the writing style of the third character is determined based on the trained network model, that is, in response to the second interactive operation, determining the writing style of the third character corresponding to the second interactive operation includes:

[0392] In response to the second interactive operation, the third character is input into the representation vector generation model to obtain a writing style representation vector of the third character, wherein the writing style representation vector represents the writing style of the third character.

[0393] Furthermore, the above-mentioned adjusting the writing styles of all second characters to the writing style of the third character includes:

[0394] Based on the writing style representation vector, the writing style of the second character is adjusted so that the writing style of the second character is similar to the writing style of the third character.

[0395] That is, in this implementation, the present application will obtain the writing style of the third character based on the representation vector generation model, that is, obtain the writing style representation vector of the third character. Then, the terminal device completes the writing style conversion of each second character through the writing style representation vector.

[0396] In this way, the implementation mode of the present application enables the writing style of the third character to be determined based on the representation vector generation model, so the writing style can be represented based on an abstract but accurate digital expression (ie, the writing style representation vector), thereby ensuring the accurate conversion of each second character.

[0397] Optionally, different users may have different writing styles for their notes, and different users may record the content they need to record in different areas, such as Fig.12As shown in the left picture, in order to enable the terminal device to accurately identify each second character in different areas of different writing styles, in some embodiments, the above-mentioned identification of all second characters in the currently displayed page includes:

[0398] If no operation is received within a preset time, the second characters in different areas of the currently displayed page are used as a group of third character combinations, wherein a distance greater than a preset distance exists between two different third character combinations;

[0399] Based on the recognition model, each second character in each third character combination is recognized.

[0400] That is, after the user does not perform any operation for a preset period of time, the terminal device will identify characters at different positions, and combine multiple adjacent characters as a group of third characters according to the distance / position relationship between the characters. Fig. 9 For example, Fig. 9 Contains 4 sets of third character combinations.

[0401] Then, for each third character combination, the terminal device inputs it into the above recognition model for individual recognition.

[0402] It is not difficult to imagine that if the terminal device is equipped with multiple recognition models (such as the first recognition model and the second recognition model mentioned above), then before inputting the third character combination into the recognition model, the terminal device will also determine the recognition scenario of the third character combination to determine whether the third character combination needs to be recognized through the first recognition model or the second recognition model.

[0403] It can also be understood that the above-mentioned preset distance is something that can be set according to actual conditions.

[0404] In this way, the present application enables the second character to be identified based on its other adjacent second characters, avoiding label recognition errors that may occur due to context differences when a single character is identified, thereby ensuring the accuracy of writing style adjustment.

[0405] Optionally, in order to reduce the load of the terminal device, in some embodiments, after identifying each second character in each group of third character combinations based on the recognition model, the recognition method of the embodiment of the present application further includes:

[0406] If the first preset cache space has stored other data, the location data of the second character and the third character combination in each group of the third character combination replaces the other data;

[0407] If the first preset cache space does not store other data, the location data of the second character and the third character combination in each group of the third character combination are stored in the first preset cache space.

[0408] That is, the embodiment of the present application will also store the location information (i.e., location data) of the second character label and the third character combination in the first preset cache space after the second character is recognized. Furthermore, before the terminal device updates the first preset cache space, the terminal device can repeatedly read the location data of the second character label and the third character combination in the preset cache space to avoid the need to perform the second character recognition operation every time the writing style is adjusted.

[0409] It is understandable that if the second character changes, the terminal device will re-recognize the second character and update the cache.

[0410] In some implementations, the third character combination in the currently displayed page can be enclosed by a rectangular frame, so the location data of the third character combination includes the lower left corner coordinates of the corresponding rectangular frame, the length of the rectangular frame, and the height of the rectangular frame.

[0411] Thus, the embodiment of the present application avoids the situation that every time the writing style is adjusted, all the second characters need to be recognized, which reduces the load of the terminal device and improves the conversion efficiency of the writing style. In addition, because the data in the first cache space is always the latest data, the effective conversion of the writing style of the second character can be ensured.

[0412] Optionally, in order to reduce the load of the terminal device, in some embodiments, after the third character is input into the representation vector generation network to obtain the writing style representation vector of the third character, the recognition method of the embodiment of the present application further includes:

[0413] If the second preset cache space has stored other vectors, the writing style representation vector replaces the other vectors;

[0414] If the second preset cache space does not store other vectors, the writing style representation vector is stored in the second preset cache space.

[0415] That is, the present application will cache the writing style representation vector of each third character, and then, if the user does not reselect the third character, the terminal will repeatedly read the data in the second preset cache space to obtain the writing style representation vector.

[0416] It is understandable that if the third character changes, the terminal device will perform a new round of acquiring the writing style representation vector, and update the data in the second preset cache space based on the new writing style representation vector.

[0417] Thus, the embodiment of the present application enables the terminal device to perform writing style conversion without having to repeat the operation of obtaining the writing style representation vector when the third character remains unchanged, thereby reducing the load of the terminal device and improving the writing style conversion efficiency. At the same time, because the data in the second preset cache space is always the latest data, the effective conversion of the writing style of the second character can be ensured.

[0418] Please refer to Fig.13 The present application also provides a training device 300 for generating a model, including:

[0419] A first sample acquisition module 310 is used to acquire a plurality of first real samples, wherein the first real sample includes a first real picture of a first character combination and a first real label of the first character combination;

[0420] A first trajectory acquisition module 320, configured to acquire stroke trajectory data of a first character combination in each first real sample based on a first real label as first real stroke trajectory data, wherein the stroke trajectory data represents a stroke position and a stroke order of each character in the first character combination;

[0421] A first input module 330, used to input the first real stroke trajectory data of each first real sample into a generator of a preset network model to obtain a reconstructed image corresponding to the first real stroke trajectory data;

[0422] A second input module 340 is used to input the reconstructed image and the first real image into the discriminator of the preset network model to obtain a first identification result and a second identification result, wherein the first identification result indicates whether the reconstructed image and the first real image input into the preset network model are true, and the second identification result indicates the similarity between the first real stroke trajectory data and the stroke trajectory data of the character combination in the corresponding reconstructed image;

[0423] The training module 350 is used to update the preset network model based on the first identification result and the second identification result to obtain a generation model of the character sample, wherein the generation model of the character sample is used to generate at least one image sample according to the first real stroke trajectory data of the input first real sample, and the similarity between the image sample and the image of the first real sample is higher than a first preset threshold, and the similarity between the stroke trajectory data corresponding to the image sample and the first real stroke trajectory data corresponding to the first real sample is higher than a second preset threshold.

[0424] The training device 300 for generating a model provided in the embodiment of the present application can implement each process of the training method for generating a model described above and can achieve the same technical effect. To avoid repetition, it will not be described here.

[0425] Please refer to Fig.14The present application also provides an identification device 400, including:

[0426] A second sample acquisition module 410 is used to acquire a plurality of second real samples, wherein the second real samples include a second real picture of a second character combination and a second real label of the second character combination;

[0427] A second trajectory acquisition module 420, configured to acquire stroke trajectory data of a second character combination in each second real sample based on a second real label as second real stroke trajectory data;

[0428] A sample obtaining module 430 is used to input the second real stroke trajectory data of the plurality of second real samples into the generation model of the character samples to obtain a plurality of picture samples, wherein the generation model of the character samples is obtained by the training method of the generation model described above;

[0429] A model training module 440 is used to train a preset recognition network model using multiple image samples to obtain a recognition model;

[0430] The response module 450 is used to call the recognition model to recognize characters in the target image in response to the calling operation of the recognition model.

[0431] The identification device 400 provided in the embodiment of the present application can implement each process of the above-mentioned identification method and can achieve the same technical effect. To avoid repetition, it will not be described here.

[0432] An embodiment of the present application further provides a terminal device, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the above method is implemented.

[0433] The embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by one or more processors, the above method is implemented.

[0434] In the description of this specification, the descriptions with reference to the terms "certain embodiments", "in an example", "exemplarily", etc., mean that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.

[0435] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.

[0436] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. A training method for generating a model, characterized in that: include: Acquire a plurality of first real samples, wherein the first real samples include a first real picture of a first character combination and a first real label of the first character combination; Based on the first real label, obtaining stroke trajectory data of the first character combination in each of the first real samples as first real stroke trajectory data, wherein the stroke trajectory data represents the stroke position and stroke order of each character in the first character combination; Inputting the first real stroke trajectory data of each first real sample into a generator of a preset network model to obtain a reconstructed image corresponding to the first real stroke trajectory data; Input the reconstructed image and the first real image into the discriminator of the preset network model to obtain a first identification result and a second identification result, wherein the first identification result indicates whether the reconstructed image and the first real image input into the preset network model are true, and the second identification result indicates the similarity between the first real stroke trajectory data and the stroke trajectory data of the character combination in the corresponding reconstructed image; The preset network model is updated based on the first identification result and the second identification result to obtain a generation model of the character sample, wherein the generation model of the character sample is used to generate at least one picture sample based on the first real stroke trajectory data of the input first real sample, the similarity between the picture sample and the picture of the first real sample is higher than a first preset threshold, and the similarity between the stroke trajectory data corresponding to the picture sample and the first real stroke trajectory data corresponding to the first real sample is higher than a second preset threshold.

2. The training method of the generative model according to claim 1, characterized in that: The first character combination includes a plurality of first characters; The step of acquiring the stroke trajectory data of the first character combination in each of the first real samples based on the first real label as the first real stroke trajectory data includes: For each of the first real samples, using the first real label of the first real sample, obtaining trajectory reference data of each of the first characters in the first character combination from a preset character trajectory knowledge set, wherein the trajectory reference data includes a reference position and order of each stroke of the first character; The trajectory reference data of each of the first characters of the first real sample are spliced ​​to obtain stroke trajectory data of the first real sample, and the stroke trajectory data is used as the first real stroke trajectory data.

3. The training method of the generative model according to claim 2, characterized in that: The step of splicing the trajectory reference data of each of the first characters of the first real sample to obtain the stroke trajectory data of the first real sample, and using the stroke trajectory data as the first real stroke trajectory data includes: According to a preset sequence, from all the first characters of the first real samples, extract a first character that has not been extracted as the current character; Using the trajectory data of the first character extracted before the current character at the preset position as a first offset, wherein the first offset of the first character extracted for the first time is 0; Based on the first offset and a preset second offset, the trajectory reference data of the current character is corrected to obtain the trajectory data of the current character, wherein the second offset of the first character extracted for the first time is 0; Returning to the step of extracting, from all the first characters of the first real sample in a preset order, a first character that has not been extracted as the current character, until all the first characters of the first real sample have been extracted, and obtaining the stroke trajectory data of the first real sample based on the trajectory data of each first character; The stroke trajectory data is used as the first real stroke trajectory data.

4. The training method for generating a model according to claim 3, characterized in that: The step of correcting the trajectory reference data of the current character based on the first offset and the preset second offset to obtain the trajectory data of the current character includes: If the current character is identified as being in a special format, the trajectory reference data of the current character is corrected based on a third offset corresponding to the special format to obtain the trajectory data of the current character, wherein the special format includes a logarithmic base format and an exponential format; If it is recognized that the current character is not in a special format, the trajectory reference data of the current character is corrected based on the first offset and the second offset to obtain the trajectory data of the current character.

5. The training method of the generative model according to claim 1, characterized in that: The generator includes a first generator and a second generator, the discriminator includes a first discriminator and a second discriminator, and the reconstructed picture includes a first reconstructed picture and a second reconstructed picture; The step of inputting the first real stroke trajectory data of each first real sample into a generator of a preset network model to obtain a reconstructed image corresponding to the first real stroke trajectory data includes: Inputting the first real stroke trajectory data of each first real sample into the first generator to obtain the first reconstructed image of each first real sample; Inputting the first reconstructed picture into the second generator to obtain the second reconstructed picture; The step of inputting the reconstructed image and the first real image into the discriminator of the preset network model to obtain a first identification result and a second identification result includes: Inputting the first reconstructed image and the first real image into the first discriminator to obtain the first identification result, wherein the first identification result also indicates whether the first reconstructed image and the first real image input into the first discriminator are true; The second reconstructed image and the first real stroke trajectory data of each first real sample are input into the second discriminator to obtain a second identification result, wherein the second identification result also indicates the similarity between the second reconstructed image and the first real stroke trajectory.

6. The training method for generating a model according to claim 5, characterized in that: The first discriminator and the second discriminator are both pre-trained networks, the first generator includes a first encoder and a first decoder, and the second generator includes a second encoder and a second decoder; The updating of the preset network model based on the first identification result and the second identification result to obtain a generation model of the character sample includes: The first decoder is updated based on the first identification result, and the first decoder and the second encoder are updated based on the second identification result to obtain a generation model of the character sample.

7. The training method for generating a model according to claim 6, characterized in that: The first encoder, the second encoder, the first decoder and the second decoder all include residual networks, and the residual network of the first decoder and the residual network of the second decoder both include deconvolution layers.

8. The training method for generating a model according to claim 6, characterized in that: The second encoder includes a plurality of feature extraction layers; The step of inputting the first reconstructed picture into the second generator to obtain the second reconstructed picture comprises: Inputting the first reconstructed image into the multiple feature extraction layers to obtain a first feature map corresponding to each feature extraction layer; The first feature map is input into the second decoder to obtain the second reconstructed picture.

9. The training method for generating a model according to claim 8, characterized in that: The updating of the first decoder based on the first identification result, and the updating of the first decoder and the second encoder based on the second identification result to obtain the generation model of the character sample includes: Inputting the first real stroke trajectory into the multiple feature extraction layers to obtain a second feature map corresponding to each feature extraction layer; Calculating feature map pixel loss based on the first feature image and the second feature map corresponding to each feature extraction layer; The first decoder is updated based on the first identification result, the second encoder is updated based on the pixel loss, and the first decoder and the second encoder are updated based on the second identification result to obtain a generation model of the character sample.

10. The training method of the generative model according to claim 9, characterized in that: The generation model of the character sample is the first generator.

11. The training method of the generative model according to claim 1, characterized in that: The first real stroke trajectory data also includes the trajectory points of each stroke of each character in the first character combination and the sequence numbers of the trajectory points.

12. A recognition method, characterized in that: include: Acquire a plurality of second real samples, wherein the second real samples include a second real picture of a second character combination and a second real label of the second character combination; Based on the second real label, obtaining the stroke trajectory data of the second character combination in each of the second real samples as the second real stroke trajectory data; Inputting the second real stroke trajectory data of the plurality of second real samples into a generation model of a character sample to obtain a plurality of image samples, wherein the generation model of the character sample is obtained by the training method of the generation model according to any one of claims 1 to 11; Using the multiple image samples to train a preset recognition network model to obtain a recognition model; In response to the calling operation of the recognition model, the recognition model is called to recognize characters in the target image.

13. The identification method according to claim 12, characterized in that: The method of using the plurality of image samples to train a preset recognition network model to obtain a recognition model includes: The plurality of picture samples and the plurality of second real samples are used to train a preset recognition network model to obtain a recognition model.

14. The identification method according to claim 12, characterized in that: The preset recognition network model includes a first preset recognition network model, and the recognition model includes a first recognition model; The obtaining of a plurality of second real samples comprises: Acquire a plurality of the second real samples in a mathematical operation scenario, wherein each character in the second character combination in the mathematical operation scenario is a parameter character and an operator character; The method of using the plurality of image samples to train a preset recognition network model to obtain a recognition model includes: The first preset recognition network model is trained using the multiple image samples to obtain the first recognition model.

15. The identification method according to claim 14, characterized in that: In response to the calling operation of the recognition model, calling the recognition model to recognize characters in the target image includes: In response to the calling operation of the first recognition model, determining a target image; Recognize target parameter characters and target operator characters in the target image using the first recognition model; The method further comprises: Utilizing the target parameter characters and the target operator characters, corresponding operations are performed to obtain operation results, and the operation results are displayed.

16. The identification method according to claim 12, characterized in that: The preset recognition network model includes a second preset recognition network model, and the recognition model includes a second recognition model; The obtaining of a plurality of second real samples comprises: Acquire a plurality of the second real samples in a text recognition scenario, wherein each character in the second character combination in the text operation scenario is a parameter character and an operator character; The method of using the plurality of image samples to train a preset recognition network model to obtain a recognition model includes: The second preset recognition network model is trained using the multiple image samples to obtain the second recognition model.

17. The identification method according to claim 16, characterized in that: In response to the calling operation of the recognition model, calling the recognition model to recognize characters in the target image includes: In response to the calling operation of the second recognition model, determining the target image; Recognize target text characters in the target image using the second recognition model; The method further comprises: The target text characters are displayed.

18. The identification method according to claim 17, characterized in that: After displaying the target text characters, the method further comprises: In response to the first interactive operation, the target text characters are exported as a file in a preset format.

19. The identification method according to claim 12, characterized in that: The calling operation includes a circle selection operation; In response to the calling operation of the recognition model, calling the recognition model to recognize characters in the target image includes: In response to the circle selection operation in the current display area, obtaining the target image; The recognition model is called to recognize characters in the target image.

20. The identification method according to claim 12, characterized in that: The calling operation includes a click operation; In response to the calling operation of the recognition model, calling the recognition model to recognize characters in the target image includes: In response to a click operation in the current display area, taking the current display area as the target image; The recognition model is called to recognize characters in the target image.

21. The identification method according to claim 19 or 20, characterized in that: The calling the recognition model to recognize characters in the target image includes: In response to the interactive confirmation operation, the recognition model is called to recognize characters in the target image.

22. The identification method according to claim 12, characterized in that: The method further comprises: Identify all second characters in the currently displayed page; In response to a second interactive operation, determining a writing style of a third character corresponding to the second interactive operation, wherein the writing style represents stroke thickness, stroke trend, stroke order, and stroke position of the third character; The writing styles of all the second characters are adjusted to the writing style of the third character.

23. The identification method according to claim 22, characterized in that: The identifying all second characters in the currently displayed page includes: If no operation is received within a preset time period, the second characters in different areas of the currently displayed page are used as a group of third character combinations, wherein a distance greater than a preset distance exists between two different third character combinations; Based on the recognition model, each of the second characters in each group of the third character combinations is recognized.

24. The identification method according to claim 23, characterized in that: After identifying each of the second characters in each group of the third character combination based on the recognition model, the method further includes: If the first preset cache space has stored other data, the other data is replaced by the location data of the second character and the third character combination in each group of the third character combination; If the first preset cache space does not store the other data, the location data of the second character and the third character combination in each group of the third character combination are stored in the first preset cache space.

25. The identification method according to claim 22, characterized in that: The step of determining, in response to the second interaction operation, a writing style of a third character corresponding to the second interaction operation includes: In response to the second interactive operation, the third character is input into a representation vector generation model to obtain a writing style representation vector of the third character, wherein the writing style representation vector represents the writing style of the third character; The step of adjusting the writing styles of all the second characters to the writing style of the third character includes: Based on the writing style representation vector, the writing style of the second character is adjusted so that the writing style of the second character is similar to the writing style of the third character.

26. The identification method according to claim 25, characterized in that: After the third character is input into the representation vector generation model in response to the second interaction operation to obtain the writing style representation vector of the third character, the method further includes: If the second preset cache space has stored other vectors, replacing the other vectors with the writing style representation vector; If the second preset cache space does not store the other vectors, the writing style representation vector is stored in the second preset cache space.

27. A training device for generating a model, characterized in that: include: A first sample acquisition module, configured to acquire a plurality of first real samples, wherein the first real samples include a first real picture of a first character combination and a first real label of the first character combination; a first trajectory acquisition module, configured to acquire stroke trajectory data of the first character combination in each of the first real samples based on the first real label as first real stroke trajectory data, wherein the stroke trajectory data represents the stroke position and stroke order of each character in the first character combination; A first input module, used for inputting the first real stroke trajectory data of each first real sample into a generator of a preset network model to obtain a reconstructed image corresponding to the first real stroke trajectory data; A second input module, used for inputting the reconstructed image and the first real image into the discriminator of the preset network model to obtain a first identification result and a second identification result, wherein the first identification result indicates whether the reconstructed image and the first real image input into the preset network model are true, and the second identification result indicates the similarity between the first real stroke trajectory data and the stroke trajectory data of the character combination in the corresponding reconstructed image; A training module is used to update the preset network model based on the first identification result and the second identification result to obtain a generation model of a character sample, wherein the generation model of the character sample is used to generate at least one picture sample according to the first real stroke trajectory data of the first real sample input, the similarity between the picture sample and the picture of the first real sample is higher than a first preset threshold, and the similarity between the stroke trajectory data corresponding to the picture sample and the first real stroke trajectory data corresponding to the first real sample is higher than a second preset threshold.

28. An identification device, characterized in that: include: A second sample acquisition module, used to acquire a plurality of second real samples, wherein the second real samples include a second real picture of a second character combination and a second real label of the second character combination; A second trajectory acquisition module, configured to acquire, based on the second real label, the stroke trajectory data of the second character combination in each of the second real samples as second real stroke trajectory data; A sample obtaining module, used for inputting the second real stroke trajectory data of the plurality of second real samples into a generation model of a character sample to obtain a plurality of image samples, wherein the generation model of the character sample is obtained by the training method of the generation model according to any one of claims 1 to 11; A model training module, used to train a preset recognition network model using the multiple image samples to obtain a recognition model; The response module is used to call the recognition model to recognize characters in the target image in response to the calling operation of the recognition model.

29. A terminal device, characterized in that: The terminal device includes a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method described in any one of claims 1 to 26 is implemented.

30. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by one or more processors, the method according to any one of claims 1 to 26 is implemented.