Text-based electronic signature positioning method

Through the text-based electronic signature positioning method, the neural network model is used to identify the signature area, and the signature keywords are combined to locate the signature position, which solves the problems of low signature positioning efficiency and irregular coverage in the existing technology, and realizes signature Accurate automatic positioning of chapter positions and recognition capabilities for multiple text types.

CN118781602APending Publication Date: 2024-10-15AGRI BANK OF CHINA CO LTD ZHEJIANG BRANCH
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202410745717.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

The existing electronic signature positioning method has problems such as heavy setup workload, low positioning efficiency, and does not consider the keywords of the signature location, resulting in irregular or partial coverage of the signature.

Method used

Using a text-based electronic signature positioning method, by obtaining the signature electronic text image, extracting signature keywords and encoding them, establishing a keyword database, building a neural network model, training to generate a signature area positioning model, and identifying candidate keywords coordinates and coding, select candidate keywords that are close to the center of the signature area and match the keywords as the target keywords, determine the center of the signature location, and achieve automatic stamping.

Benefits of technology

It achieves accurate positioning of the signature position and avoids the problems of deviation of the seal position and irregular coverage. It is simple to operate, can identify text of different types and specifications, quickly and accurately locate the signature area in the electronic document, and reduces manual operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118781602A_ABST
    Figure CN118781602A_ABST
Patent Text Reader

Abstract

The invention discloses an electronic signature positioning method based on a text, and solves the problems that in the prior art, when an electronic signature is stamped, the setting workload is large, the positioning efficiency is low, and signature position keywords are not considered, so that signature coverage is not standard or deviated. The method comprises the following steps: acquiring a signature electronic text image, and extracting and encoding signature keywords; establishing a data set according to the signature electronic text image; training and generating a signature area positioning model; inputting an electronic text image to be signed, and identifying to obtain coordinates and keyword codes of candidate keywords; inputting the size of an electronic text image to be signed into the signature area positioning model to obtain signature area positioning information; selecting a candidate keyword which is close to the center of the signature area and is matched with the keyword as a target keyword; and determining the center of the signature position, and stamping the electronic seal on the coordinates of the center of the signature position. The signature position is positioned in combination with the signature keyword, the positioning position is accurate, and the positioning efficiency is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of signature positioning, and in particular to a text-based electronic signature positioning method. Background Art

[0002] With the development of paperless office, many banking businesses are now operated in the form of electronic documents. At present, in the process of information authorization and contract signing, users are required to sign electronically. The electronic signature should be stamped on the user's name or unit name, and the signature should be accurately stamped on the name or unit name. Most of the existing methods for stamping electronic documents use preset templates. It is necessary to identify which template the signature text corresponds to in order to obtain the signature position. This method has great limitations and requires staff to perform a lot of settings. It cannot automatically determine the location of the signature, and the positioning efficiency is low. In addition, this method does not take into account the keywords at the signature location, such as name, unit name, etc. When the position of some keywords deviates, the signature cannot be stamped on the keywords, resulting in problems such as irregular or biased signature coverage. Summary of the invention

[0003] The present invention mainly solves the problems in the prior art of stamping electronic signatures, such as large setup workload, low positioning efficiency, and failure to consider signature position keywords, resulting in irregular or offset signature coverage, and provides a text-based electronic signature positioning method.

[0004] The above technical problem of the present invention is mainly solved by the following technical solution: a text-based electronic signature positioning method, comprising the following steps:

[0005] Step 1: Obtain the electronic text image of the signature, extract and encode the signature keywords, and establish a keyword database;

[0006] Step 2: Create a data set based on the signature electronic text image. The samples of the data set include the pairing relationship between the signature electronic text image size and the signature area coordinates and the keyword coding;

[0007] Step 3: Use the data set to train the neural network to generate a signature area positioning model;

[0008] Step 4: Input the electronic text image to be signed, and identify the coordinates and keyword codes of candidate keywords according to the keyword database;

[0009] Input the image size of the electronic text to be signed into the signature area positioning model to obtain the signature area positioning information, which includes the signature area coordinates and keyword codes;

[0010] Step 5: Select candidate keywords that are close to the center of the signature area and match the keyword as target keywords;

[0011] Step 6. Determine the center of the signature position based on the target keyword and the center point of the signature area, and stamp the electronic seal on the coordinates of the center of the signature position.

[0012] The present invention can locate the signature position in combination with the signature keyword. The located signature position is more consistent with the current form of the stamped text, and can adapt to the signature area, making the signature position more accurate, avoiding the existing problems of stamp position deviation and irregular stamp coverage in template recognition technology. The method of the present invention is simpler to operate, and only requires the size of the input text to adapt to the signature area, so that texts of different types and specifications can be recognized. The present invention uses a neural network model for recognition, which can quickly and accurately locate the signature area in an electronic document without too much manual operation, and shows excellent performance in processing complex document layouts and multiple font styles.

