Verification method and verification device for layout file
By processing the processed and non-processed areas of the layout file separately, extracting image and text information, and calculating the similarity, the problem of inaccurate layout file verification results is solved, and fine-grained control and content verification after format conversion are achieved.
Patent Information
- Application Number
- CN202411169288.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2044-08-23
AI Technical Summary
The existing technology cannot perform fine-grained control on the layout file, cannot implement protection verification of part of the content, and the verification result is inaccurate when the layout file is converted between different formats.
By processing the processed area and non-processed area of the layout file separately, extracting image information and text information, calculating the similarity threshold to determine the verification result, and using cosine similarity, TF-IDF, Jaccard similarity coefficient, edit distance and Pearson correlation coefficient to calculate similarity.
It realizes content verification of layout files between different formats, ensures that the content of non-processing areas is not affected by changes in processing areas, and improves the accuracy of verification results.
Smart Images

Figure CN119004548B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of file verification, and in particular to a verification method for a format file, a verification device for a format file, a computer-readable storage medium, and an electronic device. Background Art
[0002] As a carrier of information across various business scenarios, layout files pass through multiple nodes throughout their lifecycle, from file creation at the start of a business process to document storage at the end. At each node, layout files may undergo content additions and deletions, including printing, scanning, and signature processing.
[0003] Current tamper protection for layout files has the following shortcomings and issues: First, layout files only provide tamper protection for the entire document, lacking fine-grained control over them and unable to verify partial content. Second, layout files undergo printing, processing, and rescanning throughout the workflow, transforming from text to scanned images. These two different content presentation formats cannot be directly used for content protection verification. Therefore, a layout file verification method that can address these issues is urgently needed. Summary of the Invention
[0004] The main purpose of this application is to provide a verification method for a layout file, a verification device for a layout file, a computer-readable storage medium, and an electronic device, so as to at least solve the problem of inaccurate layout file verification results in the prior art.
[0005] According to one aspect of the present application, a verification method for a layout file is provided, which is applied to a current node in a node control process, wherein the node control process includes a plurality of task nodes connected in sequence, the task nodes are used to execute corresponding task processing, and the current node is any one of the plurality of task nodes. The method includes: obtaining an initial layout file, and performing a first processing on a processing area of the initial layout file to obtain a first processing file, wherein the first processing is the task processing corresponding to the current node, the initial layout file includes the processing area and the non-processing area, and the processing area and the non-processing area do not overlap, and the task processing includes editing processing, printing processing, and signing processing. At least one of processing and scanning processing; performing a second processing on the initial layout file to obtain first target information, and performing the second processing on the first processed file to obtain second target information, wherein the second processing is to extract relevant information of the non-processed area of the initial layout file or to extract relevant information of the non-processed area of the first processed file, and the relevant information includes at least one of image information and text information; calculating the similarity between the first target information and the second target information, and when the similarity is greater than or equal to a similarity threshold, determining that the verification result is a passed verification; when the similarity is less than the similarity threshold, determining that the verification result is a failed verification.
[0006] Optionally, obtaining the initial layout file includes: determining whether the current node is the first task node among the multiple task nodes; if the current node is not the first task node, receiving the layout file sent by the previous node to obtain the initial layout file.
[0007] Optionally, a second processing is performed on the predetermined file to obtain target information of the predetermined file, wherein the predetermined file is the initial layout file or the first processed file. When the predetermined file is the initial layout file, the target information of the predetermined file is the first target information, and when the predetermined file is the first processed file, the target information of the predetermined file is the second target information, including: obtaining a content representation form of the predetermined file, wherein the content representation form includes a text form and a picture form; performing a third processing on the predetermined file according to the content representation form to obtain a second processed file; obtaining domain distribution information of the second processed file and regional text distribution information of the second processed file, and performing compression representation processing on the domain distribution information and the regional text distribution information to obtain the target information of the predetermined file.
[0008] Optionally, the second processing file includes a first sub-processing file and a second sub-processing file, and the predetermined file is subjected to a third processing according to the content representation form to obtain a second processing file, including: when the content representation form is the picture form, the predetermined file is subjected to image processing to obtain an image processing file, wherein the image processing includes at least one of distortion processing, tilt processing and affine transformation processing; the image processing file is subjected to optical character recognition processing to obtain the first sub-processing file; when the content representation form is the text form, the predetermined file is subjected to text processing to obtain the second sub-processing file, wherein the text processing includes rendering processing.
[0009] Optionally, obtaining the domain distribution information of the second processed file includes: dividing the second processed file to obtain a plurality of text domains; and obtaining coordinate information of each of the text domains to obtain the domain distribution information.
[0010] Optionally, the regional text distribution information includes first information and second information, and obtaining the regional text distribution information of the second processed file includes: dividing the text domain to obtain multiple characters; obtaining coordinate information corresponding to each of the characters to obtain the first information; obtaining multi-dimensional vector representation information corresponding to each of the characters to obtain the second information.
[0011] Optionally, after determining that the verification result is passed, the method further includes: sending the first processed file to a node next to the current node.
[0012] According to another aspect of the present application, a verification device for a layout file is provided, which is applied to a current node in a node control process, wherein the node control process includes a plurality of task nodes connected in sequence, the task nodes are used to execute corresponding task processing, and the current node is any one of the plurality of task nodes. The device includes: a first processing unit, which is used to obtain an initial layout file and perform a first processing on a processing area of the initial layout file to obtain a first processing file, wherein the first processing is the task processing corresponding to the current node, the initial layout file includes the processing area and the non-processing area, and the processing area and the non-processing area do not overlap, and the task processing includes editing processing, printing processing, signing processing, and scanning processing. a second processing unit, configured to perform a second processing on the initial layout file to obtain first target information, and perform the second processing on the first processed file to obtain second target information, wherein the second processing is to extract relevant information of a non-processed area of the initial layout file or to extract relevant information of a non-processed area of the first processed file, and the relevant information includes at least one of image information and text information; a calculation unit, configured to calculate the similarity between the first target information and the second target information, and determine that the verification result is a passed verification when the similarity is greater than or equal to a similarity threshold; a determination unit, configured to determine that the verification result is a failed verification when the similarity is less than the similarity threshold.
[0013] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the methods described.
[0014] According to another aspect of the present application, an electronic device is provided, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute any one of the methods described above through the computer program.
[0015] Applying the technical solution of the present application, first, an initial layout file is obtained, and a first processing is performed on the processing area of the initial layout file to obtain a first processing file, wherein the first processing is the task processing corresponding to the current node; then a second processing is performed on the initial layout file to obtain first target information, and a second processing is performed on the first processing file to obtain second target information, wherein the second processing is to extract relevant information of the non-processing area of the initial layout file or extract relevant information of the non-processing area of the first processing file, wherein the relevant information includes at least one of image information and text information; finally, the similarity between the first target information and the second target information is calculated, and when the similarity is greater than or equal to the similarity threshold, the verification result is determined to be verification passed. In the above method, the influence of the change of the information storage format of the layout file due to process processing is taken into account, and by performing the second processing on the initial layout file and the first processing file respectively to realize information extraction, the first target information and the second target information including image information and text information are obtained, and then the similarity between the first target information and the second target information is calculated, so that the content of the text format and the image format layout file can be mutually verified, thereby solving the technical problem of inaccurate verification results of the layout file in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings that constitute part of this application are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation on this application. In the drawings:
[0017] Figure 1 A hardware structure block diagram of a mobile terminal for executing a verification method for a layout file provided in an embodiment of the present application is shown;
[0018] Figure 2 A schematic diagram showing a flow chart of a method for verifying a format file according to an embodiment of the present application is shown;
[0019] Figure 3 A schematic diagram of a process flow of a method for verifying a layout file in a node control process provided in an embodiment of the present application is shown;
[0020] Figure 4 A flow chart of a method for performing a second process on a first processed file provided in an embodiment of the present application is shown;
[0021] Figure 5 A schematic diagram showing a specific process of a format file verification method provided according to an embodiment of the present application is shown;
[0022] Figure 6 A structural block diagram of a format file verification device provided according to an embodiment of the present application is shown.
[0023] The above drawings include the following reference numerals:
[0024] 102. Processor; 104. Memory; 106. Transmission device; 108. Input / output device. DETAILED DESCRIPTION
[0025] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0026] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] For ease of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0029] Layout files: As a form of document expression, layout files are characterized by the fact that the display effect of their content does not change with the device. The text style, tables, images, paragraph layout, headers and footers, and other settings in the document are fixed when the layout file is generated. Only annotations, signatures, and other information can be added to it later. The non-editable nature of layout files ensures a high degree of consistency across different software, operating systems, and other environments. The current mainstream layout file formats are PDF and OFD, with PDF being the most widely used.
[0030] Layout file text domain: The aggregation area of discrete information elements in the layout file; it performs typeset rendering on the content information, and its display format does not change with the processing device; in the layout file, the information is saved as basic elements (characters, lines, graphics, etc.), and the main information of each element is display coordinates, format, and information; therefore, for the paragraph information in the file rendering page, its storage format is a cluster of discrete text, and this cluster area is the text domain of the layout file.
[0031] As introduced in the background technology, the verification results of the layout file in the prior art are inaccurate. To solve the above problem, the embodiments of the present application provide a layout file verification method, a layout file verification device, a computer-readable storage medium and an electronic device.
[0032] The technical solutions in the embodiments of the present invention will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present invention.
[0033] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal for a method for verifying a format file according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0034] The memory 104 can be used to store computer programs, such as software programs and modules of application software, such as the computer program corresponding to the verification method for the layout file in the embodiment of the present invention. The processor 102 executes the computer programs stored in the memory 104 to execute various functional applications and data processing, thereby implementing the above-mentioned method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. The transmission device 106 is used to receive or send data via a network. Specific examples of such networks may include a wireless network provided by the mobile terminal's telecommunications provider. In one example, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0035] In this embodiment, a method for verifying a layout file running on a mobile terminal, a computer terminal or a similar computing device 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.
[0036] Figure 2 This is a flow chart of a method for verifying a format file according to an embodiment of the present application. Figure 2 As shown, the method is applied to the current node in the node control process, the node control process includes multiple task nodes connected in sequence, the task nodes are used to perform corresponding task processing, and the current node is any one of the multiple task nodes. The method includes the following steps:
[0037] Step S201: Obtain an initial layout file and perform a first process on a processing area of the initial layout file to obtain a first processed file, wherein the first process is a task process corresponding to the current node, the initial layout file includes the processing area and a non-processing area, and the processing area and the non-processing area do not overlap, and the task process includes at least one of an editing process, a printing process, a signing process, and a scanning process;
[0038] Specifically, the above-mentioned task processing can be editing of paragraphs and contents in a specific area, signing and stamping in a specific area, etc. The above-mentioned first processed file obtained after the first processing is actually also a layout file.
[0039] Step S202: performing a second processing on the initial layout file to obtain first target information, and performing a second processing on the first processed file to obtain second target information, wherein the second processing is extracting relevant information of a non-processed area of the initial layout file or extracting relevant information of a non-processed area of the first processed file, wherein the relevant information includes at least one of image information and text information;
[0040] Specifically, the first target information and the second target information are obtained only by extracting relevant information of the non-processing area.
[0041] Step S203: calculating the similarity between the first target information and the second target information, and determining that the verification result is verification passed when the similarity is greater than or equal to a similarity threshold;
[0042] Specifically, the similarity between the first target information and the second target information can be calculated using methods such as the cosine similarity calculation method, the TF-IDF model, the Jaccard similarity coefficient, the edit distance, and the Pearson correlation coefficient. Cosine similarity is a widely used text similarity calculation method that measures similarity by calculating the cosine of the angle between two vectors. Cosine similarity values range from 0 to 1, with values closer to 1 indicating greater similarity. TF-IDF (Term Frequency-Inverse Document Frequency) is a commonly used weighting technique used in information retrieval and text mining. It is a statistical method used to assess the importance of a term to a document set or a document in a corpus. The Jaccard similarity coefficient compares similarities and differences between finite sets of samples, determining similarity by calculating the ratio of the intersection to the union of two samples. The larger the Jaccard similarity, the higher the sample similarity. The edit distance measures the difference between two strings by calculating the minimum number of single-character edits (insertion, deletion, or substitution) required to transform one string into the other. Pearson correlation coefficient: It is used to measure the degree of linear correlation between two variables, and its value ranges from -1 to 1.
[0043] Step S204 : If the similarity is less than the similarity threshold, determine that the verification result is verification failure.
[0044] Specifically, if the verification result is verification failure, it indicates that in the above-mentioned first processing process, in addition to changing the content in the processing area, the content in the non-processing area is also affected, resulting in changes in the content in the non-processing area.
[0045] Through this embodiment, a verification method for a layout file is provided. First, an initial layout file is obtained, and a first processing is performed on the processing area of the initial layout file to obtain a first processing file, wherein the first processing is the task processing corresponding to the current node; then, a second processing is performed on the initial layout file to obtain first target information, and a second processing is performed on the first processing file to obtain second target information, wherein the second processing is to extract relevant information of the non-processing area of the initial layout file or extract relevant information of the non-processing area of the first processing file, wherein the relevant information includes at least one of image information and text information; finally, a similarity between the first target information and the second target information is calculated, and when the similarity is greater than or equal to a similarity threshold, a verification result is determined to be verification passed. In the above method, the influence of the change of the information storage format of the layout file caused by process processing is taken into account. By performing the second processing on the initial layout file and the first processing file respectively to extract information, the first target information and the second target information including image information and text information are obtained, and then the similarity between the first target information and the second target information is calculated, the content of the text format and the image format layout file can be mutually verified, thereby solving the technical problem of inaccurate layout file verification results in the prior art.
[0046] In a specific implementation, step S201 can be implemented by the following steps: Step S2011, determining whether the current node is the first task node among the multiple task nodes; Step S2012, if the current node is not the first task node, receiving the layout file sent by the previous node to obtain the initial layout file. This method can further quickly obtain the initial layout file.
[0047] Specifically, if the current node is not the first task node, for example, the current node is the Sth node, then the initial layout file for node S is obtained by obtaining the output file of the previous node, i.e., node S-1. If the current node is the first task node, then the input layout file can be directly used as the initial layout file.
[0048] In order to further improve the generalization capability of the target information, the above step S202 of the present application can be implemented by the following steps: Step S2021, obtaining the content representation form of the predetermined file, wherein the content representation form includes text form and image form; Step S2022, performing a third processing on the predetermined file according to the content representation form to obtain a second processed file; Step S2023, obtaining the domain distribution information and the regional text distribution information of the second processed file, and performing compression representation processing on the domain distribution information and the regional text distribution information to obtain the target information of the predetermined file. This method can further improve the generalization capability of the target information through compression representation processing.
[0049] Specifically, compressed representation refers to the use of specific algorithms or models in machine learning and artificial intelligence to convert raw data into a more compact and efficient data representation. This conversion not only reduces data storage space and increases processing speed, but also helps algorithms better understand and process data, especially in areas such as feature learning, data compression, and generative models.
[0050] The second processed file includes a first sub-processed file and a second sub-processed file. The above step S2022 can also be implemented in other ways, for example: step S20221, when the content representation form is the image form, performing image processing on the predetermined file to obtain an image processed file, wherein the image processing includes at least one of distortion processing, tilt processing, and affine transformation processing; step S20222, performing optical character recognition processing on the image processed file to obtain the first sub-processed file; step S20223, when the content representation form is the text form, performing text processing on the predetermined file to obtain the second sub-processed file, wherein the text processing includes rendering processing. The method performs corresponding processing on the image form and text form of the predetermined file to further quickly obtain the second processed file.
[0051] Specifically, performing image processing on the predetermined file can help correct geometric distortion in the image, improve image quality, or achieve specific visual effects, thereby further improving the accuracy of optical character recognition processing. In image processing, this distortion can be corrected by an inverse transformation method. For example, using the function in the OpenCV library, distortion correction is performed based on the camera's distortion coefficient and intrinsic parameter matrix to restore the original appearance of the image. In order to correct the tilt, the getAffineTransform method in OpenCV can be used to calculate the affine transformation matrix M of the tilted image, and then the warpAffine function is applied to achieve image tilt correction. This method requires determining the three corner points of the image and calculating the affine transformation based on these three points. Affine transformation is a linear transformation from two-dimensional coordinates to two-dimensional coordinates, which can include operations such as translation, rotation, and scaling. In OpenCV, affine transformation can be implemented by the warpAffine function.
[0052] In some embodiments, step S2023 can be implemented by: step S20231, dividing the second processed file to obtain a plurality of text fields; step S20232, obtaining coordinate information of each of the text fields to obtain the field distribution information. This method can further quickly obtain the field distribution information.
[0053] Specifically, a text field refers to an area that represents text in an image or document. In the second processed file, the file can be divided into three rectangular text fields: the header part, the body part, and the footer part. In different application scenarios, the text field can have different definitions and acquisition methods. The method of obtaining the coordinates of the text field will vary depending on the specific scenario and needs. A deep learning model can be used to detect text areas in an image and locate the position and size of the text. In addition, a component-based approach can be used to extract candidate components and use a classifier to filter out non-text components, thereby achieving accurate detection of text fields.
[0054] The regional text distribution information includes first information and second information. Step S2023 can also be implemented by the following steps: Step S20233, dividing the text region to obtain multiple characters; Step S20234, obtaining coordinate information corresponding to each character to obtain the first information; Step S20235, obtaining multi-dimensional vector representation information corresponding to each character to obtain the second information. This method can further quickly obtain the regional text distribution information.
[0055] Specifically, word vector representation refers to representing text characters using vectors, with vectors for different characters in the same dimensional tensor space. Word vectors are generated by mapping certain real-world rules between characters. In the field of deep learning and related algorithms, this can be achieved through models such as Word2Vec, RankBM25, Sentence-BERT, CoSENT, and BERT.
[0056] After the above step S203, the method further includes step S205: sending the first processed file to the next node of the current node. This method can further improve the accuracy of the flow and processing of the layout file in multiple task nodes.
[0057] Specifically, if the verification result is passed, it indicates that in the above-mentioned first processing process, only the content in the processing area is changed, and the content in the non-processing area is not affected. Therefore, the first processing file can be further sent to the next node for further processing.
[0058] In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the implementation process of the format file verification method of the present application will be described in detail below with reference to specific embodiments.
[0059] Example 1
[0060] This embodiment relates to a verification method for a layout file in a node control process, such as Figure 3 As shown, the following steps are included:
[0061] In the process node S area, first, based on the verified document output from step S-1, the process task of step S is executed. The entire task is divided into process processing, document information aggregation, and node information verification.
[0062] Process processing includes but is not limited to operations such as editing, printing, signing, and scanning layout documents. Changes to layout document information are subject to node settings, such as editing paragraph content in a specific area, signing and stamping in a specific area, etc. The content of other non-changing areas should be consistent with the output document in step S-1 after completing the S node. In addition, if the process processing includes printing and scanning, the output layout file will be converted to image format.
[0063] Document information aggregation is to extract document information after process processing;
[0064] The node information verification is carried out by comparing the layout document output by the current S node with the layout document information output by the previous node S-1 step in the process document verification center. The core data of the verification and comparison is only the non-changed domain data.
[0065] Example 2
[0066] This embodiment relates to a method for performing a second process on a first process file, such as Figure 4 As shown, the following steps are included:
[0067] After the current process is completed, the temporary layout document of step S is output; the information aggregation operation, i.e. the second processing, needs to be performed; before aggregation, it is necessary to analyze whether the representation form of the layout file content is text or image format;
[0068] When the document content is saved in an image format, the layout file needs to be extracted and the image processing phase begins. In the image processing phase, the distortion and tilt of the actual content are repaired using affine transformation to ensure the correct coordinates of the OCR page recognition information in the next step.
[0069] For layout documents in text format, they are rendered directly to realize the division of text blocks;
[0070] Combining the processing results of image format and text format, the page text information extraction and block domain identification are completed, and compression representation is performed on the page text domain information and the text distribution in the block domain, and finally the second target information is output.
[0071] Example 3
[0072] This embodiment relates to a specific format file verification method, such as Figure 5 As shown, the following steps are included:
[0073] For domain distribution information, implement text domain coordinates Coord area Extract. For text distribution in the area, include text coordinates Coord word And the text N-dimensional vector representation Vector; through the function Summarize all representation information and store it in the process document verification center;
[0074] In the layout document verification stage, the S node outputs the document representation information based on the cache of the process document verification center The S-1 document representation information of the previous node Compare and use similarity algorithm Calculate the similarity of the non-changed domain;
[0075] When the similarity meets the threshold condition, it means that the document representation information output by the S node has passed the verification, and its unchanged domain data is consistent with the S-1 document. If the similarity calculation fails to meet the threshold, it means that the unchanged domain data has changed during the process processing at the S node, and the document cannot pass the fine-grained content protection verification.
[0076] The embodiments of the present application also provide a verification device for a format file. It should be noted that the verification device for a format file of the embodiments of the present application can be used to execute the verification method for a format file provided by the embodiments of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation modes, and the details that have been described will not be repeated here. As used below, the term "module" can implement a combination of software and / or hardware for 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 contemplated.
[0077] The following introduces the format file verification device provided in the embodiment of the present application.
[0078] Figure 6 Schematic diagram of a verification device for a format file according to an embodiment of the present application. Figure 6 As shown, the device is applied to the current node in the node control process, the node control process includes multiple task nodes connected in sequence, the task nodes are used to perform corresponding task processing, the current node is any one of the multiple task nodes, and the device includes:
[0079] A first processing unit 10 is configured to obtain an initial layout file and perform a first processing on a processing area of the initial layout file to obtain a first processed file, wherein the first processing is task processing corresponding to the current node, the initial layout file includes the processing area and a non-processing area, and the processing area and the non-processing area do not overlap, and the task processing includes at least one of editing processing, printing processing, signing processing, and scanning processing;
[0080] Specifically, the above-mentioned task processing can be editing of paragraphs and contents in a specific area, signing and stamping in a specific area, etc. The above-mentioned first processed file obtained after the first processing is actually also a layout file.
[0081] a second processing unit 20 configured to perform a second processing on the initial layout file to obtain first target information, and to perform the second processing on the first processed file to obtain second target information, wherein the second processing is to extract relevant information of a non-processed area of the initial layout file or extract relevant information of a non-processed area of the first processed file, wherein the relevant information includes at least one of image information and text information;
[0082] Specifically, the first target information and the second target information are obtained only by extracting relevant information of the non-processing area.
[0083] a calculation unit 30 configured to calculate a similarity between the first target information and the second target information, and determine that a verification result is a verification pass if the similarity is greater than or equal to a similarity threshold;
[0084] Specifically, the similarity between the first target information and the second target information can be calculated using methods such as the cosine similarity calculation method, the TF-IDF model, the Jaccard similarity coefficient, the edit distance, and the Pearson correlation coefficient. Cosine similarity is a widely used text similarity calculation method that measures similarity by calculating the cosine of the angle between two vectors. Cosine similarity values range from 0 to 1, with values closer to 1 indicating greater similarity. TF-IDF (Term Frequency-Inverse Document Frequency) is a commonly used weighting technique used in information retrieval and text mining. It is a statistical method used to assess the importance of a term to a document set or a document in a corpus. The Jaccard similarity coefficient compares similarities and differences between finite sets of samples, determining similarity by calculating the ratio of the intersection to the union of two samples. The larger the Jaccard similarity, the higher the sample similarity. The edit distance measures the difference between two strings by calculating the minimum number of single-character edits (insertion, deletion, or substitution) required to transform one string into the other. Pearson correlation coefficient: It is used to measure the degree of linear correlation between two variables, and its value ranges from -1 to 1.
[0085] The determining unit 40 is configured to determine that the verification result is a verification failure if the similarity is less than the similarity threshold.
[0086] Specifically, if the verification result is verification failure, it indicates that in the above-mentioned first processing process, in addition to changing the content in the processing area, the content in the non-processing area is also affected, resulting in changes in the content in the non-processing area.
[0087] According to this embodiment, a verification device for a layout file is provided, wherein a first processing unit obtains an initial layout file and performs a first processing on a processing area of the initial layout file to obtain a first processing file, wherein the first processing is the task processing corresponding to the current node; a second processing unit performs a second processing on the initial layout file to obtain first target information, and performs a second processing on the first processing file to obtain second target information, wherein the second processing is to extract relevant information of a non-processing area of the initial layout file or extract relevant information of a non-processing area of the first processing file, wherein the relevant information includes at least one of image information and text information; a calculation unit calculates the similarity between the first target information and the second target information, and determines that the verification result is a pass when the similarity is greater than or equal to a similarity threshold. In the above-mentioned device, the impact of the change of the information storage format of the layout file due to process processing is taken into account. By performing the second processing on the initial layout file and the first processing file respectively to extract information, the first target information and the second target information including image information and text information are obtained, and then the similarity between the first target information and the second target information is calculated, the content of the text format and the image format layout file can be mutually verified, thereby solving the technical problem of inaccurate layout file verification results in the prior art.
[0088] In a specific implementation, the first processing unit includes a determination module and a receiving module. The determination module is configured to determine whether the current node is the first task node among the multiple task nodes. The receiving module is configured to receive a layout file sent by a previous node to obtain the initial layout file if the current node is not the first task node. The device can further quickly obtain the initial layout file.
[0089] Specifically, if the current node is not the first task node, for example, the current node is the Sth node, then the initial layout file for node S is obtained by obtaining the output file of the previous node, i.e., node S-1. If the current node is the first task node, then the input layout file can be directly used as the initial layout file.
[0090] To further enhance the generalization capability of the target information, the second processing unit of the present application includes a first acquisition module, a processing module, and a second acquisition module. The first acquisition module is configured to acquire a content representation form of the predetermined file, wherein the content representation form includes a text form and an image form. The processing module is configured to perform a third process on the predetermined file based on the content representation form to obtain a second processed file. The second acquisition module is configured to acquire domain distribution information and regional text distribution information of the second processed file, and to perform compression representation processing on the domain distribution information and the regional text distribution information to obtain the target information of the predetermined file. This device can further enhance the generalization capability of the target information through compression representation processing.
[0091] Specifically, compressed representation refers to the use of specific algorithms or models in machine learning and artificial intelligence to convert raw data into a more compact and efficient data representation. This conversion not only reduces data storage space and increases processing speed, but also helps algorithms better understand and process data, especially in areas such as feature learning, data compression, and generative models.
[0092] The second processed file includes a first sub-processing file and a second sub-processing file. The processing module includes a first processing sub-module, a second processing sub-module, and a third processing sub-module. The first processing sub-module is configured to perform image processing on the predetermined file when the content representation form is the image form to obtain an image processed file, wherein the image processing includes at least one of distortion processing, tilt processing, and affine transformation processing; the second processing sub-module is configured to perform optical character recognition processing on the image processed file to obtain the first sub-processing file; and the third processing sub-module is configured to perform text processing on the predetermined file when the content representation form is the text form to obtain the second sub-processing file, wherein the text processing includes rendering processing. The device performs corresponding processing on the image form and text form of the predetermined file to further quickly obtain the second processed file.
[0093] Specifically, performing image processing on the predetermined file can help correct geometric distortion in the image, improve image quality, or achieve specific visual effects, thereby further improving the accuracy of optical character recognition processing. In image processing, this distortion can be corrected by an inverse transformation method. For example, using the function in the OpenCV library, distortion correction is performed based on the camera's distortion coefficient and intrinsic parameter matrix to restore the original appearance of the image. In order to correct the tilt, the getAffineTransform method in OpenCV can be used to calculate the affine transformation matrix M of the tilted image, and then the warpAffine function is applied to achieve image tilt correction. This method requires determining the three corner points of the image and calculating the affine transformation based on these three points. Affine transformation is a linear transformation from two-dimensional coordinates to two-dimensional coordinates, which can include operations such as translation, rotation, and scaling. In OpenCV, affine transformation can be implemented by the warpAffine function.
[0094] In some embodiments, the second acquisition module includes a fourth processing submodule and a first acquisition submodule, wherein the fourth acquisition submodule is configured to divide the second processed file into multiple text fields, and the first acquisition submodule is configured to obtain coordinate information of each of the text fields to obtain the field distribution information. This device can further quickly obtain the field distribution information.
[0095] Specifically, a text field refers to an area that represents text in an image or document. In the second processed file, the file can be divided into three rectangular text fields: the header part, the body part, and the footer part. In different application scenarios, the text field can have different definitions and acquisition methods. The method of obtaining the coordinates of the text field will vary depending on the specific scenario and needs. A deep learning model can be used to detect text areas in an image and locate the position and size of the text. In addition, a component-based approach can be used to extract candidate components and use a classifier to filter out non-text components, thereby achieving accurate detection of text fields.
[0096] The regional text distribution information includes first information and second information, and the second acquisition module includes a fifth processing submodule, a second acquisition submodule, and a third acquisition submodule. The fifth processing submodule is configured to divide the text region into multiple characters; the second acquisition submodule is configured to obtain coordinate information corresponding to each character to obtain the first information; and the third acquisition submodule is configured to obtain multi-dimensional vector representation information corresponding to each character to obtain the second information. This device can further quickly acquire the regional text distribution information.
[0097] Specifically, word vector representation refers to representing text characters using vectors, with vectors for different characters in the same dimensional tensor space. Word vectors are generated by mapping certain real-world rules between characters. In the field of deep learning and related algorithms, this can be achieved through models such as Word2Vec, RankBM25, Sentence-BERT, CoSENT, and BERT.
[0098] The above device further includes a sending unit for sending the first processed file to the next node of the current node. This device can further improve the accuracy of the layout file in the flow and processing process of multiple task nodes.
[0099] Specifically, if the verification result is passed, it indicates that in the above-mentioned first processing process, only the content in the processing area is changed, and the content in the non-processing area is not affected. Therefore, the first processing file can be further sent to the next node for further processing.
[0100] The format file verification device includes a processor and a memory. The first processing unit, the second processing unit, the calculation unit, and the determination unit are all stored as program units in the memory. The processor executes the program units stored in the memory to implement the corresponding functions. The above modules are all located in the same processor; alternatively, the above modules can be located in different processors in any combination.
[0101] The processor contains a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the layout file can be verified by adjusting the kernel parameters.
[0102] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0103] An embodiment of the present invention provides a computer-readable storage medium, which includes a stored program. When the program is executed, the device where the computer-readable storage medium is located is controlled to execute the verification method for the layout file.
[0104] Specifically, the verification method of the layout file includes:
[0105] Step S201: Obtain an initial layout file and perform a first process on a processing area of the initial layout file to obtain a first processed file, wherein the first process is a task process corresponding to the current node, the initial layout file includes the processing area and a non-processing area, and the processing area and the non-processing area do not overlap, and the task process includes at least one of an editing process, a printing process, a signing process, and a scanning process;
[0106] Specifically, the above-mentioned task processing can be editing of paragraphs and contents in a specific area, signing and stamping in a specific area, etc. The above-mentioned first processed file obtained after the first processing is actually also a layout file.
[0107] Step S202: performing a second processing on the initial layout file to obtain first target information, and performing a second processing on the first processed file to obtain second target information, wherein the second processing is extracting relevant information of a non-processed area of the initial layout file or extracting relevant information of a non-processed area of the first processed file, wherein the relevant information includes at least one of image information and text information;
[0108] Specifically, the first target information and the second target information are obtained only by extracting relevant information of the non-processing area.
[0109] Step S203: calculating the similarity between the first target information and the second target information, and determining that the verification result is verification passed when the similarity is greater than or equal to a similarity threshold;
[0110] Specifically, the similarity between the first target information and the second target information can be calculated using methods such as the cosine similarity calculation method, the TF-IDF model, the Jaccard similarity coefficient, the edit distance, and the Pearson correlation coefficient. Cosine similarity is a widely used text similarity calculation method that measures similarity by calculating the cosine of the angle between two vectors. Cosine similarity values range from 0 to 1, with values closer to 1 indicating greater similarity. TF-IDF (Term Frequency-Inverse Document Frequency) is a commonly used weighting technique used in information retrieval and text mining. It is a statistical method used to assess the importance of a term to a document set or a document in a corpus. The Jaccard similarity coefficient compares similarities and differences between finite sets of samples, determining similarity by calculating the ratio of the intersection to the union of two samples. The larger the Jaccard similarity, the higher the sample similarity. The edit distance measures the difference between two strings by calculating the minimum number of single-character edits (insertion, deletion, or substitution) required to transform one string into the other. Pearson correlation coefficient: It is used to measure the degree of linear correlation between two variables, and its value ranges from -1 to 1.
[0111] Step S204 : If the similarity is less than the similarity threshold, determine that the verification result is verification failure.
[0112] Specifically, if the verification result is verification failure, it indicates that in the above-mentioned first processing process, in addition to changing the content in the processing area, the content in the non-processing area is also affected, resulting in changes in the content in the non-processing area.
[0113] Optionally, obtaining the initial layout file includes: determining whether the current node is the first task node among the multiple task nodes; if the current node is not the first task node, receiving the layout file sent by the previous node to obtain the initial layout file.
[0114] Optionally, a second processing is performed on the predetermined file to obtain target information of the predetermined file, wherein the predetermined file is the initial layout file or the first processed file. When the predetermined file is the initial layout file, the target information of the predetermined file is the first target information, and when the predetermined file is the first processed file, the target information of the predetermined file is the second target information, including: obtaining a content representation form of the predetermined file, wherein the content representation form includes a text form and a picture form; performing a third processing on the predetermined file according to the content representation form to obtain a second processed file; obtaining domain distribution information of the second processed file and regional text distribution information of the second processed file, and performing compression representation processing on the domain distribution information and the regional text distribution information to obtain the target information of the predetermined file.
[0115] Optionally, the second processing file includes a first sub-processing file and a second sub-processing file, and the predetermined file is subjected to a third processing according to the content representation form to obtain a second processing file, including: when the content representation form is the picture form, the predetermined file is subjected to image processing to obtain an image processing file, wherein the image processing includes at least one of distortion processing, tilt processing and affine transformation processing; the image processing file is subjected to optical character recognition processing to obtain the first sub-processing file; when the content representation form is the text form, the predetermined file is subjected to text processing to obtain the second sub-processing file, wherein the text processing includes rendering processing.
[0116] Optionally, obtaining the domain distribution information of the second processed file includes: dividing the second processed file to obtain a plurality of text domains; and obtaining coordinate information of each of the text domains to obtain the domain distribution information.
[0117] Optionally, the regional text distribution information includes first information and second information, and obtaining the regional text distribution information of the second processed file includes: dividing the text domain to obtain multiple characters; obtaining coordinate information corresponding to each of the characters to obtain the first information; obtaining multi-dimensional vector representation information corresponding to each of the characters to obtain the second information.
[0118] Optionally, after determining that the verification result is passed, the method further includes: sending the first processed file to a node next to the current node.
[0119] An embodiment of the present invention provides a processor, which is used to run a program, wherein the verification method of the layout file is executed when the program is running.
[0120] Specifically, the verification method of the layout file includes:
[0121] Step S201: Obtain an initial layout file and perform a first process on a processing area of the initial layout file to obtain a first processed file, wherein the first process is a task process corresponding to the current node, the initial layout file includes the processing area and a non-processing area, and the processing area and the non-processing area do not overlap, and the task process includes at least one of an editing process, a printing process, a signing process, and a scanning process;
[0122] Specifically, the above-mentioned task processing can be editing of paragraphs and contents in a specific area, signing and stamping in a specific area, etc. The above-mentioned first processed file obtained after the first processing is actually also a layout file.
[0123] Step S202: performing a second processing on the initial layout file to obtain first target information, and performing a second processing on the first processed file to obtain second target information, wherein the second processing is extracting relevant information of a non-processed area of the initial layout file or extracting relevant information of a non-processed area of the first processed file, wherein the relevant information includes at least one of image information and text information;
[0124] Specifically, the first target information and the second target information are obtained only by extracting relevant information of the non-processing area.
[0125] Step S203: calculating the similarity between the first target information and the second target information, and determining that the verification result is verification passed when the similarity is greater than or equal to a similarity threshold;
[0126] Specifically, the similarity between the first target information and the second target information can be calculated using methods such as the cosine similarity calculation method, the TF-IDF model, the Jaccard similarity coefficient, the edit distance, and the Pearson correlation coefficient. Cosine similarity is a widely used text similarity calculation method that measures similarity by calculating the cosine of the angle between two vectors. Cosine similarity values range from 0 to 1, with values closer to 1 indicating greater similarity. TF-IDF (Term Frequency-Inverse Document Frequency) is a commonly used weighting technique used in information retrieval and text mining. It is a statistical method used to assess the importance of a term to a document set or a document in a corpus. The Jaccard similarity coefficient compares similarities and differences between finite sets of samples, determining similarity by calculating the ratio of the intersection to the union of two samples. The larger the Jaccard similarity, the higher the sample similarity. The edit distance measures the difference between two strings by calculating the minimum number of single-character edits (insertion, deletion, or substitution) required to transform one string into the other. Pearson correlation coefficient: It is used to measure the degree of linear correlation between two variables, and its value ranges from -1 to 1.
[0127] Step S204 : If the similarity is less than the similarity threshold, determine that the verification result is verification failure.
[0128] Specifically, if the verification result is verification failure, it indicates that in the above-mentioned first processing process, in addition to changing the content in the processing area, the content in the non-processing area is also affected, resulting in changes in the content in the non-processing area.
[0129] Optionally, obtaining the initial layout file includes: determining whether the current node is the first task node among the multiple task nodes; if the current node is not the first task node, receiving the layout file sent by the previous node to obtain the initial layout file.
[0130] Optionally, a second processing is performed on the predetermined file to obtain target information of the predetermined file, wherein the predetermined file is the initial layout file or the first processed file. When the predetermined file is the initial layout file, the target information of the predetermined file is the first target information, and when the predetermined file is the first processed file, the target information of the predetermined file is the second target information, including: obtaining a content representation form of the predetermined file, wherein the content representation form includes a text form and a picture form; performing a third processing on the predetermined file according to the content representation form to obtain a second processed file; obtaining domain distribution information of the second processed file and regional text distribution information of the second processed file, and performing compression representation processing on the domain distribution information and the regional text distribution information to obtain the target information of the predetermined file.
[0131] Optionally, the second processing file includes a first sub-processing file and a second sub-processing file, and the predetermined file is subjected to a third processing according to the content representation form to obtain a second processing file, including: when the content representation form is the picture form, the predetermined file is subjected to image processing to obtain an image processing file, wherein the image processing includes at least one of distortion processing, tilt processing and affine transformation processing; the image processing file is subjected to optical character recognition processing to obtain the first sub-processing file; when the content representation form is the text form, the predetermined file is subjected to text processing to obtain the second sub-processing file, wherein the text processing includes rendering processing.
[0132] Optionally, obtaining the domain distribution information of the second processed file includes: dividing the second processed file to obtain a plurality of text domains; and obtaining coordinate information of each of the text domains to obtain the domain distribution information.
[0133] Optionally, the regional text distribution information includes first information and second information, and obtaining the regional text distribution information of the second processed file includes: dividing the text domain to obtain multiple characters; obtaining coordinate information corresponding to each of the characters to obtain the first information; obtaining multi-dimensional vector representation information corresponding to each of the characters to obtain the second information.
[0134] Optionally, after determining that the verification result is passed, the method further includes: sending the first processed file to a node next to the current node.
[0135] An embodiment of the present invention provides a device, comprising a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, at least the following steps are performed:
[0136] Step S201: Obtain an initial layout file and perform a first process on a processing area of the initial layout file to obtain a first processed file, wherein the first process is a task process corresponding to the current node, the initial layout file includes the processing area and a non-processing area, and the processing area and the non-processing area do not overlap, and the task process includes at least one of an editing process, a printing process, a signing process, and a scanning process;
[0137] Step S202: performing a second processing on the initial layout file to obtain first target information, and performing a second processing on the first processed file to obtain second target information, wherein the second processing is extracting relevant information of a non-processed area of the initial layout file or extracting relevant information of a non-processed area of the first processed file, wherein the relevant information includes at least one of image information and text information;
[0138] Step S203, calculating the similarity between the first target information and the second target information, and determining that the verification result is verification passed when the similarity is greater than or equal to a similarity threshold;
[0139] Step S204 : If the similarity is less than the similarity threshold, determine that the verification result is verification failure.
[0140] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0141] The present application also provides a computer program product, which, when executed on a data processing device, is adapted to execute a program for initializing at least the following method steps:
[0142] Step S201: Obtain an initial layout file and perform a first process on a processing area of the initial layout file to obtain a first processed file, wherein the first process is a task process corresponding to the current node, the initial layout file includes the processing area and a non-processing area, and the processing area and the non-processing area do not overlap, and the task process includes at least one of an editing process, a printing process, a signing process, and a scanning process;
[0143] Step S202: performing a second processing on the initial layout file to obtain first target information, and performing a second processing on the first processed file to obtain second target information, wherein the second processing is extracting relevant information of a non-processed area of the initial layout file or extracting relevant information of a non-processed area of the first processed file, wherein the relevant information includes at least one of image information and text information;
[0144] Step S203: calculating the similarity between the first target information and the second target information, and determining that the verification result is verification passed when the similarity is greater than or equal to a similarity threshold;
[0145] Step S204 : If the similarity is less than the similarity threshold, determine that the verification result is verification failure.
[0146] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, can be centralized on a single computing device, or can be distributed across a network of multiple computing devices. They can be implemented using program code executable by the computing device, and thus, can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described herein can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0147] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0148] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0149] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0150] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0151] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0152] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0153] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0154] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0155] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
[0156] 1) The verification method of the layout file of the present application, first, obtains the initial layout file, and performs a first processing on the processing area of the initial layout file to obtain a first processing file, the first processing is the task processing corresponding to the current node; then performs a second processing on the initial layout file to obtain first target information, and performs a second processing on the first processing file to obtain second target information, the second processing is to extract relevant information of the non-processing area of the initial layout file or extract relevant information of the non-processing area of the first processing file, the relevant information includes at least one of image information and text information; finally, calculates the similarity of the first target information and the second target information, and determines that the verification result is passed when the similarity is greater than or equal to the similarity threshold. In the above method, the impact of the change of the information storage format of the layout file due to process processing is taken into account. By performing a second processing on the initial layout file and the first processing file respectively to realize information extraction, the first target information and the second target information including image information and text information are obtained, and then the similarity of the first target information and the second target information is calculated, the mutual verification of the content of the text format and the image format layout file can be realized, which solves the technical problem of inaccurate layout file verification results in the prior art.
[0157] 2) The layout file verification device of the present application comprises a first processing unit that obtains an initial layout file and performs a first processing on a processing area of the initial layout file to obtain a first processing file, wherein the first processing is the task processing corresponding to the current node; a second processing unit that performs a second processing on the initial layout file to obtain first target information, and a second processing on the first processing file to obtain second target information, wherein the second processing is to extract relevant information of a non-processing area of the initial layout file or extract relevant information of a non-processing area of the first processing file, wherein the relevant information includes at least one of image information and text information; a calculation unit that calculates the similarity between the first target information and the second target information, and determines that the verification result is a pass when the similarity is greater than or equal to a similarity threshold. In the above-mentioned device, the influence of the change of the information storage format of the layout file due to process processing is taken into account. By performing the second processing on the initial layout file and the first processing file respectively to extract information, the first target information and the second target information including image information and text information are obtained, and then the similarity between the first target information and the second target information is calculated, so that the content of the text format and the image format layout file can be mutually verified, thereby solving the technical problem of inaccurate layout file verification results in the prior art.
[0158] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A method for verifying a format file, characterized in that: Applied to a current node in a node control process, the node control process includes a plurality of sequentially connected task nodes, the task nodes are used to perform corresponding task processing, the current node is any one of the plurality of task nodes, the method comprising: Obtaining an initial layout file, and performing a first processing on a processing area of the initial layout file to obtain a first processing file, wherein the first processing is a task processing corresponding to the current node, the initial layout file includes the processing area and a non-processing area, and the processing area and the non-processing area do not overlap, and the task processing includes at least one of an editing process, a printing process, a signing process, and a scanning process; performing a second processing on the initial layout file to obtain first target information, and performing the second processing on the first processed file to obtain second target information, wherein the second processing is extracting relevant information of a non-processed area of the initial layout file or extracting relevant information of a non-processed area of the first processed file, the relevant information including at least one of image information and text information; Calculating the similarity between the first target information and the second target information, and determining that the verification result is verification passed if the similarity is greater than or equal to a similarity threshold; If the similarity is less than the similarity threshold, determining the verification result as verification failure; performing a second processing on a predetermined file to obtain target information of the predetermined file, wherein the predetermined file is the initial layout file or the first processed file, and when the predetermined file is the initial layout file, the target information of the predetermined file is the first target information; and when the predetermined file is the first processed file, the target information of the predetermined file is the second target information, including: Acquire a content representation form of the predetermined file, wherein the content representation form includes a text form and a picture form; performing a third processing on the predetermined file according to the content representation form to obtain a second processed file; The domain distribution information of the second processed file and the regional text distribution information of the second processed file are obtained, and compression representation processing is performed on the domain distribution information and the regional text distribution information to obtain target information of the predetermined file.
2. The method according to claim 1, characterized in that Get the initial layout files, including: Determining whether the current node is the first task node among the multiple task nodes; When the current node is not the first task node, the layout file sent by the previous node is received to obtain the initial layout file.
3. The method according to claim 1, characterized in that The second processed file includes a first sub-processed file and a second sub-processed file. The third processing is performed on the predetermined file according to the content representation form to obtain the second processed file, including: When the content representation form is the picture form, performing image processing on the predetermined file to obtain an image processing file, wherein the image processing includes at least one of distortion processing, tilt processing, and affine transformation processing; performing optical character recognition processing on the image processing file to obtain the first sub-processing file; In a case where the content representation form is the text form, text processing is performed on the predetermined file to obtain the second sub-processed file, wherein the text processing includes rendering processing.
4. The method according to claim 1, wherein Obtaining domain distribution information of the second processed file includes: dividing the second processed file to obtain a plurality of text fields; The coordinate information of each of the text fields is obtained to obtain the field distribution information.
5. The method according to claim 4, characterized in that The regional text distribution information includes first information and second information, and obtaining the regional text distribution information of the second processed file includes: Dividing the text domain to obtain multiple characters; Obtaining coordinate information corresponding to each of the characters to obtain the first information; Obtain multi-dimensional vector representation information corresponding to each of the characters to obtain the second information.
6. The method according to claim 1, characterized in that After determining that the verification result is passed, the method further includes: The first processed file is sent to a node next to the current node.
7. A verification device for a format file, characterized in that: Applied to a current node in a node control process, the node control process includes a plurality of sequentially connected task nodes, the task nodes are used to perform corresponding task processing, the current node is any one of the plurality of task nodes, the device includes: a first processing unit, configured to obtain an initial layout file and perform a first processing on a processing area of the initial layout file to obtain a first processed file, wherein the first processing is task processing corresponding to the current node, the initial layout file includes the processing area and a non-processing area, and the processing area and the non-processing area do not overlap, and the task processing includes at least one of editing processing, printing processing, signing processing, and scanning processing; a second processing unit configured to perform a second processing on the initial layout file to obtain first target information, and perform the second processing on the first processed file to obtain second target information, wherein the second processing is to extract relevant information of a non-processed area of the initial layout file or to extract relevant information of a non-processed area of the first processed file, wherein the relevant information includes at least one of image information and text information; a calculation unit, configured to calculate a similarity between the first target information and the second target information, and determine that a verification result is a verification pass if the similarity is greater than or equal to a similarity threshold; a determining unit, configured to determine that the verification result is a verification failure if the similarity is less than the similarity threshold; The second processing unit includes a first acquisition module, a processing module and a second acquisition module, wherein the first acquisition module is used to obtain the content representation form of the predetermined file, wherein the content representation form includes a text form and a picture form; the processing module is used to perform a third processing on the predetermined file according to the content representation form to obtain a second processed file; the second acquisition module is used to obtain the domain distribution information of the second processed file and the regional text distribution information of the second processed file, and perform compression representation processing on the domain distribution information and the regional text distribution information to obtain the target information of the predetermined file, the predetermined file is the initial layout file or the first processed file. When the predetermined file is the initial layout file, the target information of the predetermined file is the first target information. When the predetermined file is the first processed file, the target information of the predetermined file is the second target information.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 6.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 6 through the computer program.
Citation Information
Patent Citations
Integrity verification method and device, terminal equipment and verification server
CN112989430A
Layout file checking method and device
CN117725886A