Handwritten signature simulation sample generation method, generation device and storage medium
By simulating the generation of basic handwritten signatures and performing differentiated enhancement processing, combined with table template fusion and neighborhood binding strategies, the problem of poor quality of handwritten signature sample data was solved, high-quality simulation sample generation was achieved, and the adaptability and robustness of the model were improved.
Patent Information
- Application Number
- CN202611628694.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-21
- Publication Date
- 2026-11-20
AI Technical Summary
The existing handwritten signature sample data is of poor quality, mainly due to privacy restrictions, insufficient negative samples, and poor simulation effects, resulting in poor model adaptability in complex scenarios.
By simulating the generation of basic handwritten signatures, constructing a transparent canvas and performing differential enhancement processing, and combining table template fusion and neighborhood binding strategies, the simulation date is generated and paper scanning noise is simulated, thus achieving fully automated sample generation.
It improves the quality of handwritten signature sample data, enhances the model's generalization ability and robustness in real-world scenarios, and reduces the risk of leakage of sensitive personal information.
Smart Images

Figure CN123142240A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image recognition, and in particular to a method, apparatus and storage medium for generating simulated handwritten signature samples. Background Technology
[0002] In scenarios such as government digitalization, financial bill review, and online corporate archiving, the automatic recognition of handwritten signatures on digitized paper forms is a core step in determining document validity and completing process compliance verification. Currently, handwritten signature recognition primarily utilizes deep learning detection models such as YOLO and Faster R-CNN, whose performance heavily relies on large-scale, diverse, and accurately labeled handwritten signature image datasets. However, existing signature dataset construction and sample synthesis techniques have numerous shortcomings, severely limiting the effectiveness of deployment of detection models.
[0003] First, handwritten signatures are highly sensitive biometric information, subject to regulations related to personal information protection. Collecting authentic signature samples and sharing datasets faces extremely high compliance barriers, making it difficult to obtain a sufficient number of effective samples. Second, existing handwritten text synthesis schemes simply concatenate single characters and perform basic scaling and rotation. The resulting samples are limited to a single scenario, mostly consisting of complete and standardized signatures, with insufficient negative samples, leading to poor model adaptability to complex scenarios. Third, traditional datasets rely on manual annotation, which is costly in terms of manpower and time, and prone to various annotation noises, making it difficult to guarantee data quality. Furthermore, existing handwritten signature synthesis technologies, which only involve simple concatenation of single characters and basic scaling and rotation, generate samples with low simulation accuracy, resulting in poor model generalization performance in real-world scenarios.
[0004] In summary, due to the current limitations of handwritten signature training sample generation technology, such as privacy restrictions, insufficient negative samples, and poor simulation effects, the quality of the generated handwritten signature sample data is poor.
[0005] There is currently no effective solution to the problem of poor quality of handwritten signature sample data in related technologies. Summary of the Invention
[0006] This embodiment provides a method, apparatus, and storage medium for generating simulated handwritten signature samples to address the problem of poor quality of handwritten signature sample data in related technologies.
[0007] Firstly, this embodiment provides a method for generating simulated handwritten signature samples, including:
[0008] A basic handwritten signature is generated based on a preset set of Chinese characters.
[0009] A transparent canvas is constructed based on the basic handwritten signature to obtain a transparent image of the basic signature;
[0010] The base signature transparency image is subjected to differential enhancement processing to obtain the target signature transparency image;
[0011] The target signature transparency image is fused with a preset table template to obtain an initial simulation sample of the handwritten signature.
[0012] A simulated date is generated based on a preset handwritten digit dataset; wherein the handwriting of the simulated date is different from that of the base handwritten signature;
[0013] The simulation date is set in the initial simulation sample of the handwritten signature according to a preset neighborhood binding strategy to obtain the target simulation sample of the handwritten signature. The preset neighborhood binding strategy is to set the simulation date in different preset regions.
[0014] In some embodiments, the Chinese character set includes a subset of surname characters and a subset of commonly used given name characters. The step of simulating and generating a basic handwritten signature based on a preset Chinese character set includes:
[0015] A predetermined first number of Chinese characters are extracted from the set of surname characters as the first character of the basic handwritten signature; wherein, the predetermined first number includes 1 or 2 Chinese characters;
[0016] A predetermined second number of characters are extracted from the commonly used Chinese character set as the last character of the basic handwritten signature;
[0017] Based on the preset offset of adjacent Chinese characters, the first character and the last character are simulated for writing in either a horizontal or vertical arrangement to obtain the basic handwritten signature.
[0018] In some embodiments, the differential enhancement processing of the base signature transparency map to obtain the target signature transparency map includes:
[0019] The basic signature transparency image is deformed to obtain the basic signature deformed image;
[0020] The basic handwritten signature in the basic signature deformation diagram is subjected to stroke distortion processing to obtain a stroke distortion diagram.
[0021] Adjust the brightness of the basic handwritten signature in the pen stroke distortion image according to a preset proportional coefficient to obtain the target signature transparency image.
[0022] In some of these embodiments, the deformation processing includes horizontal scaling, vertical scaling, global rotation, and local rotation.
[0023] In some of these embodiments, the stroke distortion treatment includes random ink breakage erosion and edge ink bleed swelling.
[0024] In some embodiments, setting the simulation date before the initial simulation sample of the handwritten signature according to a preset neighborhood binding strategy further includes:
[0025] The simulation date is then subjected to differential enhancement processing to obtain the differentially enhanced simulation date.
[0026] In some embodiments, the preset neighborhood binding strategy includes:
[0027] The simulated date is set at a preset adjacent position to the basic handwritten signature according to a preset first probability, and a signature-date sample is generated;
[0028] The simulation date is set in another blank position in the preset table template according to a preset second probability, wherein the other blank position is the position adjacent to the preset position of the basic handwritten signature.
[0029] In some embodiments, after setting the simulation date in the initial simulation sample of the handwritten signature according to a preset neighborhood binding strategy to obtain the target simulation sample of the handwritten signature, the method further includes:
[0030] The handwritten signature target simulation sample is subjected to paper scanning noise simulation, and the rendered synthetic sample image is output.
[0031] Secondly, this embodiment provides a handwritten signature simulation sample generation device, including: a simulated writing module, a basic signature transparency map construction module, a differentiation enhancement module, a fusion module, a simulation date generation module, and a handwritten signature target simulation sample generation module;
[0032] The simulated writing module is used to simulate and generate a basic handwritten signature based on a preset set of Chinese characters;
[0033] The basic signature transparency image construction module is used to construct a transparent canvas based on the basic handwritten signature to obtain the basic signature transparency image.
[0034] The differentiation enhancement module is used to perform differentiation enhancement processing on the basic signature transparency image to obtain the target signature transparency image;
[0035] The fusion module is used to fuse the target signature transparency image with a preset table template to obtain an initial simulation sample of the handwritten signature.
[0036] The simulation date generation module is used to generate simulation dates based on a preset handwritten digit dataset;
[0037] The target simulation sample generation module is used to set the simulation date in the initial simulation sample of the handwritten signature according to a preset neighborhood binding strategy, so as to obtain the target simulation sample of the handwritten signature.
[0038] Thirdly, this embodiment provides a storage medium storing a computer program that, when executed by a processor, implements the handwritten signature simulation sample generation method described in the first aspect above.
[0039] Compared with related technologies, the handwritten signature simulation sample generation method provided in this embodiment generates a basic handwritten signature by simulating a set of Chinese characters; constructs a transparent canvas based on the basic handwritten signature to obtain a basic signature transparency image; performs differential enhancement processing on the basic signature transparency image to obtain a target signature transparency image; merges the target signature transparency image with a preset table template to obtain an initial simulation sample of the handwritten signature; generates a simulation date based on a preset handwritten digit dataset; wherein the handwriting of the simulation date is different from that of the basic handwritten signature; and sets the simulation date in the initial simulation sample of the handwritten signature according to a preset neighborhood binding strategy to obtain a target simulation sample of the handwritten signature. The preset neighborhood binding strategy sets the simulation date in preset different regions, improving the quality of the handwritten signature sample data.
[0040] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description
[0041] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0042] Figure 1 This is a hardware structure block diagram of the terminal for the handwritten signature simulation sample generation method in this embodiment.
[0043] Figure 2 This is a flowchart of the handwritten signature simulation sample generation method in this embodiment.
[0044] Figure 3 This is a flowchart of another method for generating simulated handwritten signature samples in this embodiment.
[0045] Figure 4 This is a structural block diagram of the handwritten signature simulation sample generation device in this embodiment. Detailed Implementation
[0046] To better understand the purpose, technical solution, and advantages of this application, the application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0047] Unless otherwise defined, the technical or scientific terms used in this application shall have the general meaning understood by one of ordinary skill in the art to which this application pertains. Words such as “a,” “an,” “an,” “the,” “the,” and “these” used in this application do not indicate quantitative limitation and may be singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or modules (units) is not limited to the listed steps or modules (units) but may include steps or modules (units) not listed, or may include other steps or modules (units) inherent to these processes, methods, products, or devices. Words such as “connected,” “linked,” and “coupled” used in this application are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. “Multiple” used in this application refers to two or more. “And / or” describes the relationship between related objects, indicating that three relationships may exist; for example, “A and / or B” can represent: A alone, A and B simultaneously, and B alone. Normally, the character " / " indicates that the objects before and after it are in an "or" relationship. The terms "first," "second," "third," etc., used in this application are merely to distinguish similar objects and do not represent a specific order of objects.
[0048] The method embodiments provided in this example can be executed on a terminal, computer, or similar computing device. For example, it can run on a terminal. Figure 1 This is a hardware structure block diagram of the terminal for the handwritten signature simulation sample generation method in this embodiment. For example... Figure 1 As shown, a terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 and a memory 104 for storing data are also included. The processor 102 may be, but is not limited to, a microprocessor (MCU) or a programmable logic device (FPGA). The terminal may also include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that… Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the terminal described above. For example, the terminal may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown are illustrated.
[0049] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the handwritten signature simulation sample generation method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0050] The transmission device 106 is used to receive or send data via a network. This network includes a wireless network provided by the terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 can be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0051] This embodiment provides a method for generating simulated handwritten signature samples. Figure 2 This is a flowchart of the handwritten signature simulation sample generation method in this embodiment, as follows: Figure 2 As shown, the process includes the following steps:
[0052] Step S201: Simulate and generate a basic handwritten signature based on a preset set of Chinese characters.
[0053] Specifically, firstly, based on the surnames and given names commonly used in real signatures in business scenarios, a multi-style handwritten character library is pre-collected. The character library contains handwritten Chinese character templates with different writing pressures, stroke thicknesses, degree of connection, and tilt angles, resulting in a set of Chinese characters.
[0054] Secondly, when generating the basic signature, the target signature character sequence is first selected from the preset set of Chinese characters. For each selected Chinese character, different handwriting templates in the character library are randomly called, and handwriting perturbation is introduced at the same time: a small displacement offset is applied to the stroke control points to simulate the shaking when a human hand is writing; the scaling ratio and rotation angle of the single character are adjusted to replicate the tilt of the character shape in natural writing; the spacing between characters is controlled to support the unique writing habits of signatures such as compact connection within the name and strokes sticking together between characters.
[0055] Finally, a global style normalization process is performed on consecutive Chinese characters to ensure that the stroke thickness and ink density of the entire signature are consistent, avoiding stylistic disjointedness in the individual characters generated by splicing. The output is a clean, unobstructed, and non-overlapping basic handwritten signature image. This method avoids directly collecting biometric information from real human signatures, preventing the leakage of sensitive personal information and compliance risks, and can generate basic signature samples for different signature subjects in batches.
[0056] Step S202: Construct a transparent canvas based on the basic handwritten signature to obtain a transparent image of the basic signature.
[0057] Specifically, in this embodiment, the transparent solid canvas is constructed using an RGBA four-channel high-transparency canvas, where the R, G, and B channels carry the color information of the signature strokes, and the alpha channel is used for pixel transparency control. Foreground and background segmentation processing is performed on the basic handwritten signature image to identify and extract the foreground pixels of the handwritten strokes; the original ink pixel information is preserved in the Chinese character stroke areas, and the alpha channel of the blank areas of the canvas is set to full transparency to eliminate the white background and prevent white borders from obscuring the underlying document during subsequent fusion.
[0058] In practice, threshold segmentation and morphological optimization are performed on the signature ink to remove noise pixels, ensure smooth stroke edges, and prevent burrs and pseudo-transparent areas. The segmented and extracted signature strokes are mapped to an RGBA canvas, and layer encapsulation is completed to output a basic signature transparency image S0. S0 preserves the complete stroke shape and ink density variations of the signature, while also possessing transparency layer properties. It can be directly overlaid onto any document background image, achieving a natural blending of the signature with the paper document background. This provides standardized layer material for generating various challenging sample templates such as signature overlap, alteration, and scaling.
[0059] Step S203: Perform differential enhancement processing on the basic signature transparency image to obtain the target signature transparency image.
[0060] Specifically, after obtaining the basic signature transparency image, further differentiation enhancement processing is applied to the basic signature transparency image to improve the quality of the handwritten signature simulation samples. Among these, the differentiation enhancement is geared towards the needs of difficult business example samples, applying multi-dimensional random perturbations to the signature strokes and transparency layers respectively, simulating various non-ideal forms of handwritten signatures in real documents while preserving the recognizability of the signature subject.
[0061] For example, the enhancement operation includes several optional perturbations, such as: performing random scaling on the entire signature to generate a very small signature sample; applying a slight rotation transformation to reproduce the natural tilt effect of handwriting; performing local erosion and dilation on the stroke outlines to simulate ink smudging and stroke incompleteness; introducing local pixel erasure to construct a difficult example of partial signature loss; superimposing a light Gaussian noise to simulate ink breaks at the pen tip and uneven ink marks caused by paper texture; and setting local transparency attenuation to simulate the effect of fading signature ink. It also supports adding local erasure perturbations, superimposing a small amount of semi-transparent occlusion blocks on the signature stroke area to simulate document erasure marks. Multiple of the above perturbations can be combined for enhancement, or only one can be selected for enhancement.
[0062] During the perturbation process, the RGBA four channels are kept synchronized, and all transformation operations are applied to the foreground signature strokes. The blank areas of the canvas remain fully transparent without introducing any additional white background. By controlling the configuration of the perturbation parameter range, target signature transparency images S1 with different shapes can be generated in batches, covering difficult examples in real-world scenarios such as incompleteness, minor alterations, and small font sizes, thus making up for the lack of difficult example samples in real-world datasets.
[0063] Step S204: The target signature transparency image is fused with the preset table template to obtain the initial simulation sample of the handwritten signature.
[0064] Specifically, the process begins by preprocessing various business form templates, including contracts, expense reports, approval forms, and account opening applications. These templates are uniformly broken down into a three-layer structure: a bottom layer of paper background, a middle layer of fixed printed text and table lines, and a top layer of blank fillable areas. Edge detection combined with text connectivity detection is used to pre-mark high-density areas where pasting is prohibited, such as black lines in the table and bold printed text. Then, the target signature transparency image is dynamically scaled according to the size of the blank cells in the form, controlling the maximum signature width to not exceed 80% of the cell width to prevent the signature from exceeding the fill field boundaries. A signature placement position is randomly selected within the blank fill area of the template, and the candidate placement area is checked for pixel overlap with the pre-marked prohibited areas. If overlap is detected, a new position is selected and the check is repeated until there is no occlusion conflict before layer overlay is performed. During the fusion process, the minimum bounding rectangle "x" corresponding to the signature entity is extracted based on the pixel coordinate system of the original table image. min y min x max y max The coordinates are simultaneously associated with the signature category label, and the corresponding annotation data is automatically generated while the simulation image is synthesized, eliminating the manual annotation step and reducing the cost of dataset construction.
[0065] In step S205, a simulated date is generated based on a preset handwritten digit dataset, wherein the handwriting of the simulated date is different from the handwriting of the basic handwritten signature.
[0066] Specifically, in the real business document scenario, a large number of paper documents have a situation where the signature handwriting and the handwritten date handwriting do not belong to the same writer: for example, the handler fills in the document date, and then the person in charge signs the name separately; or the date is filled in by another person and then submitted to the approver for signature confirmation; there are also scenarios where the date is pre-filled on the document and the name is signed later. If the handwriting simulation sample only supports a generation mode where the signature and the date are from the same writer, the above real business scenarios cannot be reproduced, resulting in incomplete scenario coverage of the simulation dataset. To meet the requirements of model training and algorithm testing for document verification, handwriting verification, document comparison, etc., this embodiment also simulates the scenario in real documents where the signature and handwritten date do not belong to the same writer.
[0067] Date interference entities that conform to the standard format are constructed through the handwritten digit dataset (MNIST). The date format can be set to five types of date formats commonly used in business scenarios: "YYYY-MM-DD, YYYY.MM.DD, YYYY / MM / DD, MM-DD, YYYY年MM月DD日". After randomly selecting one format, handwritten digit images from 0 to 9 are extracted from the dataset to complete sequence splicing to obtain the date entity; independent random deformation, ink break and grayscale attenuation perturbations are applied to the spliced digital date entity, so that the stroke texture and shade of the date ink change, forming a difference in writing handwriting from the basic handwritten signature, making the handwriting of the simulated date different from the handwriting of the basic handwritten signature, constructing negative samples with inconsistent signature handwriting and date handwriting, increasing the richness of handwritten signature simulation samples, so as to simulate the scenario in real documents where the signature and handwritten date do not belong to the same writer, and provide available interference materials for subsequent construction of hard case samples where the signature and date overlap with each other.
[0068] In step S206, the simulated date is set in the initial handwritten signature simulation sample according to a preset neighborhood binding strategy to obtain a target handwritten signature simulation sample, wherein the preset neighborhood binding strategy is to set the simulated date in different preset regions.
[0069] Specifically, in the actual arrangement of simulated dates, a neighborhood binding strategy is adopted. This strategy involves setting simulated dates in different areas, including two placement modes: one is an independent filling area far from the signature, used to generate regular samples; the other is the neighborhood range surrounding the signature, used to construct difficult sample cases where the date and signature strokes overlap. Before placement, it is checked whether there are pixel conflicts between the candidate area and the prohibited pasting areas such as printed text and borders in the table. If overlap occurs, the position is reselected. After the date layer is overlaid, the minimum bounding rectangle of the simulated date is extracted using the image pixel coordinate system and the corresponding category label is bound, realizing the synchronous generation of date labels. Through this neighborhood binding strategy, the spatial positional relationship between the simulated date and the signature can be flexibly controlled, and batch construction of difficult sample cases containing regular samples as well as signatures and handwritten dates that overlap each other can be achieved. This compensates for the lack of difficult sample cases when collecting real documents, improves the richness of the samples, and thus improves the sample quality.
[0070] Through steps S201 to S206 above, a basic handwritten signature is simulated and generated based on a preset set of Chinese characters; a transparent canvas is constructed based on the basic handwritten signature to obtain a basic signature transparent image; the basic signature transparent image is subjected to differential enhancement processing to obtain a target signature transparent image; the target signature transparent image is fused with a preset table template to obtain an initial simulation sample of the handwritten signature; a simulation date is generated based on a preset handwritten digit dataset, wherein the handwriting of the simulation date is different from that of the basic handwritten signature; the simulation date is set in the initial simulation sample of the handwritten signature according to a preset neighborhood binding strategy to obtain a target simulation sample of the handwritten signature, wherein the preset neighborhood binding strategy is to set the simulation date in preset different regions. Compared to existing technologies that generate handwritten signature simulation samples simply by splicing single characters and performing basic scaling and rotation, this embodiment achieves fully automated sample generation and synchronous annotation through signature generation, multi-level differentiation enhancement strategies, layered fusion of table backgrounds, and coupled overlay of date interference. It utilizes a publicly available handwritten character dataset, eliminating the need to collect any real handwritten signatures from individuals and avoiding any leakage of sensitive personal information or compliance risks. By binding date interference to the signature neighborhood, it batches high-frequency and difficult example scenarios of "signature + adjacent handwritten date." Training with this sample data enables the trained model to accurately distinguish between handwritten Chinese signatures and digital dates, reducing the false detection rate in real business scenarios and further verifying the improved quality of handwritten signature sample data.
[0071] In some embodiments, the Chinese character set includes a subset of surname characters and a subset of commonly used given name characters. A basic handwritten signature is generated based on a preset Chinese character set, including:
[0072] A preset number of Chinese characters are extracted from the subset of surnames as the first character of the basic handwritten signature; the preset first number includes 1 or 2 Chinese characters; a preset number of characters are extracted from the subset of commonly used given names as the last character of the basic handwritten signature; based on the preset offset of adjacent Chinese characters, the first and last characters are written in a horizontal or vertical arrangement to obtain the basic handwritten signature.
[0073] Specifically, in this embodiment, the Chinese character set mainly adopts the CASIA Handwritten Database (HWDB) offline handwritten Chinese dataset from the Institute of Automation, Chinese Academy of Sciences. The Chinese character set is divided into a subset of surname Chinese characters and a subset of commonly used given name Chinese characters. The subset of surname Chinese characters mainly consists of high-frequency surnames, including 120 commonly used surnames such as Zhao, Qian, Sun, and Li. The subset of commonly used given name Chinese characters mainly includes 300 commonly used given name Chinese characters such as Wei, Jing, Ming, and Fang.
[0074] This scheme differentiates between two-character names, three-character names, and four-character names containing compound surnames. It randomly assigns a signature character length L, ranging from 2 to 5. For single-surname names, one character is extracted from the surname subset as the first character of the basic handwritten signature. For compound surname names, two characters are extracted from the surname subset as the first character. The remaining characters are extracted from a subset of commonly used name characters, depending on the desired signature length. During character arrangement, two layout options are available: horizontal standard writing or vertical traditional signature. Segmented random offsets Δx and Δy are introduced to assign differentiated positional offsets to adjacent characters, simulating the natural writing characteristics of human handwriting, such as tighter spacing at the beginning and looser spacing at the end, and slight vertical fluctuation of the character baseline. This results in the basic handwritten signature.
[0075] For example, firstly, the HWDB handwritten Chinese dataset is split into a subset of surname characters (120 common surnames such as Zhao, Qian, Sun, and Li) and a subset of common given name characters (300 common given name characters such as Wei, Jing, Ming, and Fang). Then, the name structure is randomly assigned: a 70% probability of a common name is set, with a character length of L∈{2, 3}, the first character taken from the surname subset, and the remaining characters taken from the common given name subset. A 30% probability of a compound surname or four-character name is set, with a character length of L∈{4, 5}, the first two characters fixed, two-character compound surnames selected from the surname subset, and the remaining characters taken from the common given name subset. Finally, create a 300×600 pixel RGBA fully transparent canvas. When arranged horizontally, for each character in a row, the horizontal axis offset Δx∈[-3,3] and the vertical axis offset Δy∈[-2,2] for adjacent Chinese characters; when arranged vertically, for each character in a column, the vertical axis offset Δy∈[-4,4]; after drawing each character, output the basic handwritten signature.
[0076] The extraction rules in this embodiment prioritize selecting the beginning part of the signature characters from the surname subset, and randomly sample the remaining characters from the given name subset. This avoids generating random combinations of Chinese characters whose semantics do not conform to the habits of real names. Furthermore, random offsets are set between adjacent Chinese characters to make the generated basic handwritten signature more consistent with the real situation in the human handwriting process, thereby improving the visual realism of the generated signature and further improving the quality of the handwritten signature sample data.
[0077] In another embodiment, a differential enhancement process is performed on the base signature transparency map to obtain the target signature transparency map, including:
[0078] The basic signature transparency image is deformed to obtain the basic signature deformation image; the basic handwritten signature in the basic signature deformation image is distorted to obtain the stroke distortion image; the brightness of the basic handwritten signature in the stroke distortion image is adjusted according to a preset ratio coefficient to obtain the target signature transparency image.
[0079] Specifically, the base signature transparency image is enhanced with differential processing to obtain the target signature transparency image, which involves several processing steps:
[0080] First, deformation processing is performed on the basic signature transparency image to generate a basic signature deformation image S1. This deformation processing includes horizontal scaling, vertical scaling, global rotation, and local rotation operations. Specifically, a non-uniform block scaling method can be used, setting the horizontal scaling factor to 0.8~1.2 and the vertical scaling factor to 0.85~1.15. These two factors are independently and randomly sampled, and the basic signature transparency image is scaled using these set scaling factors. The global rotation angle is randomly selected in segments within the range of -12° to +12° to rotate the basic signature transparency image, simulating the tilt effect of real handwriting and avoiding extreme tilt effects that do not conform to real handwriting habits. Simultaneously, the signature image is divided into a 4×4 grid, and a small random offset is applied to each grid vertex to simulate local stroke distortion caused by paper bending or uneven placement, thus obtaining the basic signature deformation image S1.
[0081] Next, stroke distortion processing is applied to the handwritten signature within the basic signature deformation image S1 to obtain stroke distortion image S2. This stroke distortion processing includes random ink breakage erosion and edge ink bleed expansion. For example, two types of defect simulations closely resembling real writing scenarios are applied to the basic signature deformation image S1. Random ink breakage erosion truncates no more than 10% of the stroke pixels to simulate insufficient ink supply during writing, and a low-probability 1-pixel expansion is applied to the stroke edges to replicate the slight ink bleed effect on paper when writing with a ballpoint pen or fountain pen, resulting in stroke distortion image S2.
[0082] Finally, the brightness of the signature in the distorted image is adjusted according to a preset ratio coefficient, and the target signature transparent image S3 is output. For example, three transparency ranges are set and randomly allocated in a ratio of 3:5:2. The transparency α value ranges for light handwriting are [0.45, 0.65], for regular handwriting are [0.66, 0.85], and for dark handwriting are [0.86, 1.0]. The grayscale pixels of the image are multiplied by the corresponding transparency coefficient, and a slight global Gaussian brightness perturbation is superimposed to simulate the changes in ink brightness caused by different scanning devices and differences in paper background color, and finally the target signature transparent image S3 is obtained.
[0083] For example, a local vertex offset is applied to the basic signature transparency image S0 in a 4×4 grid, with independent random horizontal scaling of 0.82~1.18 and vertical scaling of 0.85~1.15, and rotation angle of -12°~12°; a 2.25% probability is set to trigger ink breakage erosion, randomly eliminating 5%~10% of stroke pixels; a 15% probability is set to trigger edge ink bleed expansion, expanding the strokes outward by 1 pixel; light, medium, and dark ink transparency are randomly allocated in a 3:5:2 ratio, grayscale pixels are multiplied by the corresponding α coefficient, and ±8 grayscale value random brightness perturbation is superimposed to output the target signature transparency image S3.
[0084] Through the differentiated enhancement processing in this embodiment, a basic signature transparency image is constructed using an RGBA4 channel high-transparency canvas, eliminating the white edges of the background. For image enhancement, a deformation strategy combining "non-uniform block scaling" and "local mesh vertex offset" is implemented to simulate paper bending and local distortion. Furthermore, a specific algorithm is introduced to simulate insufficient ink by introducing random ink breakage erosion and slight ink bleeding and expansion at the edges to simulate paper bleeding. Combined with random assignment of three transparency ranges (light, normal, dark), the physical defects of real handwritten strokes are highly reproduced, thereby further improving the quality of the handwritten signature sample data.
[0085] In some embodiments, the preset neighborhood binding strategy includes: setting the simulation date in a preset adjacent position of the basic handwritten signature with a preset first probability to generate a signature-date sample; and setting the simulation date in other blank positions in a preset table template with a preset second probability, wherein the other blank positions are positions other than the preset adjacent positions of the basic handwritten signature.
[0086] Specifically, firstly, a rectangular neighborhood range surrounding the signature is constructed based on the minimum bounding rectangle of the handwritten signature. This neighborhood is then expanded outwards by 1.2 times the outline of the signature itself to form a dedicated neighborhood area, used to simulate real-world business scenarios where the signature and date are filled in adjacently. In this embodiment, the neighborhood binding strategy uses a dual-probability distribution placement rule, arranging the simulated date according to preset first and second probabilities: with an 80% probability, the generated simulated date is placed within the extended neighborhood of the signature, constructing high-value, difficult-to-sample cases where the signature and date are adjacent and partially overlap, conforming to the common practice of simultaneously annotating the date next to the signature in daily business documents; simultaneously, with a 20% probability, the simulated date is randomly placed in other blank positions in the table template besides the signature's adjacent neighborhood, generating regular interference samples where the signature and date are independent and unrelated. This probabilistic neighborhood binding strategy can generate closely coupled samples and independent interference samples in batches in a balanced manner. This not only makes up for the lack of difficult example data in real-world scenarios where signatures and dates are intertwined, but also enriches the data diversity of regular samples. It effectively solves the technical defects of traditional sample datasets, such as single scenario and insufficient interference samples, improves the model's anti-interference ability and generalization performance against handwritten date interference, and improves the quality of handwritten signature sample data.
[0087] In another embodiment, after setting the simulation date in the initial simulation sample of the handwritten signature according to a preset neighborhood binding strategy to obtain the target simulation sample of the handwritten signature, the method further includes: performing paper scanning noise simulation on the target simulation sample of the handwritten signature and outputting the rendered synthetic sample image.
[0088] Specifically, after arranging the simulation date onto the initial simulation sample of the handwritten signature according to a preset neighborhood binding strategy to obtain the target simulation sample of the handwritten signature, paper scanning noise simulation is further performed on the entire target simulation sample of the handwritten signature. For example, firstly, a slight beige or light gray paper background noise is superimposed on the target simulation sample of the handwritten signature to simulate the background color differences caused by different types of printing paper and copy paper, such as superimposing a ±6 pixel random background color shift in the RGB channel. Then, low-intensity Gaussian noise and salt-and-pepper noise are added to simulate the background gray, small specks, and local pixel distortion produced by the scanner, such as adding Gaussian noise and salt-and-pepper noise with a noise density of 0.001~0.003. Based on this, a low-amplitude global perspective shift is applied to the entire image to simulate slight geometric deformation caused by folding, uneven placement, or scanning angle deviation of paper documents, such as setting the offset of the four corner vertices to no more than 5 pixels. Finally, a Gaussian blur with a radius in the range of 0.3 to 0.8 is randomly selected for global processing to simulate the edge blurring effect caused by low-resolution scanning, out-of-focus mobile phone shooting, or slight paper blurring. After rendering is complete, output the complete composite sample image.
[0089] Through the unified rendering process in this embodiment, the synthesized samples can more realistically reflect the paper scanning quality in actual business scenarios, reduce the domain offset between the simulated samples and the real document images, improve the quality of handwritten signature sample data, and thus improve the generalization ability and robustness of subsequent recognition or detection models on real scan data.
[0090] This embodiment also provides a method for generating simulated handwritten signature samples. Figure 3 This is a flowchart of another method for generating simulated handwritten signature samples in this embodiment, as shown below. Figure 3 As shown, the process includes the following steps:
[0091] Step S301: Extract a preset first number of Chinese characters from the surname Chinese character subset as the first character of the basic handwritten signature; wherein the preset first number includes 1 or 2 Chinese characters; extract a preset second number of characters from the commonly used name Chinese character subset as the last character of the basic handwritten signature; according to the preset offset of adjacent Chinese characters, simulate writing the first and last characters in a horizontal or vertical arrangement to obtain the basic handwritten signature;
[0092] Step S302: Construct a transparent canvas based on the basic handwritten signature to obtain a transparent image of the basic signature;
[0093] Step S303: Perform deformation processing on the basic signature transparent image to obtain the basic signature deformed image; wherein, the deformation processing includes horizontal scaling, vertical scaling, global rotation and local rotation.
[0094] Step S304: Perform stroke distortion processing on the basic handwritten signature in the basic signature deformation image to obtain a stroke distortion image; wherein, stroke distortion processing includes random ink breakage erosion and edge ink bleeding expansion;
[0095] Step S305: Adjust the brightness of the basic handwritten signature in the pen stroke distortion image according to the preset scaling factor to obtain the target signature transparency image;
[0096] Step S306: The target signature transparency image is fused with the preset table template to obtain the initial simulation sample of the handwritten signature.
[0097] Step S307: Generate a simulation date based on a preset handwritten digit dataset, wherein the handwriting of the simulation date is different from that of the basic handwritten signature;
[0098] Step S308: Perform differential enhancement processing on the simulation date to obtain the differential enhanced simulation date;
[0099] Step S309: Set the differentiated simulation date in the initial simulation sample of the handwritten signature according to the preset neighborhood binding strategy to obtain the target simulation sample of the handwritten signature; wherein, the preset neighborhood binding strategy is to set the differentiated simulation date in different preset regions.
[0100] Step S310: Perform paper scanning noise simulation on the handwritten signature target simulation sample and output the rendered synthetic sample image;
[0101] Step S311: Train the table document detection model based on the synthesized sample image to obtain the trained table document detection model.
[0102] Through steps S301 to S311, compared with existing technologies that simply splice single characters and perform basic scaling and rotation to generate simulated handwritten signatures, this embodiment first constructs a subset of Chinese characters specific to surnames and given names, and generates basic signatures of multiple lengths and arrangements based on real name rules to ensure the semantics and writing style of the samples are authentic and reliable. Then, through non-uniform scaling, local grid deformation, random ink breaks and bleeds, and multi-level brightness and darkness rendering, it simulates the differences and writing defects of real handwriting, enriching the features of difficult example samples. Simultaneously, it introduces the MNIST dataset to generate simulated dates in multiple formats, and sets the handwriting of the simulated dates to be different from the handwriting of the basic handwritten signatures. A probability strategy of 80% neighborhood binding and 20% random distribution is used to construct signature-date coupled interference samples, solving the problems of category confusion and missing difficult examples in traditional solutions. Finally, scanning noise such as paper background color, scanning specks, perspective shift, and slight blur is superimposed to highly restore the imaging features of real documents. The handwritten signature simulation sample generation method in this embodiment avoids the compliance risks of real signature collection. It can generate high-precision, highly diverse, and highly realistic samples in batches without manual annotation, effectively eliminating data domain offset and improving the quality of handwritten signature sample data. The handwritten signature detection model trained with target handwritten signature sample data improves the model's anti-interference ability and generalization performance in complex scenarios.
[0103] In this method embodiment, after generating synthetic sample images in batches according to the handwritten signature simulation sample generation method, the handwritten signature detection model is trained:
[0104] In the synthesized sample image, 20% light-colored signature samples, 60% overlapping date neighborhood samples, and 20% independent, interference-free signature samples are set.
[0105] The training set, validation set, and test set are automatically divided according to a 7:2:1 ratio, and the eighth-generation real-time object detection algorithm (You Only Look Once v8, or YOLOv8 for short) standard txt annotation file is generated simultaneously, with images and annotations corresponding one-to-one.
[0106] Based on the YOLOv8s detection network, two target classes, "signature" and "date", are set. The classification loss and bounding box regression loss are calculated by using the built-in accurate annotation of the synthetic data. The model is iteratively trained until the mean average precision (mAP) of the validation set is stable and converged, resulting in a special detection model for table documents that can distinguish between signatures and handwritten dates.
[0107] This embodiment also provides a handwritten signature simulation sample generation device, which is used to implement the above embodiments and preferred embodiments, and will not be repeated as described above. The terms "module," "unit," "subunit," etc., used below can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0108] Figure 4 This is a structural block diagram of the handwritten signature simulation sample generation device in this embodiment, as shown below. Figure 4 As shown, the device includes: a simulated writing module 41, a basic signature transparency map construction module 42, a differentiation enhancement module 43, a fusion module 44, a simulated date generation module 45, and a handwritten signature target simulation sample generation module 46.
[0109] The simulated writing module 41 is used to simulate and generate a basic handwritten signature based on a preset set of Chinese characters;
[0110] The basic signature transparency image construction module 42 is used to construct a transparent canvas based on the basic handwritten signature to obtain the basic signature transparency image.
[0111] Differentiation enhancement module 43 is used to perform differentiation enhancement processing on the basic signature transparency image to obtain the target signature transparency image;
[0112] The fusion module 44 is used to fuse the target signature transparency image with the preset table template to obtain the initial simulation sample of the handwritten signature.
[0113] The simulation date generation module 45 is used to generate a simulation date based on a preset handwritten digit dataset, wherein the handwriting of the simulation date is different from that of the basic handwritten signature.
[0114] The target simulation sample generation module 46 is used to set the simulation date in the initial simulation sample of the handwritten signature according to the preset neighborhood binding strategy, so as to obtain the target simulation sample of the handwritten signature.
[0115] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can reside in the same processor; or the above modules can be located in different processors in any combination.
[0116] Furthermore, in conjunction with the handwritten signature simulation sample generation method provided in the above embodiments, this embodiment can also provide a storage medium for implementation. This storage medium stores a computer program; when executed by a processor, the computer program implements any of the handwritten signature simulation sample generation methods in the above embodiments.
[0117] It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. All other embodiments derived by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.
[0118] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0119] Obviously, the accompanying drawings are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar situations based on these drawings without any creative effort. Furthermore, it is understood that although the work done in this development process may be complex and lengthy, for those skilled in the art, certain design, manufacturing, or production modifications made based on the technical content disclosed in this application are merely conventional technical means and should not be considered as insufficient disclosure of this application.
[0120] The term "embodiment" in this application refers to a specific feature, structure, or characteristic described in connection with an embodiment that may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily imply the same embodiment, nor does it imply that it is mutually exclusive with or independent of other embodiments. It will be clearly or implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0121] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0122] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of patent protection. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the appended claims.
Claims
1. A method for generating simulated handwritten signature samples, characterized in that, include: A basic handwritten signature is generated based on a preset set of Chinese characters. A transparent canvas is constructed based on the basic handwritten signature to obtain a transparent image of the basic signature; The base signature transparency image is subjected to differential enhancement processing to obtain the target signature transparency image; The target signature transparency image is fused with a preset table template to obtain an initial simulation sample of the handwritten signature. A simulated date is generated based on a preset handwritten digit dataset; wherein the handwriting of the simulated date is different from that of the base handwritten signature; The simulation date is set in the initial simulation sample of the handwritten signature according to a preset neighborhood binding strategy to obtain the target simulation sample of the handwritten signature. The preset neighborhood binding strategy is to set the simulation date in different preset regions.
2. The method for generating simulated handwritten signature samples according to claim 1, characterized in that, The set of Chinese characters includes a subset of surname characters and a subset of commonly used given names characters. The step of simulating and generating a basic handwritten signature based on the preset set of Chinese characters includes: A predetermined first number of Chinese characters are extracted from the set of surname characters as the first character of the basic handwritten signature; wherein, the predetermined first number includes 1 or 2 Chinese characters; A predetermined second number of characters are extracted from the commonly used Chinese character set as the last character of the basic handwritten signature; Based on the preset offset of adjacent Chinese characters, the first character and the last character are simulated for writing in either a horizontal or vertical arrangement to obtain the basic handwritten signature.
3. The method for generating simulated handwritten signature samples according to claim 1, characterized in that, The differential enhancement processing of the base signature transparency image to obtain the target signature transparency image includes: The basic signature transparency image is deformed to obtain the basic signature deformed image; The basic handwritten signature in the basic signature deformation diagram is subjected to stroke distortion processing to obtain a stroke distortion diagram. Adjust the brightness of the basic handwritten signature in the pen stroke distortion image according to a preset proportional coefficient to obtain the target signature transparency image.
4. The method for generating simulated handwritten signature samples according to claim 3, characterized in that, The deformation processing includes horizontal scaling, vertical scaling, global rotation, and local rotation.
5. The method for generating simulated handwritten signature samples according to claim 3, characterized in that, The brushstroke distortion treatment includes random ink breakage erosion and edge ink bleeding swelling.
6. The method for generating simulated handwritten signature samples according to claim 1, characterized in that, Before setting the simulation date to the initial simulation sample of the handwritten signature according to a preset neighborhood binding strategy, the method further includes: The simulation date is then subjected to differential enhancement processing to obtain the differentially enhanced simulation date.
7. The method for generating simulated handwritten signature samples according to claim 1, characterized in that, The preset neighborhood binding strategy includes: The simulated date is set at a preset adjacent position to the basic handwritten signature according to a preset first probability, and a signature-date sample is generated; The simulation date is set in another blank position in the preset table template according to a preset second probability, wherein the other blank position is the position adjacent to the preset position of the basic handwritten signature.
8. The method for generating simulated handwritten signature samples according to claim 1, characterized in that, After setting the simulation date in the initial simulation sample of the handwritten signature according to a preset neighborhood binding strategy to obtain the target simulation sample of the handwritten signature, the method further includes: The handwritten signature target simulation sample is subjected to paper scanning noise simulation, and the rendered synthetic sample image is output.
9. A device for generating simulated handwritten signature samples, characterized in that, include: The module includes a simulated writing module, a basic signature transparency map construction module, a differentiation enhancement module, a fusion module, a simulation date generation module, and a handwritten signature target simulation sample generation module. The simulated writing module is used to simulate and generate a basic handwritten signature based on a preset set of Chinese characters; The basic signature transparency image construction module is used to construct a transparent canvas based on the basic handwritten signature to obtain the basic signature transparency image. The differentiation enhancement module is used to perform differentiation enhancement processing on the basic signature transparency image to obtain the target signature transparency image; The fusion module is used to fuse the target signature transparency image with a preset table template to obtain an initial simulation sample of the handwritten signature. The simulated date generation module is used to generate a simulated date based on a preset handwritten digit dataset; wherein the handwriting of the simulated date is different from the handwriting of the basic handwritten signature; The target simulation sample generation module is used to set the simulation date in the initial simulation sample of the handwritten signature according to a preset neighborhood binding strategy, so as to obtain the target simulation sample of the handwritten signature.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the handwritten signature simulation sample generation method according to any one of claims 1 to 8.