[0013] As a preferred embodiment, the step 1 comprises the following steps:

[0014] Obtaining the signed electronic text image of the signature;

[0015] Extract keywords from the signature and stamp area and build a keyword database;

[0016] Encode each keyword and create a key-value pair.

[0017] In this scheme, multiple signed electronic text images are obtained, and the electronic signature areas of these electronic text images are analyzed. The signature stamped areas all have relevant keywords, such as "applicant", "authorizer", "Party A", "Party B", "signature", "seal", etc. The signature is generally stamped near the keyword. These corresponding keywords are obtained through analysis and included in the database to establish a keyword vocabulary. Each keyword in the vocabulary is encoded, and a key-value pair is established starting from 1, which is a combination of keywords and codes, such as ("applicant": 1), ("authorizer": 2), ("Party A": 3)..., and so on.

[0018] As a preferred solution, the establishment of the data set includes:

[0019] The signature area of ​​the electronic text image is extracted according to the signature position, a coordinate system is established with the upper left corner of the electronic text image as the origin, and the signature area coordinates are marked. The signature area coordinates include the upper left corner and lower right corner coordinates of the signature area.

[0020] The process of establishing the data set includes the extraction and annotation of the signature area. The signature area is selected according to the signature position. The signature area requires the signature to be complete, and other areas may be reduced. A coordinate system is established for the signature electronic text image, with the upper left corner of the signature electronic text image as the coordinate origin. The tool software is used to annotate the coordinates (x min ,y min ) and the lower right corner coordinate (x max ,y max ). The electronic text image of the signature can be annotated using tool software, such as the artifact software LableImg.

[0021] As a preferred solution, the establishment of the data set includes:

[0022] Obtaining corresponding keyword codes according to keywords in the signature area of ​​the signature electronic text image;

[0023] Obtain the size of the electronic text image of the signature, and establish a pairing relationship between the size and the signature area coordinates and keyword code of the electronic text image of the signature;

[0024] The samples are composed of signature electronic text images and pairing relationships, and multiple samples are established into a data set, which is divided into a training set and a test set in proportion.

[0025] This solution extracts the size of the electronic text image, the coordinates of the signature area, and the keyword code, and establishes a one-to-one correspondence relationship. The signature electronic text image and the pairing relationship constitute a sample, and a data set is established by multiple samples. The data set is divided into a training set and a test set according to the proportion. For example, 2,000 signature electronic text images are selected and processed to establish a data set, including 1,650 training sets and 350 test sets. In this solution, the keyword code is obtained by extracting the keywords in the signature area and obtaining the keyword code corresponding to the keyword according to the established keyword thesaurus.

[0026] As a preferred solution, the step three comprises the following steps:

[0027] Build a neural network with 2 neurons in the input layer, 60 neurons in the hidden layer, and 5 neurons in the output layer;

[0028] Construct the loss function and use the minimum mean square error loss function;

[0029] The length and width of the sample are used as input signals and input into the constructed neural network. Through forward propagation from the input layer to the output layer, the output signal, i.e. the coordinates of the signature area and the keyword encoding, is obtained at the output end. The error is back-propagated to update the connection weights between neurons.

[0030] By continuously iterating and updating the weights, training and learning 1,000 times, and verifying the reliability of the model, we finally obtained the signature area positioning model.

[0031] This solution builds a neural network, uses a training set to train the neural network, obtains a trained model, and then uses a test set for testing, and finally obtains a stable signature area positioning model. By inputting the size of the signature electronic text image, that is, the length and width values, the model outputs the coordinates and keyword code of the signature area.

[0032] As a preferred solution, the identification and acquisition of the coordinates and keyword codes of the candidate keywords includes the following steps:

[0033] Input the electronic text image to be signed and perform image preprocessing;

[0034] Based on the keyword word library, use OCR to identify the location of the keyword in the electronic text image of the signature;

[0035] The keywords are obtained as candidate keywords, and the coordinates and keyword codes of the candidate keywords are recorded.

[0036] This solution is to detect keywords in the electronic text image to be signed, and pre-process the electronic text image to be signed, including grayscale, denoising and other operations, to improve the accuracy of character recognition. According to the constructed keyword thesaurus, ORC is used to identify the corresponding keywords, which are candidate keywords. The coordinates of the candidate keywords and the corresponding keyword codes are obtained by identification. There may be multiple candidate keywords, and the coordinates of the candidate keywords are recorded as (A1, B1), (A2, B2), (A3, B3), ..., (A n , B n ).

[0037] As a preferred solution, the obtaining of signature area location information includes the following steps:

[0038] Obtain the electronic text image to be signed, and parse it to obtain the image size of the electronic text to be signed;

[0039] Input the size of the electronic text image to be signed into the signature area positioning model to obtain the upper left corner coordinates, lower right corner coordinates and keyword code of the signature area of ​​the electronic text image to be signed;

