A text-based electronic signature positioning method

By establishing a keyword database and neural network model, the location of electronic signatures can be automatically identified, solving the problems of low efficiency in signature positioning and non-standard stamping in existing technologies, and achieving accurate positioning of signatures and simplifying operations.

CN118781602BActive Publication Date: 2026-11-27AGRI BANK OF CHINA CO LTD ZHEJIANG BRANCH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410745717.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2026-11-27
Estimated Expiration
2044-06-11

AI Technical Summary

Technical Problem

Existing electronic signature location methods require a lot of manual setup, resulting in low location efficiency and the inability to automatically identify the signature position, leading to non-standard stamping or deviation from keywords.

Method used

By acquiring electronic text images of the signature, extracting keywords and building a thesaurus, using a neural network model to train a signature area localization model, identifying the coordinates and codes of candidate keywords, and combining the center point of the signature area to determine the signature position.

Benefits of technology

It achieves automatic positioning of the signature, avoiding problems such as misalignment and non-standard coverage of the stamp, and can quickly and accurately identify different types and specifications of text, simplifying the operation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118781602B_ABST
    Figure CN118781602B_ABST
Patent Text Reader

Abstract

The application discloses a kind of electronic seal positioning methods based on text, solve the existing technology exists and sets up large workload, positioning efficiency is low, and does not consider seal position keyword, leading to seal cover is not standard or cover deviation problem.Method includes obtaining seal electronic text image, extracts seal keyword and carries out coding;According to seal electronic text image, data set is established;Training generates seal area positioning model;Input to be signed electronic text image, the coordinate of candidate keyword and keyword code are obtained by identification;The size of to-be-signed electronic text image is input into seal area positioning model, and seal area positioning information is obtained;Select the candidate keyword close to seal area center and matched with keyword as target keyword;Determine seal position center, and electronic seal is affixed on seal position center coordinate.The application combines seal keyword and positions seal position, and positioning position is accurate, and positioning efficiency is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of signature location technology, and in particular to a text-based electronic signature location method. Background Technology

[0002] With the development of paperless office practices, many banking transactions are now conducted using electronic documents. Currently, in processes such as information authorization and contract signing, users are required to provide electronic signatures. These electronic signatures must be affixed to the user's or company's name, and the signature must be accurately placed on the name or company name. Most existing methods for affixing signatures to electronic documents use preset templates. This requires identifying which template the signature text corresponds to to determine the signature position. This method has significant limitations, requiring considerable setup work from staff, and cannot automatically determine the signature position, resulting in low efficiency. Furthermore, this method does not consider keywords such as names and company names at the signature location. When these keywords are misaligned, the signature cannot be affixed to them, leading to problems such as incorrect or misaligned signature coverage. Summary of the Invention

[0003] The present invention mainly addresses the problems of large workload in setting up electronic signatures, low positioning efficiency, and lack of consideration for signature location keywords in the existing technology, which leads to irregular or misaligned signature coverage. It provides a text-based electronic signature positioning method.

[0004] The above-mentioned technical problem of the present invention is mainly solved by the following technical solution: a text-based electronic signature location 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 thesaurus;

[0006] Step 2: Establish a dataset based on the signed electronic text image. The dataset samples include the size of the signed electronic text image, the coordinates of the signature area, and the pairing relationship of keyword encoding.

[0007] Step 3: Use the dataset to train the neural network to generate a signature region localization model;

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

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

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

[0011] Step 6: Determine the center of the signature position based on the target keywords and the center point of the signature area, and affix the electronic seal to the coordinates of the signature position center.

[0012] This invention can locate the signature position by combining signature keywords. The located signature position is more consistent with the current format of stamped text and can adapt to the signature area, making the signature position more accurate and avoiding the problems of misaligned signatures and non-standard seal coverage that exist in existing template-based recognition technologies. The method of this invention is simpler to operate; it only requires inputting text dimensions that adapt to the signature area, enabling the recognition of different types and sizes of text. This invention uses a neural network model for recognition, which can quickly and accurately locate the signature area in electronic documents without much manual intervention, demonstrating excellent performance in handling complex document layouts and various font styles.

[0013] As a preferred embodiment, step one includes the following steps:

[0014] Obtain an image of the signed electronic text;

[0015] Extract keywords from the area where the signature is affixed and establish a keyword database;

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

