Handwriting feature extraction method based on pseudo paragraph handwriting prototype guidance
Through the method of pseudo-paragraph handwriting prototype guidance, the ProtoNCE loss and GuideNCE loss functions are used to extract the overall and local style characteristics of the writer, solving the problem that cannot accurately reflect the overall style of the writer in the existing technology, and improving the accuracy of handwriting verification.
Patent Information
- Application Number
- CN202510683800.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-26
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2045-05-26
AI Technical Summary
Existing handwriting verification techniques cannot accurately reflect the writer's overall style and affect the verification effect.
Using the method of pseudo-paragraph handwriting prototype guidance, the loss function ProtoNCE loss and the guided comparison learning loss function GuideNCE loss are used to construct positive sample sets and negative sample sets, design feature encoders, and extract the overall and local style features of the writer.
It improves the accuracy and performance of handwriting verification and can better distinguish between authentic and false handwriting.
Smart Images

Figure CN120496098A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer vision, and in particular relates to a handwriting feature extraction method based on pseudo-paragraph handwriting prototype guidance. Background Art
[0002] Handwriting, a unique human skill, is ubiquitous in all social contexts. From a biometric perspective, handwriting contains rich personal characteristics that can be used to confirm a person's identity. With the rapid development of information technology, handwriting verification technology is gaining widespread application in identity recognition fields such as banking, finance, and e-commerce.
[0003] For example, in the legal field, accurately determining the authenticity of handwritten documents such as contracts, wills, and suicide notes is crucial to ensuring the legal validity of these documents. Courts currently rely on forensic document examiners (FDEs) for handwriting verification. However, obtaining FDE qualifications requires two years of training, and the verification process is very time-consuming. Therefore, how to quickly and automatically verify the authenticity of a given handwritten image by comparing it with a reference sample of the actual author is of great significance.
[0004] The primary technical challenge in handwriting verification is extracting stable and discriminative feature representations from handwritten text images. These feature representations can capture the uniqueness of individual handwriting and are crucial for accurately distinguishing authentic works from similar forgeries. Early research in handwriting verification has devised various types of feature representations, including character tilt, centroid ratio, and stroke curvature. However, these traditional methods share a common problem: they require complex preprocessing steps such as foreground-background separation, contour extraction, and grapheme segmentation.
[0005] Some advanced deep learning-based methods can automatically extract features from handwritten text images. However, the training process of these learning methods focuses only on the relationship between single sample pairs, such as a pair of similar characters, causing the encoder to favor the local style features of these sample pairs. However, the handwriting style characteristics of the same individual are often reflected in the style commonalities across multiple handwriting samples, such as consistent character shape, tilt, and stroke thickness across multiple handwriting samples.
[0006] To sum up, existing handwriting verification technologies often focus on the local style characteristics of the writer and cannot accurately reflect the overall style characteristics of the writer, which affects the handwriting verification effect and hinders the application of handwriting verification technology. Therefore, there is an urgent need for a method that can more accurately reflect the writer's overall style to improve the handwriting verification performance. Summary of the Invention
[0007] (1) Technical problems to be solved
[0008] The present invention provides a handwriting feature extraction method based on pseudo-paragraph handwriting prototype guidance, aiming to solve the problem that existing handwriting verification technology cannot accurately reflect the overall style of the writer, thus affecting the handwriting verification effect.
[0009] (2) Technical solution
[0010] A handwriting feature extraction method based on pseudo-paragraph handwriting prototype guidance, characterized by comprising the following steps:
[0011] Step 1: Collect multiple handwriting samples from multiple writers. For a single writer, randomly select several handwriting samples and combine them into pseudo-paragraphs, which are then processed by the prototype encoder to obtain handwriting prototypes.
[0012] Step 2: For the handwriting prototype, construct a positive sample set and a negative sample set and design a prototype contrast learning loss function ProtoNCE loss to obtain the mutual information between the handwriting prototypes with the greatest similarity to the same writer, thereby obtaining a more distinguishable handwriting prototype;
[0013] Step 3: Using the more distinctive handwriting prototype as an anchor point, a feature encoder is used to select positive sample handwriting features and negative sample handwriting features, and a guided contrastive learning loss function (GuideNCE loss) is designed to guide the training of the feature encoder to obtain handwriting features with representative characteristics of the writer;
[0014] Step 4: In the query stage, multiple real handwriting samples of the designated writer and the handwriting to be queried are processed by the trained feature encoder respectively to obtain the handwriting features to be queried and the real handwriting features, and the average features of the real handwriting features are calculated. Then, the cosine distance between the handwriting features to be queried and the average features is calculated, and the cosine distance is compared with a predefined threshold to determine whether the handwriting belongs to the real handwriting of the designated writer.
[0015] Furthermore, the step 1 includes the following steps:
[0016] Step 101: Collecting a number of independent single handwritten text samples from multiple writers;
[0017] Step 102: For a certain writer, randomly select m handwritten text samples and combine them into a pseudo paragraph I p ;
[0018] Step 103: The pseudo paragraph I p After the prototype encoder E p Processing to obtain the handwriting prototype p = E p (I p );
[0019] Step 104: Repeat steps 102 to 103 for different writers to obtain a plurality of pseudo paragraphs I corresponding to each writer and generated randomly. p and a plurality of said handwriting prototypes p.
[0020] Furthermore, step 102 includes the following steps:
[0021] Step 10201: randomly dividing m handwritten text samples of a certain writer into a plurality of subsets, each subset containing a plurality of said handwritten text samples, and randomly combining them into text lines;
[0022] Step 10202: Select the shortest text line as a reference, and crop the remaining text lines to uniformly match the widths, so that the widths of the text lines are aligned with each other;
[0023] Step 10203: Concatenate the text lines to form the pseudo paragraph and adapt it to the prototype encoder.
[0024] Furthermore, the step 2 includes the following steps:
[0025] Step 201: Select a set of handwriting prototypes from several writers with a batch size of N, and select a designated handwriting prototype of a designated writer in the set, and use the other handwriting prototypes of the writer as the positive sample set, denoted as P + , the handwriting prototypes of other different writers are used as negative sample sets, denoted as P - ;
[0026] Step 202: Using the positive sample set P + And the negative sample set P - The prototype contrast learning loss function ProtoNCE loss is designed to obtain the mutual information between the handwriting prototypes with the greatest similarity of the same writer, thereby obtaining a more distinguishable handwriting prototype p c .
[0027] Furthermore, step 202 includes the following steps:
[0028] Design prototype contrast learning loss function ProtoNCE loss, denoted as Specifically expressed as:
[0029]
[0030] Where τ is the temperature parameter, N represents the size of the handwriting prototype set, i∈M={1,…,N} represents the index of the handwriting prototype in the set, M represents the set of the index, and index j∈A(i)=M\{i} represents other indexes different from i, p + P + Any element of p i Indicates the specified handwriting prototype, p j Represents any element of the handwriting prototype set, φ(p i ,p + )=f1(p i ) T f1(p + ) represents the similarity between the specified handwriting prototype and the positive sample, φ(p i ,p j )=f1(p i ) T f1(,p j ) represents the similarity between a specified handwriting prototype and any element in the handwriting prototype set, and f1(·) represents a multi-layer perceptron MLP.
[0031] Furthermore, the step 3 includes the following steps:
[0032] Step 301: The more distinctive handwriting prototype p c As anchor points, a total of K more distinguishable handwriting prototype samples containing several different writers are selected for training, among which writer W is selected i Another random sample is passed through the feature encoder E f Processing to obtain the positive sample handwriting feature e + , select K-1 random samples of different writers and pass them through the feature encoder E f Processing to obtain negative sample handwriting features e - ;
[0033] Step 302: Design the contrastive learning loss function GuideNCE loss, denoted as Specifically expressed as:
[0034]
[0035] Among them, τ is the temperature parameter, φ(p c ,e + )=f2(p c ) T f2(e + ) represents the anchor point p c The similarity between the handwritten features and the positive sample, φ(p c ,e -)=f2(p c )Tf2(e - ) represents the anchor point p c The similarity between the handwritten features of the negative samples, f2(·) is a multi-layer perceptron (MLP) with the same structure as f1(·), j represents the index of K-1 negative sample handwritten features, and K represents the size of the handwritten prototype sample set;
[0036] Step 303: Use the contrastive learning loss function GuideNCEloss to guide the training of the feature encoder E f .
[0037] Furthermore, the step 4 includes the following steps:
[0038] Step 401: Given the handwriting I to be queried q and n real handwriting samples X of the designated writer;
[0039] Step 402: The handwritten q Input to the trained feature encoder E f In the query, the handwritten feature E is obtained f (I q );
[0040] Step 403: Input the real handwriting samples X into the trained feature encoder E f In the example, we get n real handwriting features E f (X) and average to get the average feature
[0041] Step 404: Calculate the handwritten feature E to be queried f (I q ) and average characteristics The cosine distance between The formula is:
[0042]
[0043] Among them, ||·|| represents norm;
[0044] Step 405: Given a predefined threshold t, if the cosine distance Then determine the handwriting I q It is the authentic handwriting of the designated writer; otherwise, it is determined to be not the authentic handwriting of the designated writer.
[0045] Compared with the prior art, the present invention has the following beneficial effects:
[0046] By adopting the handwriting prototype learning strategy of ProtoNCE loss and the feature-guided learning strategy of GuideNCE loss, pseudo-paragraph guidance is used to enhance the learning of individual prototype features, and the encoder can extract discriminative handwriting features from handwriting samples and perform verification analysis, thereby improving the handwriting verification performance and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A schematic flow chart of an implementation method of the present invention is shown;
[0048] Figure 2 A schematic flow chart of step 4 of the present invention is shown; DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0050] In order to better understand the technical content of this embodiment, the following explanations of the terms involved in this embodiment are first introduced.
[0051] MLP: Multilayer Perceptron, a feedforward artificial neural network model that maps multiple input data sets to a single output data set.
[0052] Norm refers to the square root of the sum of the squares of the elements in the quantity.
[0053] ResNet: (Residual Network) is a convolutional neural network architecture in the field of deep learning.
[0054] Pseudo-paragraph: A text paragraph that is randomly assembled from several independent writing samples.
[0055] Loss function: used to measure the degree of inconsistency between the model's predicted value and the true value.
[0056] Temperature parameter: A hyperparameter that controls the diversity and certainty of text generation.
[0057] Mutual information: A measure of information in information theory, which is the amount of information contained in one random variable about another random variable.
[0058] Anchor: A sample representing a certain class in the feature space, used to guide the model for classification or metric learning.
[0059] Handwriting prototype: refers to the class center of the writer, which is specifically manifested as characteristic features in the feature space.
[0060] Class center: refers to the central position or representative feature used to describe the data of a certain category (or class).
[0061] Figure 1 A flow chart of an embodiment of the present invention is shown, which shows a handwriting feature extraction method based on pseudo-paragraph handwriting prototype guidance, comprising the following steps:
[0062] Step 1: Collect multiple handwriting samples from multiple writers. For a single writer, randomly select several handwriting samples and combine them into pseudo paragraphs. Then, process them through the prototype encoder to obtain the handwriting prototype.
[0063] Step 2: For the handwriting prototype, construct a positive sample set and a negative sample set and design a prototype contrast learning loss function ProtoNCE loss to obtain the mutual information between the handwriting prototypes with the greatest similarity to the same writer, thereby obtaining a more distinguishable handwriting prototype;
[0064] Step 3: Using the more distinctive handwriting prototype as an anchor point, a feature encoder is used to select positive sample handwriting features and negative sample handwriting features, and a guided contrastive learning loss function (GuideNCE loss) is designed to guide the training of the feature encoder to obtain handwriting features with representative characteristics of the writer;
[0065] Step 4: In the query stage, multiple real handwriting samples of the designated writer and the handwriting to be queried are processed by the trained feature encoder respectively to obtain the handwriting features to be queried and the real handwriting features, and the average features of the real handwriting features are calculated. Then, the cosine distance between the handwriting features to be queried and the average features is calculated, and the cosine distance is compared with a predefined threshold to determine whether the handwriting belongs to the real handwriting of the designated writer.
[0066] Follow step 1.
[0067] Specifically, the step 1 includes the following steps:
[0068] Step 101: Collecting a plurality of mutually independent single handwritten text samples from multiple writers, wherein the single handwritten text sample may be a single text image;
[0069] Step 102: For a certain writer, randomly select m handwritten text samples and combine them into a pseudo paragraph I p ;
[0070] Step 103: The pseudo paragraph I p After the prototype encoder E p Processing to obtain the handwriting prototype p = E p (I p );
[0071] Step 104: Repeat steps 102 to 103 for different writers to obtain a plurality of pseudo paragraphs I corresponding to each writer and generated randomly. p and a plurality of said handwriting prototypes p.
[0072] Specifically, step 102 includes the following specific steps:
[0073] Step 10201: randomly divide m handwritten text samples of a certain writer into a plurality of subsets, each subset containing a plurality of said handwritten text samples, and randomly combine them into text lines; for example, for 16 text images written by a certain writer, divide them equally into 4 subsets, each subset containing 4 text images, and each subset is randomly concatenated into a text line;
[0074] Step 10202: Selecting a text line of a certain length as a reference, cropping the remaining text lines to uniformly match the width, and aligning the widths of the text lines. Since the number of selected text images is also random, the sizes of the subsets may vary. Therefore, taking the shortest text line as a reference, cropping the remaining text lines to align the widths of the text lines for ease of calculation.
[0075] Step 10203: splice the text lines together to form the pseudo paragraph image, and adjust the pixels of the pseudo paragraph image to match the prototype encoder; that is, splice the text lines after the width alignment mentioned above into a pseudo paragraph image in the form of a paragraph by vertical connection, horizontal connection, or a combination of vertical and horizontal connection, and adjust the pixels of the pseudo paragraph image to 512×512, so as to adapt to the 512-dimensional encoding vector of the prototype encoder.
[0076] Execute step 2.
[0077] Specifically, step 2 includes the following specific steps:
[0078] Step 201: Select a set of handwriting prototypes from several writers with a batch size of N, and select a designated handwriting prototype of a designated writer in the set, and use the other handwriting prototypes of the writer as the positive sample set, denoted as P+ , the handwriting prototypes of other different writers are used as negative sample sets, denoted as P - ;
[0079] Step 202: Using the positive sample set P + And the negative sample set P - The prototype contrast learning loss function ProtoNCE loss is designed to obtain the mutual information between the handwriting prototypes with the greatest similarity of the same writer, thereby obtaining a more distinguishable handwriting prototype p c ;
[0080] The ProtoNCE loss combines the ideas of contrastive learning and clustering. It improves the InfoNCE loss by dynamically estimating the concentration of feature distribution around each handwriting prototype. This loss function encourages sample embeddings of the same writer to be closer to the corresponding handwriting prototype and farther away from the handwriting prototypes of other writers, thereby achieving comprehensive learning of the writer's overall and local style, and thus guiding the generation of more distinctive handwriting prototypes.
[0081] Specifically, the specific steps of step 201 are as follows:
[0082] Step 20101: First, a set of handwriting prototypes from several writers with a batch size of N is recorded as {p1,…,p N}, each handwriting prototype corresponds to a writer, and the same writer can correspond to multiple handwriting prototypes, i∈M={1,…,N} represents the index of the handwriting prototype in the set, and M represents the set of the indexes; wherein, index j∈A(i)=M\{i} represents other indices different from i, which is used to exclude the specified handwriting prototype itself to improve the recognition ability of the model and avoid overfitting of the recognition results;
[0083] Step 20102: Next, specify a writer W in the handwriting prototype set i A handwritten prototype p i , and then the other handwriting prototypes of the writer are taken as the positive sample set P + , denoted as P + ={p j |j∈A(i),W j =W i}, and handwriting prototypes from other different writers as negative sample set P - , denoted as P - ={p j |j∈A(i),W j ≠W i};
[0084] For ease of understanding, the following is an exemplary example. Suppose the indexes of N handwriting prototypes are {1, 2, 3, 4, ..., N}, which include the prototypes from the writer W. i The handwriting prototype of , also includes the handwriting prototypes from other writers, assuming that the prototype comes from writer W i The indexes of all handwriting prototypes of W are {1, 2, 3, 4}, and the indexes of handwriting prototypes from other writers are {5, 6, 7, ..., N}. i Handwriting prototype p i Its index is 2, then the positive sample set P + The index is {1, 3, 4}, the negative sample set P - The index is {5, 6, 7, …, N}.
[0085] Specifically, the specific steps of step 202 are as follows:
[0086] Design prototype contrast learning loss function ProtoNCE loss, denoted as Specifically expressed as:
[0087]
[0088] Among them, τ is the temperature parameter, p + P + Any element of p i Indicates the specified handwriting prototype, φ(p i ,p + )=f1(p i ) T f1(p + ) represents the similarity between the specified handwriting prototype and the positive sample, φ(p i ,p j )=f1(p i ) T f1(,p j ) represents the similarity between a specified handwriting prototype and any element in the handwriting prototype set, and f1(·) represents a multi-layer perceptron MLP, which is used to project the handwriting prototype onto the application of In metric space;
[0089] By adopting the training optimization method of the prototype contrast learning loss function ProtoNCE loss, the similarity between the specified handwriting prototype and the positive sample is much greater than the similarity with the negative sample; at the same time, the similarity between the specified handwriting prototype and the negative sample is made as small as possible. When the result value of the prototype contrast learning loss function ProtoNCE loss is close to the ideal value, a more discriminative handwriting prototype p is inferred. c .
[0090] Execute step 3.
[0091] Specifically, step 3 includes the following steps:
[0092] Step 301: The more distinctive handwriting prototype p c As anchor points, a total of K more distinguishable handwriting prototype samples containing several different writers are selected for training, among which writer W is selected i Another random sample is passed through the feature encoder E f Processing to obtain the positive sample handwriting feature e + , select K-1 random samples of different writers and pass them through the feature encoder E f Processing to obtain negative sample handwriting features e - ;
[0093] That is to say, the writer W i Handwriting prototype p c As anchor points, a total of K handwriting prototype samples from different writers are selected as a set, where the set contains a writer W i Another random sample of , and a total of K-1 random samples of other writers are selected;
[0094] Then the K handwriting prototype samples are respectively passed through the feature encoder E f Processing to obtain handwriting features, where the writer W i After processing another random sample of the positive sample handwriting feature e + , while other random samples are processed to obtain negative sample handwriting features e - ;
[0095] At the same time, in order to prevent the handwriting features from being overfitted, the set does not include the writer W i Anchor handwriting prototype p c ;
[0096] Step 302: Design the contrastive learning loss function GuideNCE loss, denoted as Specifically expressed as:
[0097]
[0098] Among them, τ is the temperature parameter, φ(p c ,e + )=f2(p c ) T f2(e + ) represents the anchor point p c The similarity between the handwritten features and the positive sample, φ(p c ,e - )=f2(p c ) T f2(e - ) represents the anchor point p c The similarity between the handwritten features of the negative samples, f2(·) is a multi-layer perceptron (MLP) with the same structure as f1(·), j represents the index of K-1 negative sample handwritten features, and K represents the size of the handwritten prototype sample set;
[0099] Step 303: Use the contrastive learning loss function GuideNCE loss to guide the feature encoder E f , so that the handwriting features of the same writer are closer and the handwriting features of different writers are farther away, thereby training the feature encoder to learn more representative handwriting features, and then achieving the above e + With handwriting prototype p c Align.
[0100] Execute step 4 (refer to Figure 2 ),
[0101] Specifically, step 4 includes the following steps:
[0102] Step 401: Given the handwriting I to be queried q and n real handwriting samples X of the designated writer;
[0103] Step 402: The handwritten q Input to the trained feature encoder E f In the query, the handwritten features are obtained
[0104] Step 403: Input the real handwriting samples X into the trained feature encoder E f In the example, we get n real handwriting features E f (X) and average to get the average feature
[0105] Step 404: Calculate the handwritten feature E to be queried f (I q ) and average characteristics The cosine distance between The formula is:
[0106]
[0107] Among them, ||·|| represents norm;
[0108] Step 405: Given a predefined threshold t, if the cosine distance Then determine the handwriting I q It is the authentic handwriting of the designated writer; otherwise, it is determined to be not the authentic handwriting of the designated writer;
[0109] For example, for the predefined threshold t=0.2, if 0.1<0.2, so it is determined that the handwriting is I q Is the authentic handwriting of the designated writer, otherwise 0.3>0.2, so it is determined that the handwriting is I q It is not the authentic handwriting of the designated writer.
[0110] The technical principle of the method of the present invention is as follows: first, a pseudo paragraph is constructed from a handwritten text sample; then, a prototype encoder and a prototype contrast learning loss function ProtoNCE loss are designed to extract a handwriting prototype with both the overall style and the local style of the writer from the pseudo paragraph; then, a feature encoder and a guided contrast learning loss function GuideNCE loss are designed to extract more discriminative handwriting features from isolated samples; the handwriting prototype is used as information supervision, and the feature encoder is unidirectionally guided to achieve effective individual feature extraction; finally, the query handwriting feature E is calculated. f (I q ) and average characteristics The cosine distance between them is compared with the predefined threshold t to determine the handwriting I to be queried. q Whether it is the authentic handwriting of the writer.
[0111] The present invention adopts the learning strategy of prototype contrast learning loss function ProtoNCE loss and guided contrast learning loss function GuideNCE loss to effectively extract handwriting features with the writer's overall style and local style, further improving the accuracy and comprehensiveness of handwriting recognition. Among them, ProtoNCE loss can guide the prototype encoder to extract handwriting prototypes from pseudo-paragraphs, and GuideNCE loss can guide the feature encoder to extract highly discriminative handwriting features from the handwriting prototype, thereby effectively improving the handwriting verification performance, and thus effectively identifying the authenticity of the writer using a given text sample.
[0112] In the present invention, the prototype encoder E pand feature encoder E f All are implemented using the standard ResNet18 architecture and trained for 200 epochs on a single RTX 4090 GPU using the RMSProp optimizer with a batch size of 64, a base learning rate set to 0.005, and a linear warmup for the first 10 epochs followed by a cosine decay to 0.
[0113] The various technical features or steps of the above embodiments can be arbitrarily combined. To make the description concise, not all possible combinations of the various technical features or steps in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0114] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
Claims
1. A handwriting feature extraction method based on pseudo-paragraph handwriting prototype guidance, characterized in that: The following steps are involved: Step 1: Collect multiple handwritten text samples from multiple writers; For a single writer, several handwriting samples are randomly selected and combined into pseudo paragraphs, which are then processed by the prototype encoder to obtain the handwriting prototype; Step 2: For the handwriting prototype, construct a positive sample set and a negative sample set and design a prototype contrast learning loss function ProtoNCE loss to obtain the mutual information between the handwriting prototypes with the greatest similarity to the same writer, thereby obtaining a more distinguishable handwriting prototype; Step 3: Using the more distinctive handwriting prototype as an anchor point, a feature encoder is used to select positive sample handwriting features and negative sample handwriting features, and a guided contrastive learning loss function (GuideNCE loss) is designed to guide the training of the feature encoder to obtain handwriting features with representative characteristics of the writer; Step 4: In the query stage, multiple real handwriting samples of the designated writer and the handwriting to be queried are processed by the trained feature encoder respectively to obtain the handwriting features to be queried and the real handwriting features, and the average features of the real handwriting features are calculated. Then, the cosine distance between the handwriting features to be queried and the average features is calculated, and the cosine distance is compared with a predefined threshold to determine whether the handwriting belongs to the real handwriting of the designated writer.
2. The handwriting feature extraction method based on pseudo-paragraph handwriting prototype guidance according to claim 1 is characterized in that: The step 1 comprises the following steps: Step 101: Collecting a number of independent single handwritten text samples from multiple writers; Step 102: For a certain writer, randomly select m handwritten text samples and combine them into a pseudo paragraph I p ; Step 103: The pseudo paragraph I p After the prototype encoder E p Processing to obtain the handwriting prototype p = E p (I p ); Step 104: Repeat steps 102 to 103 for different writers to obtain a plurality of pseudo paragraphs I corresponding to each writer and generated randomly. p and a plurality of said handwriting prototypes p.
3. The handwriting feature extraction method based on pseudo-paragraph handwriting prototype guidance according to claim 2 is characterized in that: The step 102 includes the following steps: Step 10201: randomly dividing m handwritten text samples of a certain writer into a plurality of subsets, each subset containing a plurality of said handwritten text samples, and randomly combining them into text lines; Step 10202: Select the shortest text line as a reference, and crop the remaining text lines to uniformly match the widths, so that the widths of the text lines are aligned with each other; Step 10203: Concatenate the text lines to form the pseudo paragraph and adapt it to the prototype encoder.
4. The handwriting feature extraction method based on pseudo-paragraph handwriting prototype guidance according to claim 1 is characterized in that: The step 2 comprises the following steps: Step 201: Select a set of handwriting prototypes from several writers with a batch size of N, and select a designated handwriting prototype of a designated writer in the set, and use the other handwriting prototypes of the writer as the positive sample set, denoted as P + , the handwriting prototypes of other different writers are used as negative sample sets, denoted as P - ; Step 202: Using the positive sample set P + And the negative sample set P - The prototype contrast learning loss function ProtoNCE loss is designed to obtain the mutual information between the handwriting prototypes with the greatest similarity of the same writer, thereby obtaining a more distinguishable handwriting prototype p c .
5. The handwriting feature extraction method based on pseudo-paragraph handwriting prototype guidance according to claim 4 is characterized in that: The step 202 includes the following steps: Design prototype contrast learning loss function ProtoNCE loss, denoted as Specifically expressed as: Where τ is the temperature parameter, N represents the size of the handwriting prototype set, i∈M={1,…,N} represents the index of the handwriting prototype in the set, M represents the set of the index, and index j∈A(i)=M\{i} represents other indexes different from i, p + P + Any element of p i Indicates the specified handwriting prototype, p j Represents any element of the handwriting prototype set, φ(p i ,p + )=f1(p i ) T f1(p + ) represents the similarity between the specified handwriting prototype and the positive sample, φ(p i ,p j )=f1(p i ) T f1(,p j ) represents the similarity between a specified handwriting prototype and any element in the handwriting prototype set, and f1(·) represents a multi-layer perceptron MLP.
6. The handwriting feature extraction method based on pseudo-paragraph handwriting prototype guidance according to claim 1, characterized in that: The step 3 comprises the following steps: Step 301: The more distinctive handwriting prototype p c As anchor points, a total of K more distinguishable handwriting prototype samples containing several different writers are selected for training, among which writer W is selected i Another random sample is passed through the feature encoder E f Processing to obtain the positive sample handwriting feature e + , select K-1 random samples of different writers and pass them through the feature encoder E f Processing to obtain negative sample handwriting features e - ; Step 302: Design the contrastive learning loss function GuideNCE loss, denoted as Specifically expressed as: Where τ is the temperature parameter, Represents the anchor point p c The similarity between the handwritten features and the positive samples, Represents the anchor point p c The similarity between the handwritten features of the negative samples, f2(·) is a multi-layer perceptron (MLP) with the same structure as f1(·), j represents the index of K-1 negative sample handwritten features, and K represents the size of the handwritten prototype sample set; Step 303: Use the contrastive learning loss function GuideNCE loss to guide the training of feature encoder E f .
7. The handwriting feature extraction method based on pseudo-paragraph handwriting prototype guidance according to claim 1 is characterized in that: The step 4 comprises the following steps: Step 401: Given the handwriting I to be queried q and n real handwriting samples X of the designated writer; Step 402: The handwritten q Input to the trained feature encoder E f In the query, the handwritten feature E is obtained f (I q ); Step 403: Input the real handwriting samples X into the trained feature encoder E f In the example, we get n real handwriting features E f (X) and average to get the average feature Step 404: Calculate the handwritten feature E to be queried f (I q ) and average characteristics The cosine distance between The formula is: Among them, ||·|| represents the l2 norm; Step 405: Given a predefined threshold t, if the cosine distance Then determine the handwriting I q It is the authentic handwriting of the designated writer; otherwise, it is determined to be not the authentic handwriting of the designated writer.
Citation Information
Patent Citations
Cross-modal character handwriting verification method, system and equipment and storage medium
CN115620312A
Handwritten signature retrieval method based on deep learning
CN116701690A
Remote sensing image change detection method based on axial displacement feature interaction and prototype guidance penalty constraint
CN118608948A
Independent processing style and content feature combined Chinese handwritten font migration method
CN119692305A
Wireless automatic ankle-brachial index (AABI) measurement system
US20100292586A1