[0040] Determine the center point of the signature area based on the coordinates of the upper left corner and the lower right corner of the signature area.

[0041] This solution first analyzes the size of the electronic text image to be signed, obtains the size of the electronic text image to be signed, including the length and width values, and inputs the signature area positioning model to obtain the upper left corner coordinates, lower right corner coordinates, and keyword code of the signature area of ​​the electronic text image to be signed. And according to the upper left corner coordinates and lower right corner coordinates of the signature area, the coordinates of the center point of the signature area can be calculated.

[0042] As a preferred solution, the distance between the candidate keyword and the center of the signature area is determined by the deviation, and the deviation is calculated as:

[0043]

[0044] Among them, d i is the distance between the ith candidate keyword and the center of the signature area, x and y are the coordinate values ​​of the center of the signature area, A i and B i is the coordinate value of the i-th candidate keyword;

[0045] The deviation value is used to determine the match between the candidate keyword and the keyword of the electronic text image to be signed. The deviation value is calculated as:

[0046] e i =abs(kk i )

[0047] where e i is the matching degree between the i-th candidate keyword and the keyword of the electronic text image to be signed, k is the keyword code of the keyword of the electronic text image to be signed, k i is the keyword code of the i-th candidate keyword.

[0048] As a preferred solution, the step five comprises the following steps:

[0049] Compare the candidate keyword coordinates with the signature area center coordinates to calculate the deviation of the candidate keyword;

[0050] Compare the keyword code of the candidate keyword with the keyword code of the keyword of the electronic text image to be signed, and calculate the deviation value of the candidate keyword;

[0051] Select the candidate keyword with the smallest deviation, and determine whether the deviation of the corresponding candidate keyword is within the set threshold. If so, use the candidate keyword as the target keyword to obtain the target keyword coordinates. If not, select the candidate keyword with the second smallest deviation, use the candidate keyword as the target keyword, and obtain the target keyword coordinates.

[0052] This solution compares the degree of deviation and the deviation value, and finally selects the candidate keyword with a small degree of deviation and a deviation value within the set threshold range, and uses the candidate keyword as the target keyword, and uses the coordinates of the candidate keyword as the coordinates of the target keyword. After obtaining the coordinates of the target keyword, the center position C ((x+A) / 2, (y+B) / 2) of the two is calculated based on the target keyword coordinates and the center point of the signature area, where A and B are the target keyword coordinates. The center position is used as the signature position center, and the electronic seal is stamped on the signature position center coordinates.

[0053] As a preferred solution, it also includes the judgment of the integrity of the signature, including:

[0054] Calculate the distance between the center coordinates of the signature position and the border of the signature area, obtain the signature size, and determine whether the signature is completely within the signature area based on the comparison of the border distance and the signature size. If not, translate the center coordinates of the signature position in the opposite direction according to the overlapping position until the signature is completely within the signature area.

[0055] After determining the center coordinates of the signature position, it is also determined whether the signature is completely located in the signature area, wherein the size of the signature is a determined value. Based on the comparison of the boundary distance and the size of the signature, it can be known which boundary of the signature area overlaps with the signature, and the center coordinates of the signature position are adjusted by translating in the opposite direction of the overlapped position. After one or more judgments and adjustments, until the signature is completely located in the signature area, the new center coordinates of the signature position are determined, and the electronic seal is stamped on the new center coordinates of the signature position.

[0056] Therefore, the advantages of the present invention are: the signature position is located in combination with the signature keywords, and the located signature position is more in line with the current form of the stamped text, making the signature position more accurate, avoiding the existing problems of stamp position deviation and irregular stamp coverage that only rely on image recognition technology.

[0057] The operation is simpler, and the signature area can be obtained by simply inputting the size of the text, so that texts of different types and specifications can be recognized. The present invention uses a neural network model for recognition, which can quickly and accurately locate the signature area in the electronic document without too much manual operation, and shows excellent performance in processing complex document layouts and multiple font styles. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 It is a schematic diagram of a process of the present invention. DETAILED DESCRIPTION

[0059] The technical solution of the present invention is further specifically described below through embodiments and in conjunction with the accompanying drawings.

[0060] Embodiment 1:

[0061] This embodiment provides a text-based electronic signature positioning method, such as Figure 1 As shown, the following steps are included:

[0062] Step 1: Obtain the electronic text image of the signature, extract and encode the signature keywords, and establish a keyword database;

[0063] Step 2: Create a data set based on the signature electronic text image. The samples of the data set include the pairing relationship between the signature electronic text image size and the signature area coordinates and the keyword coding;

[0064] Step 3: Use the data set to train the neural network to generate a signature area positioning model;

[0065] Step 4: Input the electronic text image to be signed, and identify the coordinates and keyword codes of candidate keywords according to the keyword database;

[0066] Input the image size of the electronic text to be signed into the signature area positioning model to obtain the signature area positioning information, which includes the signature area coordinates and keyword codes;