[0017] This solution acquires multiple signed electronic text images and analyzes the electronic signature areas of these images. Each signature area contains relevant keywords, such as "applicant," "authorizer," "Party A," "Party B," "signature," and "seal." The signature is generally affixed near these keywords. These keywords are analyzed and incorporated into a database to build a keyword thesaurus. Each keyword in the thesaurus is encoded, starting with 1 to create key-value pairs, in the form of a combination of keyword and code, such as ("applicant": 1), ("authorizer": 2), ("Party A": 3)... and so on.

[0018] As a preferred approach, the creation of the dataset includes:

[0019] Extract the signature area from the electronic text image based on the signature location. Establish a coordinate system with the upper left corner of the electronic text image as the origin and mark the coordinates of the signature area. The coordinates of the signature area include the coordinates of the upper left and lower right corners of the signature area.

[0020] The dataset creation process includes the extraction and annotation of the signature area. The signature area is selected based on its location, requiring the signature to be complete and minimizing the need for other areas. A coordinate system is established for the electronic text image with the top-left corner as the origin. Software tools are used to annotate the top-left corner coordinates (x, y, y) of each signature area in the electronic text image. min y min ) and the coordinates of the lower right corner (x max y max (This can be achieved by using software tools to annotate the electronic text images of the signature, such as the workpiece software LabelImg.)

[0021] As a preferred approach, the creation of the dataset includes:

[0022] Obtain the corresponding keyword code based on the keywords in the signature area of ​​the signed electronic text image;

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

[0024] The samples consist of signed electronic text images and pairing relationships. Multiple samples are used to build a dataset, which is then divided into a training set and a test set according to a set ratio.

[0025] This scheme extracts the dimensions, signature area coordinates, and keyword codes from electronic text images, establishing a one-to-one pairing relationship. Each signature electronic text image and its pairing constitutes a sample, and multiple samples are used to build a dataset. The dataset is then divided into training and testing sets according to a set ratio. For example, if 2000 signature electronic text images are selected and processed to create a dataset, the training set contains 1650 images, and the testing set contains 350 images. Keyword codes are obtained by extracting keywords from the signature area and using a pre-established keyword thesaurus.

[0026] As a preferred embodiment, step three includes the following steps:

[0027] Construct 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 a loss function, using the minimum mean squared error loss function;

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

[0030] By continuously iterating and updating the weights, training the model 1000 times, verifying its reliability, and finally obtaining the signature area localization model.

[0031] This solution builds a neural network, trains the neural network using a training set to obtain a trained model, and then tests it using a test set to finally obtain a stable signature area localization model. By inputting the dimensions of the electronic text image of the signature, i.e., the length and width values, the model outputs the coordinates of the signature area and the keyword encoding.

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

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

[0034] Based on the keyword thesaurus, OCR is used to identify the location of keywords in the signed electronic text image;

[0035] Obtain keywords as candidate keywords and record the coordinates and keyword codes of the candidate keywords.

[0036] This solution detects keywords in the electronic text image to be signed and preprocesses the image, including grayscale conversion and noise reduction, to improve the accuracy of character recognition. Based on a pre-built keyword lexicon, ORC is used to identify corresponding keywords, which are then designated as candidate keywords. The coordinates and corresponding keyword codes of the candidate keywords are obtained. Multiple candidate keywords may exist, and their coordinates are recorded as (A1, B1), (A2, B2), (A3, B3), ..., (A4, B5). n B n ).

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

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

[0039] Input the size of the electronic text image to be signed into the signature area positioning model to obtain the coordinates of the upper left corner, the lower right corner, and the keyword encoding 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 top left and bottom right corners.

[0041] This solution first analyzes the dimensions of the electronic text image to be signed, obtaining its length and width values. After inputting these values ​​into the signature area localization model, it obtains the coordinates of the top-left and bottom-right corners of the signature area, as well as the keyword encoding. Furthermore, based on the top-left and bottom-right corner coordinates, the coordinates of the center point of the signature area can be calculated.

[0042] As a preferred approach, the distance between candidate keywords and the center of the signature area is determined by the deviation degree. The deviation degree is calculated as follows:

[0043]

[0044] Where, d i Let A be the distance between the i-th candidate keyword and the center of the signature area, and let x and y be the coordinates of the center of the signature area. i and B i Let be the coordinates of the i-th candidate keyword;

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

