Handwritten signature recognition method, device, equipment, medium and program product
By calculating the cutting probability and location of the stroke trajectory in handwritten signature recognition, cutting it into single-word images and using the single-word recognition model, the problem of low overall recognition accuracy is solved, and efficient single-word recognition and accuracy improvement are achieved.
Patent Information
- Application Number
- CN202210372758.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-11
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-04-11
AI Technical Summary
Existing handwritten signature recognition methods use holistic recognition, resulting in low recognition accuracy. Especially when there are many types of Chinese characters, the training set required is huge, making effective recognition difficult.
By obtaining the stroke trajectory of the signature image, calculating the cutting probability of each point, determining the target cutting site for cutting, obtaining a single-word image, and using the trained single-word recognition model for recognition, combining the water drop algorithm and the hidden Markov model to improve the cutting accuracy.
It realizes single-word recognition of handwritten signatures, improves recognition accuracy, simplifies the training process, and reduces the demand for training sets.
Smart Images

Figure CN114863574B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image recognition technology, and in particular relates to a handwritten signature recognition method, apparatus, device, computer storage medium, and computer program product. Background Art
[0002] With the development of technology, handwritten electronic signatures have been widely used in checks, forms, certificates, postal envelopes, bills, manuscript documents, etc.
[0003] Currently, handwritten signature recognition mostly relies on holistic recognition, which treats the signature image as a whole and directly identifies the corresponding signature using a convolutional neural network model. This holistic recognition method suffers from low accuracy in handwritten signature recognition scenarios. Summary of the Invention
[0004] Embodiments of the present application provide a handwritten signature recognition method, apparatus, device, computer-readable storage medium, and computer program product, which can improve the recognition accuracy of handwritten signatures.
[0005] In a first aspect, an embodiment of the present application provides a handwritten signature recognition method, the method comprising:
[0006] Acquire a stroke trajectory in the signature image to be recognized, where the stroke trajectory includes multiple locations;
[0007] Calculate the cutting probability of each point in the stroke trajectory;
[0008] Determine the target cutting site of the signature image to be identified according to the cutting probability;
[0009] Cutting the signature image to be identified according to the target cutting site to obtain multiple cut single word images;
[0010] Inputting the multiple cut single-word images into a trained single-word recognition model, and obtaining candidate single words corresponding to each single-word image through the single-word recognition model;
[0011] Determine the signature corresponding to the signature image to be recognized based on the candidate words.
[0012] In an optional embodiment, calculating the cutting probability of each point in the stroke trajectory; and determining the target cutting site of the signature image to be recognized according to the cutting probability includes:
[0013] Calculate the first cutting probability of each point in the stroke trajectory through the water drop algorithm;
[0014] When the first cutting probability does not meet the preset conditions, the second cutting probability of each point in the stroke trajectory is calculated by the hidden Markov model, and the second cutting probability includes the conditional probability that the site is the target cutting site;
[0015] According to the second cleavage probability, the Viterbi algorithm is used to determine the target cleavage site.
[0016] In an optional embodiment, determining the signature corresponding to the signature image to be recognized based on the candidate characters includes:
[0017] Obtain multiple candidate signatures based on candidate word combinations;
[0018] The signature corresponding to the signature image to be recognized is determined based on the distance similarity between the candidate signature and the names in the preset name set.
[0019] In an optional embodiment, obtaining the stroke trajectory in the signature image to be recognized includes:
[0020] Perform image preprocessing on the signature image to be recognized, including image denoising, image binarization, and stroke width conversion;
[0021] Obtain the stroke trajectory from the preprocessed signature image to be recognized.
[0022] In an optional embodiment, before inputting the plurality of segmented single-word images into a trained single-word recognition model and obtaining a candidate single word corresponding to each single-word image through the single-word recognition model, the method further comprises:
[0023] Acquire a plurality of sample single-word images and first eigenvectors corresponding to the plurality of sample single-word images;
[0024] Creating a single-word recognition model training sample for each sample single-word image and the first feature vector corresponding to each sample single-word image;
[0025] The single-word recognition model is trained according to a plurality of single-word recognition model training samples to obtain a trained single-word recognition model.
[0026] In an optional embodiment, the single word recognition model is trained according to a plurality of single word recognition model training samples to obtain a trained single word recognition model, including:
[0027] For each single word recognition model training sample, perform the following steps respectively:
[0028] Inputting the single-word recognition model training sample into a preset single-word recognition model to obtain at least one sample candidate single word corresponding to the sample single word image in the single-word recognition model training sample;
[0029] Based on the sample candidate single words, obtaining at least one second feature vector corresponding to the sample single word image in the single word recognition model training sample;
[0030] Determine the loss function value of the single word recognition model according to the second eigenvector of each single word recognition model training sample and the first eigenvector of the sample single word image corresponding to the single word recognition model training sample;
[0031] When the loss function value satisfies the second training stop condition, a trained single-word recognition model is obtained.
[0032] In an optional embodiment, determining the loss function value of the single word recognition model according to the second eigenvector of each single word recognition model training sample and the first eigenvector of the sample single word image corresponding to the single word recognition model training sample includes:
[0033] Calculate the difference between the second eigenvector and the first eigenvector;
[0034] The difference is processed by the Sigmoid function to obtain the cross entropy loss function value.
[0035] A second aspect of the present application provides a handwritten signature recognition device, the device comprising:
[0036] An acquisition module, configured to acquire a stroke trajectory in a signature image to be recognized, wherein the stroke trajectory includes a plurality of locations;
[0037] A calculation module, used to calculate the cutting probability of each point in the stroke trajectory;
[0038] A determination module, configured to determine a target cutting site of the signature image to be identified based on the cutting probability;
[0039] A cutting module, used for cutting the signature image to be identified according to the target cutting site to obtain multiple cut single word images;
[0040] An input module is used to input a plurality of cut single-word images into a trained single-word recognition model, and obtain a candidate single word corresponding to each single-word image through the single-word recognition model;
[0041] The determination module is further used to determine the signature corresponding to the signature image to be recognized based on the candidate words.
[0042] In a third aspect, an embodiment of the present application provides a handwritten signature recognition device, the device comprising: a processor and a memory storing computer program instructions;
[0043] When the processor executes the computer program instructions, the handwritten signature recognition method of any embodiment of the first aspect of the present application is implemented.
[0044] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, a handwritten signature recognition method as in any embodiment of the first aspect of the present application is implemented.
[0045] In a fifth aspect, an embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes a handwritten signature recognition method as described in any embodiment of the first aspect of the present application.
[0046] The handwritten signature recognition method, apparatus, device, computer storage medium, and computer program product of the embodiments of the present application can calculate the cutting probability of each point in the stroke trajectory of the signature image to be recognized, and then determine the cutting site based on the cutting probability, thereby cutting to obtain a single-word image. In this way, the signature image can be character-cut by using quantitative indicators, thereby improving the accuracy of character cutting. Then, the single-word image is input into a trained single-word recognition model to obtain candidate single words corresponding to each single-word image, and the signature corresponding to the signature image to be recognized is determined based on the candidate single words. In this way, the signature image can be accurately cut into multiple single-word images, thereby performing single-word recognition on the signature image, and determining the signature corresponding to the signature image based on the candidate single words obtained by single-word recognition. In this way, single-word recognition of handwritten signatures is achieved, and the accuracy of handwritten signature recognition is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0048] Figure 1 This is a flowchart of a handwritten signature recognition method provided by an embodiment of the present application;
[0049] Figure 2 is a flowchart of a handwritten signature recognition method provided by another embodiment of the present application;
[0050] Figure 3 1 is a flowchart of a handwritten signature recognition method provided by another embodiment of the present application;
[0051] Figure 4 1 is a flow chart of a handwritten signature recognition method provided in yet another embodiment of the present application;
[0052] Figure 5 1 is a schematic diagram of the structure of a handwritten signature recognition device provided in yet another embodiment of the present application;
[0053] Figure 6 This is a structural diagram of a handwritten signature recognition device provided in yet another embodiment of the present application. DETAILED DESCRIPTION
[0054] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present application by illustrating the examples of the present application.
[0055] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, the elements defined by the phrase "comprising..." do not exclude the presence of other identical elements in the process, method, article, or device comprising the elements.
[0056] The acquisition, storage, use, and processing of data in this application's technical solution comply with relevant national laws and regulations.
[0057] As mentioned in the background, existing methods for handwritten signature recognition often use holistic recognition. This involves treating the signature image as a whole and directly identifying the corresponding signature using a convolutional neural network model. This holistic recognition method suffers from low accuracy in handwritten signature recognition scenarios.
[0058] In addition, due to the wide variety of Chinese characters and the difficulty in mastering the rules of Chinese names, if a holistic recognition mechanism is adopted, a huge training set is required to train the handwritten signature recognition model.
[0059] After in-depth research, the inventors proposed a handwritten signature recognition method based on single-word recognition, which can effectively improve the accuracy of handwritten signature recognition.
[0060] In view of this, embodiments of the present application provide a handwritten signature recognition method, apparatus, device, computer-readable storage medium, and computer program product.
[0061] The handwritten signature recognition method provided in the embodiments of the present application is described below through specific embodiments and their application scenarios, in conjunction with the accompanying drawings. The handwritten signature recognition method provided in the present application can be executed by a handwritten signature recognition device or a module within the handwritten signature recognition device that is used to execute the handwritten signature recognition method. In the embodiments of the present application, the handwritten signature recognition method provided in the embodiments of the present application is described in detail, using the example of a handwritten signature being executed by the device.
[0062] In addition, it should be noted that the handwritten signature recognition method provided in the embodiment of the present application, after cutting the signature image to be recognized to obtain the single word image, needs to use the trained single word recognition model to recognize the single word image. Therefore, before using the single word recognition model to recognize the single word image, it is necessary to first train the single word recognition model. Figure 1 The specific implementation of the single-word recognition model training method used in the handwritten signature recognition method provided in the embodiment of the present application is described.
[0063] Figure 1 A flow chart of a handwritten signature recognition method provided in one embodiment of the present application is shown, which may specifically be a training method for a single-word recognition model used in the handwritten signature recognition method provided in the embodiment of the present application.
[0064] like Figure 1 As shown, the training of the single-word recognition model used in the handwritten signature recognition method provided in the embodiment of the present application may include steps S110 to S130.
[0065] S110, obtaining a plurality of sample single-word images and first feature vectors corresponding to the plurality of sample single-word images.
[0066] The sample single-character image may be a cut single-character image obtained by cutting a handwritten signature image, or may be a directly obtained sample single-character image, for example, a directly obtained handwritten single-character image. The first feature vector may be a feature vector of a reference single-character image corresponding to the sample single-character image. In one example, the reference single-character image may be a single-character image obtained from a preset Chinese character database, for example, a single-character image obtained from a Xinhua Dictionary database.
[0067] S120 , creating a single-word recognition model training sample using each sample single-word image and the first feature vector corresponding to each sample single-word image.
[0068] S130, training a single-word recognition model according to a plurality of single-word recognition model training samples to obtain a trained single-word recognition model.
[0069] Among them, the single-word recognition model can be created in a variety of ways. In one embodiment, it can be created using a twin network architecture based on contrastive learning. In one example, the network architecture of TripleNet can be used on the twin model structure. Specifically, in this network architecture, for the input image, multiple candidate words can be retrieved from a huge benchmark single-word image repository based on a retrieval method, and the best one or more can be selected as the candidate words obtained by recognition. In this way, not only can the flexibility of the network architecture in the model be improved, but also the single-word images in the benchmark single-word image repository can be used as a benchmark, so as to achieve a single-word recognition model with high single-word recognition accuracy by using fewer single-word recognition model training samples, thereby improving the efficiency and accuracy of single-word recognition.
[0070] The embodiment of the present application obtains multiple sample single-word images and the first eigenvectors corresponding to the multiple sample single-word images, creates single-word recognition model training samples for each sample single-word image and the first eigenvector corresponding to each sample single-word image, and trains the single-word recognition model based on the multiple single-word recognition model training samples to obtain a trained single-word recognition model. In this way, candidate single words corresponding to the single-word images can be accurately and efficiently identified based on the trained single-word recognition model.
[0071] In one embodiment, Figure 2 As shown, according to multiple single-word recognition model training samples, the single-word recognition model is trained to obtain a trained single-word recognition model, which may specifically include:
[0072] For each single-word recognition model training sample, the following steps S131 to S134 are performed respectively.
[0073] S131: Input the single-word recognition model training sample into a preset single-word recognition model to obtain at least one sample candidate single word corresponding to the sample single-word image in the single-word recognition model training sample.
[0074] The number of sample candidate words can be one or more.
[0075] S132: Based on the sample candidate single words, obtain at least one second feature vector corresponding to the sample single word image in the single word recognition model training sample.
[0076] The second feature vector may be a feature vector of a reference single-word image corresponding to a sample candidate single word obtained by the single-word recognition model from the sample single-word image. In one example, after obtaining the sample candidate single word through the single-word recognition model, the single-word image corresponding to the sample candidate single word may be obtained from a preset Chinese character database, for example, the single-word image corresponding to the sample candidate single word may be obtained from the Xinhua Dictionary database.
[0077] S133 , determining a loss function value of the single-word recognition model according to the second eigenvector of each single-word recognition model training sample and the first eigenvector of the sample single-word image corresponding to the single-word recognition model training sample.
[0078] In one embodiment, when there are multiple candidate words, the above-mentioned determination of the loss function value of the word recognition model based on the second eigenvector of each word recognition model training sample and the first eigenvector of the sample word image corresponding to the word recognition model training sample may include: calculating each second eigenvector in each word recognition model training sample and the first eigenvector of the sample word image corresponding to the word recognition model training sample, determining the loss function value corresponding to each second eigenvector, and determining the minimum or maximum value of the corresponding loss function value in each second eigenvector as the loss function value corresponding to the word recognition model training sample. In one example, when there are multiple candidate words, the set of corresponding loss function values in each second eigenvector can also be used as the loss function value of the word recognition model.
[0079] S134, when the loss function value meets the training stop condition, a trained single-word recognition model is obtained.
[0080] The above-mentioned training stop condition can be a pre-set condition for stopping the training of the single-word recognition model. As an example, the training stop condition can be that the loss function of the single-word recognition model is less than a certain threshold. As another example, when there are multiple candidate words, the training stop condition can also include that the distribution of each loss function value in the set of corresponding loss function values in each second eigenvector meets the preset condition. The specific training stop condition can be selected according to user needs and is not limited here.
[0081] In this way, the preset single-word recognition model can be trained through the single-word recognition model training samples, so that the single-word image can be accurately recognized based on the trained single-word recognition model.
[0082] In one embodiment, determining the loss function value of the single word recognition model based on the second eigenvector of each single word recognition model training sample and the first eigenvector of the sample single word image corresponding to the single word recognition model training sample may include:
[0083] Calculate the difference between the second eigenvector and the first eigenvector.
[0084] The difference is processed by the Sigmoid function to obtain the cross entropy loss function value.
[0085] The difference between the second eigenvector and the first eigenvector can be calculated by a method known in the art, which will not be described in detail here.
[0086] In this embodiment, the difference between the second eigenvector and the first eigenvector is calculated and processed by the Sigmoid function to obtain the cross-entropy loss function value. In this way, the difference between the second eigenvector and the first eigenvector can be mapped to a numerical range of [0,1], so that the parameters of the single-word recognition model can be adjusted according to the cross-entropy loss function, thereby improving the accuracy of the single-word recognition model.
[0087] The following is combined with Figure 3 The handwritten signature recognition method provided in the embodiment of the present application is described in detail.
[0088] Figure 3 A flow chart of a handwritten signature recognition method provided in an embodiment of the present application is shown as follows: Figure 3 As shown, the handwritten signature recognition method provided in the embodiment of the present application may include steps S210 to S260.
[0089] S210: Acquire a stroke trajectory in the signature image to be recognized, where the stroke trajectory includes a plurality of locations.
[0090] In step S210, the stroke trajectory may include the trajectory formed by all strokes used to form multiple characters in the signature image to be recognized. Obtaining the stroke trajectory in the signature image to be recognized can be achieved using methods known in the art and are not limited here. In one example, obtaining the stroke trajectory in the signature image to be recognized may include grayscale processing the signature image to be recognized and obtaining the stroke trajectory from the grayscaled signature image to be recognized.
[0091] S220, calculating the cutting probability of each point in the stroke trajectory.
[0092] In step S220 , the cutting probability may include a probability that the site is a target cutting site, where the target cutting site may be a site at the end of a stroke and a boundary between two characters.
[0093] S230: Determine a target cutting site of the signature image to be identified according to the cutting probability.
[0094] In one embodiment, a plurality of candidate cleavage sites having cleavage probabilities greater than a preset threshold may be screened out, and the target cleavage site may be determined based on the distances between these candidate cleavage sites.
[0095] S240 , cutting the signature image to be recognized according to the target cutting site to obtain a plurality of cut single-word images.
[0096] In one example, the cut single-word images corresponding to each single-word field can be obtained according to the position of the single word in the signature image.
[0097] S250: Input the plurality of segmented single-word images into a trained single-word recognition model, and obtain candidate single words corresponding to each single-word image through the single-word recognition model.
[0098] In one example, candidate words corresponding to each word column can be obtained based on the word columns corresponding to each cut word image, and each word unit can correspond to one or more candidate words.
[0099] S260: Determine the signature corresponding to the signature image to be recognized based on the candidate characters.
[0100] Determining the signature corresponding to the signature image to be recognized based on the candidate characters may include: determining the signature corresponding to the signature image to be recognized based on candidate signatures obtained from multiple combinations of the candidate characters. In one example, determining the signature corresponding to the signature image to be recognized based on the candidate characters may include: permuting and combining the candidate characters in each character field to obtain multiple candidate signatures, and determining the signature corresponding to the signature image to be recognized from the multiple candidate signatures.
[0101] The handwritten signature recognition method of the embodiment of the present application can calculate the cutting probability of each point in the stroke trajectory of the signature image to be recognized, and then determine the cutting site based on the cutting probability, thereby cutting to obtain a single-word image. In this way, the signature image can be character-cut through quantitative indicators, thereby improving the accuracy of character cutting. Then, the single-word image is input into a trained single-word recognition model to obtain candidate single words corresponding to each single-word image, and the signature corresponding to the signature image is determined based on the candidate single words. In this way, the signature image can be accurately cut into multiple single-word images, thereby performing single-word recognition on the signature image, and determining the signature corresponding to the signature image based on the candidate single words obtained by single-word recognition. In this way, single-word recognition of handwritten signatures is achieved, and the accuracy of handwritten signature recognition is improved.
[0102] In this application, steps S210 to S240 can be implemented by a variety of methods, which are not limited here. In one embodiment, steps S210 to S240 can be performed by a character cutting algorithm. Therefore, before performing the above steps S210 to S240 by the character cutting algorithm, it is necessary to first determine the parameters of the character cutting algorithm. Figure 4 The specific implementation method of the parameter determination process of the character segmentation algorithm used in the handwritten signature recognition method provided in the embodiment of the present application is described.
[0103] like Figure 4 As shown, the parameter determination process of the character segmentation algorithm used in the handwritten signature recognition method provided in the embodiment of the present application may include steps S310 to S340.
[0104] S310, obtaining multiple sample signature images.
[0105] The sample signature image may be a handwritten signature image.
[0106] S320 , for each sample signature image, segment the sample signature image using a preset character segmentation algorithm to obtain a plurality of segmented sample single-character images.
[0107] Among them, the preset character cutting algorithm can be set by a variety of methods. In one embodiment, the preset character cutting algorithm may include at least one of a water drop algorithm and a combination of a hidden Markov model and a Viterbi algorithm (HMM-Viterbi algorithm). The water drop algorithm has a simple process and high efficiency, but it is only applicable to situations where there is no character adhesion. Since handwritten signatures often have strokes of different characters adhering to each other, it is impossible to accurately determine the water drop leakage point, and sometimes the characters cannot be effectively segmented correctly. The process of the HMM-Viterbi algorithm is more complicated, but has higher accuracy.
[0108] Specifically, the water drop algorithm can simulate the process of water droplets dripping from high to low to divide characters. Under the action of gravity, water droplets drip down from the top of the character along the character contour. When the water droplets sink into the concave part of the contour, they will penetrate into the character strokes. Finally, the probability that the site on the stroke trajectory in the signature image is the target cutting site can be determined based on the trajectory of the water droplets, thereby determining the segmentation path of the character.
[0109] When the character segmentation algorithm includes the HMM-Viterbi algorithm, segmenting the sample signature image using the preset character segmentation algorithm to obtain a plurality of segmented sample single-word images may include:
[0110] Obtaining the stroke trajectory in the sample signature image to obtain multiple observation vectors;
[0111] Segmenting the trajectory of the character strokes to obtain multiple pieces of position information where strokes may be adhered to each other, wherein the multiple pieces of position information where strokes may be adhered to each other are multiple pieces of possible cutting site information;
[0112] Based on multiple observation vectors and multiple possible cleavage site information, the output probability and probability transition probability of the hidden Markov model (HMM) model are calculated to obtain the conditional probabilities of multiple cleavage modes;
[0113] The Viterbi algorithm is used to calculate the target cutting site information corresponding to the maximum conditional probability, and the sample signature image is cut according to the target cutting site information.
[0114] The HMM model can thus segment the stroke trajectory of a signature image into several non-overlapping grid images. If each grid image is considered a node, the entire image can be viewed as multiple rows, each consisting of multiple nodes. Each node can be connected to each other, and multiple paths can be taken from the initial node in row 0 to the final node in the last row. Using the Viterbi algorithm and dynamic programming, an optimal path can be found. This path represents a potential suitable segmentation result for the signature image, thereby improving the accuracy of character segmentation.
[0115] S330: Determine a cutting evaluation index of a character cutting algorithm based on the plurality of cut sample single-word images.
[0116] S340 : When the cutting evaluation index meets the preset conditions, determine the current character cutting algorithm parameters as the final character cutting algorithm parameters.
[0117] The above-mentioned cutting evaluation index may include a cutting evaluation score determined based on a sample single-character image obtained by the character cutting algorithm, or whether the sample single-character image obtained by the character cutting algorithm meets the preset requirements. As an example, the cutting evaluation index may include whether the number of cut sample single-character images meets the preset requirements. For example, in non-ethnic minority areas, Chinese names are basically composed of 2 to 4 characters. For each sample signature image, if the number of cut sample single-character images is 2 to 4, it is considered that the number of cut sample single-character images meets the preset requirements, and accordingly, the cutting evaluation index can be considered to meet the preset conditions. As another example, the cutting evaluation index may include whether the recognition result of the cut sample single-character image meets the preset requirements. For example, the cut sample single-character image can be recognized by a single-character recognition model to obtain the signature corresponding to the sample single-character image. If the signature corresponding to the sample single-character image conforms to the naming convention of Chinese names, it can be considered that the recognition result of the cut sample single-character image meets the preset requirements, and accordingly, the cutting evaluation index can be considered to meet the preset conditions.
[0118] It is easy to understand that when the cutting evaluation index does not meet the preset conditions, the parameters of the character cutting algorithm can be adjusted and the above S310 to S340 can be executed again until the cutting evaluation index meets the preset conditions.
[0119] In one embodiment, the preset character segmentation algorithm may include a water drop algorithm and an HMM-Viterbi algorithm. The character segmentation algorithm obtained thereby can segment the handwritten signature image more accurately.
[0120] At this time, the above S310 to S340 can be executed separately for the waterdrop algorithm and the HMM-Viterbi algorithm, or they can be executed together. As an example of the combined execution of the above S310 to S340, for each sample signature image, the sample signature image is cut using a preset character cutting algorithm to obtain multiple cut sample single word images, which may include:
[0121] For each sample signature image, a plurality of first sample single word images after cutting are obtained by cutting with the water drop algorithm, and a plurality of second sample single word images after cutting are obtained by cutting with the HMM-Viterbi algorithm;
[0122] When the similarity between the first sample single-word image and the second sample single-word image is less than a preset threshold, the first sample single-word image or the second sample single-word image is determined as the sample single-word image.
[0123] It is easy to understand that when the similarity between the first sample single-word image and the second sample single-word image is greater than or equal to a preset threshold, the parameters of the water drop algorithm and the HMM-Viterbi algorithm can be adjusted until the similarity between the first sample single-word image and the second sample single-word image is less than the preset threshold.
[0124] In this way, the parameters of the preset character segmentation algorithm can be adjusted through the sample signature image, thereby obtaining a character segmentation algorithm that can accurately segment the signature image.
[0125] In one embodiment, the cutting probability of each point in the stroke trajectory is calculated; and the target cutting position of the signature image to be recognized is determined based on the cutting probability, which can be performed by a character cutting algorithm. Specifically, it may include:
[0126] The first cutting probability of each point in the stroke trajectory is calculated using the water drop algorithm.
[0127] When the first cutting probability does not meet the preset conditions, the second cutting probability of each point in the stroke trajectory is calculated by the hidden Markov model, and the second cutting probability includes the conditional probability that the point is the target cutting point.
[0128] According to the second cleavage probability, the Viterbi algorithm is used to determine the target cleavage site.
[0129] The above preset conditions can be set according to actual conditions and are not particularly limited here. As an example, the preset condition can be that the number of images after segmentation according to the first segmentation probability is expected to be within a preset range, such as 2 to 4.
[0130] Determining the target cutting site using the Viterbi algorithm according to the second cutting probability may include: using the Viterbi algorithm to determine which sites have the highest conditional probability as the target cutting site, and determining the cutting site with the highest conditional probability as the cutting site of the signature image to be identified.
[0131] It is easy to understand that when the multiple cut images obtained by cutting the signature image to be identified by the water drop algorithm meet the preset conditions, the multiple cut images can be determined as multiple cut single-word images.
[0132] In this way, when the water drop algorithm accurately cuts the signature image to be identified, only the relatively simple water drop algorithm can be used to cut the signature image to be identified, thereby simplifying the signature image cutting process and improving the signature image cutting efficiency; when the accuracy of the water drop algorithm in cutting the signature image to be identified is insufficient, the HMM-Viterbi algorithm can be used to cut the signature image to be identified, thereby ensuring that the cutting of the signature image to be identified has a high accuracy, thereby improving the accuracy of handwritten signature recognition.
[0133] In one embodiment, determining the signature corresponding to the signature image to be recognized based on the candidate characters may specifically include:
[0134] Multiple candidate signatures are obtained based on the candidate word combinations.
[0135] The signature corresponding to the signature image to be recognized is determined based on the distance similarity between the candidate signature and the names in the preset name set.
[0136] The preset name set may be a name set obtained from relevant literature, such as the "Compendium of Chinese Names," or existing Chinese name data. The distance similarity may include the minimum edit distance between the candidate signature and names in the preset name set. In one example, based on the minimum edit distances between multiple candidate signatures and names in the preset name set, one or more candidate signatures whose minimum edit distances are within a preset range may be identified, and the signature corresponding to the signature image may be determined from these candidate signatures.
[0137] In this way, the signature corresponding to the recognized signature image can be made more consistent with Chinese name standards and naming habits, thereby improving the accuracy of handwritten signature recognition.
[0138] In one embodiment, obtaining the stroke trajectory in the signature image to be recognized may include:
[0139] Perform image preprocessing on the signature image, which includes image denoising, image binarization, and stroke width transformation.
[0140] Obtain the stroke trajectory from the preprocessed signature image to be recognized.
[0141] Image preprocessing can be achieved through a variety of algorithms, not specifically limited here. In one example, image denoising can be performed by removing noise points from an image using a smooth spatial domain filter algorithm; image binarization can be performed by using the OTSU algorithm to separate the text and background in a signature image; and stroke width transformation can be performed by estimating the stroke width using the run-length method and then performing dilation, erosion, and other processing based on the estimated results, thereby increasing or decreasing the stroke width. This can improve the accuracy of character segmentation and single-word recognition, thereby improving the accuracy of handwritten signature recognition.
[0142] Based on the same inventive concept, the embodiment of the present application also provides a handwritten signature recognition device 400.
[0143] like Figure 5 As shown, the handwritten signature recognition device 400 may include an acquisition module 401 , a calculation module 402 , a determination module 403 , a cutting module 404 and an input module 405 .
[0144] The acquisition module 401 is used to acquire the stroke trajectory in the signature image to be recognized, where the stroke trajectory includes multiple locations.
[0145] The calculation module 402 is used to calculate the cutting probability of each point in the stroke trajectory.
[0146] The determination module 403 is configured to determine the target cutting site of the signature image to be identified according to the cutting probability.
[0147] The cutting module 404 is used to cut the signature image to be recognized according to the target cutting site to obtain a plurality of cut single-word images.
[0148] The input module 405 is used to input the multiple segmented single-word images into the trained single-word recognition model, and obtain the candidate single words corresponding to each single-word image through the single-word recognition model.
[0149] The determination module 403 is further configured to determine the signature corresponding to the signature image to be recognized based on the candidate characters.
[0150] The handwritten signature recognition device of the embodiment of the present application can calculate the cutting probability of each point in the stroke trajectory of the signature image to be recognized, and then determine the cutting site based on the cutting probability, thereby cutting to obtain a single-word image. In this way, the signature image can be cut into characters through quantitative indicators, thereby improving the accuracy of character cutting. Then, the single-word image is input into a trained single-word recognition model to obtain candidate single words corresponding to each single-word image, and the signature corresponding to the signature image is determined based on the candidate single words. In this way, the signature image can be accurately cut into multiple single-word images, thereby performing single-word recognition on the signature image, and determining the signature corresponding to the signature image based on the candidate single words obtained by single-word recognition. In this way, single-word recognition of handwritten signatures is achieved, and the accuracy of handwritten signature recognition is improved.
[0151] In one embodiment, the calculation module is used to calculate the cutting probability of each point in the stroke trajectory; the determination module is used to determine the target cutting site of the signature image to be recognized based on the cutting probability, which may specifically include:
[0152] The calculation module is used to calculate the first cutting probability of each point in the stroke trajectory by using the water drop algorithm.
[0153] The calculation module is further configured to calculate a second cutting probability for each point in the stroke trajectory using a hidden Markov model when the first cutting probability does not meet a preset condition. The second cutting probability includes a conditional probability that the point is a target cutting point.
[0154] The above-mentioned determination module is further used to determine the target cleavage site using the Viterbi algorithm according to the second cleavage probability.
[0155] The cutting module is used to cut the signature image according to the cutting site to obtain multiple cut single-word images.
[0156] In one embodiment, the determination module is used to determine the signature corresponding to the signature image to be recognized based on the candidate characters, and may include:
[0157] The combination module is used to obtain multiple candidate signatures based on the candidate single words.
[0158] The above-mentioned determination module is used to determine the signature corresponding to the signature image to be identified based on the distance similarity between the candidate signature and the names in the preset name set.
[0159] In one embodiment, the acquisition module is used to acquire the stroke trajectory in the signature image to be recognized, which may specifically include:
[0160] The preprocessing module is used to perform image preprocessing on the signature image to be recognized. The image preprocessing includes image denoising, image binarization, and stroke width conversion.
[0161] The acquisition module is used to acquire the stroke trajectory from the pre-processed signature image to be recognized.
[0162] In one embodiment, the apparatus 400 may further include:
[0163] The acquisition module is used to acquire multiple sample single-word images and first feature vectors corresponding to the multiple sample single-word images.
[0164] The creation module is used to create a single-word recognition model training sample using each sample single-word image and the first feature vector corresponding to each sample single-word image.
[0165] The training module is used to train the single-word recognition model according to multiple single-word recognition model training samples to obtain a trained single-word recognition model.
[0166] In one embodiment, the training module is used to train the single word recognition model based on a plurality of single word recognition model training samples to obtain a trained single word recognition model, which may specifically include:
[0167] For each single word recognition model training sample, perform the following steps respectively:
[0168] The single-word recognition model training sample is input into a preset single-word recognition model to obtain at least one sample candidate single word corresponding to the sample single word image in the single-word recognition model training sample.
[0169] Based on the sample candidate single words, at least one second feature vector corresponding to the sample single word image in the single word recognition model training sample is obtained.
[0170] The loss function value of the single word recognition model is determined according to the second eigenvector of each single word recognition model training sample and the first eigenvector of the sample single word image corresponding to the single word recognition model training sample.
[0171] When the loss function value satisfies the second training stop condition, a trained single-word recognition model is obtained.
[0172] In one embodiment, determining the loss function value of the single word recognition model based on the second eigenvector of each single word recognition model training sample and the first eigenvector of the sample single word image corresponding to the single word recognition model training sample may include:
[0173] Calculate the difference between the second eigenvector and the first eigenvector;
[0174] The difference is processed by the Sigmoid function to obtain the cross entropy loss function value.
[0175] The handwritten signature recognition device provided in the embodiment of the present application can realize Figure 3To avoid repetition, the various processes implemented in the method embodiment are not described here.
[0176] Figure 6 A schematic diagram of the hardware structure of a handwritten signature recognition device provided in an embodiment of the present application is shown.
[0177] The handwritten signature recognition device may include a processor 501 and a memory 502 storing computer program instructions.
[0178] Specifically, the processor 501 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0179] The memory 502 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 502 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 502 may include removable or non-removable (or fixed) media. Where appropriate, the memory 502 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 502 is a non-volatile solid-state memory.
[0180] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present application.
[0181] The processor 501 reads and executes computer program instructions stored in the memory 502 to implement any one of the handwritten signature recognition methods in the above embodiments.
[0182] In one example, the handwritten signature recognition device may further include a communication interface 503 and a bus 510. Figure 6 As shown, the processor 501, the memory 502, and the communication interface 503 are connected via a bus 510 and communicate with each other.
[0183] The communication interface 503 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0184] Bus 510 includes hardware, software or both, and the parts of handwritten signature recognition equipment are coupled to each other. For example, and not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industry standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industry standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnect (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 510 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0185] The handwritten signature recognition device can execute the handwritten signature recognition method in the embodiment of the present application, thereby realizing the combination of Figure 3 and Figure 5 Described is a method and device for handwritten signature recognition.
[0186] In addition, in conjunction with the handwritten signature recognition method in the above embodiments, embodiments of the present application may provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any of the handwritten signature recognition methods in the above embodiments is implemented.
[0187] It should be understood that the present application is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and illustrated as examples. However, the method process of the present application is not limited to the specific steps described and illustrated. Those skilled in the art can make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present application.
[0188] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROMs, flash memories, erasable ROMs (EROMs), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0189] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps. In other words, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0190] Aspects of the present disclosure have been described above with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit. It is also understood that each box in the block diagram and / or flowchart and the combination of the boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0191] The above description is only a specific embodiment of the present application. Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the scope of protection of the present application.
Claims
1. A handwritten signature recognition method, characterized in that: include: Acquire a stroke trajectory in the signature image to be recognized, wherein the stroke trajectory includes a plurality of locations; Calculating the cutting probability of each of the sites in the stroke trajectory; Determining a target cutting site of the signature image to be identified according to the cutting probability; Cutting the signature image to be identified according to the target cutting site to obtain a plurality of cut single-word images; Inputting the plurality of cut single-word images into a trained single-word recognition model, and obtaining a candidate single word corresponding to each of the single-word images through the single-word recognition model; Determine the signature corresponding to the signature image to be recognized based on the candidate characters; Calculating the cutting probability of each site in the stroke trajectory; Determining a target cutting site of the signature image to be identified according to the cutting probability includes: Calculating the first cutting probability of each of the positions in the stroke trajectory by using a water drop algorithm; When the first cutting probability does not meet the preset condition, a second cutting probability of each site in the stroke trajectory is calculated by a hidden Markov model, where the second cutting probability includes a conditional probability that the site is a target cutting site; Determining the target cleavage site using a Viterbi algorithm according to the second cleavage probability; Determining the signature corresponding to the signature image to be recognized based on the candidate characters includes: Obtaining multiple candidate signatures based on the candidate word combinations; The signature corresponding to the signature image to be identified is determined based on the distance similarity between the candidate signature and names in a preset name set, where the preset name set is a name set obtained from the "Chinese Name Database" or Chinese name data.
2. The method according to claim 1, characterized in that The step of obtaining the stroke trajectory in the signature image to be recognized includes: Performing image preprocessing on the signature image to be identified, wherein the image preprocessing includes image denoising, image binarization, and stroke width conversion; Obtain the stroke trajectory from the preprocessed signature image to be recognized.
3. The method according to claim 1, characterized in that Before inputting the plurality of cut single-word images into a trained single-word recognition model and obtaining a candidate single word corresponding to each of the single-word images through the single-word recognition model, the method further comprises: Acquire a plurality of sample single-word images and first feature vectors corresponding to the plurality of sample single-word images; Creating a single-word recognition model training sample using each of the sample single-word images and the first feature vector corresponding to each of the sample single-word images; The single-word recognition model is trained according to a plurality of the single-word recognition model training samples to obtain the trained single-word recognition model.
4. The method according to claim 3, characterized in that The method of training the single word recognition model according to the plurality of single word recognition model training samples to obtain the trained single word recognition model comprises: For each of the single-word recognition model training samples, perform the following steps respectively: Inputting the single-word recognition model training sample into a preset single-word recognition model to obtain at least one sample candidate single word corresponding to the sample single-word image in the single-word recognition model training sample; Based on the sample candidate single words, obtaining at least one second feature vector corresponding to the sample single word image in the single word recognition model training sample; Determine the loss function value of the single word recognition model according to the second eigenvector of each of the single word recognition model training samples and the first eigenvector of the sample single word image corresponding to the single word recognition model training sample; When the loss function value satisfies the second training stop condition, the trained single-word recognition model is obtained.
5. The method according to claim 4, characterized in that Determining the loss function value of the single word recognition model according to the second eigenvector of each of the single word recognition model training samples and the first eigenvector of the sample single word image corresponding to the single word recognition model training sample includes: Calculating a difference between the second eigenvector and the first eigenvector; The difference is processed by the Sigmoid function to obtain the cross entropy loss function value.
6. A handwritten signature recognition device, characterized in that: The device comprises: An acquisition module, configured to acquire a stroke trajectory in a signature image to be recognized, wherein the stroke trajectory includes a plurality of locations; A calculation module, configured to calculate a cutting probability of each of the sites in the stroke trajectory; a determination module, configured to determine a target cutting site of the signature image to be identified according to the cutting probability; a cutting module, configured to cut the signature image to be identified according to the target cutting site to obtain a plurality of cut single-word images; An input module, configured to input the plurality of cut single-word images into a trained single-word recognition model, and obtain a candidate single word corresponding to each of the single-word images through the single-word recognition model; The determining module is further configured to determine the signature corresponding to the signature image to be recognized based on the candidate characters; The calculation module is used to calculate the cutting probability of each site in the stroke trajectory; the determination module is used to determine the target cutting site of the signature image to be identified according to the cutting probability, including: The calculation module is used to calculate the first cutting probability of each of the positions in the stroke trajectory by using a water drop algorithm; The calculation module is further configured to calculate, by using a hidden Markov model, a second cutting probability for each site in the stroke trajectory when the first cutting probability does not meet a preset condition, wherein the second cutting probability includes a conditional probability that the site is a target cutting site; The determining module is configured to determine the target cleavage site using a Viterbi algorithm according to the second cleavage probability; The determination module is used to determine the signature corresponding to the signature image to be recognized based on the candidate characters, including: A combination module, used to obtain multiple candidate signatures based on candidate single words; The determination module is used to determine the signature corresponding to the signature image to be identified based on the distance similarity between the candidate signature and the names in the preset name set, and the preset name set is a name set obtained according to the "Chinese Name Encyclopedia" or Chinese name data.
7. A handwritten signature recognition device, characterized in that: The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the handwritten signature recognition method according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the handwritten signature recognition method according to any one of claims 1 to 5 is implemented.
9. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the handwritten signature recognition method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Handwriting recognition method and system as well as handwriting recognition terminal
CN102750552A
File content identification method and device, computer equipment and storage medium
CN111683285A
Method for identifying adhered handwritten English characters
CN113936181A
Method and system for establishing HMM topology adapted to recognize hand-written east-asian character
WO2008104130A1