[0067] Step 5: Select candidate keywords that are close to the center of the signature area and match the keyword as target keywords;

[0068] Step 6. Determine the center of the signature position based on the target keyword and the center point of the signature area, and stamp the electronic seal on the coordinates of the center of the signature position.

[0069] The present invention can automatically locate the signature position in combination with the signature keyword. The located signature position is more consistent with the current form of the stamped text, making the signature position more accurate and avoiding the problems of stamp position deviation and irregular stamp coverage in the existing template-based recognition. The method of the present invention is simpler to operate. The signature area can be obtained by simply inputting the size of the text, so that texts of different types and specifications can be recognized. The present invention uses a neural network model for recognition, which can quickly and accurately locate the signature area in an electronic document without involving too much manual operation, and shows excellent performance in processing complex document layouts and multiple font styles.

[0070] As a preferred solution of this embodiment, step 1 specifically includes the following process:

[0071] S11. Obtain the signed electronic text image and analyze the electronic signature area of ​​the electronic text image;

[0072] S12. Extract keywords in the signature and stamp area and establish a keyword thesaurus;

[0073] There are related keywords in the signature and seal area, such as "applicant", "authorizer", "Party A", "Party B", "signature", "seal", etc. The signature and seal are usually stamped near the keywords. These related keywords are extracted through analysis and included in the database to establish a keyword thesaurus.

[0074] S13. Encode each keyword and create a key-value pair.

[0075] Start from 1 to create a key-value pair, which is a combination of keywords and codes, such as ("keywords": code). Specific examples are as follows: ("applicant": 1), ("authorizer": 2), ("Party A": 3)..., and so on.

[0076] As a preferred solution of this embodiment, a data set is established based on the signature electronic text image, and the specific process includes:

[0077] S21. Extraction and annotation of signature area

[0078] The signature area of ​​the electronic text image is extracted according to the signature position, a coordinate system is established with the upper left corner of the electronic text image as the origin, and the signature area coordinates are marked. The signature area coordinates include the upper left corner and lower right corner coordinates of the signature area.

[0079] When extracting the signature area from the electronic text image of the signature, the signature area is selected according to the position of the signature. The signature area requires the signature to be complete, and other areas may be reduced. Use artifact software such as Label to mark the signature area and mark the coordinates of the upper left corner of the signature area (x min ,y min ) and the lower right corner coordinate (x max ,y max ).

[0080] S22. Set up pairing relationships and establish a data set, including:

[0081] S221. Obtain corresponding keyword codes according to the keywords in the signature area of ​​the signed electronic text image; for each signed electronic text image, determine the keywords in its signature area, and obtain corresponding keyword codes by comparing with the established keyword thesaurus.

[0082] S222. Get the size of the electronic text image of the signature, and establish a pairing relationship between the size and the signature area coordinates and keyword code of the electronic text image of the signature;

[0083] There is a strong correlation between the signature type and the signature area of ​​texts of different types and specifications. By extracting the size of the electronic text image of the signature, the size of the electronic text image, the coordinates of the signature area, and the keyword code are matched one by one to establish a matching relationship.

[0084] S223. The signature electronic text image and the pairing relationship constitute a sample, and multiple samples are established into a data set, and the data set is divided into a training set and a test set according to a proportion. In this embodiment, 2000 signature electronic text images are taken as an example, and a data set is established after processing, and is divided into 1650 training sets and 350 test sets according to a proportion.

[0085] As a preferred solution of this embodiment, using the data set to train the neural network to generate a signature area positioning model specifically includes the following steps:

[0086] Build a neural network with 2 neurons in the input layer, 60 neurons in the hidden layer, and 5 neurons in the output layer;

[0087] Construct the loss function and use the minimum mean square error loss function;

[0088] The length and width of the sample are used as input signals and input into the constructed neural network. Through forward propagation from the input layer to the output layer, the output signal, i.e. the coordinates of the signature area and the keyword encoding, is obtained at the output end. The error is back-propagated to update the connection weights between neurons.

[0089] By continuously iterating and updating the weights, training and learning 1,000 times, and verifying the reliability of the model, we finally obtained the signature area positioning model.

[0090] For the signature area positioning model, you only need to input the size of the electronic text image to be signed, that is, the length and width values, and the signature area positioning model will output the coordinates and keyword code of the signature area.

[0091] As a preferred solution of this embodiment, in step 4, the electronic text image to be signed is input, and the coordinates and keyword codes of candidate keywords are identified according to the keyword word library, which specifically includes:

[0092] S401. Input the electronic text image to be signed and perform image preprocessing;

[0093] The electronic text image to be signed is obtained, and the electronic text image to be signed is preprocessed, including grayscale conversion, denoising and other operations, so as to improve the accuracy of character recognition.

[0094] S402. Based on the keyword thesaurus, use OCR to identify the location of keywords in the electronic text image of the signature;