[0046] e i =abs(kk) i )

[0047] Where e i Let k be the matching degree between the i-th candidate keyword and the keywords of the electronic text image to be signed, and k be the keyword encoding of the keywords of the electronic text image to be signed. i The keyword encoding for the i-th candidate keyword.

[0048] As a preferred embodiment, step five includes the following steps:

[0049] The deviation of the candidate keywords is calculated by comparing their coordinates with the center coordinates of the signature area.

[0050] The keyword codes of the candidate keywords are compared with the keyword codes of the electronic text image to be signed, and the deviation value of the candidate keywords is calculated.

[0051] Select the candidate keyword with the smallest deviation, and at the same time determine whether the deviation of the corresponding candidate keyword is within the set threshold. If it is, take the candidate keyword as the target keyword and obtain the target keyword coordinates. If not, select the candidate keyword with the second smallest deviation, take the candidate keyword as the target keyword and obtain the target keyword coordinates.

[0052] This scheme compares the deviation degree and the deviation value to select candidate keywords with small deviation degrees and deviation values ​​within a set threshold range. These candidate keywords are then used as target keywords, and their coordinates are used as the coordinates of the target keywords. After obtaining the target keyword coordinates, the center position C((x+A) / 2, (y+B) / 2), where A and B are the target keyword coordinates, is calculated based on the target keyword coordinates and the center point of the signature area. This center position is then used as the center of the signature location, and the electronic seal is affixed to the center coordinates of the signature location.

[0053] As a preferred option, it also includes determining the completeness of the signature, including:

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

[0055] After determining the center coordinates of the signature, it is further determined whether the signature is completely within the signature area, with the signature size being a fixed value. By comparing the distance to the boundary and the signature size, it can be determined which boundary of the signature area coincides with the signature. The center coordinates of the signature position are then adjusted by shifting the center coordinates of the signature position in the opposite direction of the coinciding position. After one or more judgments and adjustments, until the signature is completely within the signature area, this is determined as the new center coordinates of the signature position, and the electronic seal is affixed to the new center coordinates of the signature position.

[0056] Therefore, the advantages of this invention are: by combining signature keywords to locate the signature position, the located signature position is more in line with the current form of stamped text, making the signature position more accurate and avoiding the problems of stamp position deviation and non-standard stamp coverage that exist in existing technologies that rely solely on image recognition.

[0057] The operation is simpler; simply input the text dimensions to obtain the signature area, enabling the recognition of different types and sizes of text. This invention uses a neural network model for recognition, which can quickly and accurately locate the signature area in electronic documents without much manual intervention, demonstrating excellent performance in handling complex document layouts and various font styles. Attached Figure Description

[0058] Figure 1 This is a flowchart of the present invention. Detailed Implementation

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

[0060] Example 1:

[0061] This embodiment presents a text-based electronic signature location method, such as... Figure 1 As shown, it includes the following steps:

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

[0063] Step 2: Establish a dataset based on the signed electronic text image. The dataset samples include the size of the signed electronic text image, the coordinates of the signature area, and the pairing relationship of keyword encoding.

[0064] Step 3: Use the dataset to train the neural network to generate a signature region localization model;

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

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

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

[0068] Step 6: Determine the center of the signature position based on the target keywords and the center point of the signature area, and affix the electronic seal to the coordinates of the signature position center.

[0069] This invention can automatically locate the signature position by combining signature keywords. The located signature position is more consistent with the current format of stamped text, making the signature position more accurate and avoiding the problems of misaligned and non-standard stamp coverage that exist with existing template-based recognition methods. The method of this invention is simpler to operate; only the size of the text needs to be input to obtain the signature area, enabling the recognition of different types and sizes of text. This invention uses a neural network model for recognition, which can quickly and accurately locate the signature area in electronic documents without much manual intervention, demonstrating excellent performance in handling complex document layouts and various font styles.

[0070] As a preferred embodiment, step one specifically includes the following process:

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

[0072] S12. Extract keywords from the area where the signature is affixed and establish a keyword database;

[0073] The areas for affixing signatures and seals all contain relevant keywords, such as "applicant," "authorizer," "Party A," "Party B," "signature," and "seal." The signatures and seals are generally affixed near these keywords. These relevant keywords are analyzed and extracted, then incorporated into a database to build a keyword thesaurus.

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

