Document signing method, device, computer equipment and storage medium
By automatically identifying the type and location of the signature, the target detection model and the OCR model are used to solve the problems of low efficiency and error-prone manual signature, and efficient and accurate electronic signature operation are achieved.
Patent Information
- Application Number
- CN202311617425.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2043-11-29
AI Technical Summary
Manual electronic signatures are inefficient and prone to errors, especially when multiple chapters are required to be signed, it is easy to miss or sign incorrectly.
By automatically identifying the signature type and location, using the combination of the target detection model and the OCR model, we identify keywords in the file to determine the signature type and location, and realize automatic signature operation on computer devices.
It improves the efficiency of signature and avoids omissions and errors, and is especially suitable for multi-page signature tasks of large documents such as electronic bids, improving the accuracy and efficiency of signature and seal.
Smart Images

Figure CN117437649B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of document editing, and in particular to a document signing method, device, computer equipment and storage medium. Background Art
[0002] Electronic seal is a form of electronic signature. It essentially uses image processing technology to transform the electronic signature operation into the same visual effect as the paper document stamping operation, while using electronic signature technology to ensure the authenticity, integrity and non-repudiation of electronic information.
[0003] For example, in bidding applications, electronic bidding documents PDF files need to be signed and sealed to prevent tampering and ensure the authenticity of the documents. Currently, the usual practice is to complete the signing manually, which is not only inefficient but also prone to errors. Summary of the invention
[0004] In view of this, the present invention provides a document signing method, apparatus, computer equipment and storage medium to solve the problem that manual electronic signing is not only inefficient but also prone to errors.
[0005] In a first aspect, the present invention provides a method for signing a document, the method comprising:
[0006] Get the target file to be signed;
[0007] Identify one or more target signature types corresponding to the target file;
[0008] Obtain information about one or more locations to be signed in the target file;
[0009] Use the signature of the corresponding target signature type to complete the signature at the location to be signed.
[0010] The document signing method provided in this embodiment can automatically identify the signature type, so there is no need to manually browse the document to determine what type of seal needs to be signed, thereby improving the signing efficiency. It also avoids the problem of missing one or more seals when manually signing when multiple seals are required on a document, and can also avoid the problem of signing the wrong seal when manually signing.
[0011] In an optional implementation, the above-mentioned identification of one or more target signature types corresponding to the target file includes:
[0012] Get target information based on the target file;
[0013] Input the target information into the target detection model;
[0014] The target signature type corresponding to the target file is determined based on the output of the target detection model.
[0015] In an optional implementation, before determining the target signature type corresponding to the target file based on the output of the target detection model, the method further includes:
[0016] Identify the first keyword in the target file;
[0017] Determine a first target signature type corresponding to the target file according to the first keyword;
[0018] Determine the target signature type corresponding to the target file based on the output of the target detection model, including:
[0019] Determine a second target signature type corresponding to the target file based on the output of the target detection model;
[0020] Based on the first target signature type and the second target signature type, a target signature type corresponding to the target file is determined.
[0021] In an optional implementation, before inputting the target information into the target detection model, the method further includes:
[0022] Obtain training samples of each signature type, and obtain the signature type corresponding to the training sample as a label;
[0023] Select some training samples to form a training set, and select another part of the training samples to form a validation set;
[0024] Establish the detection model to be trained;
[0025] Configure training parameters;
[0026] Use the training samples in the training set to train the detection model to be trained;
[0027] Use the validation set to evaluate the detection model to be trained after each iterative training to obtain the evaluation result;
[0028] The detection model to be trained with the best evaluation result is used as the target detection model.
[0029] In an optional implementation, obtaining information of one or more locations to be signed in the target file includes:
[0030] Identify a second keyword in the target file and obtain a target position of the second keyword in the target file;
[0031] The location to be signed is determined based on the target location.
[0032] In an optional implementation, the second keyword includes a first keyword portion and a second keyword portion, and the target position includes a first target position where the first keyword portion is located and a second target position where the second keyword portion is located;
[0033] Determine the location to be signed based on the target location, including:
[0034] Acquire the size of the interval between the first part of keywords and the second part of keywords based on the first target position and the second target position;
[0035] If the size of the interval is greater than a preset threshold, the position to be signed is determined based on the center position of the interval;
[0036] If the size of the interval is less than or equal to the preset threshold, the signature position is determined based on the first position, where the first position is to the right of the second part of the keyword.
[0037] In an optional implementation, completing the signing at the to-be-signed position using a signature of a corresponding target signature type includes:
[0038] Get the offset between the coordinate origin and the center of the signature type;
[0039] Calculate the signature coordinates based on the offset and the center position of the location to be signed;
[0040] Sign based on signature coordinates.
[0041] In an optional implementation, the information of each position to be signed includes the page number of the position to be signed in the target file and the signature coordinates of the position to be signed in the page of the target file;
[0042] Use the corresponding target signature type to complete the signature at the location to be signed, including:
[0043] Complete the signature at one or more corresponding locations to be signed according to the page number and signature coordinates.
[0044] In an optional implementation, completing the signing at the to-be-signed position using a signature of a corresponding target signature type includes:
[0045] Determine whether the distance between the positions to be signed is less than a first preset distance;
[0046] If there is a first position to be signed and a second position to be signed whose distance is less than the first preset distance, the first position to be signed is moved away from the second position to be signed by the second preset distance and / or the second position to be signed is moved away from the first position to be signed by a third preset distance.
[0047] In a second aspect, the present invention provides a document signing device, the device comprising:
[0048] The file acquisition module is used to obtain the target file to be signed;
[0049] A signature type identification module, used to identify one or more target signature types corresponding to the target file;
[0050] A signature location acquisition module is used to obtain information about one or more locations to be signed in a target file;
[0051] The signature module is used to complete the signature at the location to be signed using a signature of the corresponding target signature type.
[0052] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the file signing method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0053] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the file signing method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0055] Figure 1 is a flowchart of a method for signing a document according to an embodiment of the present invention;
[0056] Figure 2 is a flowchart of another file signing method according to an embodiment of the present invention;
[0057] Figure 3 is a flowchart of another file signing method according to an embodiment of the present invention;
[0058] Figure 4 is a structural block diagram of a document signing device according to an embodiment of the present invention;
[0059] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0061] In the related art, when manually signing an electronic document, it is necessary to manually identify the signature type of each document, then call up the corresponding signature image, move the signature image to the signature position by using a mouse, and then fine-tune the position of the signature image to make the signature position more suitable, and finally complete the signature. However, this manual signing method is not only time-consuming and inefficient, but also prone to errors and omissions. For example, if a document needs to be signed with multiple seals, then one or more of the seals may be missed when signing manually. To this end, an embodiment of the present invention provides a document signing method.
[0062] According to an embodiment of the present invention, a file signing method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0063] In this embodiment, a file signing method is provided, which can be used in a computer device. Figure 1 is a flow chart of a file signing method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0064] Step S101, obtaining a target file to be signed, and specifically loading and parsing the target file according to a signing request triggered by a user.
[0065] Documents that require signatures are generally non-editable files such as pictures and Portable Document Format (PDF).
[0066] Step S102, identifying one or more target signature types corresponding to the target file.
[0067] The target file here generally refers to a single file, and does not include a file composed of multiple files together, such as a single certificate, rather than a file composed of multiple certificates put together. The specific method of identifying the target signature type can, for example, determine the type of seal to be stamped by identifying the type of file, and the file type can be determined by identifying the title or content keywords of the file, or directly by identifying the keywords related to stamping in the file (such as "stamping the unit's official seal") to determine the type of seal to be stamped.
[0068] The signature type may include, for example, official seal of the unit, seal of the legal representative, handwritten signature of the legal representative, etc.
[0069] A target file may need to be stamped with both the company seal and the legal representative's seal. Therefore, a file may not necessarily have only one target seal type.
[0070] Step S103, obtaining information of one or more locations to be signed in the target file.
[0071] Specifically, the location to be signed in the document can be automatically identified, and can be identified by signature-related keywords.
[0072] The position to be signed can also be determined based on the position manually clicked by the user. In this case, the user can determine the position to be signed by clicking the mouse in the document, but the signing operation is not completed directly. Specifically, when it is recognized that the document needs to be signed with a certain type of seal, the document can be displayed on the display, and a reminder such as "please click to confirm the signature position" can be displayed. Of course, the reminder can also be not displayed, and then wait for the customer to select the signature position.
[0073] In addition, for some documents, the signature position can be determined directly according to the file type. For example, for copies of business licenses, identity cards, corporate qualification levels, professional title certificates, academic certificates and other certificates in the bid, the signature position is generally in the upper left corner.
[0074] There is no limit to the order between step S102 and step S103, and they can be performed simultaneously.
[0075] Step S104: Use a signature of the target signature type to complete the signature at the location to be signed. Specifically, the signature can be completed by calling a signature control corresponding to the target signature type.
[0076] The document signing method provided in this embodiment can automatically identify the signature type, so there is no need to manually browse the document to determine what type of seal needs to be signed, thereby improving the signing efficiency. It also avoids the problem of missing one or more seals when manually signing when multiple seals are required on a document, and can also avoid the problem of signing the wrong seal when manually signing.
[0077] For electronic tender documents, there are multiple files that need to be signed in one document, and the tender documents are often hundreds or even thousands of pages. When signing manually, you need to browse the document page by page, find the files that need to be signed, and then sign at the signature position. In this case, the files that need to be signed in the document may be missed. In other words, there may be a file in the document that needs to be signed, but in the process of manually signing the entire document, only other files are signed, and the file is missed. To solve this problem, in some optional specific embodiments of the present invention, step S101, i.e., obtaining the target file to be signed, includes:
[0078] Get the document to be signed; specifically, load and parse the document to be signed according to the signature request triggered by the user.
[0079] The file to be signed in the document to be signed is identified as the target file to be signed. Specifically, whether it is a file to be signed can be determined based on the file type, file title and / or file keywords.
[0080] In this embodiment, a file signing method is provided, which can be used in a computer device. Figure 2 is a flow chart of a file signing method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0081] Step S201, obtain the target file to be signed. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0082] Step S202: identifying one or more target signature types corresponding to the target file.
[0083] In some optional specific implementations, identifying one or more target signature types corresponding to the target file includes:
[0084] Step S2021, obtaining target information based on the target file; the target information may be, for example, characters and their coordinates in the target file, or information obtained by performing base64 encoding on a picture file.
[0085] Step S2022, inputting the target information into the target detection model;
[0086] Step S2023, determining the target signature type corresponding to the target file based on the output of the target detection model.
[0087] In some other optional specific implementations, before determining the target signature type corresponding to the target file based on the output of the target detection model, the method further includes:
[0088] Step S20201, identifying the first keyword in the target file; specifically, an optical character recognition (OCR) model may be used to identify the keyword in the file.
[0089] Step S20202, determining the first target signature type corresponding to the target file according to the first keyword; this step can also be implemented by the OCR model.
[0090] Determine the target signature type corresponding to the target file based on the output of the target detection model, including:
[0091] Step S20231, determining a second target signature type corresponding to the target file based on the output of the target detection model;
[0092] Step S20232, based on the first target signature type and the second target signature type, determine the target signature type corresponding to the target file. Specifically, if the first target signature type and the second target signature type are consistent, then the type is determined as the signature type corresponding to the target file. If they are inconsistent, then the signature type corresponding to the target file can be determined based on a predetermined confidence level, that is, if the confidence level of keyword recognition is high, the first target signature type is used as the signature type corresponding to the target file, and if the confidence level of the target detection model is high, the second target signature type is used as the signature type corresponding to the target file.
[0093] In this embodiment, on the basis of using the artificial intelligence model to identify the signature type corresponding to the file, the OCR model is also used to identify the keywords in the file and identify the signature type corresponding to the file based on the keywords. The two recognition results are then combined to finally determine the signature type of the file, thereby improving the confidence level of signature type recognition.
[0094] In this embodiment, the trained target detection model and OCR model can be deployed in the cloud, and then the model prediction verification strategy can be added. The whole can be used as a web service to provide a prediction interface to the outside world. When identifying one or more target signature types corresponding to the target file, the prediction interface is called, and the target detection model is called internally in the interface to predict the signature type based on the target information. Among them, the model prediction verification strategy is used to compare the recognition results of the two models, and then output the final prediction result based on the preset rules.
[0095] In some optional specific implementations, before inputting the target information into the target detection model, the following steps are further included:
[0096] Step 1: Obtain training samples of each signature type, and obtain the signature type corresponding to the training sample as a label;
[0097] Since the actual file used for signing may be a picture file or a PDF file, when collecting training samples here, both picture files and PDF files will be collected at the same time. The training samples of picture files can also be converted into PDF files as PDF file samples, or PDF file samples can be converted into picture file samples.
[0098] Of course, different input file formats will place higher requirements on the model. Therefore, in order to simplify the target detection model, the training samples can be unified into PDF files or image files. When using the model later, the input files also need to be unified into PDF files or image files.
[0099] In addition, for the training samples of the image files, the sizes need to be unified by scaling them proportionally.
[0100] In order to enable the model to accurately identify various signature types, when collecting training samples, you can prepare training samples according to the type of signature to be signed, and then place each type of training sample in a folder for easy labeling.
[0101] The encoding of each signature type can be defined before annotation. For samples of image files, the annotation tool labelme can be used for annotation. The annotation content includes the encoding of the signature type. After the annotation is completed, use the script provided by PaddlePaddle (i.e. PaddlX, an industrial-grade deep learning framework) to convert the files annotated with labelme into PascalVOC format, and finally generate two folders, JPEGImages and Annotations, to store image files and annotation data files respectively. Accordingly, this embodiment uses PaddlX to fine-tune the model.
[0102] Step 2: Select some training samples to form a training set, and select another part of the training samples to form a validation set; specifically, when constructing the training set and validation set, you can first create a data set, then define the data set name, and finally import the labeled data set file, that is, import the image file and the labeled data file.
[0103] Step 3: Establish a detection model to be trained; for example, build a detection model based on the FasterRCNN model (Faster RCNN model, RCNN: Region-CNN, regional convolutional neural network).
[0104] Step 4: Configure training parameters; specifically, uniformly configure some hyperparameters used in the training process, such as backbone network (Backbone), number of iterations (Epoch), learning rate (Learning Rate), batch size (Batch Size), etc.
[0105] Step 5: Use the training samples in the training set to train the detection model to be trained; specifically, a graphics processing unit (GPU) can be used for training, and indicators such as training progress and training set loss function (loss) can be observed during the training process.
[0106] Step 6: Use the validation set to evaluate the detection model to be trained after each iteration of training to obtain an evaluation result; the evaluation result may include a bbox_map value.
[0107] Step 7: Use the to-be-trained detection model with the best evaluation result as the target detection model. Specifically, the Epoch model with the best bbox_map value can be published as a model file that can be used for prediction.
[0108] Finally, the trained detection model, that is, the Epoch model with the best bbox_map value, can be deployed as a target detection model in the cloud and provided as a web service to provide a prediction interface. When identifying one or more target signature types corresponding to the target file, the prediction interface is called, and the target detection model is called internally in the interface to predict the signature type based on the target information.
[0109] Step S203, obtain information about one or more locations to be signed in the target file. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.
[0110] Step S204: Use a signature of the corresponding target signature type to complete the signature at the location to be signed. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.
[0111] In this embodiment, a file signing method is provided, which can be used in a computer device. Figure 3 is a flow chart of a file signing method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0112] Step S301, obtain the target file to be signed. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0113] Step S302: identifying one or more target signature types corresponding to the target file.
[0114] For details, please see Figure 1 Step S102 of the embodiment shown or Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.
[0115] Step S303, obtaining information of one or more locations to be signed in the target file.
[0116] In some specific implementations, step S303, obtaining information of one or more locations to be signed in the target file, may include:
[0117] Step S3031, identifying the second keyword in the target file and obtaining the target position of the second keyword in the target file; the second keyword may be, for example, a company name (with official seal).
[0118] Step S3032, determining the location to be signed based on the target location.
[0119] Specifically, the second keyword includes a first keyword part and a second keyword part, and the target position includes a first target position where the first keyword part is located and a second target position where the second keyword part is located;
[0120] Determine the location to be signed based on the target location, including:
[0121] Acquire the size of the interval between the first part of keywords and the second part of keywords based on the first target position and the second target position;
[0122] For example, the specific form of the second keyword can be: "Company name (official seal):", or it can be: "Company name:__________________________(official seal)", where "Company name" is the first part of the keyword and "official seal" is the second part of the keyword. The underscore is used to fill in the specific company name. The second keyword in the first form can also be followed by an underscore. When obtaining the size of the interval between the first part of the keyword and the second part of the keyword, the minimum rectangular enclosing box of the first part of the keyword and the second part of the keyword can be determined first, which can be expressed by the upper left corner coordinates and the width and height of the rectangle, or by the upper left corner coordinates and the lower right corner coordinates. The minimum rectangular enclosing box of the first part of the keyword and the second part of the keyword can be determined by a box algorithm.
[0123] If the size of the interval is larger than the preset threshold, the position of the seal to be signed is determined based on the center of the interval; if the interval between the first part of the keyword and the second part of the keyword is larger, it means that the specific company name or legal representative needs to be filled in the interval, so the corresponding seal must be stamped on the specific company name or legal representative in the interval. The preset threshold can be the width of two characters or words.
[0124] If the size of the interval is less than or equal to the preset threshold, the signature position is determined based on the first position, and the first position is to the right of the second part of the keyword. If the interval between the first part of the keyword and the second part of the keyword is small, for example, less than the width of two characters, it means that the specific company name or legal representative cannot be filled in the interval. The specific company name or legal representative must be filled in to the right of the second part of the keyword, and the corresponding seal must be stamped on the right side of the second part of the keyword. The preset threshold can be the width of two characters or text. If the center point of the seal is used as the standard for signing, then when determining the signature position, the right side of the second part of the keyword is offset to the right by a preset distance as the signature position. The preset distance is determined according to the size of the signature of the target signature type.
[0125] Step S304: Using a signature of a corresponding target signature type to complete the signature at the location to be signed. In some optional specific implementations, using a signature of a corresponding target signature type to complete the signature at the location to be signed includes:
[0126] Get the offset between the coordinate origin and the center of the signature type;
[0127] Calculate the signature coordinates based on the offset and the center position of the location to be signed;
[0128] Sign based on signature coordinates.
[0129] Generally, the upper left corner of the seal is used as the coordinate origin of the seal when signing electronically, and the center of the seal is used as the coordinate origin when determining the position of the seal. In other words, the position of the seal is determined based on the center of the seal. Therefore, when signing in practice, it is necessary to calculate the offset between the center of the seal and the upper left corner of the seal. Then, the signature coordinates are calculated based on the offset, and the signature coordinate origin is overlapped with the signature coordinates when signing to complete the positioning of the seal.
[0130] In some specific implementations, the information of each position to be signed includes the page number of the position to be signed in the target file and the signature coordinates of the position to be signed in the page of the target file;
[0131] Complete the signature at the location to be signed based on the target signature type, including:
[0132] Complete the signature at one or more corresponding locations to be signed according to the page number and signature coordinates.
[0133] For scenarios where there are multiple locations in a document that need to be signed, the signing method provided in this embodiment can identify all pages in the document that need to be signed at one time, and determine the coordinates of the specific signature locations, so that all locations on different pages in a document that need to be signed can be signed at one time. Specifically, after obtaining the page numbers of all locations to be signed in the target file and the signature coordinates in the target file page, the electronic signature control can be called to transfer the page numbers and coordinates of all locations to be signed to the electronic signature control at one time. The electronic signature control generates a digital signature to complete the signing of all locations to be signed. Especially for documents such as bids that have many pages and many places that need to be signed, the efficiency and accuracy of signing can be greatly improved.
[0134] Some optional specific implementations, using a signature of a corresponding target signature type to complete the signature at the location to be signed, include:
[0135] Determine whether the spacing between the positions to be signed is less than a first preset distance; specifically, if the positions to be signed are represented by their relative position coordinates in the target file page, then it is necessary to first determine whether there are two or more positions to be signed located on the same page. If there are two or more positions to be signed located on the same page, then further determine whether the spacing between these positions to be signed is less than the first preset distance.
[0136] If there is a first position to be signed and a second position to be signed that is less than the first preset distance apart, the first position to be signed is moved away from the second position to be signed by a second preset distance and / or the second position to be signed is moved away from the first position to be signed by a third preset distance. The second preset distance and the third preset distance are determined according to the size of the target signature type corresponding to the first position to be signed and the second position to be signed.
[0137] In this embodiment, a document signing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0138] This embodiment provides a document signing device, such as Figure 4 As shown, including:
[0139] The file acquisition module 401 is used to acquire the target file to be signed;
[0140] A signature type identification module 402, used to identify one or more target signature types corresponding to the target file;
[0141] The signature position acquisition module 403 is used to acquire information of one or more positions to be signed in the target file;
[0142] The signature module 404 is used to complete the signature at the location to be signed using a signature of the corresponding target signature type.
[0143] In some optional implementations, the signature type identification module 402 includes:
[0144] An information acquisition unit, used for obtaining target information based on a target file;
[0145] A transmission unit, used for inputting target information into a target detection model;
[0146] The signature type determination unit is used to determine the target signature type corresponding to the target file based on the output of the target detection model.
[0147] In some optional implementations, the signature type identification module 402 further includes:
[0148] A first keyword recognition unit, used to recognize a first keyword in a target file;
[0149] A first target signature type determining unit, configured to determine a first target signature type corresponding to a target file according to a first keyword;
[0150] The signature type determination unit is used to determine the second target signature type corresponding to the target file based on the output of the target detection model; and determine the target signature type corresponding to the target file based on the first target signature type and the second target signature type.
[0151] In some optional embodiments, the device further comprises:
[0152] The sample acquisition module is used to obtain training samples of each signature type and obtain the signature type corresponding to the training sample as a label;
[0153] The data set selection module is used to select some training samples to form a training set and another part of the training samples to form a validation set;
[0154] A model building module is used to build a detection model to be trained;
[0155] Parameter configuration module, used to configure training parameters;
[0156] A training module, used to train the detection model to be trained using the training samples in the training set;
[0157] An evaluation module is used to evaluate the detection model to be trained after each iterative training using a validation set to obtain an evaluation result;
[0158] The model screening module is used to select the to-be-trained detection model with the best evaluation result as the target detection model.
[0159] In some optional implementations, the signature position acquisition module 403 includes:
[0160] A second keyword position acquisition unit, used for identifying a second keyword in a target file and acquiring a target position of the second keyword in the target file;
[0161] The unit for determining the position to be signed is used to determine the position to be signed based on the target position.
[0162] In some optional implementations, the second keyword includes a first keyword portion and a second keyword portion, and the target position includes a first target position where the first keyword portion is located and a second target position where the second keyword portion is located;
[0163] The unit for determining the position of the seal to be signed includes:
[0164] An interval size acquisition subunit, used to acquire the size of the interval between the first part of keywords and the second part of keywords based on the first target position and the second target position;
[0165] A first to-be-signed position determination subunit, configured to determine the to-be-signed position based on the center position of the interval when the size of the interval is greater than a preset threshold;
[0166] The second to-be-signed position determination subunit is used to determine the signature position based on the first position when the size of the interval is less than or equal to a preset threshold, where the first position is on the right side of the second part of the keyword.
[0167] In some optional implementations, the signature module 404 includes:
[0168] An offset acquisition unit, used to acquire an offset between the coordinate origin and the center of a signature of a signature type;
[0169] A signature coordinate calculation unit, used to calculate the signature coordinates according to the offset and the center position of the position to be signed;
[0170] The signature unit is used to sign based on the signature coordinates.
[0171] In some optional implementations, the information of each position to be signed includes the page number of the position to be signed in the target file and the signature coordinates of the position to be signed in the page of the target file;
[0172] The signature module 404 is used to complete the signature at one or more corresponding locations to be signed according to the page number and the signature coordinates.
[0173] In some optional implementations, the signature module 404 includes:
[0174] A judging unit, used to judge whether the distance between the positions to be signed is less than a first preset distance;
[0175] The adjusting unit is used to move the first position to be signed away from the second position to be signed by a second preset distance and / or move the second position to be signed away from the first position to be signed by a third preset distance when there is a first position to be signed and a second position to be signed separated by a distance less than a first preset distance.
[0176] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0177] The file signing device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0178] The embodiment of the present invention also provides a computer device having the above Figure 4 The document signing device shown.
[0179] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.
[0180] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0181] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0182] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0183] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0184] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0185] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0186] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A document signing method, characterized in that: The method comprises: Get the target file to be signed; Identifying one or more target signature types corresponding to the target file; Obtain information of one or more locations to be signed in the target file; Complete the signing at the location to be signed using a signature of the target signature type; The identifying one or more target signature types corresponding to the target file includes: Obtaining target information based on the target file; the target information is characters and coordinates of the characters in the target file, and when the target file is a picture file, the target information is information obtained by encoding the target file; Inputting the target information into a target detection model; Determine the target signature type corresponding to the target file based on the output of the target detection model; Before determining the target signature type corresponding to the target file based on the output of the target detection model, the method further includes: Identifying a first keyword in the target file; Determine a first target signature type corresponding to the target file according to the first keyword; The determining the target signature type corresponding to the target file based on the output of the target detection model includes: Determine a second target signature type corresponding to the target file based on the output of the target detection model; The target signature type corresponding to the target file is determined based on the first target signature type and the second target signature type.
2. The method according to claim 1, characterized in that Before inputting the target information into the target detection model, the method further includes: Obtain training samples of each signature type, and obtain the signature type corresponding to the training sample as a label; Selecting part of the training samples to form a training set, and selecting another part of the training samples to form a validation set; Establish the detection model to be trained; Configure training parameters; Using the training samples in the training set to train the detection model to be trained; Using the validation set to evaluate the detection model to be trained after each iterative training to obtain an evaluation result; The detection model to be trained with the best evaluation result is used as the target detection model.
3. The method according to claim 1, characterized in that The obtaining of information of one or more locations to be signed in the target file includes: Identify a second keyword in the target file and obtain a target position of the second keyword in the target file; The location to be signed is determined based on the target location.
4. The method according to claim 3, characterized in that The second keyword includes a first keyword part and a second keyword part, and the target position includes a first target position where the first keyword part is located and a second target position where the second keyword part is located; The determining the location to be signed based on the target location includes: Acquire the size of the interval between the first partial keyword and the second partial keyword based on the first target position and the second target position; If the size of the interval is greater than a preset threshold, determining the position to be signed based on the center position of the interval; If the size of the interval is less than or equal to the preset threshold, the signature position is determined based on the first position, where the first position is to the right of the second part of the keyword.
5. The method according to claim 4, characterized in that The step of completing the signing at the to-be-signed position using a signature of the corresponding target signature type includes: Obtain the offset between the coordinate origin and the center of the signature of the signature type; Calculate the signature coordinates according to the offset and the center position of the position to be signed; Signing is performed based on the signature coordinates.
6. The method according to any one of claims 1 to 5, characterized in that The information of each position to be signed includes the page number of the position to be signed in the target file and the signature coordinates of the position to be signed in the page of the target file; The step of completing the signing at the to-be-signed position using a signature of the corresponding target signature type includes: The signature is completed at the corresponding one or more locations to be signed according to the page number and the signature coordinates.
7. The method according to claim 6, characterized in that The step of completing the signing at the to-be-signed position using a signature of the corresponding target signature type includes: Determine whether the distance between the positions to be signed is less than a first preset distance; If there is a first position to be signed and a second position to be signed that is spaced less than the first preset distance, the first position to be signed is moved away from the second position to be signed by a second preset distance and / or the second position to be signed is moved away from the first position to be signed by a third preset distance.
8. A document signing device, characterized in that: The device comprises: The file acquisition module is used to obtain the target file to be signed; A signature type identification module, used to identify one or more target signature types corresponding to the target file; A signature position acquisition module, used to acquire information of one or more positions to be signed in the target file; A signature module, used to complete the signature at the to-be-signed position using a signature of the corresponding target signature type; The signature type identification module includes: A first keyword recognition unit, used to recognize a first keyword in the target file; A first target signature type determining unit, configured to determine a first target signature type corresponding to the target file according to the first keyword; An information acquisition unit, configured to obtain target information based on the target file; the target information is characters and coordinates of the characters in the target file, and when the target file is a picture file, the target information is information obtained by encoding the target file; A transmission unit, used for inputting the target information into a target detection model; A signature type determination unit is used to determine a second target signature type corresponding to the target file based on the output of the target detection model; and to determine the target signature type corresponding to the target file based on the first target signature type and the second target signature type.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the file signing method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the file signing method according to any one of claims 1 to 7.