[0095] S403. Obtain the keyword as a candidate keyword, and record the coordinates and keyword code of the candidate keyword. There are one or more candidate keywords, and the coordinates of the candidate keywords are recorded as (A1, B1), (A2, B2), (A3, B3), ..., (A n , B n ).

[0096] As a preferred solution of this embodiment, in step 4, the image size of the electronic text to be signed is input into the signature area positioning model to obtain the signature area positioning information, which includes the signature area coordinates and keyword codes, specifically including:

[0097] S411. Obtain the electronic text image to be signed, and parse it to obtain the size of the electronic text image to be signed; first parse the size of the input electronic text image to be signed, and automatically obtain the size of the electronic text image to be signed, the size includes the length and width values.

[0098] S412. Input the size of the electronic text image to be signed into the signature area positioning model to obtain the upper left corner coordinates, lower right corner coordinates, and keyword code of the signature area of ​​the electronic text image to be signed;

[0099] S413. Determine the center point of the signature area according to the coordinates of the upper left corner and the lower right corner of the signature area. The coordinates of the center point of the signature area are calculated by the coordinates of the upper left corner and the lower right corner of the signature area. The coordinates of the center point of the signature area are ((x max -x min ) / 2,(y max -y min ) / 2).

[0100] As a preferred solution of this embodiment, a candidate keyword that is close to the center of the signature area and matches the keyword is selected as the target keyword, specifically including:

[0101] The distance between the candidate keyword and the center of the signature area is close to the center of the signature area. The distance between the candidate keyword and the center of the signature area is measured by setting the deviation. The deviation is calculated as:

[0102]

[0103] Among them, d i is the distance between the ith candidate keyword and the center of the signature area, x and y are the coordinate values ​​of the center of the signature area, A i and B i is the coordinate value of the i-th candidate keyword.

[0104] The keyword matching is the matching of the candidate keyword with the keyword of the electronic text image to be signed. The matching of the candidate keyword with the keyword of the electronic text image to be signed is measured by setting a deviation value. The deviation value is calculated as:

[0105] e i =abs(kk i )

[0106] where e iis the matching degree between the i-th candidate keyword and the keyword of the electronic text image to be signed, k is the keyword code of the keyword of the electronic text image to be signed, k i is the keyword code of the i-th candidate keyword.

[0107] For the candidate keywords obtained in step 4, their deviation and bias values ​​are calculated respectively.

[0108] Select the candidate keyword with the smallest deviation, and determine whether the deviation of the corresponding candidate keyword is within the set threshold. In this embodiment, the threshold is set to 0.8, and then determine whether e i ≤0.8;

[0109] If yes, the candidate keyword is used as the target keyword, and the coordinates of the candidate keyword are used as the coordinates of the target keyword;

[0110] If not, select the candidate keyword with the second smallest deviation, and use the candidate keyword as the target keyword, and the coordinates of the candidate keyword as the coordinates of the target keyword.

[0111] As a preferred solution of this embodiment, the center of the signature position is determined according to the target keyword and the center point of the signature area, and the electronic seal is stamped on the coordinates of the center of the signature position, specifically including: after obtaining the coordinates of the target keyword, the center position C of the two is calculated according to the coordinates of the target keyword and the center point of the signature area, expressed as C((x+A) / 2, (y+B) / 2), where A and B are the coordinate values ​​of the target keyword. The center position is used as the center of the signature position, and the electronic seal is stamped on the coordinates of the center of the signature position.

[0112] Embodiment 2:

[0113] This embodiment discloses a second implementation of a text-based electronic signature positioning method, which specifically includes the following steps:

[0114] Step 1: Obtain the electronic text image of the signature, extract and encode the signature keywords, and establish a keyword database;

[0115] Step 2: Create a data set based on the signature electronic text image. The samples of the data set include the pairing relationship between the signature electronic text image size and the signature area coordinates and the keyword coding;

[0116] Step 3: Use the data set to train the neural network to generate a signature area positioning model;

[0117] Step 4: Input the electronic text image to be signed, and identify the coordinates and keyword codes of candidate keywords according to the keyword database;

[0118] Input the image size of the electronic text to be signed into the signature area positioning model to obtain the signature area positioning information, which includes the signature area coordinates and keyword codes;

[0119] Step 5: Select candidate keywords that are close to the center of the signature area and match the keyword as target keywords;

[0120] Step 6. Determine the center of the signature position based on the target keyword and the center point of the signature area, and stamp the electronic seal on the coordinates of the center of the signature position.

[0121] The present invention can automatically locate the signature position in combination with the signature keyword. The located signature position is more consistent with the current form of the stamped text, making the signature position more accurate and avoiding the problems of stamp position deviation and irregular stamp coverage in the existing template-based recognition. The method of the present invention is simpler to operate. The signature area can be obtained by simply inputting the size of the text, so that texts of different types and specifications can be recognized. The present invention uses a neural network model for recognition, which can quickly and accurately locate the signature area in an electronic document without involving too much manual operation, and shows excellent performance in processing complex document layouts and multiple font styles.