[0075] Key-value pairs are created starting from 1, and are in the form of a combination of keywords and codes, namely ("keywords":code). Specific examples are as follows: ("applicant":1), ("authorizer":2), ("Party A":3)... and so on.

[0076] As a preferred embodiment, a dataset is established based on the image of the signed electronic text. The specific process includes:

[0077] S21. Extraction and annotation of the signature area

[0078] Extract the signature area from the electronic text image based on the signature location. Establish a coordinate system with the upper left corner of the electronic text image as the origin and mark the coordinates of the signature area. The coordinates of the signature area include the coordinates of the upper left and lower right corners of the signature area.

[0079] The signature area is extracted from the electronic text image based on its location. The signature area must be complete, and other areas may be omitted. Workpiece software such as LabelImg is used to annotate the signature area, marking the coordinates of its upper left corner (x, y, y). min y min ) and the coordinates of the lower right corner (x max y max ).

[0080] S22. Set up pairing relationships and create a dataset, including:

[0081] S221. Obtain the corresponding keyword code based on 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 the corresponding keyword code by referring to the established keyword database.

[0082] S222. Obtain the dimensions of the signed electronic text image, and establish a pairing relationship between the dimensions and the coordinates of the signature area and the keyword encoding of the signed electronic text image;

[0083] Different types and specifications of text exhibit a strong correlation between signature type and signature area. By extracting the dimensions of the electronic text image with signature, and then establishing a one-to-one pairing relationship between the electronic text image dimensions, signature area coordinates, and keyword encoding.

[0084] S223. Samples are constructed from signed electronic text images and their pairing relationships. Multiple samples are used to build a dataset, which is then divided into a training set and a test set according to a set ratio. In this embodiment, 2000 signed electronic text images are used as an example. After processing, a dataset is constructed and allocated proportionally, with 1650 images in the training set and 350 images in the test set.

[0085] As a preferred embodiment, a signature region localization model is generated by training neural networks using a dataset, specifically including the following steps:

[0086] Construct 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 a loss function, using the minimum mean squared error loss function;

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

[0089] By continuously iterating and updating the weights, training the model 1000 times, verifying its reliability, and finally obtaining the signature area localization model.

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

[0091] As a preferred embodiment, step four involves inputting an image of the electronic text to be signed, and identifying the coordinates and keyword codes of candidate keywords based on a keyword database. Specifically, this includes:

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

[0093] The system acquires an image of the electronic text to be signed and preprocesses it, including grayscale conversion and noise reduction, to improve the accuracy of character recognition.

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

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

[0096] As a preferred embodiment, in step four, the size of the electronic text image to be signed is input into the signature area positioning model to obtain signature area positioning information. The signature area positioning information includes signature area coordinates and keyword encoding, 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, including 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 coordinates of the upper left corner, the lower right corner, and the keyword encoding of the signature area of ​​the electronic text image to be signed;

[0099] S413. Determine the center point of the signature area based on the coordinates of its upper left and lower right corners. The coordinates of the center point are calculated using the coordinates of the upper left and lower right corners of the signature area. The coordinates of the center point are ((x...) max -x min ) / 2, (y max -y min ) / 2).

[0100] As a preferred embodiment, candidate keywords that are close to the center of the signature area and match the keywords are selected as target keywords, specifically including:

[0101] The distance between the candidate keyword and the center of the signature area is defined as the proximity to the center of the signature area. A deviation is used to measure this distance, calculated as follows:

[0102]

[0103] Where, d i Let A be the distance between the i-th candidate keyword and the center of the signature area, and let x and y be the coordinates of the center of the signature area. i and B i Let be the coordinates of the i-th candidate keyword.

[0104] Keyword matching refers to the matching of candidate keywords with the keywords in the electronic text image to be signed. A deviation value is set to measure the matching between candidate keywords and the keywords in the electronic text image to be signed. The deviation value is calculated as follows:

[0105] e i =abs(kk) i )

[0106] Where e iLet k be the matching degree between the i-th candidate keyword and the keywords of the electronic text image to be signed, and k be the keyword encoding of the keywords of the electronic text image to be signed. i The keyword encoding for the i-th candidate keyword.

[0107] For the candidate keywords obtained in step four, calculate their deviation degree and deviation value respectively.