[0122] As a preferred solution of this embodiment, step 1 specifically includes the following process:

[0123] S11. Obtain the signed electronic text image and analyze the electronic signature area of ​​the electronic text image;

[0124] S12. Extract keywords in the signature and stamp area and establish a keyword thesaurus;

[0125] There are related keywords in the signature and seal area, such as "applicant", "authorizer", "Party A", "Party B", "signature", "seal", etc. The signature and seal are usually stamped near the keywords. These related keywords are extracted through analysis and included in the database to establish a keyword thesaurus.

[0126] S13. Encode each keyword and create a key-value pair.

[0127] Start from 1 to create a key-value pair, which is a combination of keywords and codes, such as ("keywords": code). Specific examples are as follows: ("applicant": 1), ("authorizer": 2), ("Party A": 3)..., and so on.

[0128] As a preferred solution of this embodiment, a data set is established based on the signature electronic text image, and the specific process includes:

[0129] S21. Extraction and annotation of signature area

[0130] The signature area of ​​the electronic text image is extracted according to the signature position, a coordinate system is established with the upper left corner of the electronic text image as the origin, and the signature area coordinates are marked. The signature area coordinates include the upper left corner and lower right corner coordinates of the signature area.

[0131] When extracting the signature area from the electronic text image of the signature, the signature area is selected according to the position of the signature. The signature area requires the signature to be complete, and other areas may be reduced. Use artifact software such as Label to mark the signature area and mark the coordinates of the upper left corner of the signature area (x min ,y min ) and the lower right corner coordinate (x max ,y max ).

[0132] S22. Set up pairing relationships and establish a data set, including:

[0133] S221. Obtain corresponding keyword codes according to the keywords in the signature area of ​​the signed electronic text image; for each signed electronic text image, determine the keywords in its signature area, and obtain corresponding keyword codes by comparing with the established keyword thesaurus.

[0134] S222. Get the size of the electronic text image of the signature, and establish a pairing relationship between the size and the signature area coordinates and keyword code of the electronic text image of the signature;

[0135] There is a strong correlation between the signature type and the signature area of ​​texts of different types and specifications. By extracting the size of the electronic text image of the signature, the size of the electronic text image, the coordinates of the signature area, and the keyword code are matched one by one to establish a matching relationship.

[0136] S223. The signature electronic text image and the pairing relationship constitute a sample, and multiple samples are established into a data set, and the data set is divided into a training set and a test set according to a proportion. In this embodiment, 2000 signature electronic text images are taken as an example, and a data set is established after processing, and is divided into 1650 training sets and 350 test sets according to a proportion.

[0137] As a preferred solution of this embodiment, using the data set to train the neural network to generate a signature area positioning model specifically includes the following steps:

[0138] Build a neural network with 2 neurons in the input layer, 60 neurons in the hidden layer, and 5 neurons in the output layer;

[0139] Construct the loss function and use the minimum mean square error loss function;

[0140] The length and width of the sample are used as input signals and input into the constructed neural network. Through forward propagation from the input layer to the output layer, the output signal, i.e. the coordinates of the signature area and the keyword encoding, is obtained at the output end. The error is back-propagated to update the connection weights between neurons.

[0141] By continuously iterating and updating the weights, training and learning 1,000 times, and verifying the reliability of the model, we finally obtained the signature area positioning model.

[0142] For the signature area positioning model, you only need to input the size of the electronic text image to be signed, that is, the length and width values, and the signature area positioning model will output the coordinates and keyword code of the signature area.

[0143] As a preferred solution of this embodiment, in step 4, the electronic text image to be signed is input, and the coordinates and keyword codes of candidate keywords are identified according to the keyword word library, which specifically includes:

[0144] S401. Input the electronic text image to be signed and perform image preprocessing;

[0145] The electronic text image to be signed is obtained, and the electronic text image to be signed is preprocessed, including grayscale conversion, denoising and other operations, so as to improve the accuracy of character recognition.

[0146] S402. Based on the keyword thesaurus, use OCR to identify the location of keywords in the electronic text image of the signature;

[0147] S403. Obtain the keyword as a candidate keyword, and record the coordinates and keyword code of the candidate keyword. There are one or more candidate keywords, and the coordinates of the candidate keywords are recorded as (A1, B1), (A2, B2), (A3, B3), ..., (A n , B n ).

[0148] As a preferred solution of this embodiment, in step 4, the image size of the electronic text to be signed is input into the signature area positioning model to obtain the signature area positioning information, which includes the signature area coordinates and keyword codes, specifically including:

[0149] S411. Obtain the electronic text image to be signed, and parse it to obtain the size of the electronic text image to be signed; first parse the size of the input electronic text image to be signed, and automatically obtain the size of the electronic text image to be signed, the size includes the length and width values.

[0150] S412. Input the size of the electronic text image to be signed into the signature area positioning model to obtain the upper left corner coordinates, lower right corner coordinates, and keyword code of the signature area of ​​the electronic text image to be signed;

[0151] S413. Determine the center point of the signature area according to the coordinates of the upper left corner and the lower right corner of the signature area. The coordinates of the center point of the signature area are calculated by the coordinates of the upper left corner and the lower right corner of the signature area. The coordinates of the center point of the signature area are ((x max -x min ) / 2,(y max -y min ) / 2).

[0152] As a preferred solution of this embodiment, a candidate keyword that is close to the center of the signature area and matches the keyword is selected as the target keyword, specifically including:

[0153] The distance between the candidate keyword and the center of the signature area is close to the center of the signature area. The distance between the candidate keyword and the center of the signature area is measured by setting the deviation. The deviation is calculated as:

[0154]

[0155] Among them, d i is the distance between the ith candidate keyword and the center of the signature area, x and y are the coordinate values ​​of the center of the signature area, A i and B i is the coordinate value of the i-th candidate keyword.

[0156] The keyword matching is the matching of the candidate keyword with the keyword of the electronic text image to be signed. The matching of the candidate keyword with the keyword of the electronic text image to be signed is measured by setting a deviation value. The deviation value is calculated as:

[0157] e i =abs(kk i )

[0158] where e i is the matching degree between the i-th candidate keyword and the keyword of the electronic text image to be signed, k is the keyword code of the keyword of the electronic text image to be signed, k i is the keyword code of the i-th candidate keyword.

[0159] For the candidate keywords obtained in step 4, their deviation and bias values ​​are calculated respectively.

[0160] Select the candidate keyword with the smallest deviation, and determine whether the deviation of the corresponding candidate keyword is within the set threshold. In this embodiment, the threshold is set to 0.8, and then determine whether e i ≤0.8;

[0161] If yes, the candidate keyword is used as the target keyword, and the coordinates of the candidate keyword are used as the coordinates of the target keyword;

[0162] If not, select the candidate keyword with the second smallest deviation, and use the candidate keyword as the target keyword, and the coordinates of the candidate keyword as the coordinates of the target keyword.

[0163] As a preferred scheme of this embodiment, the center of the signature position is determined according to the target keyword and the center point of the signature area, and the electronic seal is stamped on the coordinates of the center of the signature position, specifically including: after obtaining the coordinates of the target keyword, the center position C of the two is calculated according to the target keyword coordinates and the center point of the signature area, expressed as C((x+A) / 2, (y+B) / 2), where A and B are the coordinate values ​​of the target keyword.

[0164] As a preferred solution of this embodiment, after determining the center coordinates of the signature position, it is also judged whether the signature is completely located in the signature area, specifically including:

[0165] The distance from the center of the signature to the border of the signature area is compared with the size of the signature to determine whether the signature is completely within the signature area.

[0166] The size of the signature is a fixed value. If the signature is a circular signature, the radius of the signature can be obtained. The center of the signature is the center of the signature position. The radius is compared with the distance from the center of the signature position to the boundary of the signature area. If the signature is not completely within the signature area, the signature overlaps with the boundary of the signature area, that is, the radius is greater than the distance from the center of the signature position to the boundary of the signature area.

[0167] If it is determined that the signature is not completely within the signature area, the signature position center coordinates are translated in the opposite direction according to the overlapped position, and after one or more judgments and adjustments, the signature is completely within the signature area. At this time, the new signature position center coordinates are determined, and the electronic seal is stamped on the new signature position center coordinates.

[0168] The specific embodiments described herein are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the specific embodiments described or replace them in similar ways, but they will not deviate from the spirit of the present invention or exceed the scope defined by the appended claims.

[0169] Although the terms such as signature electronic text image, data set, keyword code, target keyword, etc. are used more frequently in this article, the possibility of using other terms is not excluded. These terms are used only to more conveniently describe and explain the essence of the present invention; interpreting them as any additional restrictions is contrary to the spirit of the present invention.

Claims

1. A text-based electronic signature positioning method, It is characterized in that The following steps are involved: Step 1: Obtain the electronic text image of the signature, extract and encode the signature keywords, and establish a keyword database; Step 2: Create a data set based on the electronic text image of the signature; Step 3: Use the data set to train the neural network to generate a signature area positioning model; Step 4: Input the electronic text image to be signed, and identify the candidate keyword coordinates and keyword codes according to the keyword word library; Input the image size of the electronic text to be signed into the signature area positioning model to obtain the signature area positioning information, which includes the signature area coordinates and keyword codes; Step 5: Select candidate keywords that are close to the center of the signature area and match the keyword as target keywords; Step 6: Determine the center of the signature position based on the target keyword and the center point of the signature area.