[0108] The candidate keyword with the smallest deviation is selected, and it is determined whether the deviation of the corresponding candidate keyword is within a set threshold. In this embodiment, the threshold is set to 0.8. Then, it is determined whether the condition e is met. i ≤0.8;

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

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

[0111] In a preferred embodiment, the signature position center is determined based on the target keyword and the center point of the signature area. The electronic seal is then affixed to the signature position center coordinates. Specifically, after obtaining the coordinates of the target keyword, the center position C of the target keyword coordinates and the center point of the signature area is calculated, denoted as C((x+A) / 2, (y+B) / 2), where A and B are the coordinate values ​​of the target keyword. This center position is then used as the signature position center, and the electronic seal is affixed to the signature position center coordinates.

[0112] Example 2:

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

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

[0115] Step 2: Establish a dataset based on the signed electronic text image. The dataset samples include the size of the signed electronic text image, the coordinates of the signature area, and the pairing relationship of keyword encoding.

[0116] Step 3: Use the dataset to train the neural network to generate a signature region localization model;

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

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

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

[0120] Step 6: Determine the center of the signature position based on the target keywords and the center point of the signature area, and affix the electronic seal to the coordinates of the signature position center.

[0121] This invention can automatically locate the signature position by combining signature keywords. The located signature position is more consistent with the current format of stamped text, making the signature position more accurate and avoiding the problems of misaligned and non-standard stamp coverage that exist with existing template-based recognition methods. The method of this invention is simpler to operate; only the size of the text needs to be input to obtain the signature area, enabling the recognition of different types and sizes of text. This invention uses a neural network model for recognition, which can quickly and accurately locate the signature area in electronic documents without much manual intervention, demonstrating excellent performance in handling complex document layouts and various font styles.

[0122] As a preferred embodiment, step one specifically includes the following process:

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

[0124] S12. Extract keywords from the area where the signature is affixed and establish a keyword database;

[0125] The areas for affixing signatures and seals all contain relevant keywords, such as "applicant," "authorizer," "Party A," "Party B," "signature," and "seal." The signatures and seals are generally affixed near these keywords. These relevant keywords are analyzed and extracted, then incorporated into a database to build a keyword thesaurus.

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

[0127] Key-value pairs are created starting from 1, and are in the form of a combination of keywords and codes, namely ("keywords":code). Specific examples are as follows: ("applicant":1), ("authorizer":2), ("Party A":3)... and so on.

[0128] As a preferred embodiment, a dataset is established based on the image of the signed electronic text. The specific process includes:

[0129] S21. Extraction and annotation of the signature area

[0130] Extract the signature area from the electronic text image based on the signature location. Establish a coordinate system with the upper left corner of the electronic text image as the origin and mark the coordinates of the signature area. The coordinates of the signature area include the coordinates of the upper left and lower right corners of the signature area.

[0131] The signature area is extracted from the electronic text image based on its location. The signature area must be complete, and other areas may be omitted. Workpiece software such as LabelImg is used to annotate the signature area, marking the coordinates of its upper left corner (x, y, y). min y min ) and the coordinates of the lower right corner (x max y max ).

[0132] S22. Set up pairing relationships and create a dataset, including:

[0133] S221. Obtain the corresponding keyword code based on 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 the corresponding keyword code by referring to the established keyword database.

[0134] S222. Obtain the dimensions of the signed electronic text image, and establish a pairing relationship between the dimensions and the coordinates of the signature area and the keyword encoding of the signed electronic text image;

[0135] Different types and specifications of text exhibit a strong correlation between signature type and signature area. By extracting the dimensions of the electronic text image with signature, and then establishing a one-to-one pairing relationship between the electronic text image dimensions, signature area coordinates, and keyword encoding.

[0136] S223. Samples are constructed from signed electronic text images and their pairing relationships. Multiple samples are used to build a dataset, which is then divided into a training set and a test set according to a set ratio. In this embodiment, 2000 signed electronic text images are used as an example. After processing, a dataset is constructed and allocated proportionally, with 1650 images in the training set and 350 images in the test set.

[0137] As a preferred embodiment, a signature region localization model is generated by training neural networks using a dataset, specifically including the following steps:

[0138] Construct 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 a loss function, using the minimum mean squared error loss function;

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

[0141] By continuously iterating and updating the weights, training the model 1000 times, verifying its reliability, and finally obtaining the signature area localization model.

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