2. A text-based electronic signature positioning method according to claim 1, Its characteristics are The step 1 comprises the following steps: Obtaining the signed electronic text image of the signature; Extract keywords from the signature and stamp area and build a keyword database; Encode each keyword and create a key-value pair.

3. A text-based electronic signature positioning method according to claim 1, Its characteristics are The establishment of the dataset includes: The signature area of ​​the electronic text image is extracted according to the signature position, a coordinate system is established with the upper left corner of the electronic text image as the origin, and the signature area coordinates are marked. The signature area coordinates include the upper left corner and lower right corner coordinates of the signature area.

4. A text-based electronic signature positioning method according to claim 3, Its characteristics are The establishment of the dataset includes: Obtaining corresponding keyword codes according to keywords in the signature area of ​​the signature electronic text image; Obtain the size of the electronic text image of the signature, and establish a pairing relationship between the size and the signature area coordinates and keyword code of the electronic text image of the signature; The samples are composed of signature electronic text images and pairing relationships, and multiple samples are established into a data set, which is divided into a training set and a test set in proportion.

5. A text-based electronic signature positioning method according to claim 1, 2, 3 or 4, Its characteristics are The step three comprises the following steps: Build a neural network with 2 neurons in the input layer, 60 neurons in the hidden layer, and 5 neurons in the output layer; Construct the loss function and use the minimum mean square error loss function; The length and width of the sample are used as input signals and input into the constructed neural network. Through forward propagation from the input layer to the output layer, the output signal, i.e. the coordinates of the signature area and the keyword encoding, is obtained at the output end. The error is back-propagated to update the connection weights between neurons. By continuously iterating and updating the weights, training and learning 1,000 times, and verifying the reliability of the model, we finally obtained the signature area positioning model.

6. A text-based electronic signature positioning method according to claim 2, Its characteristics are The identification and acquisition of the coordinates and keyword codes of the candidate keywords include the following steps: Input the electronic text image to be signed and perform image preprocessing; Based on the keyword word library, use OCR to identify the location of the keyword in the electronic text image of the signature; The keywords are obtained as candidate keywords, and the coordinates and keyword codes of the candidate keywords are recorded.

7. A text-based electronic signature positioning method according to claim 6, Its characteristics are The obtaining of signature area location information comprises the following steps: Obtain the electronic text image to be signed, and parse it to obtain the image size of the electronic text to be signed; Input the size of the electronic text image to be signed into the signature area positioning model to obtain the upper left corner coordinates, lower right corner coordinates and keyword code of the signature area of ​​the electronic text image to be signed; Determine the center point of the signature area based on the coordinates of the upper left corner and the lower right corner of the signature area.

8. A text-based electronic signature positioning method according to claim 7, Its characteristics are: The deviation is used to determine the distance between the candidate keyword and the center of the signature area. The deviation is calculated as: Among them, d i is the distance between the ith candidate keyword and the center of the signature area, x and y are the coordinate values ​​of the center of the signature area, A i and B i is the coordinate value of the i-th candidate keyword; The deviation value is used to determine the match between the candidate keyword and the keyword of the electronic text image to be signed. The deviation value is calculated as: e i =abs(kk i ) where e i is the matching degree between the i-th candidate keyword and the keyword of the electronic text image to be signed, k is the keyword code of the keyword of the electronic text image to be signed, k i is the keyword code of the i-th candidate keyword.

9. A text-based electronic signature positioning method according to claim 8, Its characteristics are The step five comprises the following steps: Compare the candidate keyword coordinates with the signature area center coordinates to calculate the deviation of the candidate keyword; Compare the keyword code of the candidate keyword with the keyword code of the keyword of the electronic text image to be signed, and calculate the deviation value of the candidate keyword; Select the candidate keyword with the smallest deviation, and determine whether the deviation of the corresponding candidate keyword is within the set threshold. If so, use the candidate keyword as the target keyword to obtain the target keyword coordinates. If not, select the candidate keyword with the second smallest deviation, use the candidate keyword as the target keyword, and obtain the target keyword coordinates.

10. A text-based electronic signature positioning method according to any one of claims 6 to 9, Its characteristics are It also includes a complete judgment of the signature, including: Calculate the distance between the center coordinates of the signature position and the border of the signature area, obtain the signature size, and determine whether the signature is completely within the signature area based on the comparison of the border distance and the signature size. If not, translate the center coordinates of the signature position in the opposite direction according to the overlapping position until the signature is completely within the signature area.

Citation Information

Patent Citations

  • Seal detection method based on deep learning technology

    CN111753785A

  • Seal text positioning method and device and electronic equipment

    CN111950356A

  • Method and system for signing perforation seal to electronic document and storage medium

    CN113656766A

  • Method for realizing batch stamping of PDF (Portable Document Format) and OFD (Open Format Format) documents

    CN116341499A

  • Electronic signature method and device for PDF (Portable Document Format) file, front end, rear end and medium

    CN117349554A