[0143] As a preferred embodiment, step four involves inputting an image of the electronic text to be signed, and identifying the coordinates and keyword codes of candidate keywords based on a keyword database. Specifically, this includes:

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

[0145] The system acquires an image of the electronic text to be signed and preprocesses it, including grayscale conversion and noise reduction, to improve the accuracy of character recognition.

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

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

[0148] As a preferred embodiment, in step four, the size of the electronic text image to be signed is input into the signature area positioning model to obtain signature area positioning information. The signature area positioning information includes signature area coordinates and keyword encoding, 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, including 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 coordinates of the upper left corner, the lower right corner, and the keyword encoding of the signature area of ​​the electronic text image to be signed;

[0151] S413. Determine the center point of the signature area based on the coordinates of its upper left and lower right corners. The coordinates of the center point are calculated using the coordinates of the upper left and lower right corners of the signature area. The coordinates of the center point are ((x...) max -x min ) / 2, (y max -y min ) / 2).

[0152] As a preferred embodiment, candidate keywords that are close to the center of the signature area and match the keywords are selected as target keywords, specifically including:

[0153] The distance between the candidate keyword and the center of the signature area is defined as the proximity to the center of the signature area. A deviation is used to measure this distance, calculated as follows:

[0154]

[0155] Where, d i Let A be the distance between the i-th candidate keyword and the center of the signature area, and let x and y be the coordinates of the center of the signature area. i and B i Let be the coordinates of the i-th candidate keyword.

[0156] Keyword matching refers to the matching of candidate keywords with the keywords in the electronic text image to be signed. A deviation value is set to measure the matching between candidate keywords and the keywords in the electronic text image to be signed. The deviation value is calculated as follows:

[0157] e i =abs(kk) i )

[0158] Where e i Let k be the matching degree between the i-th candidate keyword and the keywords of the electronic text image to be signed, and k be the keyword encoding of the keywords of the electronic text image to be signed. i The keyword encoding for the i-th candidate keyword.

[0159] For the candidate keywords obtained in step four, calculate their deviation degree and deviation value respectively.

[0160] The candidate keyword with the smallest deviation is selected, and it is determined whether the deviation of the corresponding candidate keyword is within a set threshold. In this embodiment, the threshold is set to 0.8. Then, it is determined whether the condition e is met. i ≤0.8;

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

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

[0163] As a preferred embodiment, the center of the signature position is determined based on the target keyword and the center point of the signature area, and the electronic seal is affixed to the coordinates of the center of the signature position. Specifically, after obtaining the coordinates of the target keyword, the center position C of the two is calculated based on the coordinates of the target keyword and the center point of the signature area, which is represented as C((x+A) / 2, (y+B) / 2), where A and B are the coordinate values ​​of the target keyword.

[0164] As a preferred embodiment, after determining the center coordinates of the signature position, a further determination is made as to whether the signature is completely located within the signature area, specifically including:

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

[0166] The size of the signature is a fixed value. For example, if the signature is circular, 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 located within the signature area, the signature coincides 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 the signature is not fully located within the signature area, the center coordinates of the signature are shifted in the opposite direction based on the overlapping position. This process is repeated once or multiple times until the signature is fully located within the signature area. The new center coordinates of the signature are then determined, and the electronic seal is affixed to these new coordinates.

[0168] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.

[0169] Although this paper uses terms such as signed electronic text images, datasets, keyword encoding, and target keywords extensively, the possibility of using other terms is not excluded. These terms are used merely for the convenience of describing and explaining the essence of this invention; interpreting them as any additional limitation would contradict the spirit of this invention.

Claims

1. A text-based electronic signature location method, characterized in that, Includes the following steps: Step 1: Obtain the electronic text image of the signature, extract and encode the signature keywords, and establish a keyword thesaurus; Step 2: Create a dataset based on the signed electronic text image; Step 3: Use the dataset to train the neural network to generate a signature area localization model; Step 4: Input the electronic text image to be signed, and identify the coordinates and codes of candidate keywords based on the keyword database; Input the length and width of the electronic text image to be signed into the signature area positioning model to obtain the signature area positioning information, which includes the signature area coordinates and keyword encoding. Step 5: Select candidate keywords that are close to the center of the signature area and match the keywords as target keywords; Step 6: Determine the center of the signature position based on the target keywords and the center point of the signature area.

2. The text-based electronic signature location method according to claim 1, characterized in that: Step one includes the following steps: Obtain an image of the signed electronic text; Extract keywords from the area where the signature is affixed and establish a keyword database; Encode each keyword and create key-value pairs.

3. The text-based electronic signature location method according to claim 1, characterized in that: The creation of the dataset includes: Extract the signature area from the electronic text image based on the signature location. Establish a coordinate system with the upper left corner of the electronic text image as the origin and mark the coordinates of the signature area. The coordinates of the signature area include the coordinates of the upper left and lower right corners of the signature area.

4. The text-based electronic signature location method according to claim 3, characterized in that: The creation of the dataset includes: Obtain the corresponding keyword code based on the keywords in the signature area of ​​the signed electronic text image; Obtain the dimensions of the signed electronic text image, and establish a pairing relationship between the dimensions and the coordinates of the signature area and the keyword encoding of the signed electronic text image; The samples consist of signed electronic text images and pairing relationships. Multiple samples are used to build a dataset, which is then divided into a training set and a test set according to a set ratio.

5. A text-based electronic signature location method according to claim 1, 2, 3, or 4, characterized in that: Step three includes the following steps: Construct a neural network with 2 neurons in the input layer, 60 neurons in the hidden layer, and 5 neurons in the output layer; Construct a loss function, using the minimum mean squared error loss function; The length and width of the sample are used as input signals and input into the constructed neural network. The signal is propagated forward from the input layer to the output layer. The output signal, namely the coordinates of the signature area and the keyword encoding, is obtained at the output end. The error is propagated backward to update the connection weights between neurons. By continuously iterating and updating the weights, training the model 1000 times, verifying its reliability, and finally obtaining the signature area localization model.

6. The text-based electronic signature location method according to claim 2, characterized in that: The process of identifying and obtaining the coordinates and keyword codes of candidate keywords includes the following steps: Input the electronic text image to be signed and perform image preprocessing; Based on the keyword thesaurus, OCR is used to identify the location of keywords in the signed electronic text image; Obtain keywords as candidate keywords and record the coordinates and keyword codes of the candidate keywords.

7. The text-based electronic signature location method according to claim 6, characterized in that: Obtaining the signature area location information includes the following steps: Acquire the electronic text image to be signed and parse it to obtain the size of the electronic text image to be signed; Input the size of the electronic text image to be signed into the signature area positioning model to obtain the coordinates of the upper left corner, the lower right corner, and the keyword encoding 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 top left and bottom right corners.

8. The text-based electronic signature location method according to claim 7, characterized in that: The deviation is used to determine the distance between candidate keywords and the center of the signature area. The deviation is calculated as follows: Where, d i Let A be the distance between the i-th candidate keyword and the center of the signature area, and let x and y be the coordinates of the center of the signature area. i and B i Let be the coordinates of the i-th candidate keyword; The deviation value is used to determine the match between candidate keywords and keywords in the electronic text image to be signed. The deviation value is calculated as follows: e i =abs(kc i ) Where e i Let k be the matching degree between the i-th candidate keyword and the keywords of the electronic text image to be signed, and k be the keyword encoding of the keywords of the electronic text image to be signed. i The keyword encoding for the i-th candidate keyword.

9. The text-based electronic signature location method according to claim 8, characterized in that: Step five includes the following steps: The deviation of the candidate keywords is calculated by comparing their coordinates with the center coordinates of the signature area. The keyword codes of the candidate keywords are compared with the keyword codes of the electronic text image to be signed, and the deviation value of the candidate keywords is calculated. Select the candidate keyword with the smallest deviation, and at the same time determine whether the deviation of the corresponding candidate keyword is within the set threshold. If it is, take the candidate keyword as the target keyword and obtain the target keyword coordinates. If not, select the candidate keyword with the second smallest deviation, take the candidate keyword as the target keyword and obtain the target keyword coordinates.

10. A text-based electronic signature location method according to any one of claims 6-9, characterized in that: This also includes determining the completeness of the signature, including: Calculate the distance between the center coordinates of the signature position and the boundary of the signature area to obtain the signature size. Based on the comparison between the distance to the boundary and the signature size, determine whether the signature is completely located within the signature area. If not, shift the center coordinates of the signature position in the opposite direction according to the overlapping position until the signature is completely located 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